[Bug 260593] Drafts are not saved in the draft folder which belongs to the identity

Tobias Koenig tokoe at kde.org
Fri Dec 31 07:50:25 GMT 2010


https://bugs.kde.org/show_bug.cgi?id=260593


Tobias Koenig <tokoe at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Tobias Koenig <tokoe kde org>  2010-12-31 08:50:24 ---
commit 33696c399edfe08ba7e17a12ef810107b115634f
branch master
Author: Tobias Koenig <tokoe at 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 ) );

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list