Subject: Fix Bug 283467 - Kmail has duplicated folders after migration from previous version.
From: Montel Laurent <[email-masked]>
Date: Fri, 07 Oct 2011 15:14:06 +0000

---
Fix Bug 283467 - Kmail has duplicated folders after migration from previous version.

By default in config we don't translate config name.
We use "inbox" "sent-mail" etc.

BUG: 283467
FIXED-IN: 4.7.3
---

--- a/migration/kmail/localfolderscollectionmigrator.cpp
+++ b/migration/kmail/localfolderscollectionmigrator.cpp
@@ -64,23 +64,41 @@ void LocalFoldersCollectionMigrator::set
 
   const KConfigGroup group( config, QLatin1String( "General" ) );
 
-  QString name = group.readEntry( QLatin1String( "inboxFolder" ), i18nc( "mail folder name for role inbox",  "inbox" ) );
-  d->mSystemFolders.insert( name, SpecialMailCollections::Inbox );
-
-  name = group.readEntry( QLatin1String( "outboxFolder" ), i18nc( "mail folder name for role outbox",  "outbox" ) );
-  d->mSystemFolders.insert( name, SpecialMailCollections::Outbox );
-
-  name = group.readEntry( QLatin1String( "sentFolder" ), i18nc( "mail folder name for role sent-mail",  "sent-mail" ) );
-  d->mSystemFolders.insert( name, SpecialMailCollections::SentMail );
-
-  name = group.readEntry( QLatin1String( "trashFolder" ), i18nc( "mail folder name for role trash",  "trash" ) );
-  d->mSystemFolders.insert( name, SpecialMailCollections::Trash );
-
-  name = group.readEntry( QLatin1String( "draftsFolder" ), i18nc( "mail folder name for role drafts",  "drafts" ) );
-  d->mSystemFolders.insert( name, SpecialMailCollections::Drafts );
-
-  name = group.readEntry( QLatin1String( "templatesFolder" ), i18nc( "mail folder name for role templates",  "templates" ) );
-  d->mSystemFolders.insert( name, SpecialMailCollections::Templates );
+  if ( group.hasKey( QLatin1String( "inboxFolder" ) ) ) {
+    const QString name = group.readEntry( QLatin1String( "inboxFolder" ), i18nc( "mail folder name for role inbox",  "inbox" ) );
+    d->mSystemFolders.insert( name, SpecialMailCollections::Inbox );
+  } else 
+    d->mSystemFolders.insert( QLatin1String( "inbox" ), SpecialMailCollections::Inbox );
+
+  if ( group.hasKey( QLatin1String( "outboxFolder" ) ) ) {
+    const QString name = group.readEntry( QLatin1String( "outboxFolder" ), i18nc( "mail folder name for role outbox",  "outbox" ) );
+    d->mSystemFolders.insert( name, SpecialMailCollections::Outbox );
+  } else 
+    d->mSystemFolders.insert( QLatin1String( "outbox" ), SpecialMailCollections::Outbox );
+
+  if ( group.hasKey( QLatin1String( "sentFolder" ) ) ) {
+    const QString name = group.readEntry( QLatin1String( "sentFolder" ), i18nc( "mail folder name for role sent-mail",  "sent-mail" ) );
+    d->mSystemFolders.insert( name, SpecialMailCollections::SentMail );
+  } else 
+    d->mSystemFolders.insert( QLatin1String( "sent-mail" ), SpecialMailCollections::SentMail );
+
+  if ( group.hasKey( QLatin1String( "trashFolder" ) ) ) {
+    const QString name = group.readEntry( QLatin1String( "trashFolder" ), i18nc( "mail folder name for role trash",  "trash" ) );
+    d->mSystemFolders.insert( name, SpecialMailCollections::Trash );
+  } else 
+    d->mSystemFolders.insert( QLatin1String( "trash" ), SpecialMailCollections::Trash );
+
+  if ( group.hasKey( QLatin1String( "draftsFolder" ) ) ) {
+    const QString name = group.readEntry( QLatin1String( "draftsFolder" ), i18nc( "mail folder name for role drafts",  "drafts" ) );
+    d->mSystemFolders.insert( name, SpecialMailCollections::Drafts );
+  } else 
+    d->mSystemFolders.insert( QLatin1String( "drafts" ), SpecialMailCollections::Drafts );
+
+  if ( group.hasKey( QLatin1String( "templatesFolder" ) ) ) {
+    const QString name = group.readEntry( QLatin1String( "templatesFolder" ), i18nc( "mail folder name for role templates",  "templates" ) );
+    d->mSystemFolders.insert( name, SpecialMailCollections::Templates );
+  } else
+    d->mSystemFolders.insert( QLatin1String( "templates" ), SpecialMailCollections::Templates );
 }
 
 void LocalFoldersCollectionMigrator::migrateCollection( const Collection &collection, const QString &folderId )