Branch 'kolab/integration/4.13.0' - 16 commits - kmail/kmmainwidget.cpp kmail/messageactions.cpp kmail/messageactions.h mailcommon/folder messagecore/CMakeLists.txt messagecore/widgets messagelist/CMakeLists.txt messagelist/core messagelist/storagemodel.cpp messageviewer/job messageviewer/viewer messageviewer/widgets

Christian Mollekopf mollekopf at kolabsys.com
Fri Oct 31 13:38:56 CET 2014


 kmail/kmmainwidget.cpp                        |    3 
 kmail/messageactions.cpp                      |   24 ----
 kmail/messageactions.h                        |    4 
 mailcommon/folder/foldercollectionmonitor.cpp |    2 
 messagecore/CMakeLists.txt                    |    1 
 messagecore/widgets/annotationdialog.cpp      |  136 --------------------------
 messagecore/widgets/annotationdialog.h        |   71 -------------
 messagelist/CMakeLists.txt                    |    1 
 messagelist/core/messageitem.cpp              |   41 ++-----
 messagelist/core/messageitem.h                |   11 --
 messagelist/core/messageitem_p.h              |    2 
 messagelist/core/view.cpp                     |   13 --
 messagelist/storagemodel.cpp                  |   12 --
 messageviewer/job/createnotejob.cpp           |   96 ++++++++----------
 messageviewer/job/createnotejob.h             |    5 
 messageviewer/viewer/viewer.cpp               |    1 
 messageviewer/viewer/viewer_p.cpp             |   59 ++++++++++-
 messageviewer/viewer/viewer_p.h               |    3 
 messageviewer/widgets/noteedit.cpp            |    4 
 19 files changed, 144 insertions(+), 345 deletions(-)

New commits:
commit 85b18461eddd60b790efa17badbaa5f0ce5b61f4
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date:   Fri Oct 31 13:37:54 2014 +0100

    MessageViewer: Don't crash without mCreateNoteAction
    
    It's not created without action collection.

diff --git a/messageviewer/viewer/viewer_p.cpp b/messageviewer/viewer/viewer_p.cpp
index 9dc81c9..d1fdec6 100644
--- a/messageviewer/viewer/viewer_p.cpp
+++ b/messageviewer/viewer/viewer_p.cpp
@@ -203,6 +203,7 @@ ViewerPrivate::ViewerPrivate(Viewer *aParent, QWidget *mainWindow,
       mZoomResetAction( 0 ),
       mToggleMimePartTreeAction( 0 ),
       mSpeakTextAction(0),
+      mCreateNoteAction(0),
       mCanStartDrag( false ),
       mHtmlWriter( 0 ),
       mSavedRelativePosition( 0 ),
@@ -1348,15 +1349,17 @@ void ViewerPrivate::resetStateForNewMessage()
 void ViewerPrivate::setMessageInternal( const KMime::Message::Ptr message,
                                         Viewer::UpdateMode updateMode )
 {
-    QString createNoteText;
-    if ( mMessageItem.relations().isEmpty() ) {
-        createNoteText = i18nc( "create a new note out of this message", "Create Note" );
-    } else {
-        createNoteText = i18nc( "edit a note on this message", "Edit Note" );
-    }
+    if ( mCreateNoteAction ) {
+        QString createNoteText;
+        if ( mMessageItem.relations().isEmpty() ) {
+            createNoteText = i18nc( "create a new note out of this message", "Create Note" );
+        } else {
+            createNoteText = i18nc( "edit a note on this message", "Edit Note" );
+        }
 
-    mCreateNoteAction->setText( createNoteText );
-    mCreateNoteAction->setIconText( createNoteText );
+        mCreateNoteAction->setText( createNoteText );
+        mCreateNoteAction->setIconText( createNoteText );
+    }
 
     mMessage = message;
     if ( message ) {


commit c789aa6e4c75d3f4e35059d3614de74e92dc4127
Merge: e71ab95 b73d31b
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date:   Fri Oct 31 10:46:42 2014 +0100

    Merge remote-tracking branch 'kolab/feature/notes_on_emails' into kolab/integration/4.13.0



commit b73d31b20de81a00fae0664c330f089d26dcdb64
Author: Aaron Seigo <aseigo at kde.org>
Date:   Fri Oct 10 16:52:37 2014 +0200

    no longer consider this a FIXME either: the caller needs to load it

diff --git a/messagelist/core/messageitem.cpp b/messagelist/core/messageitem.cpp
index e4a9b02..755cd4d 100644
--- a/messagelist/core/messageitem.cpp
+++ b/messagelist/core/messageitem.cpp
@@ -275,7 +275,6 @@ Akonadi::Item MessageItem::annotation() const
         }
 
         if ( relation.isValid() ) {
-          //FIXME NOTES_ON_EMAIL doesn't have payload here
             return relation.right();
         }
     }


commit 5c604c53b556c36d651d9d8d4e84c9cd3804672b
Author: Aaron Seigo <aseigo at kde.org>
Date:   Fri Oct 10 16:50:50 2014 +0200

    these are not fixmes at this point

diff --git a/messagelist/core/messageitem.cpp b/messagelist/core/messageitem.cpp
index 2e981f8..e4a9b02 100644
--- a/messagelist/core/messageitem.cpp
+++ b/messagelist/core/messageitem.cpp
@@ -168,7 +168,6 @@ void MessageItemPrivate::invalidateTagCache()
 
 void MessageItemPrivate::invalidateAnnotationCache()
 {
-  //FIXME NOTES_ON_EMAIL
 }
 
 const MessageItem::Tag* MessageItemPrivate::bestTag() const
@@ -321,7 +320,6 @@ void MessageItem::invalidateTagCache()
 void MessageItem::invalidateAnnotationCache()
 {
     Q_D( MessageItem );
-    //FIXME: NOTES_ON_EMAIL
     d->invalidateAnnotationCache();
 }
 


commit f1b0e422a2cbaccb6f3bcaeaf2fd8e512c8b4165
Author: Aaron Seigo <aseigo at kde.org>
Date:   Fri Oct 10 16:50:04 2014 +0200

    don't show the note in the tooltip
    
    loading it requires roundtrips (async, less performance) and the
    note may be arbitrarily large?

diff --git a/messagelist/core/view.cpp b/messagelist/core/view.cpp
index 9fb557e..05c58e6 100644
--- a/messagelist/core/view.cpp
+++ b/messagelist/core/view.cpp
@@ -2427,15 +2427,6 @@ bool View::event( QEvent *e )
             tip += htmlCodeForStandardRow.arg( mi->formattedSize() ).arg( i18n( "Size" ) );
         }
 
