Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv15592/src/gui
Modified Files:
wxFolderView.cpp wxMainFrame.cpp
Log Message:
1. more code refactoring to be able to use it from MFVirt: this time
the expunge event generation moved to MFCmn from MFCC
2. search now uses MFVirt and it even works -- as long as you don't try
to delete the messages from the search results folder
Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.595
retrieving revision 1.596
diff -b -u -2 -r1.595 -r1.596
--- wxFolderView.cpp 5 Jul 2002 12:16:41 -0000 1.595
+++ wxFolderView.cpp 17 Jul 2002 19:22:50 -0000 1.596
@@ -813,4 +813,7 @@
// ----------------------------------------------------------------------------
+static
+bool ShowSearchResults(MailFolder *mf, const UIdArray& uids, wxFrame *frame);
+
// return the n-th shown column (WXFLC_NONE if no more columns)
static wxFolderListColumn GetColumnByIndex(const int *columns, size_t n)
@@ -4801,5 +4804,4 @@
{
case ASMailFolder::Op_SearchMessages:
- ASSERT(result->GetSequence());
if( ok )
{
@@ -4811,38 +4813,14 @@
}
- unsigned long count = uidsMatching->Count();
-
- wxFolderListCtrlBlockOnSelect dontHandleOnSelect(m_FolderCtrl);
-
- /*
- The returned message numbers are UIds which we must map
- to our listctrl indices via the current HeaderInfo
- structure.
-
- VZ: I wonder why do we jump through all these hops - we might
- return msgnos from search directly... (FIXME)
- */
- HeaderInfoList_obj hil = GetFolder()->GetHeaders();
- for ( unsigned long n = 0; n < uidsMatching->Count(); n++ )
- {
- UIdType idx = hil->GetIdxFromUId((*uidsMatching)[n]);
- if ( idx != UID_ILLEGAL )
- {
- m_FolderCtrl->Select(hil->GetPosFromIdx(idx));
- }
- else
- {
- FAIL_MSG( "found inexistent message??" );
- }
- }
+ MailFolder_obj mf = GetMailFolder();
+ ShowSearchResults(mf, *uidsMatching, m_Frame);
- msg.Printf(_("Found %lu messages."), count);
+ wxLogStatus(m_Frame, _("Found %lu messages."),
+ uidsMatching->GetCount());
}
else
{
- msg.Printf(_("No matching messages found."));
+ wxLogWarning(_("No matching messages found."));
}
-
- wxLogStatus(m_Frame, msg);
break;
@@ -5054,4 +5032,38 @@
// other public functions (from include/FolderView.h)
// ----------------------------------------------------------------------------
+
+static
+bool ShowSearchResults(MailFolder *mf, const UIdArray& uids, wxFrame *frame)
+{
+ MFolder_obj folder = MFolder::CreateTemp
+ (
+ "virtual",
+ "Search results",
+ MF_FILE,
+ mf->GetProfile()
+ );
+ if ( !folder )
+ return false;
+
+ MailFolder_obj mfVirt = MailFolder::OpenFolder(folder);
+ if ( !mfVirt )
+ return false;
+
+ HeaderInfoList_obj hil = mf->GetHeaders();
+ if ( !hil )
+ return false;
+
+ size_t count = uids.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ Message_obj message = mf->GetMessage(uids[n]);
+ if ( message )
+ {
+ mfVirt->AppendMessage(*message.Get());
+ }
+ }
+
+ return OpenFolderViewFrame(folder, frame);
+}
bool OpenFolderViewFrame(MFolder *folder,
Index: wxMainFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMainFrame.cpp,v
retrieving revision 1.149
retrieving revision 1.150
diff -b -u -2 -r1.149 -r1.150
--- wxMainFrame.cpp 17 Jul 2002 00:06:29 -0000 1.149
+++ wxMainFrame.cpp 17 Jul 2002 19:22:52 -0000 1.150
@@ -58,8 +58,4 @@
#include "MModule.h"
-#ifdef DEBUG
- #include "HeaderInfo.h"
-#endif
-
// define this for future, less broken versions of wxWindows to dynamically
// insert/remove the message menu depending on whether we have or not a folder
@@ -75,6 +71,5 @@
enum
{
- WXMENU_DEBUG_WIZARD = WXMENU_DEBUG_BEGIN + 1,
- WXMENU_DEBUG_SHOWVFOLDER,
+ WXMENU_DEBUG_WIZARD = WXMENU_DEBUG_BEGIN + 1
};
@@ -281,5 +276,4 @@
wxMenu *menuDebug = new wxMenu;
menuDebug->Append(WXMENU_DEBUG_WIZARD, "Run install &wizard...");
- menuDebug->Append(WXMENU_DEBUG_SHOWVFOLDER, "Show test &virtual folder");
GetMenuBar()->Append(menuDebug, "&Debug");
#endif // debug
@@ -700,44 +694,4 @@
wxLogMessage("Wizard returned %s",
RunInstallWizard() ? "true" : "false");
- break;
-
- case WXMENU_DEBUG_SHOWVFOLDER:
- if ( m_FolderView )
- {
- MailFolder_obj mf(m_FolderView->GetMailFolder());
- if ( mf )
- {
- MFolder_obj folder = MFolder::CreateTemp
- (
- "virtual",
- "Search results",
- MF_FILE,
- mf->GetProfile()
- );
- if ( folder )
- {
- MailFolder_obj vf = MailFolder::OpenFolder(folder);
- if ( vf )
- {
- HeaderInfoList_obj hil = mf->GetHeaders();
- if ( hil )
- {
- const HeaderInfo *hi = hil[0];
- if ( hi )
- {
- Message_obj message = mf->GetMessage(hi->GetUId());
-
- if ( message )
- {
- vf->AppendMessage(*message.Get());
-
- OpenFolderViewFrame(folder, this);
- }
- }
- }
- }
- }
- }
- }
break;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates