[Bug 159029] Account settings not stored

Jaroslaw Staniek js at iidea.pl
Thu Mar 13 08:39:20 GMT 2008


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=159029         
js iidea pl changed:

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



------- Additional Comments From js iidea pl  2008-03-13 09:39 -------
SVN commit 785085 by staniek:

Store new account settings.

The fixed issue: only overwriting previous acounts was possible, so no new accounts were stored.
For fresh installation that means 0 accounts.

CCMAIL:159029-done bugs kde org



 M  +21 -6     accountmanager.cpp  


--- trunk/KDE/kdepim/kmail/accountmanager.cpp #785084:785085
 @ -45,24 +45,39  @
 {
   KConfig* config = KMKernel::config();
 
-  // Delete all account enabled groups in the config file
-  // and replace them with new account groups
+  // Delete all accounts for groups in the config file not having 
+  // Enabled=false flag (accountGroups) 
+  // and replace them with account groups existing in memory (mAcctList)
   uint accounts = 0;
   QStringList accountGroups =
     config->groupList().filter( QRegExp( "Account \\d+" ) );
   AccountList::ConstIterator enabledAccountIt = mAcctList.constBegin();
-  foreach ( const QString& groupName, accountGroups ) {
+  for ( QStringList::ConstIterator it = accountGroups.constBegin() ;; ) {
+    QString groupName;
+    bool appendNewGroup = false;
+    if ( it == accountGroups.constEnd() ) {
+      if ( enabledAccountIt == mAcctList.constEnd() )
+        break;
+      appendNewGroup = true;
+      groupName.sprintf( "Account %d", accounts + 1 );
+    }
+    else {
+      groupName = *it;
+      ++it;
+    }
+
     KConfigGroup group(config, groupName);
     uint id = group.readEntry( "Id", 0 );
     if ( mDisabledAccounts.contains( id ) )
-      accounts++;
+      accounts++; // do not modify disabled account - skip
     else {
-      config->deleteGroup( groupName );
-      if ( enabledAccountIt != mAcctList.constEnd() ) {
+      if ( appendNewGroup ) {
         (*enabledAccountIt)->writeConfig( group );
         ++enabledAccountIt;
         accounts++;
       }
+      else // no such account on the list - disabled / enabled
+        config->deleteGroup( groupName );
     }
   }



More information about the Kdepim-bugs mailing list