Branch 'feature/notes_on_emails' - 2 commits - messagelist/CMakeLists.txt messagelist/core messageviewer/viewer
Aaron Seigo
seigo at kolabsys.com
Thu Oct 9 22:59:05 CEST 2014
messagelist/CMakeLists.txt | 1 +
messagelist/core/messageitem.cpp | 3 +--
messagelist/core/view.cpp | 12 ++++++++----
messageviewer/viewer/viewer.cpp | 1 +
messageviewer/viewer/viewer_p.cpp | 12 +++++++++++-
5 files changed, 22 insertions(+), 7 deletions(-)
New commits:
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 {
More information about the commits
mailing list