Merged revisions 938122 via svnmerge from

svn+ssh://tmcguire@svn.kde.org/home/kde/branches/kdepim/enterprise4/kdepim

........
  r938122 | tmcguire | 2009-03-11 12:40:52 +0100 (Wed, 11 Mar 2009) | 3 lines
  
  Add config compatibilty code for account types, this is necessary to not loose
  the dimap cache if the update scripts screw up and run in KDE3 already.
........

svn path=/trunk/KDE/kdepim/; revision=938125
wilder-work
Thomas McGuire 17 years ago
parent 835d1fba3f
commit 041cb92ff5
  1. 26
      accountmanager.cpp

@ -94,6 +94,32 @@ void AccountManager::readConfig(void)
uint id = group.readEntry( "Id", 0 );
KAccount::Type acctType = KAccount::typeForName( group.readEntry( "Type" ) );
QString accountName = group.readEntry( "Name" );
// Fixes for config compatibilty: We do have an update script, but that is not reliable, because
// sometimes the scripts don't run (or already run in KDE3, but don't actually change anything)
// This is a big problem, since incorrect account type values make you loose your account settings,
// which in case of disconnected IMAP means you'll loose your cache.
// So for extra saftey, convert the account type values here as well.
// See also kmail-4.0-misc.pl
if ( acctType == -1 ) {
kWarning() << "Config upgrade failed! Danger! Trying to convert old account type for account" << accountName;
const QString accountTypeName = group.readEntry( "Type" );
if ( accountTypeName == "cachedimap" )
acctType = KAccount::DImap;
if ( accountTypeName == "pop" )
acctType = KAccount::Pop;
if ( accountTypeName == "local" )
acctType = KAccount::Local;
if ( accountTypeName == "maildir" )
acctType = KAccount::Maildir;
if ( accountTypeName == "imap" )
acctType = KAccount::Imap;
if ( acctType == -1 )
kWarning() << "Unrecognized account type. Your account settings are now lost, sorry.";
else
kDebug() << "Account type upgraded.";
}
if ( accountName.isEmpty() )
accountName = i18n( "Account %1", accountNum++ );
KMAccount *account = create( acctType, accountName, id );

Loading…
Cancel
Save