[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/kmail
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2010-01-17 20:24:39
Message-ID: 1263759879.420353.15464.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1076234 by tmcguire:

Put the annotation edit action into the context menu of the message viewer.

Not sure if that is the best place usability-wise, but it needs to be somewhere.


 M  +1 -0      kmmainwidget.cpp  
 M  +28 -0     messageactions.cpp  
 M  +3 -1      messageactions.h  


--- branches/work/akonadi-ports/kdepim/kmail/kmmainwidget.cpp #1076233:1076234
@@ -2910,6 +2910,7 @@
     menu->addAction( mMsgActions->messageStatusMenu() );
     menu->addSeparator();
 
+    menu->addAction( mMsgActions->annotateAction() );
     menu->addAction( viewSourceAction() );
     if ( mMsgView ) {
       menu->addAction( mMsgView->toggleFixFontAction() );
--- branches/work/akonadi-ports/kdepim/kmail/messageactions.cpp #1076233:1076234
@@ -24,6 +24,10 @@
 #include "kmkernel.h"
 #include "util.h"
 
+#include "messagecore/annotationdialog.h"
+
+#include <Nepomuk/Resource>
+
 #include <KAction>
 #include <KActionMenu>
 #include <KActionCollection>
@@ -152,6 +156,11 @@
            this, SLOT(editCurrentMessage()) );
   mEditAction->setShortcut( Qt::Key_T );
 
+  mAnnotateAction = new KAction( KIcon( "view-pim-notes" ), i18n( "Add Note..."), this );
+  mActionCollection->addAction( "annotate", mAnnotateAction );
+  connect( mAnnotateAction, SIGNAL(triggered(bool)),
+           this, SLOT(annotateMessage()) );
+
   mForwardActionMenu  = new KActionMenu(KIcon("mail-forward"), i18nc("Message->","&Forward"), this);
   mActionCollection->addAction("message_forward", mForwardActionMenu );
 
@@ -242,6 +251,15 @@
   mReplyListAction->setEnabled( singleMsg );
   mNoQuoteReplyAction->setEnabled( singleMsg );
 
+  mAnnotateAction->setEnabled( singleMsg );
+  if( mCurrentItem.isValid() ) {
+    Nepomuk::Resource resource( mCurrentItem.url() );
+    if ( resource.description().isEmpty() )
+      mAnnotateAction->setText( i18n( "Add Note..." ) );
+    else
+      mAnnotateAction->setText( i18n( "Edit Note...") );
+  }
+
   mStatusMenu->setEnabled( multiVisible );
   mToggleFlagAction->setEnabled( flagsAvailable );
   mToggleToActAction->setEnabled( flagsAvailable );
@@ -484,4 +502,14 @@
   command->start();
 }
 
+void MessageActions::annotateMessage()
+{
+  if ( !mCurrentItem.isValid() )
+    return;
+
+  KPIM::AnnotationEditDialog *dialog = new KPIM::AnnotationEditDialog( mCurrentItem.url() );
+  dialog->setAttribute( Qt::WA_DeleteOnClose );
+  dialog->show();
+}
+
 #include "messageactions.moc"
--- branches/work/akonadi-ports/kdepim/kmail/messageactions.h #1076233:1076234
@@ -77,11 +77,13 @@
     KActionMenu *forwardMenu() const { return mForwardActionMenu; }
 
     KAction* editAction() const { return mEditAction; }
+    KAction* annotateAction() const { return mAnnotateAction; }
 
     KActionMenu* mailingListActionMenu() const { return mMailingListActionMenu; }
 
   public slots:
     void editCurrentMessage();
+    void annotateMessage();
 
   private:
     void updateActions();
@@ -128,7 +130,7 @@
     KActionMenu *mForwardActionMenu;
     KActionMenu *mMailingListActionMenu;
     KToggleAction *mToggleFlagAction, *mToggleToActAction;
-    KAction *mEditAction;
+    KAction *mEditAction, *mAnnotateAction;
     bool mKorganizerIsOnSystem;
 };
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic