Thread: SVN Commit by andreas: r4737 - in trunk/pgadmin3: . src/include src/utils

SVN Commit by andreas: r4737 - in trunk/pgadmin3: . src/include src/utils

From
svn@pgadmin.org
Date:
Author: andreas
Date: 2005-11-11 17:42:42 +0000 (Fri, 11 Nov 2005)
New Revision: 4737

Modified:
   trunk/pgadmin3/CHANGELOG.txt
   trunk/pgadmin3/src/include/sysSettings.h
   trunk/pgadmin3/src/utils/sysSettings.cpp
Log:
leave pre-1.5 server config settings untouched

Modified: trunk/pgadmin3/CHANGELOG.txt
===================================================================
--- trunk/pgadmin3/CHANGELOG.txt    2005-11-11 09:35:19 UTC (rev 4736)
+++ trunk/pgadmin3/CHANGELOG.txt    2005-11-11 17:42:42 UTC (rev 4737)
@@ -17,6 +17,7 @@
 </ul>
 <br>
 <ul>
+    <li>2005-11-11 AP         leave pre-1.5 server config settings untouched
     <li>2005-11-10 AP         Configurable indent in ctlSqlBox
     <li>2005-11-10 AP  1.4.1  Fix role rename (r: Antonio)
     <li>2005-11-09 AP         database and schema display restriction

Modified: trunk/pgadmin3/src/include/sysSettings.h
===================================================================
--- trunk/pgadmin3/src/include/sysSettings.h    2005-11-11 09:35:19 UTC (rev 4736)
+++ trunk/pgadmin3/src/include/sysSettings.h    2005-11-11 17:42:42 UTC (rev 4737)
@@ -151,8 +151,8 @@

 private:

-    void moveStringValue(wxChar *oldKey, wxChar *newKey, int index=-1);
-    void moveLongValue(wxChar *oldKey, wxChar *newKey, int index=-1);
+    bool moveStringValue(wxChar *oldKey, wxChar *newKey, int index=-1);
+    bool moveLongValue(wxChar *oldKey, wxChar *newKey, int index=-1);

     wxFont systemFont, sqlFont;


Modified: trunk/pgadmin3/src/utils/sysSettings.cpp
===================================================================
--- trunk/pgadmin3/src/utils/sysSettings.cpp    2005-11-11 09:35:19 UTC (rev 4736)
+++ trunk/pgadmin3/src/utils/sysSettings.cpp    2005-11-11 17:42:42 UTC (rev 4737)
@@ -58,17 +58,18 @@
     Read(wxT("Servers/Count"), &serverCount, 0L);
     for (i=1 ; i <= serverCount ; i++)
     {
-        moveStringValue(wxT("Servers/Database%d"), wxT("Servers/%d/Database"), i);
-        moveStringValue(wxT("Servers/Description%d"), wxT("Servers/%d/Description"), i);
-        moveStringValue(wxT("Servers/LastDatabase%d"), wxT("Servers/%d/LastDatabase"), i);
-        moveStringValue(wxT("Servers/LastSchema%d"), wxT("Servers/%d/LastSchema"), i);
-        moveStringValue(wxT("Servers/Server%d"), wxT("Servers/%d/Server"), i);
-        moveStringValue(wxT("Servers/ServiceId%d"), wxT("Servers/%d/ServiceId"), i);
-        moveStringValue(wxT("Servers/StorePWD%d"), wxT("Servers/%d/StorePWD"), i);
-        moveStringValue(wxT("Servers/Username%d"), wxT("Servers/%d/Username"), i);
-        moveLongValue(wxT("Servers/Port%d"), wxT("Servers/%d/Port"), i);
-        moveLongValue(wxT("Servers/SSL%d"), wxT("Servers/%d/SSL"), i);
-        moveLongValue(wxT("Servers/LastSSL%d"), wxT("Servers/%d/LastSSL"), i);
+        if (moveStringValue(wxT("Servers/Database%d"), wxT("Servers/%d/Database"), i))
+        {
+            moveStringValue(wxT("Servers/Description%d"), wxT("Servers/%d/Description"), i);
+            moveStringValue(wxT("Servers/LastDatabase%d"), wxT("Servers/%d/LastDatabase"), i);
+            moveStringValue(wxT("Servers/LastSchema%d"), wxT("Servers/%d/LastSchema"), i);
+            moveStringValue(wxT("Servers/Server%d"), wxT("Servers/%d/Server"), i);
+            moveStringValue(wxT("Servers/ServiceId%d"), wxT("Servers/%d/ServiceId"), i);
+            moveStringValue(wxT("Servers/StorePWD%d"), wxT("Servers/%d/StorePWD"), i);
+            moveStringValue(wxT("Servers/Username%d"), wxT("Servers/%d/Username"), i);
+            moveLongValue(wxT("Servers/Port%d"), wxT("Servers/%d/Port"), i);
+            moveLongValue(wxT("Servers/SSL%d"), wxT("Servers/%d/SSL"), i);
+        }
     }


@@ -207,7 +208,7 @@
 }


-void sysSettings::moveStringValue(wxChar *oldKey, wxChar *newKey, int index)
+bool sysSettings::moveStringValue(wxChar *oldKey, wxChar *newKey, int index)
 {
     wxString k1, k2;
     if (index >= 0)
@@ -221,18 +222,21 @@
         k2=newKey;
     }

-    if (Exists(k1))
+    if (!Exists(k2) && Exists(k1))
     {
         wxString value;
         Read(k1, &value, wxEmptyString);
         Write(k2, value);
-        DeleteEntry(k1);
+
+        return true;
     }
+
+    return false;
 }



-void sysSettings::moveLongValue(wxChar *oldKey, wxChar *newKey, int index)
+bool sysSettings::moveLongValue(wxChar *oldKey, wxChar *newKey, int index)
 {
     wxString k1, k2;
     if (index >= 0)
@@ -246,13 +250,16 @@
         k2=newKey;
     }

-    if (Exists(k1))
+    if (!Exists(k2) && Exists(k1))
     {
         long value;
         Read(k1, &value, 0L);
         Write(k2, value);
-        DeleteEntry(k1);
+
+        return true;
     }
+
+    return false;
 }

 void sysSettings::Save()