Version: 2.0.89 (using KDE 4.5.85) OS: Linux When I save a draft, the draft is saved in the draft folder belonging to "Kmail local folders" and not in the draft folder belonging to that identity (which is a cached IMAP-account). Reproducible: Always OS: Linux (i686) release 2.6.37-7-generic-pae Compiler: cc
bug is still present in 4.6. Beta 3
commit 33696c399edfe08ba7e17a12ef810107b115634f branch master Author: Tobias Koenig <tokoe@kde.org> Date: Fri Dec 31 08:52:08 2010 +0100 Use identity specific drafts/templates folders Patch provided by Antonis Tsiapaliokas, coding style adapted. BUG: 260593 diff --git a/messagecomposer/composerviewbase.cpp b/messagecomposer/composerviewbase.cpp index 84b6fe8..c5c2765 100644 --- a/messagecomposer/composerviewbase.cpp +++ b/messagecomposer/composerviewbase.cpp @@ -899,12 +899,27 @@ void Message::ComposerViewBase::saveMessage( KMime::Message::Ptr message, Messag { Akonadi::Collection target; + // preinitialize with the default collections if ( saveIn == MessageSender::SaveInTemplates ) { target = Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Templates ); } else { target = Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Drafts ); } + // overwrite with identity specific collections if available + const KPIMIdentities::Identity identity = identityManager()->identityForUoid( m_identityCombo->currentIdentity() ); + if ( !identity.isNull() ) { // we have a valid identity + if ( saveIn == MessageSender::SaveInTemplates ) { + if ( !identity.templates().isEmpty() ) { // the user has specified a custom templates collection + target = Akonadi::Collection( identity.templates().toLongLong() ); + } + } else { + if ( !identity.drafts().isEmpty() ) { // the user has specified a custom drafts collection + target = Akonadi::Collection( identity.drafts().toLongLong() ); + } + } + } + if ( !target.isValid() ) { kWarning() << "No default collection for" << saveIn; emit failed( i18n( "No default collection for %1", saveIn ) );