-        if ( mi->hasAnnotation() && mi->annotation().hasPayload<KMime::Message::Ptr>()) {
-            QString note = Akonadi::NoteUtils::NoteMessageWrapper( mi->annotation().payload<KMime::Message::Ptr>() ).text();
-            if ( textIsLeftToRight ) {
-                tip += htmlCodeForStandardRow.arg( i18n( "Note" ) ).arg( note.replace( QLatin1Char( '\n' ), QLatin1String( "<br>" ) ) );
-            } else {
-                tip += htmlCodeForStandardRow.arg( note.replace( QLatin1Char( '\n' ), QLatin1String( "<br>" ) ) ).arg( i18n( "Note" ) );
-            }
-        }
-
         QString content = MessageList::Util::contentSummary( mi->akonadiItem() );
         if ( !content.trimmed().isEmpty() ) {
             if ( textIsLeftToRight ) {


commit 5111f8bfe27c5cd6b0925c494cbf06dc21e644f3
Author: Aaron Seigo <aseigo at kde.org>
Date:   Fri Oct 10 16:43:47 2014 +0200

    if there is a note, then fetch the note info for editting before showing the note edit

diff --git a/messageviewer/viewer/viewer_p.cpp b/messageviewer/viewer/viewer_p.cpp
index 3817948..9dc81c9 100644
--- a/messageviewer/viewer/viewer_p.cpp
+++ b/messageviewer/viewer/viewer_p.cpp
@@ -3445,11 +3445,51 @@ void ViewerPrivate::slotCreateEvent(const KCalCore::Event::Ptr &eventPtr, const
 
 void ViewerPrivate::slotShowCreateNoteWidget()
 {
+    if (!mMessageItem.relations().isEmpty())  {
+        Akonadi::Relation relation;
+        foreach (const Akonadi::Relation &r, mMessageItem.relations()) {
+            // assuming that GENERIC relations to emails are notes is a pretty horirific hack imo - aseigo
+            if (r.type() == Akonadi::Relation::GENERIC/* && r.right().mimeType() == Akonadi::NoteUtils::noteMimeType(*/) {
+                relation = r;
+                break;
+            }
+        }
+
+        if (relation.isValid()) {
+            Akonadi::ItemFetchJob* job = new Akonadi::ItemFetchJob(relation.right());
+            job->fetchScope().fetchFullPayload(true);
+            connect(job, SIGNAL(result(KJob*)), this, SLOT(slotNoteItemFetched(KJob*)));
+            return;
+        }
+    }
+
+    showCreateNewNoteWidget();
+}
+
+void ViewerPrivate::showCreateNewNoteWidget()
+{
     if (mMessage) {
         mCreateNote->setMessage(mMessage);
         mCreateNote->showNoteEdit();
     } else {
-        qDebug()<<" There is not valid message";
+        qDebug() << "There is not valid message";
+    }
+}
+
+void ViewerPrivate::slotNoteItemFetched(KJob *job)
+{
+    if (job->error()) {
+        showCreateNewNoteWidget();
+    } else {
+        Akonadi::ItemFetchJob *fetch = qobject_cast<Akonadi::ItemFetchJob*>( job );
+        Q_ASSERT( fetch );
+        if (fetch->items().isEmpty() || !fetch->items().first().hasPayload<KMime::Message::Ptr>()) {
+            showCreateNewNoteWidget();
+        } else {
+            Akonadi::NoteUtils::NoteMessageWrapper note(fetch->items().first().payload<KMime::Message::Ptr>());
+            mCreateNote->setMessage(note.message());
+            mCreateNote->showNoteEdit();
+        }
     }
 }
 
diff --git a/messageviewer/viewer/viewer_p.h b/messageviewer/viewer/viewer_p.h
index 819df31..3797363 100644
--- a/messageviewer/viewer/viewer_p.h
+++ b/messageviewer/viewer/viewer_p.h
@@ -620,6 +620,7 @@ public slots:
     void slotShowCreateTodoWidget();
     void slotShowCreateEventWidget();
     void slotShowCreateNoteWidget();
+    void slotNoteItemFetched(KJob *job);
 
 signals:
     void showStatusBarMessage( const QString &message );
@@ -634,7 +635,9 @@ signals:
 
     void changeDisplayMail(Viewer::ForceDisplayTo,bool);
     void moveMessageToTrash();
+
 private:
+    void showCreateNewNoteWidget();
     QString attachmentInjectionHtml() const;
     QString recipientsQuickListLinkHtml( bool, const QString & ) const;
     void initGrantleeThemeName();


commit 35a80484f91d2ef2e627e1840a24fe5bffce4977
Author: Aaron Seigo <aseigo at kde.org>
Date:   Fri Oct 10 16:28:54 2014 +0200

    if the note exists, update it rather than create a new one

diff --git a/messageviewer/job/createnotejob.cpp b/messageviewer/job/createnotejob.cpp
index 6735c14..f58702d 100644
--- a/messageviewer/job/createnotejob.cpp
+++ b/messageviewer/job/createnotejob.cpp
@@ -20,6 +20,8 @@
 #include <Akonadi/KMime/MessageParts>
 #include <Akonadi/RelationCreateJob>
 #include <Akonadi/ItemCreateJob>
+#include <Akonadi/ItemModifyJob>
+#include <Akonadi/Relation>
 
 #include <KMime/Message>
 #include <QApplication>
@@ -43,11 +45,29 @@ void CreateNoteJob::start()
 {
     mNote.setFrom(QCoreApplication::applicationName() + QCoreApplication::applicationVersion());
     mNote.setLastModifiedDate(KDateTime::currentUtcDateTime());
+    if (!mItem.relations().isEmpty())  {
+        Akonadi::Relation relation;
+        foreach (const Akonadi::Relation &r, mItem.relations()) {
+            // assuming that GENERIC relations to emails are notes is a pretty horirific hack imo - aseigo
+            if (r.type() == Akonadi::Relation::GENERIC/* && r.right().mimeType() == Akonadi::NoteUtils::noteMimeType(*/) {
+                relation = r;
+                break;
+            }
+        }
+
+        if (relation.isValid()) {
+            Akonadi::Item item = relation.right();
+            item.setMimeType(Akonadi::NoteUtils::noteMimeType());
+            item.setPayload(mNote.message());
+            Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item);
+            connect(modifyJob, SIGNAL(result(KJob*)), this, SLOT(noteUpdated(KJob*)));
+            return;
+        }
+    }
 
     Akonadi::Item newNoteItem;
     newNoteItem.setMimeType( Akonadi::NoteUtils::noteMimeType() );
     newNoteItem.setPayload( mNote.message() );
-
     Akonadi::ItemCreateJob *createJob = new Akonadi::ItemCreateJob(newNoteItem, mCollection);
     connect(createJob, SIGNAL(result(KJob*)), this, SLOT(noteCreated(KJob*)));
 }
@@ -67,8 +87,19 @@ void CreateNoteJob::noteCreated(KJob *job)
     }
 }
 
