Update of /cvsroot/mahogany/M/src/classes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28053/src/classes

Modified Files:
        Profile.cpp ConfigSource.cpp 
Log Message:
fixed folder renaming (bug 875)

Index: Profile.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/Profile.cpp,v
retrieving revision 1.158
retrieving revision 1.159
diff -b -u -2 -r1.158 -r1.159
--- Profile.cpp 30 Mar 2004 18:16:21 -0000      1.158
+++ Profile.cpp 9 Jul 2004 13:16:46 -0000       1.159
@@ -308,8 +308,12 @@
       Rename a group in all config sources where it exists.
 
+      @param pathOld the full path to the existing group
+      @param nameNew the new name (just the name)
+
       @return true if the group was renamed successfully in all configs, false
-              if for at least one of them it failed
+              if for at least one of them it failed or if it was not found in
+              any config
     */
-   bool Rename(const String& nameOld, const String& nameNew);
+   bool Rename(const String& pathOld, const String& nameNew);
 
    /**
@@ -949,10 +953,11 @@
 }
 
-bool AllConfigSources::Rename(const String& nameOld, const String& nameNew)
+bool AllConfigSources::Rename(const String& pathOld, const String& nameNew)
 {
    bool rc = true;
+   size_t numRenamed = 0;
 
-   String parent = nameOld.BeforeLast(_T('/')),
-          name = nameOld.AfterLast(_T('/')),
+   String parent = pathOld.BeforeLast(_T('/')),
+          name = pathOld.AfterLast(_T('/')),
           group;
 
@@ -968,5 +973,8 @@
          {
             // this config has that group, do rename it
-            rc &= i->RenameGroup(nameOld, nameNew);
+            if ( i->RenameGroup(pathOld, nameNew) )
+               numRenamed++;
+            else
+               rc = false;
 
             break;
@@ -975,5 +983,5 @@
    }
 
-   return rc;
+   return rc && numRenamed > 0;
 }
 
@@ -1451,5 +1459,5 @@
             _T("can't call Profile methods before CreateGlobalConfig()") );
 
-   return gs_allConfigSources->Rename(oldName, newName);
+   return gs_allConfigSources->Rename(GetFullPath(oldName), newName);
 }
 

Index: ConfigSource.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/ConfigSource.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -b -u -2 -r1.13 -r1.14
--- ConfigSource.cpp    11 Mar 2004 10:45:10 -0000      1.13
+++ ConfigSource.cpp    9 Jul 2004 13:16:46 -0000       1.14
@@ -739,7 +739,9 @@
 
 bool
-ConfigSourceLocal::RenameGroup(const String& nameOld, const String& nameNew)
+ConfigSourceLocal::RenameGroup(const String& pathOld, const String& nameNew)
 {
-   return m_config->RenameGroup(nameOld, nameNew);
+   wxConfigPathChanger path(m_config, pathOld);
+
+   return m_config->RenameGroup(path.Name(), nameNew);
 }
 



-------------------------------------------------------
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

Reply via email to