Summary: | Drafts are not saved in the draft folder which belongs to the identity | ||
---|---|---|---|
Product: | [Applications] kmail2 | Reporter: | m.wege |
Component: | general | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 2.0.89 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
m.wege
2010-12-17 23:58:05 UTC
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 ) ); |