+void CreateNoteJob::noteUpdated(KJob *job)
+{
+    if ( job->error() ) {
+        setError( job->error() );
+        setErrorText( job->errorText() );
+    }
+
+    emitResult();
+}
+
 void CreateNoteJob::relationCreated(KJob *job)
 {
+   Q_UNUSED(job)
    emitResult();
 }
 
diff --git a/messageviewer/job/createnotejob.h b/messageviewer/job/createnotejob.h
index 6680376..5191308 100644
--- a/messageviewer/job/createnotejob.h
+++ b/messageviewer/job/createnotejob.h
@@ -39,6 +39,7 @@ public:
 
 private slots:
     void noteCreated(KJob *job);
+    void noteUpdated(KJob *job);
     void relationCreated(KJob *job);
 
 private:


commit 9e977d5ebe20ae1dbe1451a8831243fc2892754f
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 22:58:01 2014 +0200

    small steps towards the messagelist parts of notes working

diff --git a/messagelist/CMakeLists.txt b/messagelist/CMakeLists.txt
index a52db2a..6ff76f3 100644
--- a/messagelist/CMakeLists.txt
+++ b/messagelist/CMakeLists.txt
@@ -93,6 +93,7 @@ target_link_libraries(messagelist
   ${KDE4_KDEUI_LIBS}
   ${KDE4_KIO_LIBS}
   ${KDEPIMLIBS_AKONADI_LIBS}
+  ${KDEPIMLIBS_AKONADI_NOTES_LIBS}
   ${KDEPIMLIBS_AKONADI_KMIME_LIBS}
   ${KDEPIMLIBS_KMIME_LIBS}
   ${BALOO_LIBRARIES}
diff --git a/messagelist/core/messageitem.cpp b/messagelist/core/messageitem.cpp
index 73cf0dd..2e981f8 100644
--- a/messagelist/core/messageitem.cpp
+++ b/messagelist/core/messageitem.cpp
@@ -260,14 +260,12 @@ QList< MessageItem::Tag * > MessageItem::tagList() const
 bool MessageItem::hasAnnotation() const
 {
     Q_D( const MessageItem );
-    //FIXME NOTES_ON_EMAIL
     return !d->mAkonadiItem.relations().isEmpty();
 }
 
 Akonadi::Item MessageItem::annotation() const
 {
     Q_D( const MessageItem );
-    //FIXME NOTES_ON_EMAIL
     if ( hasAnnotation() ) {
         Akonadi::Relation relation;
         foreach( const Akonadi::Relation &r, d->mAkonadiItem.relations() ) {
@@ -278,6 +276,7 @@ Akonadi::Item MessageItem::annotation() const
         }
 
         if ( relation.isValid() ) {
+          //FIXME NOTES_ON_EMAIL doesn't have payload here
             return relation.right();
         }
     }
diff --git a/messagelist/core/view.cpp b/messagelist/core/view.cpp
index f12e80f..9fb557e 100644
--- a/messagelist/core/view.cpp
+++ b/messagelist/core/view.cpp
@@ -37,6 +37,7 @@
 #include <kmime/kmime_dateformatter.h> // kdepimlibs
 
 #include <Akonadi/Item>
+#include <Akonadi/Notes/NoteUtils>
 #include <QHelpEvent>
 #include <QToolTip>
 #include <QHeaderView>
@@ -2128,7 +2129,9 @@ void View::mousePressEvent( QMouseEvent * e )
                 switch ( d->mDelegate->hitContentItem()->type() )
                 {
                 case Theme::ContentItem::AnnotationIcon:
-                    static_cast< MessageItem * >( it )->editAnnotation();
+                    qDebug() <<" NEED TO SHOW THE EDITOR!";
+                    //FIXME: NOTES_ON_EMAIL
+                    //static_cast< MessageItem * >( it )->editAnnotation();
                     return; // don't select the item
                     break;
                 case Theme::ContentItem::ActionItemStateIcon:
@@ -2424,11 +2427,12 @@ bool View::event( QEvent *e )
             tip += htmlCodeForStandardRow.arg( mi->formattedSize() ).arg( i18n( "Size" ) );
         }
 
-        if ( mi->hasAnnotation() ) {
+        if ( mi->hasAnnotation() && mi->annotation().hasPayload<KMime::Message::Ptr>()) {
+            QString note = Akonadi::NoteUtils::NoteMessageWrapper( mi->annotation().payload<KMime::Message::Ptr>() ).text();
             if ( textIsLeftToRight ) {
-                tip += htmlCodeForStandardRow.arg( i18n( "Note" ) ).arg( mi->annotation().replace( QLatin1Char( '\n' ), QLatin1String( "<br>" ) ) );
+                tip += htmlCodeForStandardRow.arg( i18n( "Note" ) ).arg( note.replace( QLatin1Char( '\n' ), QLatin1String( "<br>" ) ) );
             } else {
-                tip += htmlCodeForStandardRow.arg( mi->annotation().replace( QLatin1Char( '\n' ), QLatin1String( "<br>" ) ) ).arg( i18n( "Note" ) );
+                tip += htmlCodeForStandardRow.arg( note.replace( QLatin1Char( '\n' ), QLatin1String( "<br>" ) ) ).arg( i18n( "Note" ) );
             }
         }
 


commit 5669a8673483209b9df152ee561c0b1212405066
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 22:55:55 2014 +0200

    show the correct text for note create / edit based on note status

diff --git a/messageviewer/viewer/viewer.cpp b/messageviewer/viewer/viewer.cpp
index 0e2d8a4..3adf767 100644
--- a/messageviewer/viewer/viewer.cpp
+++ b/messageviewer/viewer/viewer.cpp
@@ -528,6 +528,7 @@ Akonadi::ItemFetchJob* Viewer::createFetchJob( const Akonadi::Item &item )
     job->fetchScope().fetchAllAttributes();
     job->fetchScope().setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
     job->fetchScope().fetchFullPayload( true );
+    job->fetchScope().setFetchRelations( true ); // needed to know if we have notes or not
     job->fetchScope().fetchAttribute<MailTransport::ErrorAttribute>();
     return job;
 }
diff --git a/messageviewer/viewer/viewer_p.cpp b/messageviewer/viewer/viewer_p.cpp
index a224fb9..3817948 100644
--- a/messageviewer/viewer/viewer_p.cpp
+++ b/messageviewer/viewer/viewer_p.cpp
@@ -1348,6 +1348,16 @@ void ViewerPrivate::resetStateForNewMessage()
 void ViewerPrivate::setMessageInternal( const KMime::Message::Ptr message,
                                         Viewer::UpdateMode updateMode )
 {
+    QString createNoteText;
+    if ( mMessageItem.relations().isEmpty() ) {
+        createNoteText = i18nc( "create a new note out of this message", "Create Note" );
+    } else {
+        createNoteText = i18nc( "edit a note on this message", "Edit Note" );
+    }
+
+    mCreateNoteAction->setText( createNoteText );
+    mCreateNoteAction->setIconText( createNoteText );
+
     mMessage = message;
     if ( message ) {
         mNodeHelper->setOverrideCodec( mMessage.get(), overrideCodec() );
@@ -3403,7 +3413,7 @@ void ViewerPrivate::slotExpandShortUrl()
 
 void ViewerPrivate::slotShowCreateTodoWidget()
 {
-    if (mMessage) {       
+    if (mMessage) {
         mCreateTodo->setMessage(mMessage);
         mCreateTodo->showToDoWidget();
     } else {


commit cf612b5bf19cb59d6667f14b22feb806d0fea992
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 16:33:13 2014 +0200

    we no longer care about annotations, but relations

diff --git a/mailcommon/folder/foldercollectionmonitor.cpp b/mailcommon/folder/foldercollectionmonitor.cpp
index f2ebf7d..895ff32 100644
--- a/mailcommon/folder/foldercollectionmonitor.cpp
+++ b/mailcommon/folder/foldercollectionmonitor.cpp
@@ -56,7 +56,7 @@ FolderCollectionMonitor::FolderCollectionMonitor( Akonadi::Session *session, QOb
   mMonitor->itemFetchScope().setFetchModificationTime( false );
   mMonitor->itemFetchScope().setFetchRemoteIdentification( false );
   mMonitor->itemFetchScope().setFetchTags( true );
-  mMonitor->itemFetchScope().fetchAttribute<Akonadi::EntityAnnotationsAttribute>( true );
+  mMonitor->itemFetchScope().setFetchRelations( true );
 }
 
 FolderCollectionMonitor::~FolderCollectionMonitor()


commit 2be02a261c4fab64bebed668f380758aaec1e8fc
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 16:32:40 2014 +0200

    update the implementation of the API to reflect that we are using realy notes

diff --git a/messagelist/core/messageitem.cpp b/messagelist/core/messageitem.cpp
index 52b7775..73cf0dd 100644
--- a/messagelist/core/messageitem.cpp
+++ b/messagelist/core/messageitem.cpp
@@ -25,6 +25,7 @@
 #include "theme.h"
 
 #include <akonadi/item.h>
+#include <akonadi/relation.h>
 #include <akonadi/tagattribute.h>
 #include <akonadi/tagfetchjob.h>
 #include <akonadi/tagfetchscope.h>
@@ -41,8 +42,8 @@ class MessageItem::Tag::Private
     Private()
         :mPriority( 0 ) //Initialize it
     {
-
     }
+
     QPixmap mPixmap;
     QString mName;
     QString mId;             ///< The unique id of this tag
@@ -260,20 +261,28 @@ bool MessageItem::hasAnnotation() const
 {
     Q_D( const MessageItem );
     //FIXME NOTES_ON_EMAIL
-    return false;
+    return !d->mAkonadiItem.relations().isEmpty();
 }
 
-QString MessageItem::annotation() const
+Akonadi::Item MessageItem::annotation() const
 {
     Q_D( const MessageItem );
     //FIXME NOTES_ON_EMAIL
-    return QString();
-}
+    if ( hasAnnotation() ) {
+        Akonadi::Relation relation;
+        foreach( const Akonadi::Relation &r, d->mAkonadiItem.relations() ) {
+            if ( r.type() == Akonadi::Relation::GENERIC ) {
+                relation = r;
+                break;
+            }
+        }
 
-void MessageItem::editAnnotation()
-{
-    Q_D( MessageItem );
-    //FIXME: NOTES_ON_EMAIL
+        if ( relation.isValid() ) {
+            return relation.right();
+        }
+    }
+
+    return Akonadi::Item();
 }
 
 const MessageItem::Tag * MessageItemPrivate::findTagInternal( const QString &szTagId ) const
diff --git a/messagelist/core/messageitem.h b/messagelist/core/messageitem.h
index e3f96da..48b4161 100644
--- a/messagelist/core/messageitem.h
+++ b/messagelist/core/messageitem.h
@@ -105,15 +105,12 @@ public:
     virtual bool hasAnnotation() const;
 
     /// Returns the annotation of the message, given that hasAnnotation() is true
-    QString annotation() const;
-
-    /// Shows a dialog to edit or delete the annotation
-    void editAnnotation();
+    Akonadi::Item annotation() const;
 
     /**
-   * Returns Tag associated to this message that has the specified id or 0
-   * if no such tag exists. mTagList will be 0 in 99% of the cases.
-   */
+     * Returns Tag associated to this message that has the specified id or 0
+     * if no such tag exists. mTagList will be 0 in 99% of the cases.
+     */
     const Tag * findTag( const QString &szTagId ) const;
 
     QString tagListDescription() const;


commit 62d25ce8596df6d2c96278e6b2cbf5efd0a51d91
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 16:11:56 2014 +0200

    don't defeat the optimization by creating new strings

diff --git a/messagelist/storagemodel.cpp b/messagelist/storagemodel.cpp
index e7822fa..d131479 100644
--- a/messagelist/storagemodel.cpp
+++ b/messagelist/storagemodel.cpp
@@ -233,7 +233,9 @@ bool StorageModel::initializeMessageItem( MessageList::Core::MessageItem *mi,
     }
 
     // Static for speed reasons
-    static const QString noSubject = i18nc( "displayed as subject when the subject of a mail is empty", "No Subject" );
+    static const QString noSubject = QLatin1Char( '(' ) +
+                                     i18nc( "displayed as subject when the subject of a mail is empty", "No Subject" ) +
+                                     QLatin1Char( ')' );
     static const QString unknown( i18nc( "displayed when a mail has unknown sender, receiver or date", "Unknown" ) );
 
     if ( sender.isEmpty() ) {
@@ -249,12 +251,8 @@ bool StorageModel::initializeMessageItem( MessageList::Core::MessageItem *mi,
                       bUseReceiver );
     mi->setItemId( item.id() );
 
-    QString subject = mail->subject()->asUnicodeString();
-    if ( subject.isEmpty() ) {
-        subject = QLatin1Char( '(' ) + noSubject + QLatin1Char( ')' );
-    }
-
-    mi->setSubject( subject );
+    const QString subject = mail->subject()->asUnicodeString();
+    mi->setSubject( subject.isEmpty() ? noSubject : subject );
 
     updateMessageItemData( mi, row );
 


commit 4a01a063f9ebfc27f238896df89bbfaac1e54b30
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 15:58:00 2014 +0200

    we don't really care about errors in the end
    
    relations can only be formed if the mail and the note are in the same
    collection. so it is completely plausible for a relation to fail but
    the note is created and stored in akonadi where requestsed.

diff --git a/messageviewer/job/createnotejob.cpp b/messageviewer/job/createnotejob.cpp
index 113aa8e..6735c14 100644
--- a/messageviewer/job/createnotejob.cpp
+++ b/messageviewer/job/createnotejob.cpp
@@ -37,12 +37,11 @@ CreateNoteJob::CreateNoteJob(const KMime::Message::Ptr &notePtr, const Akonadi::
 
 CreateNoteJob::~CreateNoteJob()
 {
-    qDebug()<<" CreateNoteJob::~CreateNoteJob()";
 }
 
 void CreateNoteJob::start()
 {
-    mNote.setFrom(QCoreApplication::applicationName()+QCoreApplication::applicationVersion());
+    mNote.setFrom(QCoreApplication::applicationName() + QCoreApplication::applicationVersion());
     mNote.setLastModifiedDate(KDateTime::currentUtcDateTime());
 
     Akonadi::Item newNoteItem;
@@ -70,14 +69,6 @@ void CreateNoteJob::noteCreated(KJob *job)
 
 void CreateNoteJob::relationCreated(KJob *job)
 {
-   if ( job->error() ) {
-        qDebug() << "Error when creating the relation" << job->errorString();
-        setError( job->error() );
-        setErrorText( job->errorText() );
-
-        //FIXME NOTES_ON_EMAIL on failure, what to do with the note? leave it? clean it up? ...?
-   }
-
    emitResult();
 }
 


commit 79a971ec66a734b6cb3b8e6c5f251241bb802c79
Author: Aaron Seigo <aseigo at kde.org>
Date:   Thu Oct 9 10:46:23 2014 +0200

    create the actual relation

diff --git a/messageviewer/job/createnotejob.cpp b/messageviewer/job/createnotejob.cpp
index 3364337..113aa8e 100644
--- a/messageviewer/job/createnotejob.cpp
+++ b/messageviewer/job/createnotejob.cpp
@@ -18,8 +18,7 @@
 #include "createnotejob.h"
 
 #include <Akonadi/KMime/MessageParts>
-#include <Akonadi/ItemFetchJob>
-#include <Akonadi/ItemFetchScope>
+#include <Akonadi/RelationCreateJob>
 #include <Akonadi/ItemCreateJob>
 
 #include <KMime/Message>
@@ -43,52 +42,6 @@ CreateNoteJob::~CreateNoteJob()
 
 void CreateNoteJob::start()
 {
-    // We need the full payload to attach the mail
-    if ( !mItem.loadedPayloadParts().contains( Akonadi::MessagePart::Body ) ) {
-        Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( mItem );
-        job->fetchScope().fetchFullPayload();
-        connect( job, SIGNAL(result(KJob*)), this, SLOT(slotFetchDone(KJob*)) );
-
-        if ( job->exec() ) {
-            if ( job->items().count() == 1 ) {
-                mItem = job->items().first();
-            }
-        } else {
-            qDebug()<<" createNote: Error during fetch: "<<job->errorString();
-        }
-    } else {
-        createNote();
-    }
-}
-
-void CreateNoteJob::slotFetchDone(KJob *job)
-{
-    qDebug()<<" void CreateNoteJob::slotFetchDone(KJob *job)";
-    Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
-    if ( fetchJob->items().count() == 1 ) {
-        mItem = fetchJob->items().first();
-    } else {
-        Q_EMIT emitResult();
-        return;
-    }
-    createNote();
-}
-
-void CreateNoteJob::createNote()
-{
-    if ( !mItem.hasPayload<KMime::Message::Ptr>() ) {
-        qDebug()<<" item has not payload";
-        Q_EMIT emitResult();
-        return;
-    }
-    KMime::Message::Ptr msg =  mItem.payload<KMime::Message::Ptr>();
-
-    Akonadi::NoteUtils::Attachment attachment(msg->encodedContent(), msg->mimeType());
-    const KMime::Headers::Subject * const subject = msg->subject(false);
-    if (subject)
-        attachment.setLabel(subject->asUnicodeString());
-    mNote.attachments().append(attachment);
-
     mNote.setFrom(QCoreApplication::applicationName()+QCoreApplication::applicationVersion());
     mNote.setLastModifiedDate(KDateTime::currentUtcDateTime());
 
@@ -97,13 +50,34 @@ void CreateNoteJob::createNote()
     newNoteItem.setPayload( mNote.message() );
 
     Akonadi::ItemCreateJob *createJob = new Akonadi::ItemCreateJob(newNoteItem, mCollection);
-    connect(createJob, SIGNAL(result(KJob*)), this, SLOT(slotCreateNewNote(KJob*)));
+    connect(createJob, SIGNAL(result(KJob*)), this, SLOT(noteCreated(KJob*)));
 }
 
-void CreateNoteJob::slotCreateNewNote(KJob *job)
+void CreateNoteJob::noteCreated(KJob *job)
 {
     if ( job->error() ) {
         qDebug() << "Error during create new Note "<<job->errorString();
+        setError( job->error() );
+        setErrorText( job->errorText() );
+        emitResult();
+    } else {
+        Akonadi::ItemCreateJob *createJob = static_cast<Akonadi::ItemCreateJob *> ( job );
+        Akonadi::Relation relation( Akonadi::Relation::GENERIC, mItem, createJob->item() );
+        Akonadi::RelationCreateJob *job = new Akonadi::RelationCreateJob( relation );
+        connect( job, SIGNAL( result( KJob * ) ), this, SLOT( relationCreated( KJob * ) ) );
     }
-    Q_EMIT emitResult();
 }
+
+void CreateNoteJob::relationCreated(KJob *job)
+{
+   if ( job->error() ) {
+        qDebug() << "Error when creating the relation" << job->errorString();
+        setError( job->error() );
+        setErrorText( job->errorText() );
+
+        //FIXME NOTES_ON_EMAIL on failure, what to do with the note? leave it? clean it up? ...?
+   }
+
+   emitResult();
+}
+
diff --git a/messageviewer/job/createnotejob.h b/messageviewer/job/createnotejob.h
index 4749745..6680376 100644
--- a/messageviewer/job/createnotejob.h
+++ b/messageviewer/job/createnotejob.h
@@ -38,8 +38,8 @@ public:
     void start();
 
 private slots:
-    void slotFetchDone(KJob *job);
-    void slotCreateNewNote(KJob *job);
+    void noteCreated(KJob *job);
+    void relationCreated(KJob *job);
 
 private:
     void createNote();


commit 9095b4e8f08a1e422aeac2b15b5f42156c2601f9
Author: Aaron Seigo <aseigo at kde.org>
Date:   Mon Oct 6 14:16:15 2014 +0200

    before going further, remove the existing email annotation feature
    
    this preserve the API for annotations, which will quietly change
    in implementation to edit / fetch / etc notes for the email. this
    will preserve code elsewhere such as for theming.

diff --git a/kmail/kmmainwidget.cpp b/kmail/kmmainwidget.cpp
index b6655c5..db3137d 100644
--- a/kmail/kmmainwidget.cpp
+++ b/kmail/kmmainwidget.cpp
@@ -2923,12 +2923,13 @@ void KMMainWidget::showMessagePopup(const Akonadi::Item&msg ,const KUrl&url,cons
         menu->addAction( mMsgView->createEventAction() );
         menu->addAction( mMsgView->createNoteAction() );
         menu->addSeparator();
+
         if (mMsgView) {
             menu->addAction( mMsgView->saveMessageDisplayFormatAction() );
             menu->addAction( mMsgView->resetMessageDisplayFormatAction() );
             menu->addSeparator();
         }
-        menu->addAction( mMsgActions->annotateAction() );
+
         if (mMsgView && mMsgView->adblockEnabled()) {
             menu->addSeparator();
             menu->addAction( mMsgView->openBlockableItems());
diff --git a/kmail/messageactions.cpp b/kmail/messageactions.cpp
index 8f8caf2..196c8e0 100644
--- a/kmail/messageactions.cpp
+++ b/kmail/messageactions.cpp
@@ -27,7 +27,6 @@
 #include "kmcommands.h"
 #include "customtemplatesmenu.h"
 
-#include "messagecore/widgets/annotationdialog.h"
 #include "messagecore/settings/globalsettings.h"
 #include "messagecore/misc/mailinglist.h"
 #include "messagecore/helpers/messagehelpers.h"
@@ -55,7 +54,6 @@
 #include <QVariant>
 #include <qwidget.h>
 #include <akonadi/collection.h>
-#include <akonadi/entityannotationsattribute.h>
 #include <util/mailutil.h>
 
 using namespace KMail;
@@ -139,11 +137,6 @@ MessageActions::MessageActions( KActionCollection *ac, QWidget *parent )
              this, SLOT(editCurrentMessage()) );
     mEditAction->setShortcut( Qt::Key_T );
 
-    mAnnotateAction = new KAction( KIcon( QLatin1String("view-pim-notes") ), i18n( "Add Note..."), this );
-    ac->addAction( QLatin1String("annotate"), mAnnotateAction );
-    connect( mAnnotateAction, SIGNAL(triggered(bool)),
-             this, SLOT(annotateMessage()) );
-
     mPrintAction = KStandardAction::print( this, SLOT(slotPrintMsg()), ac );
     if(KPrintPreview::isAvailable())
         mPrintPreviewAction = KStandardAction::printPreview( this, SLOT(slotPrintPreviewMsg()), ac );
@@ -282,12 +275,6 @@ void MessageActions::updateActions()
     mReplyListAction->setEnabled( hasPayload );
     mNoQuoteReplyAction->setEnabled( hasPayload );
 
-    mAnnotateAction->setEnabled( uniqItem );
-    if ( !mCurrentItem.hasAttribute<Akonadi::EntityAnnotationsAttribute>() )
-        mAnnotateAction->setText( i18n( "Add Note..." ) );
-    else
-        mAnnotateAction->setText( i18n( "Edit Note...") );
-
     mStatusMenu->setEnabled( multiVisible );
 
     if ( mCurrentItem.hasPayload<KMime::Message::Ptr>() ) {
@@ -298,7 +285,6 @@ void MessageActions::updateActions()
             job->fetchScope().fetchAllAttributes();
             job->fetchScope().fetchFullPayload( true );
             job->fetchScope().fetchPayloadPart( Akonadi::MessagePart::Header );
-            job->fetchScope().fetchAttribute<Akonadi::EntityAnnotationsAttribute>();
             connect( job, SIGNAL(result(KJob*)), SLOT(slotUpdateActionsFetchDone(KJob*)) );
         }
     }
@@ -581,16 +567,6 @@ void MessageActions::editCurrentMessage()
     }
 }
 
-void MessageActions::annotateMessage()
-{
-    if ( !mCurrentItem.isValid() )
-        return;
-
-    MessageCore::AnnotationEditDialog *dialog = new MessageCore::AnnotationEditDialog( mCurrentItem );
-    dialog->setAttribute( Qt::WA_DeleteOnClose );
-    dialog->exec();
-}
-
 void MessageActions::addWebShortcutsMenu( KMenu *menu, const QString & text )
 {
     if ( text.isEmpty() )
diff --git a/kmail/messageactions.h b/kmail/messageactions.h
index 7733db1..a10a2f8 100644
--- a/kmail/messageactions.h
+++ b/kmail/messageactions.h
@@ -80,7 +80,6 @@ public:
     KActionMenu *forwardMenu() const { return mForwardActionMenu; }
 
     KAction* editAction() const { return mEditAction; }
-    KAction* annotateAction() const { return mAnnotateAction; }
     KAction* printAction() const { return mPrintAction; }
     KAction* printPreviewAction() const { return mPrintPreviewAction; }
     KAction* listFilterAction() const { return mListFilterAction; }
@@ -100,7 +99,6 @@ signals:
 
 public slots:
     void editCurrentMessage();
-    void annotateMessage();
 
 private:
     void updateActions();
@@ -146,7 +144,7 @@ private:
     KActionMenu *mStatusMenu;
     KActionMenu *mForwardActionMenu;
     KActionMenu *mMailingListActionMenu;
-    KAction *mEditAction, *mAnnotateAction, *mPrintAction, *mPrintPreviewAction;
+    KAction *mEditAction, *mPrintAction, *mPrintPreviewAction;
     TemplateParser::CustomTemplatesMenu *mCustomTemplatesMenu;
     KAction *mListFilterAction;
 };
diff --git a/messagecore/CMakeLists.txt b/messagecore/CMakeLists.txt
index dfb30ff..4afbe81 100644
--- a/messagecore/CMakeLists.txt
+++ b/messagecore/CMakeLists.txt
@@ -32,7 +32,6 @@ set(messagecore_LIB_SRCS
    helpers/messagehelpers.cpp
    helpers/nodehelper.cpp
    utils/stringutil.cpp
-   widgets/annotationdialog.cpp
 )
 
 kde4_add_kcfg_files(messagecore_LIB_SRCS
diff --git a/messagecore/widgets/annotationdialog.cpp b/messagecore/widgets/annotationdialog.cpp
deleted file mode 100644
index 3e37bb2..0000000
--- a/messagecore/widgets/annotationdialog.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright 2010 Thomas McGuire <mcguire at kde.org>
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License or (at your option) version 3 or any later version
-   accepted by the membership of KDE e.V. (or its successor approved
-   by the membership of KDE e.V.), which shall act as a proxy
-   defined in Section 14 of version 3 of the license.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "annotationdialog.h"
-#include "pimcommon/texteditor/richtexteditor/richtexteditorwidget.h"
-
-#include <KMessageBox>
-#include <KLocalizedString>
-#include <Akonadi/ItemModifyJob>
-#include <KSharedConfig>
-#include <akonadi/item.h>
-#include <akonadi/entityannotationsattribute.h>
-
-
-#include <QLabel>
-#include <QGridLayout>
-
-using namespace MessageCore;
-
-class AnnotationEditDialog::Private
-{
-public:
-    Private()
-        : mTextEdit( 0 ),
-          mHasAnnotation( false )
-    {
-    }
-
-    Akonadi::Item mItem;
-    PimCommon::RichTextEditorWidget *mTextEdit;
-    bool mHasAnnotation;
-};
-
-AnnotationEditDialog::AnnotationEditDialog( const Akonadi::Item &item, QWidget *parent )
-    : KDialog( parent ), d( new Private )
-{
-    d->mItem = item;
-    //check for correct key?
-    d->mHasAnnotation = item.hasAttribute<Akonadi::EntityAnnotationsAttribute>();
-    if ( d->mHasAnnotation ) {
-        setCaption( i18n( "Edit Note" ) );
-        setButtons( Ok | Cancel | User1 );
-        setButtonText( User1, i18n( "Delete Note" ) );
-        setButtonIcon( User1, KIcon( QLatin1String("edit-delete") ) );
-    } else {
-        setCaption( i18n( "Add Note" ) );
-        setButtons( Ok | Cancel );
-    }
-
-    setDefaultButton( KDialog::Ok );
-
-    QLabel *label = new QLabel( i18n( "Enter the text that should be stored as a note to the mail:" ) );
-    QGridLayout *grid = new QGridLayout( mainWidget() );
-    d->mTextEdit = new PimCommon::RichTextEditorWidget( this );
-    d->mTextEdit->setAcceptRichText(false);
-    grid->addWidget( label );
-    grid->addWidget( d->mTextEdit );
-    d->mTextEdit->setFocus();
-
-    if ( d->mHasAnnotation && item.attribute<Akonadi::EntityAnnotationsAttribute>() ) {
-        //TODO shared/private annotations
-        d->mTextEdit->setPlainText( item.attribute<Akonadi::EntityAnnotationsAttribute>()->value("/private/comment") );
-    }
-    readConfig();
-}
-
-AnnotationEditDialog::~AnnotationEditDialog()
-{
-    writeConfig();
-    delete d;
-}
-
-void AnnotationEditDialog::slotButtonClicked( int button )
-{
-    if ( button == KDialog::Ok ) {
-        bool textIsEmpty = d->mTextEdit->toPlainText().isEmpty();
-        if ( !textIsEmpty ) {
-            d->mItem.removeAttribute<Akonadi::EntityAnnotationsAttribute>();
-            Akonadi::EntityAnnotationsAttribute *annotation = d->mItem.attribute<Akonadi::EntityAnnotationsAttribute>(Akonadi::Entity::AddIfMissing);
-            annotation->insert("/private/comment", d->mTextEdit->toPlainText());
-            d->mItem.addAttribute(annotation);
-        } else if ( d->mHasAnnotation && textIsEmpty ) {
-            d->mItem.removeAttribute<Akonadi::EntityAnnotationsAttribute>();
-        }
-        new Akonadi::ItemModifyJob(d->mItem);
-
-        accept();
-    } else if ( button == KDialog::Cancel ) {
-        reject();
-    } else if ( button == KDialog::User1 ) {
-        const int answer = KMessageBox::warningContinueCancel( this,
-                                                               i18n( "Do you really want to delete this note?" ),
-                                                               i18n( "Delete Note?" ), KGuiItem( i18n( "Delete" ), QLatin1String("edit-delete") ) );
-        if ( answer == KMessageBox::Continue ) {
-            d->mItem.removeAttribute<Akonadi::EntityAnnotationsAttribute>();
-            new Akonadi::ItemModifyJob(d->mItem);
-            accept();
-        }
-    }
-}
-
-void AnnotationEditDialog::readConfig()
-{
-    KSharedConfig::Ptr cfg = KGlobal::config();
-    KConfigGroup group( cfg, "AnnotationEditDialog" );
-    QSize size = group.readEntry( "Size", QSize() );
-    if ( !size.isEmpty() ) {
-        resize( size );
-    }
-}
-
-void AnnotationEditDialog::writeConfig()
-{
-    KSharedConfig::Ptr cfg = KGlobal::config();
-    KConfigGroup group( cfg, "AnnotationEditDialog" );
-    group.writeEntry( "Size", size() );
-}
-
-
-
diff --git a/messagecore/widgets/annotationdialog.h b/messagecore/widgets/annotationdialog.h
deleted file mode 100644
index 3b5c63b..0000000
--- a/messagecore/widgets/annotationdialog.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright 2010 Thomas McGuire <mcguire at kde.org>
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License or (at your option) version 3 or any later version
-   accepted by the membership of KDE e.V. (or its successor approved
-   by the membership of KDE e.V.), which shall act as a proxy
-   defined in Section 14 of version 3 of the license.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef MESSAGECORE_ANNOTATIONDIALOG_H
-#define MESSAGECORE_ANNOTATIONDIALOG_H
-
-#include "messagecore_export.h"
-
-#include <KDialog>
-
-namespace Akonadi {
-class Item;
-}
-
-namespace MessageCore {
-
-/**
- * @short A dialog for editing annotations of an email.
- *
- * @author Thomas McGuire <mcguire at kde.org>
- */
-class MESSAGECORE_EXPORT AnnotationEditDialog : public KDialog
-{
-    Q_OBJECT
-
-public:
-    /**
-     * Creates a new annotation edit dialog.
-     *
-     * @param item The item.
-     * @param parent The parent widget.
-     */
-    explicit AnnotationEditDialog( const Akonadi::Item &item, QWidget *parent = 0 );
-
-    /**
-     * Destroys the annotation edit dialog.
-     */
-    ~AnnotationEditDialog();
-
-protected:
-    /// Reimplemented to handle button clicks
-    void slotButtonClicked( int button );
-    void readConfig();
-    void writeConfig();
-
-private:
-    //@cond PRIVATE
-    class Private;
-    Private* const d;
-    //@endcond
-};
-
-}
-
-#endif
diff --git a/messagelist/core/messageitem.cpp b/messagelist/core/messageitem.cpp
index 7c1cfaf..52b7775 100644
--- a/messagelist/core/messageitem.cpp
+++ b/messagelist/core/messageitem.cpp
@@ -22,11 +22,9 @@
 #include "messageitem.h"
 #include "messageitem_p.h"
 
-#include "messagecore/widgets/annotationdialog.h"
 #include "theme.h"
 
 #include <akonadi/item.h>
-#include <akonadi/entityannotationsattribute.h>
 #include <akonadi/tagattribute.h>
 #include <akonadi/tagfetchjob.h>
 #include <akonadi/tagfetchscope.h>
@@ -169,6 +167,7 @@ void MessageItemPrivate::invalidateTagCache()
 
 void MessageItemPrivate::invalidateAnnotationCache()
 {
+  //FIXME NOTES_ON_EMAIL
 }
 
 const MessageItem::Tag* MessageItemPrivate::bestTag() const
@@ -260,37 +259,21 @@ QList< MessageItem::Tag * > MessageItem::tagList() const
 bool MessageItem::hasAnnotation() const
 {
     Q_D( const MessageItem );
-    //TODO check for note entry?
-    return d->mAkonadiItem.hasAttribute<Akonadi::EntityAnnotationsAttribute>();
+    //FIXME NOTES_ON_EMAIL
+    return false;
 }
 
 QString MessageItem::annotation() const
 {
     Q_D( const MessageItem );
-    if ( d->mAkonadiItem.hasAttribute<Akonadi::EntityAnnotationsAttribute>() ) {
-        Akonadi::EntityAnnotationsAttribute *attr = d->mAkonadiItem.attribute<Akonadi::EntityAnnotationsAttribute>();
-        const QMap<QByteArray, QByteArray> annotations = attr->annotations();
-        if (annotations.contains("/private/comment")) {
-            return QString::fromLatin1(annotations.value("/private/comment"));
-        }
-        if (annotations.contains("/shared/comment")) {
-            return QString::fromLatin1(annotations.value("/shared/comment"));
-        }
-    }
+    //FIXME NOTES_ON_EMAIL
     return QString();
 }
 
 void MessageItem::editAnnotation()
 {
     Q_D( MessageItem );
-    if ( d->mAnnotationDialog.data() )
-        return;
-    d->mAnnotationDialog = new MessageCore::AnnotationEditDialog( d->mAkonadiItem );
-    d->mAnnotationDialog.data()->setAttribute( Qt::WA_DeleteOnClose );
-    //FIXME make async
-    if ( d->mAnnotationDialog.data()->exec() ) {
-        // invalidate the cached mHasAnnotation value
-    }
+    //FIXME: NOTES_ON_EMAIL
 }
 
 const MessageItem::Tag * MessageItemPrivate::findTagInternal( const QString &szTagId ) const
@@ -330,6 +313,7 @@ void MessageItem::invalidateTagCache()
 void MessageItem::invalidateAnnotationCache()
 {
     Q_D( MessageItem );
+    //FIXME: NOTES_ON_EMAIL
     d->invalidateAnnotationCache();
 }
 
diff --git a/messagelist/core/messageitem_p.h b/messagelist/core/messageitem_p.h
index 47f16b8..dac7b67 100644
--- a/messagelist/core/messageitem_p.h
+++ b/messagelist/core/messageitem_p.h
@@ -23,7 +23,6 @@
 
 #include "messageitem.h"
 #include "item_p.h"
-#include "messagecore/widgets/annotationdialog.h"
 #include <Akonadi/Item>
 #include <Akonadi/Monitor>
 #include <Akonadi/Tag>
@@ -70,7 +69,6 @@ public:
   QByteArray mReferencesIdMD5;         ///< set only if we're doing threading
   QByteArray mStrippedSubjectMD5;      ///< set only if we're doing threading
   Akonadi::Item mAkonadiItem;
-  QWeakPointer<MessageCore::AnnotationEditDialog> mAnnotationDialog;
   MessageItem::ThreadingStatus mThreadingStatus : 4;
   MessageItem::EncryptionState mEncryptionState : 4;
   MessageItem::SignatureState mSignatureState : 4;
diff --git a/messageviewer/widgets/noteedit.cpp b/messageviewer/widgets/noteedit.cpp
index 9d9df41..936052a 100644
--- a/messageviewer/widgets/noteedit.cpp
+++ b/messageviewer/widgets/noteedit.cpp
@@ -146,7 +146,7 @@ void NoteEdit::showNoteEdit()
 void NoteEdit::readConfig()
 {
     const qint64 id = MessageViewer::GlobalSettingsBase::self()->lastNoteSelectedFolder();
-    if (id!=-1) {
+    if (id != -1) {
         mCollectionCombobox->setDefaultCollection(Akonadi::Collection(id));
     }
 }
@@ -243,4 +243,4 @@ bool NoteEdit::eventFilter(QObject *object, QEvent *e)
         }
     }
     return QWidget::eventFilter(object,e);
-}
\ No newline at end of file
+}


commit d8f3c10a2df6f479dbf9ed17852c8d4191bd5539
Author: Aaron Seigo <aseigo at kde.org>
Date:   Mon Oct 6 11:22:59 2014 +0200

    typo in whatsthis

diff --git a/messageviewer/viewer/viewer_p.cpp b/messageviewer/viewer/viewer_p.cpp
index 705f46a..a224fb9 100644
--- a/messageviewer/viewer/viewer_p.cpp
+++ b/messageviewer/viewer/viewer_p.cpp
@@ -1888,7 +1888,7 @@ void ViewerPrivate::createActions()
     mCreateNoteAction = new KAction(KIcon( QLatin1String("view-pim-notes") ),i18nc("create a new note out of this message", "Create Note"), this);
     mCreateNoteAction->setIconText( i18nc("create a new note out of this message", "Create Note") );
     mCreateNoteAction->setHelpText( i18n("Allows you to create a note from this message") );
-    mCreateNoteAction->setWhatsThis( i18n( "This option starts a editor to create a note. Then you can edit the note to your liking before saving it." ) );
+    mCreateNoteAction->setWhatsThis( i18n( "This option starts an editor to create a note. Then you can edit the note to your liking before saving it." ) );
     ac->addAction(QLatin1String("create_note"), mCreateNoteAction);
     connect( mCreateNoteAction, SIGNAL(triggered(bool)), SLOT(slotShowCreateNoteWidget()) );
 }





More information about the commits mailing list