[Konversation-devel] [Bug 218784] Server list dialog doesn't remember network order as established by DND

Eike Hein hein at kde.org
Sat May 22 19:38:21 CEST 2010


https://bugs.kde.org/show_bug.cgi?id=218784


Eike Hein <hein at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Eike Hein <hein kde org>  2010-05-22 19:38:19 ---
commit 9f4ec69e3a434d0364ae7d5304cedbfec3b5864a
Author: Eike Hein <hein at kde.org>
Date:   Sat May 22 19:31:45 2010 +0200

    Fix server list dialog network order not being preserved across restarts.

    BUG:218784

diff --git a/ChangeLog b/ChangeLog
index 5fbd673..a0c1fa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -123,6 +123,8 @@ Changes since 1.2.3:
 * Added a "-local" parameter to the '/amsg' and '/ame' commands that
   limits their scope to the channel and query tabs associated with
   the same connection as the tab the command is issued in.
+* Fixed a bug causing the order of networks in the server list dialog
+  not to be preserved across application restarts.


 Changes from 1.2.2 to 1.2.3:
diff --git a/src/application.cpp b/src/application.cpp
index 837a901..8c60385 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -401,6 +401,7 @@ void Application::readOptions()
         QStringList::iterator it;
         QStringList tmp1;
         QStringList::iterator it2;
+        int index = 0;
         Konversation::ChannelList channelHistory;
         Konversation::ServerSettings server;
         Konversation::ChannelSettings channel;
@@ -410,6 +411,7 @@ void Application::readOptions()
             KConfigGroup cgServerGroup(KGlobal::config()->group(*it));
             Konversation::ServerGroupSettingsPtr serverGroup(new
Konversation::ServerGroupSettings);
             serverGroup->setName(cgServerGroup.readEntry("Name"));
+            serverGroup->setSortIndex(index);
            
serverGroup->setIdentityId(Preferences::identityByName(cgServerGroup.readEntry("Identity"))->id());
            
serverGroup->setConnectCommands(cgServerGroup.readEntry("ConnectCommands"));
            
serverGroup->setAutoConnectEnabled(cgServerGroup.readEntry("AutoConnect",
false));
@@ -465,6 +467,8 @@ void Application::readOptions()

             serverGroups.insert(serverGroup->id(), serverGroup);
             sgKeys.append(serverGroup->id());
+
+            index++;
         }

         Preferences::setServerGroupHash(serverGroups);
@@ -726,11 +730,24 @@ void Application::saveOptions(bool updateGUI)

     // Add the new servergroups to the config
     Konversation::ServerGroupHash serverGroupHash =
Preferences::serverGroupHash();
-    QHashIterator<int, Konversation::ServerGroupSettingsPtr>
it(serverGroupHash);
+    QHashIterator<int, Konversation::ServerGroupSettingsPtr>
hashIt(serverGroupHash);
+
+    QMap<int, Konversation::ServerGroupSettingsPtr> sortedServerGroupMap;
+
+    // Make the indices in the group headers reflect the server list dialog
sorting.
+    while (hashIt.hasNext())
+    {
+        hashIt.next();
+
+        sortedServerGroupMap.insert(hashIt.value()->sortIndex(),
hashIt.value());
+    }
+
+    QMapIterator<int, Konversation::ServerGroupSettingsPtr>
it(sortedServerGroupMap);
+
     index = 0;
     int index2 = 0;
     int index3 = 0;
-    int width=0;
+    int width = 0;
     QList<int> keys = serverGroupHash.keys();
     for(int i=0; i<keys.count(); i++)
         if(width < keys.at(i)) width = keys.at(i);
diff --git a/src/commit.h b/src/commit.h
index 6cf9ebb..fa1da65 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 4041
+#define COMMIT 4042
 #endif

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Konversation-devel mailing list