Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8377/src/mail
Modified Files:
SpamFilter.cpp
Log Message:
added interface for showing spam filters options dialog
Index: SpamFilter.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SpamFilter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -u -2 -r1.4 -r1.5
--- SpamFilter.cpp 10 Jul 2004 20:55:38 -0000 1.4
+++ SpamFilter.cpp 11 Jul 2004 19:04:35 -0000 1.5
@@ -25,10 +25,52 @@
#endif // USE_PCH
-#include "pointers.h"
+#include <wx/imaglist.h>
+
#include "MAtExit.h"
+#include "gui/wxOptionsPage.h"
+#include "gui/wxOptionsDlg.h"
+
#include "SpamFilter.h"
// ----------------------------------------------------------------------------
+// local types
+// ----------------------------------------------------------------------------
+
+class SpamOptionsDialog : public wxOptionsEditDialog
+{
+public:
+ SpamOptionsDialog(wxFrame *parent, wxImageList *imagelist)
+ : wxOptionsEditDialog(parent,
+ _("Spam filters options"),
+ _T("SpamDlg"))
+ {
+ m_imagelist = imagelist;
+
+ CreateAllControls();
+ Layout();
+ }
+
+ virtual void CreateNotebook(wxPanel *panel)
+ {
+ m_notebook = new wxPNotebook(_T("SpamOptions"), panel);
+ if ( m_imagelist )
+ m_notebook->SetImageList(m_imagelist);
+
+ // now we can put the pages into it
+ for ( SpamFilter *p = SpamFilter::ms_first; p; p = p->m_next )
+ {
+ p->CreateOptionPage(m_notebook);
+ }
+ }
+
+protected:
+ virtual Profile *GetProfile() const { return mApplication->GetProfile(); }
+
+private:
+ wxImageList *m_imagelist;
+};
+
+// ----------------------------------------------------------------------------
// local globals
// ----------------------------------------------------------------------------
@@ -124,4 +166,42 @@
// ----------------------------------------------------------------------------
+// spam filters configuration
+// ----------------------------------------------------------------------------
+
+/* static */
+void SpamFilter::Configure(wxFrame *parent)
+{
+ LoadAll();
+
+ // first get all the icon names: we need them to create the notebook
+ wxImageList *imagelist = wxNotebookWithImages::ShouldShowIcons()
+ ? new wxImageList(32, 32)
+ : NULL;
+
+ size_t nPages = 0;
+ for ( SpamFilter *p = ms_first; p; p = p->m_next )
+ {
+ const wxChar *iconname = p->GetOptionPageIconName();
+ if ( iconname )
+ {
+ nPages++;
+ if ( imagelist )
+ imagelist->Add(mApplication->GetIconManager()->GetBitmap(iconname));
+ }
+ }
+
+ if ( !nPages )
+ {
+ wxLogMessage(_("There are no configurable spam filters."));
+ return;
+ }
+
+ // do create the dialog and show it
+ SpamOptionsDialog dlg(parent, imagelist);
+
+ (void)dlg.ShowModal();
+}
+
+// ----------------------------------------------------------------------------
// loading/unloading spam filters
// ----------------------------------------------------------------------------
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates