Update of /cvsroot/mahogany/M/src/classes
In directory usw-pr-cvs1:/tmp/cvs-serv1812/src/classes

Modified Files:
        MFolder.cpp 
Log Message:
Use CopyEntries to update the settings when moving folders

Index: MFolder.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/MFolder.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -b -u -2 -r1.89 -r1.90
--- MFolder.cpp 31 Oct 2002 21:19:07 -0000      1.89
+++ MFolder.cpp 12 Nov 2002 17:27:25 -0000      1.90
@@ -1128,65 +1128,13 @@
    }
 
-   // We will now copy in the profile of the newly created folder all the
-   // information found in the profile of the moved (old) folder.
-   // XNOTODO(?): make this some method of the Profile class
-   Profile_obj newProfile(newSubfolder->GetProfile());
-   CHECK( newProfile, false, _T("panic in MFolder: no profile") );
-   Profile_obj oldProfile(m_folderName);
-
-   bool isExpendingEnvVars = oldProfile->IsExpandingEnvVars();
-   oldProfile->SetExpandEnvVars(false);
-   // Copy all the profile entries 
-   String entryName;
-   long dummy;
-   bool rc = true;
-   bool bCont = oldProfile->GetFirstEntry(entryName, dummy);
-   while ( bCont ) {
-      wxConfigBase::EntryType type = oldProfile->GetEntryType(entryName);
-      switch (type)
-      {
-         case wxConfigBase::Type_String:
-            {
-               String value;
-               bool found = false;
-               value = oldProfile->readEntry(entryName, "", &found);
-               if ( !found )
-               {
-                  wxLogError(_("Problem reading original profile."));
-                  return false;
-               }
-               rc = newProfile->writeEntry(entryName, value);
-               if ( !rc )
-               {
-                  wxLogError(_("Problem writing new profile."));
-                  return false;
-               }
-               break;
-            }
-         case wxConfigBase::Type_Integer:
-            {
-               long value;
-               bool found = false;
-               value = oldProfile->readEntry(entryName, -1, &found);
-               if ( !found )
-               {
-                  wxLogError(_("Problem reading original profile."));
-                  return false;
-               }
-               rc = newProfile->writeEntry(entryName, value);
-               if ( !rc )
+   wxString oldProfilePath, newProfilePath;
+   oldProfilePath << Profile::GetProfilePath() << '/' << m_folderName;
+   newProfilePath << Profile::GetProfilePath() << '/' << newFullName;
+   if ( CopyEntries(mApplication->GetProfile()->GetConfig(), oldProfilePath, 
+newProfilePath, false) == -1 )
                {
-                  wxLogError(_("Problem writing new profile."));
+      wxLogError(_("Could not copy profile."));
                   return false;
                }
-               break;
-            }
-         default:
-            wxLogError(_("Unkown type for key '%s'."),
-                         entryName.c_str());
-      }
-      bCont = oldProfile->GetNextEntry(entryName, dummy);
-   }
-   oldProfile->SetExpandEnvVars(isExpendingEnvVars);
+   bool rc = true;
 
    if ( GetFolderType(GetType()) == MF_IMAP )
@@ -1199,7 +1147,4 @@
    }
 
-   // Now, we can delete the old folder from the hierarchy
-   Delete();
-
    // We should update the cache, but I (XNO) did not find a way to do it correctly.
    //MFolderCache::Remove(this);
@@ -1252,4 +1197,7 @@
                                      MEventFolderTreeChangeData::Create)
       );
+
+   // Now, we can delete the old folder from the hierarchy
+   Delete();
 
    struct MailFolderStatus status;



-------------------------------------------------------
This sf.net email is sponsored by: 
To learn the basics of securing your web site with SSL, 
click here to get a FREE TRIAL of a Thawte Server Certificate: 
http://www.gothawte.com/rd522.html
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to