Bug 159029 - Account settings not stored
Summary: Account settings not stored
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.9.50
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 159210 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-09 16:57 UTC by Michi
Modified: 2008-03-13 09:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michi 2008-03-09 16:57:31 UTC
Version:           1.9.50 (using 4.00.65 (KDE 4.0.65 >= 20080305) "release 4.1", compiled sources)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.24.1-16-mic

Hi,

I just had another attempt to switch to KDE4 and wanted to setup Kontact. And again I hit a problem which means I have to keep on waiting :-(. The problem is, I can't figure out how I can get kmail to remember my incoming mail account settings. After I close kmail the settings are lost the next time I start the program; this does not apply to the outbound mail settings though. I also tried a fresh kmailrc and share/apps/kmail folder just to be sure - no difference.

hope this is useful information
thx M;chi
Comment 1 Thomas McGuire 2008-03-10 12:40:29 UTC
Works fine for me, I can not reproduce this problem, and therefore I can't fix it until I have more information to reproduce this myself.
I tried a POP3 and a IMAP account, with standalone KMail and from within Kontact, both with a clean config. This worked fine.
Comment 2 Jean-Baptiste Mardelle 2008-03-12 13:23:25 UTC
I have the same problem here. I habe been using KMail from KDE4 svn trunk for a while now with disconnected IMAP accounts. I updated my svn 3 days ago and my accounts disappeared when I restarted KMail (I also had my disk full to be honest). But since then, everytime I recreate my disconnected IMAP accounts, they disappear when restarting KMail. POP imap are saved correctly...

If you need more info let me know, I can also provide a testing disconnected IMAP account to developers if required...

regards
Comment 3 Thomas McGuire 2008-03-12 22:25:13 UTC
*** Bug 159210 has been marked as a duplicate of this bug. ***
Comment 4 Jarosław Staniek 2008-03-13 09:39:19 UTC
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 );
     }
   }