Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28592/src/gui
Modified Files:
wxMenuDefs.cpp wxFiltersDialog.cpp wxMainFrame.cpp
Log Message:
added a command to find all existing filters copying messages to the given folder
Index: wxMenuDefs.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMenuDefs.cpp,v
retrieving revision 1.224
retrieving revision 1.225
diff -b -u -2 -r1.224 -r1.225
--- wxMenuDefs.cpp 23 Aug 2004 13:11:18 -0000 1.224
+++ wxMenuDefs.cpp 12 Sep 2004 22:57:46 -0000 1.225
@@ -275,5 +275,5 @@
// folder
- // available accels: DGJKQVWXYZ
+ // available accels: DGJKQVXYZ
{ WXMENU_FOLDER_OPEN, gettext_noop("&Open...\tCtrl-O"), gettext_noop("Open
an existing message folder") , wxITEM_NORMAL },
{ WXMENU_FOLDER_OPEN_RO, gettext_noop("Open read-onl&y..."), gettext_noop("Open
a folder in read only mode") , wxITEM_NORMAL },
@@ -303,4 +303,6 @@
{ WXMENU_SEPARATOR, wxEmptyString, wxEmptyString
, wxITEM_NORMAL },
{ WXMENU_FOLDER_FILTERS, gettext_noop("&Filters..."), gettext_noop("Edit the
filters to use for current folder") , wxITEM_NORMAL },
+ { WXMENU_FOLDER_WHENCE, gettext_noop("&Where is filter..."), gettext_noop("Find
the filters which move messages to this folder") , wxITEM_NORMAL },
+ { WXMENU_SEPARATOR, wxEmptyString, wxEmptyString
, wxITEM_NORMAL },
{ WXMENU_FOLDER_PROP, gettext_noop("&Properties..."), gettext_noop("Show the
properties of the current folder") , wxITEM_NORMAL },
Index: wxFiltersDialog.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFiltersDialog.cpp,v
retrieving revision 1.124
retrieving revision 1.125
diff -b -u -2 -r1.124 -r1.125
--- wxFiltersDialog.cpp 24 Jul 2004 14:17:43 -0000 1.124
+++ wxFiltersDialog.cpp 12 Sep 2004 22:57:46 -0000 1.125
@@ -1481,4 +1481,5 @@
bool DoCopyFilter(const wxString& nameOld, const wxString& nameNew);
bool DoDeleteFilter(const wxString& name);
+ bool DoFillWithFilters(const wxArrayString& filterNames);
// listbox contains the names of all filters
@@ -1863,11 +1864,10 @@
bool
-wxAllFiltersDialog::TransferDataToWindow()
+wxAllFiltersDialog::DoFillWithFilters(const wxArrayString& filterNames)
{
- wxArrayString allFilters = Profile::GetAllFilters();
- size_t count = allFilters.GetCount();
+ size_t count = filterNames.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- m_lboxFilters->Append(allFilters[n]);
+ m_lboxFilters->Append(filterNames[n]);
}
@@ -1876,4 +1876,10 @@
bool
+wxAllFiltersDialog::TransferDataToWindow()
+{
+ return DoFillWithFilters(Profile::GetAllFilters());
+}
+
+bool
wxAllFiltersDialog::TransferDataFromWindow()
{
@@ -1885,4 +1891,33 @@
// ============================================================================
+// wxMultipleFiltersDialog - dialog to show multiple (but not all) filters
+// ============================================================================
+
+// confusingly enough, this one derives from wxAllFiltersDialog and not the
+// other way around -- this is entirely due to history of this code and lack of
+// time to erfactor it (but this can/should be done later)
+class wxMultipleFiltersDialog : public wxAllFiltersDialog
+{
+public:
+ wxMultipleFiltersDialog(wxWindow *win,
+ const String& folderName,
+ const wxArrayString& filterNames)
+ : wxAllFiltersDialog(win),
+ m_filterNames(filterNames)
+ {
+ SetTitle(String::Format(_("Filters copying messages to \"%s\""),
+ folderName.c_str()));
+ }
+
+ virtual bool TransferDataToWindow()
+ {
+ return DoFillWithFilters(m_filterNames);
+ }
+
+protected:
+ wxArrayString m_filterNames;
+};
+
+// ============================================================================
// wxFolderFiltersDialog - dialog to configure filters to use for this folder
// ============================================================================
@@ -2516,2 +2551,51 @@
return dlg.ShowModal() == wxID_OK;
}
+
+extern bool FindFiltersForFolder(MFolder *folder, wxWindow *parent)
+{
+ CHECK( folder, false, _T("FindFiltersForFolder(): NULL folder") );
+
+ // look at all filters and remember names of those which copy/move messages
+ // to this folder
+ wxArrayString filtersForThisFolder;
+ const String fullname = folder->GetFullName();
+ wxArrayString allFilters = Profile::GetAllFilters();
+ const size_t count = allFilters.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ // examine this filter: we can only really parse simple filters
+ const String& filterName = allFilters[n];
+ MFilter_obj filter(filterName);
+ MFilterDesc fdesc(filter->GetDesc());
+ if ( fdesc.IsSimple() )
+ {
+ RefCounter<MFDialogSettings> settings(fdesc.GetSettings());
+ if ( settings )
+ {
+ // look at the action: is it "copy/move to this folder"?
+ if ( (settings->GetAction() == OAC_T_CopyTo ||
+ settings->GetAction() == OAC_T_MoveTo) &&
+ settings->GetActionArgument() == fullname )
+ {
+ filtersForThisFolder.push_back(filterName);
+ }
+ }
+ }
+ }
+
+ if ( filtersForThisFolder.empty() )
+ {
+ wxLogStatus(GetFrame(parent),
+ _("No filters copying messages to folder \"%s\" found."),
+ fullname.c_str());
+
+ return false;
+ }
+
+ // we do have some filters, show them
+ wxMultipleFiltersDialog dlg(parent, fullname, filtersForThisFolder);
+ dlg.ShowModal();
+
+ return true;
+}
+
Index: wxMainFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMainFrame.cpp,v
retrieving revision 1.187
retrieving revision 1.188
diff -b -u -2 -r1.187 -r1.188
--- wxMainFrame.cpp 16 Jul 2004 22:43:58 -0000 1.187
+++ wxMainFrame.cpp 12 Sep 2004 22:57:46 -0000 1.188
@@ -910,4 +910,12 @@
break;
+ case WXMENU_FOLDER_WHENCE:
+ {
+ MFolder_obj folder(m_FolderTree->GetSelection());
+ if ( folder )
+ FindFiltersForFolder(folder, this);
+ }
+ break;
+
case WXMENU_FOLDER_IMPORTTREE:
// create all MBOX folders under the specified dir
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates