Update of /cvsroot/mahogany/M/src/mail
In directory usw-pr-cvs1:/tmp/cvs-serv15586/src/mail
Modified Files:
MailFolder.cpp MailFolderCC.cpp
Log Message:
introduced MFFactory to decouple MailFolder better from MailFolderCC
Index: MailFolder.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolder.cpp,v
retrieving revision 1.281
retrieving revision 1.282
diff -b -u -2 -r1.281 -r1.282
--- MailFolder.cpp 4 Jul 2002 17:22:37 -0000 1.281
+++ MailFolder.cpp 5 Jul 2002 17:58:35 -0000 1.282
@@ -50,14 +50,8 @@
#include "LogCircle.h"
-// we use many MailFolderCC methods explicitly currently, this is wrong: we
-// should have some sort of a redirector to emulate virtual static methods
-// (TODO)
-#include "MailFolderCC.h"
-
+#include "MFFactory.h"
#include "MFPrivate.h"
-#ifdef EXPERIMENTAL
-#include "MMailFolder.h"
-#endif
+#include "MailFolderCC.h"
#include "Composer.h"
@@ -89,4 +83,6 @@
// ============================================================================
+static MFFactory *MFFactory::ms_factories = NULL;
+
// ----------------------------------------------------------------------------
// MailFolder opening
@@ -102,5 +98,28 @@
CHECK( folder, NULL, "NULL MFolder in OpenFolder()" );
- return MailFolderCC::OpenFolder(folder, mode, frame);
+ String kind = folder->GetClass();
+
+ // this is a hack needed for backwards compatibility and which also allows
+ // to have the empty default value for the folder class which saves quite
+ // some bytes in the profile
+ if ( kind.empty() )
+ {
+ kind = "cclient";
+ }
+
+ // find the creation function for this kind of folders
+ for ( const MFFactory *factory = MFFactory::GetHead();
+ factory;
+ factory = factory->GetNext() )
+ {
+ if ( factory->GetName() == kind )
+ {
+ return factory->OpenFolder(folder, mode, frame);
+ }
+ }
+
+ ERRORMESSAGE((_("Unknown folder kind '%s'"), kind.c_str()));
+
+ return NULL;
}
Index: MailFolderCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolderCC.cpp,v
retrieving revision 1.628
retrieving revision 1.629
diff -b -u -2 -r1.628 -r1.629
--- MailFolderCC.cpp 5 Jul 2002 16:56:18 -0000 1.628
+++ MailFolderCC.cpp 5 Jul 2002 17:58:35 -0000 1.629
@@ -60,4 +60,6 @@
#include "Sequence.h"
+#include "MFFactory.h"
+
// just to use wxFindFirstFile()/wxFindNextFile() for lockfile checking and
// wxFile::Exists() too
@@ -259,4 +261,7 @@
static int cc_loglevel = wxLOG_Error;
+/// our mail folder factory object
+static MFFactory s_factoryCC("cclient", MailFolderCC::OpenFolder);
+
// ----------------------------------------------------------------------------
// private functions
@@ -2113,5 +2118,5 @@
/* static */
-MailFolderCC *
+MailFolder *
MailFolderCC::OpenFolder(const MFolder *mfolder,
OpenMode openmode,
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates