2 Copyright (c) 2007 Volker Krause <vkrause@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "messageactions.h"
21 #include "globalsettings.h"
22 #include "kmreaderwin.h"
26 #include "messagecore/annotationdialog.h"
27 #include "messagecore/mailinglist-magic.h"
28 #include "messagecore/globalsettings.h"
29 #include "messagecore/messagehelpers.h"
30 #include "messageviewer/csshelper.h"
31 #include "messageviewer/globalsettings.h"
33 #include <Nepomuk/Resource>
36 #include <KActionMenu>
37 #include <KActionCollection>
38 #include <KToggleAction>
41 #include <KXMLGUIClient>
42 #include <KStandardDirs>
48 #include <akonadi/collection.h>
49 #include <Akonadi/Monitor>
51 using namespace KMail
;
53 MessageActions::MessageActions( KActionCollection
*ac
, QWidget
* parent
) :
56 mActionCollection( ac
),
60 mReplyActionMenu
= new KActionMenu( KIcon("mail-reply-sender"), i18nc("Message->","&Reply"), this );
61 mActionCollection
->addAction( "message_reply_menu", mReplyActionMenu
);
62 connect( mReplyActionMenu
, SIGNAL(triggered(bool)),
63 this, SLOT(slotReplyToMsg()) );
65 mReplyAction
= new KAction( KIcon("mail-reply-sender"), i18n("&Reply..."), this );
66 mActionCollection
->addAction( "reply", mReplyAction
);
67 mReplyAction
->setShortcut(Qt::Key_R
);
68 connect( mReplyAction
, SIGNAL(triggered(bool)),
69 this, SLOT(slotReplyToMsg()) );
70 mReplyActionMenu
->addAction( mReplyAction
);
72 mReplyAuthorAction
= new KAction( KIcon("mail-reply-sender"), i18n("Reply to A&uthor..."), this );
73 mActionCollection
->addAction( "reply_author", mReplyAuthorAction
);
74 mReplyAuthorAction
->setShortcut(Qt::SHIFT
+Qt::Key_A
);
75 connect( mReplyAuthorAction
, SIGNAL(triggered(bool)),
76 this, SLOT(slotReplyAuthorToMsg()) );
77 mReplyActionMenu
->addAction( mReplyAuthorAction
);
79 mReplyAllAction
= new KAction( KIcon("mail-reply-all"), i18n("Reply to &All..."), this );
80 mActionCollection
->addAction( "reply_all", mReplyAllAction
);
81 mReplyAllAction
->setShortcut( Qt::Key_A
);
82 connect( mReplyAllAction
, SIGNAL(triggered(bool)),
83 this, SLOT(slotReplyAllToMsg()) );
84 mReplyActionMenu
->addAction( mReplyAllAction
);
86 mReplyListAction
= new KAction( KIcon("mail-reply-list"), i18n("Reply to Mailing-&List..."), this );
87 mActionCollection
->addAction( "reply_list", mReplyListAction
);
88 mReplyListAction
->setShortcut( Qt::Key_L
);
89 connect( mReplyListAction
, SIGNAL(triggered(bool)),
90 this, SLOT(slotReplyListToMsg()) );
91 mReplyActionMenu
->addAction( mReplyListAction
);
93 mNoQuoteReplyAction
= new KAction( i18n("Reply Without &Quote..."), this );
94 mActionCollection
->addAction( "noquotereply", mNoQuoteReplyAction
);
95 mNoQuoteReplyAction
->setShortcut( Qt::SHIFT
+Qt::Key_R
);
96 connect( mNoQuoteReplyAction
, SIGNAL(triggered(bool)),
97 this, SLOT(slotNoQuoteReplyToMsg()) );
100 mCreateTodoAction
= new KAction( KIcon( "task-new" ), i18n( "Create To-do/Reminder..." ), this );
101 mCreateTodoAction
->setIconText( i18n( "Create To-do" ) );
102 mCreateTodoAction
->setHelpText( i18n( "Allows you to create a calendar to-do or reminder from this message" ) );
103 mCreateTodoAction
->setWhatsThis( i18n( "This option starts the KOrganizer to-do editor with initial values taken from the currently selected message. Then you can edit the to-do to your liking before saving it to your calendar." ) );
104 mActionCollection
->addAction( "create_todo", mCreateTodoAction
);
105 connect( mCreateTodoAction
, SIGNAL(triggered(bool)),
106 this, SLOT(slotCreateTodo()) );
107 mKorganizerIsOnSystem
= !KStandardDirs::findExe("korganizer").isEmpty();
108 mCreateTodoAction
->setEnabled( mKorganizerIsOnSystem
);
110 mStatusMenu
= new KActionMenu ( i18n( "Mar&k Message" ), this );
111 mActionCollection
->addAction( "set_status", mStatusMenu
);
115 action
= new KAction( KIcon("mail-mark-read"), i18n("Mark Message as &Read"), this );
116 action
->setHelpText( i18n("Mark selected messages as read") );
117 connect( action
, SIGNAL(triggered(bool)),
118 this, SLOT(slotSetMsgStatusRead()) );
119 mActionCollection
->addAction( "status_read", action
);
120 mStatusMenu
->addAction( action
);
122 action
= new KAction( KIcon("mail-mark-unread"), i18n("Mark Message as &Unread"), this );
123 action
->setHelpText( i18n("Mark selected messages as unread") );
124 connect( action
, SIGNAL(triggered(bool)),
125 this, SLOT(slotSetMsgStatusUnread()) );
126 mActionCollection
->addAction( "status_unread", action
);
127 action
->setShortcut( Qt::CTRL
+Qt::Key_U
);
128 mStatusMenu
->addAction( action
);
130 mStatusMenu
->addSeparator();
132 mToggleFlagAction
= new KToggleAction( KIcon("mail-mark-important"),
133 i18n("Mark Message as &Important"), this );
134 mToggleFlagAction
->setShortcut( Qt::CTRL
+ Qt::Key_I
);
135 connect( mToggleFlagAction
, SIGNAL(triggered(bool)),
136 this, SLOT(slotSetMsgStatusFlag()) );
137 mToggleFlagAction
->setCheckedState( KGuiItem(i18n("Remove &Important Message Mark")) );
138 mToggleFlagAction
->setIconText( i18n( "Important" ) );
139 mActionCollection
->addAction( "status_flag", mToggleFlagAction
);
140 mStatusMenu
->addAction( mToggleFlagAction
);
142 mToggleToActAction
= new KToggleAction( KIcon("mail-mark-task"),
143 i18n("Mark Message as &Action Item"), this );
144 connect( mToggleToActAction
, SIGNAL(triggered(bool)),
145 this, SLOT(slotSetMsgStatusToAct()) );
146 mToggleToActAction
->setCheckedState( KGuiItem(i18n("Remove &Action Item Message Mark")) );
147 mToggleToActAction
->setIconText( i18n( "Action Item" ) );
148 mActionCollection
->addAction( "status_toact", mToggleToActAction
);
149 mStatusMenu
->addAction( mToggleToActAction
);
151 mEditAction
= new KAction( KIcon("accessories-text-editor"), i18n("&Edit Message"), this );
152 mActionCollection
->addAction( "edit", mEditAction
);
153 connect( mEditAction
, SIGNAL(triggered(bool)),
154 this, SLOT(editCurrentMessage()) );
155 mEditAction
->setShortcut( Qt::Key_T
);
157 mAnnotateAction
= new KAction( KIcon( "view-pim-notes" ), i18n( "Add Note..."), this );
158 mActionCollection
->addAction( "annotate", mAnnotateAction
);
159 connect( mAnnotateAction
, SIGNAL(triggered(bool)),
160 this, SLOT(annotateMessage()) );
162 mPrintAction
= KStandardAction::print( this, SLOT( slotPrintMsg() ), mActionCollection
);
164 mForwardActionMenu
= new KActionMenu(KIcon("mail-forward"), i18nc("Message->","&Forward"), this);
165 mActionCollection
->addAction("message_forward", mForwardActionMenu
);
167 mForwardAttachedAction
= new KAction( KIcon("mail-forward"),
168 i18nc( "@action:inmenu Message->Forward->",
169 "As &Attachment..." ),
171 connect( mForwardAttachedAction
, SIGNAL( triggered( bool ) ),
172 parent
, SLOT( slotForwardAttachedMsg() ) );
173 mActionCollection
->addAction( "message_forward_as_attachment", mForwardAttachedAction
);
175 mForwardInlineAction
= new KAction( KIcon( "mail-forward" ),
176 i18nc( "@action:inmenu Message->Forward->",
179 connect( mForwardInlineAction
, SIGNAL( triggered( bool ) ),
180 parent
, SLOT( slotForwardInlineMsg() ) );
181 mActionCollection
->addAction( "message_forward_inline", mForwardInlineAction
);
183 setupForwardActions();
185 mRedirectAction
= new KAction(i18nc("Message->Forward->", "&Redirect..."), this );
186 mActionCollection
->addAction( "message_forward_redirect", mRedirectAction
);
187 connect( mRedirectAction
, SIGNAL( triggered( bool ) ),
188 parent
, SLOT( slotRedirectMsg() ) );
189 mRedirectAction
->setShortcut( QKeySequence( Qt::Key_E
) );
190 mForwardActionMenu
->addAction( mRedirectAction
);
192 //FIXME add KIcon("mail-list") as first arguement. Icon can be derived from
193 // mail-reply-list icon by removing top layers off svg
194 mMailingListActionMenu
= new KActionMenu( i18nc( "Message->", "Mailing-&List" ), this );
195 connect( mMailingListActionMenu
->menu(), SIGNAL(triggered(QAction
*)),
196 this, SLOT(slotRunUrl(QAction
*)) );
197 mActionCollection
->addAction( "message_list", mMailingListActionMenu
);
199 mMonitor
= new Akonadi::Monitor( this );
200 //FIXME: Attachment fetching is not needed here, but on-demand loading is not supported ATM
201 mMonitor
->itemFetchScope().fetchFullPayload();
202 connect( mMonitor
, SIGNAL(itemChanged( Akonadi::Item
, QSet
<QByteArray
> )), SLOT(slotItemModified( Akonadi::Item
, QSet
<QByteArray
> )));
207 MessageActions::~MessageActions()
211 void MessageActions::setCurrentMessage( const Akonadi::Item
&msg
)
213 mMonitor
->setItemMonitored( mCurrentItem
, false );
216 if ( !msg
.isValid() ) {
217 mSelectedItems
.clear();
218 mVisibleItems
.clear();
221 mMonitor
->setItemMonitored( mCurrentItem
, true );
225 void MessageActions::slotItemModified( const Akonadi::Item
& item
, const QSet
< QByteArray
> & partIdentifiers
)
227 if ( item
.id() == mCurrentItem
.id() && item
.remoteId() == mCurrentItem
.remoteId() )
229 const int numberOfVisibleItems
= mVisibleItems
.count();
230 for( int i
= 0; i
< numberOfVisibleItems
; ++i
) {
231 Akonadi::Item it
= mVisibleItems
[i
];
232 if ( item
.id() == it
.id() && item
.remoteId() == it
.remoteId() ) {
233 mVisibleItems
[i
] = item
;
241 void MessageActions::setSelectedItem( const Akonadi::Item::List
&items
)
243 mSelectedItems
= items
;
247 void MessageActions::setSelectedVisibleItems( const Akonadi::Item::List
&items
)
249 Q_FOREACH( const Akonadi::Item
& item
, mVisibleItems
) {
250 mMonitor
->setItemMonitored( item
, false );
252 mVisibleItems
= items
;
253 Q_FOREACH( const Akonadi::Item
& item
, items
) {
254 mMonitor
->setItemMonitored( item
, true );
259 void MessageActions::updateActions()
261 bool singleMsg
= mCurrentItem
.isValid();
262 Akonadi::Collection parent
;
263 if ( singleMsg
) //=> valid
264 parent
= mCurrentItem
.parentCollection();
265 if ( parent
.isValid() ) {
266 if ( KMKernel::self()->folderIsTemplates(parent
) )
270 const bool multiVisible
= mVisibleItems
.count() > 0 || mCurrentItem
.isValid();
271 const bool flagsAvailable
= GlobalSettings::self()->allowLocalFlags()
272 || !(parent
.isValid() ? parent
.rights() & Akonadi::Collection::ReadOnly
: true);
274 mCreateTodoAction
->setEnabled( singleMsg
&& mKorganizerIsOnSystem
);
275 mReplyActionMenu
->setEnabled( singleMsg
);
276 mReplyAction
->setEnabled( singleMsg
);
277 mNoQuoteReplyAction
->setEnabled( singleMsg
);
278 mReplyAuthorAction
->setEnabled( singleMsg
);
279 mReplyAllAction
->setEnabled( singleMsg
);
280 mReplyListAction
->setEnabled( singleMsg
);
281 mNoQuoteReplyAction
->setEnabled( singleMsg
);
283 mAnnotateAction
->setEnabled( singleMsg
);
284 updateAnnotateAction();
286 mStatusMenu
->setEnabled( multiVisible
);
287 mToggleFlagAction
->setEnabled( flagsAvailable
);
288 mToggleToActAction
->setEnabled( flagsAvailable
);
290 if ( mCurrentItem
.hasPayload
<KMime::Message::Ptr
>() ) {
291 Akonadi::MessageStatus status
;
292 status
.setStatusFromFlags( mCurrentItem
.flags() );
293 mToggleToActAction
->setChecked( status
.isToAct() );
294 mToggleFlagAction
->setChecked( status
.isImportant() );
296 MessageCore::MailingList mailList
;
297 mailList
= MessageCore::MailingList::detect( MessageCore::Util::message( mCurrentItem
) );
299 if ( mailList
.features() & ~MessageCore::MailingList::Id
) {
300 // A mailing list menu with only a title is pretty boring
301 // so make sure theres at least some content
303 if ( mailList
.features() & MessageCore::MailingList::Id
) {
304 // From a list-id in the form, "Birds of France <bof.yahoo.com>",
305 // take "Birds of France" if it exists otherwise "bof.yahoo.com".
306 listId
= mailList
.id();
307 const int start
= listId
.indexOf( '<' );
309 listId
.truncate( start
- 1 );
310 } else if ( start
== 0 ) {
311 const int end
= listId
.lastIndexOf( '>' );
312 if ( end
< 1 ) { // shouldn't happen but account for it anyway
313 listId
.remove( 0, 1 );
315 listId
= listId
.mid( 1, end
-1 );
319 mMailingListActionMenu
->menu()->clear();
320 if ( !listId
.isEmpty() )
321 mMailingListActionMenu
->menu()->addTitle( listId
);
323 if ( mailList
.features() & MessageCore::MailingList::ArchivedAt
)
324 // IDEA: this may be something you want to copy - "Copy in submenu"?
325 addMailingListAction( i18n( "Open Message in List Archive" ), KUrl( mailList
.archivedAt() ) );
326 if ( mailList
.features() & MessageCore::MailingList::Post
)
327 addMailingListActions( i18n( "Post New Message" ), mailList
.postURLS() );
328 if ( mailList
.features() & MessageCore::MailingList::Archive
)
329 addMailingListActions( i18n( "Go to Archive" ), mailList
.archiveURLS() );
330 if ( mailList
.features() & MessageCore::MailingList::Help
)
331 addMailingListActions( i18n( "Request Help" ), mailList
.helpURLS() );
332 if ( mailList
.features() & MessageCore::MailingList::Owner
)
333 addMailingListActions( i18n( "Contact Owner" ), mailList
.ownerURLS() );
334 if ( mailList
.features() & MessageCore::MailingList::Subscribe
)
335 addMailingListActions( i18n( "Subscribe to List" ), mailList
.subscribeURLS() );
336 if ( mailList
.features() & MessageCore::MailingList::Unsubscribe
)
337 addMailingListActions( i18n( "Unsubscribe from List" ), mailList
.unsubscribeURLS() );
338 mMailingListActionMenu
->setEnabled( true );
340 mMailingListActionMenu
->setEnabled( false );
344 mEditAction
->setEnabled( singleMsg
);
347 template<typename T
> void MessageActions::replyCommand()
349 if ( !mCurrentItem
.isValid() )
351 const QString text
= mMessageView
? mMessageView
->copyText() : QString();
352 KMCommand
*command
= new T( mParent
, mCurrentItem
, text
);
353 connect( command
, SIGNAL( completed( KMCommand
* ) ),
354 this, SIGNAL( replyActionFinished() ) );
358 void MessageActions::slotCreateTodo()
360 if ( !mCurrentItem
.isValid() )
362 KMCommand
*command
= new CreateTodoCommand( mParent
, mCurrentItem
);
366 void MessageActions::setMessageView(KMReaderWin
* msgView
)
368 mMessageView
= msgView
;
371 void MessageActions::setupForwardActions()
373 disconnect( mForwardActionMenu
, SIGNAL( triggered(bool) ), 0, 0 );
374 mForwardActionMenu
->removeAction( mForwardInlineAction
);
375 mForwardActionMenu
->removeAction( mForwardAttachedAction
);
377 if ( GlobalSettings::self()->forwardingInlineByDefault() ) {
378 mForwardActionMenu
->insertAction( mRedirectAction
, mForwardInlineAction
);
379 mForwardActionMenu
->insertAction( mRedirectAction
, mForwardAttachedAction
);
380 mForwardInlineAction
->setShortcut(QKeySequence(Qt::Key_F
));
381 mForwardAttachedAction
->setShortcut(QKeySequence(Qt::SHIFT
+Qt::Key_F
));
382 QObject::connect( mForwardActionMenu
, SIGNAL(triggered(bool)),
383 mParent
, SLOT(slotForwardInlineMsg()) );
386 mForwardActionMenu
->insertAction( mRedirectAction
, mForwardAttachedAction
);
387 mForwardActionMenu
->insertAction( mRedirectAction
, mForwardInlineAction
);
388 mForwardInlineAction
->setShortcut(QKeySequence(Qt::SHIFT
+Qt::Key_F
));
389 mForwardAttachedAction
->setShortcut(QKeySequence(Qt::Key_F
));
390 QObject::connect( mForwardActionMenu
, SIGNAL(triggered(bool)),
391 mParent
, SLOT(slotForwardAttachedMsg()) );
395 void MessageActions::setupForwardingActionsList( KXMLGUIClient
*guiClient
)
397 QList
<QAction
*> forwardActionList
;
398 guiClient
->unplugActionList( "forward_action_list" );
399 if ( GlobalSettings::self()->forwardingInlineByDefault() ) {
400 forwardActionList
.append( mForwardInlineAction
);
401 forwardActionList
.append( mForwardAttachedAction
);
404 forwardActionList
.append( mForwardAttachedAction
);
405 forwardActionList
.append( mForwardInlineAction
);
407 forwardActionList
.append( mRedirectAction
);
408 guiClient
->plugActionList( "forward_action_list", forwardActionList
);
412 void MessageActions::slotReplyToMsg()
414 replyCommand
<KMReplyToCommand
>();
417 void MessageActions::slotReplyAuthorToMsg()
419 replyCommand
<KMReplyAuthorCommand
>();
422 void MessageActions::slotReplyListToMsg()
424 replyCommand
<KMReplyListCommand
>();
427 void MessageActions::slotReplyAllToMsg()
429 replyCommand
<KMReplyToAllCommand
>();
432 void MessageActions::slotNoQuoteReplyToMsg()
434 if ( !mCurrentItem
.isValid() )
436 KMCommand
*command
= new KMNoQuoteReplyToCommand( mParent
, mCurrentItem
);
440 void MessageActions::slotSetMsgStatusUnread()
442 setMessageStatus( Akonadi::MessageStatus::statusUnread() );
445 void MessageActions::slotSetMsgStatusRead()
447 setMessageStatus( Akonadi::MessageStatus::statusRead() );
450 void MessageActions::slotSetMsgStatusFlag()
452 setMessageStatus( Akonadi::MessageStatus::statusImportant(), true );
455 void MessageActions::slotSetMsgStatusToAct()
457 setMessageStatus( Akonadi::MessageStatus::statusToAct(), true );
460 void MessageActions::slotRunUrl( QAction
*urlAction
)
462 const QVariant q
= urlAction
->data();
463 if ( q
.type() == QVariant::String
) {
464 new KRun( KUrl( q
.toString() ) , mParent
);
468 void MessageActions::slotPrintMsg()
470 const bool htmlOverride
= mMessageView
? mMessageView
->htmlOverride() : false;
471 const bool htmlLoadExtOverride
= mMessageView
? mMessageView
->htmlLoadExtOverride() : false;
472 const bool useFixedFont
= mMessageView
? mMessageView
->isFixedFont() :
473 MessageViewer::GlobalSettings::self()->useFixedFont();
474 const QString overrideEncoding
= mMessageView
? mMessageView
->overrideEncoding() :
475 MessageCore::GlobalSettings::self()->overrideCharacterEncoding();
477 // FIXME: This is broken when the Viewer shows an encapsulated message
478 const Akonadi::Item message
= mMessageView
? mMessageView
->message() : mCurrentItem
;
479 KMPrintCommand
*command
=
480 new KMPrintCommand( mParent
, message
,
481 mMessageView
? mMessageView
->headerStyle() : 0,
482 mMessageView
? mMessageView
->headerStrategy() : 0,
483 htmlOverride
, htmlLoadExtOverride
,
484 useFixedFont
, overrideEncoding
);
486 if ( mMessageView
) {
487 command
->setAttachmentStrategy( mMessageView
->attachmentStrategy() );
488 command
->setOverrideFont( mMessageView
->cssHelper()->bodyFont(
489 mMessageView
->isFixedFont(), true /*printing*/ ) );
494 void MessageActions::setMessageStatus( Akonadi::MessageStatus status
, bool toggle
)
496 Akonadi::Item::List items
= mVisibleItems
;
497 if ( items
.isEmpty() && mCurrentItem
.isValid() )
498 items
.append( mCurrentItem
);
501 KMCommand
*command
= new KMSetStatusCommand( status
, items
, toggle
);
507 * This adds a list of actions to mMailingListActionMenu mapping the identifier item to
510 * e.g.: item = "Contact Owner"
511 * "Contact Owner (email)" -> KRun( "mailto:bob@arthouseflowers.example.com" )
512 * "Contact Owner (web)" -> KRun( "http://arthouseflowers.example.com/contact-owner.php" )
514 void MessageActions::addMailingListActions( const QString
&item
, const KUrl::List
&list
)
516 foreach ( const KUrl
& url
, list
) {
517 addMailingListAction( item
, url
);
522 * This adds a action to mMailingListActionMenu mapping the identifier item to
523 * the url. See addMailingListActions above.
525 void MessageActions::addMailingListAction( const QString
&item
, const KUrl
&url
)
527 QString protocol
= url
.protocol().toLower();
528 QString prettyUrl
= url
.prettyUrl();
529 if ( protocol
== "mailto" ) {
530 protocol
= i18n( "email" );
531 prettyUrl
.remove( 0, 7 ); // length( "mailto:" )
532 } else if ( protocol
.startsWith( QLatin1String( "http" ) ) ) {
533 protocol
= i18n( "web" );
535 // item is a mailing list url description passed from the updateActions method above.
536 KAction
*act
= new KAction( i18nc( "%1 is a 'Contact Owner' or similar action. %2 is a protocol normally web or email though could be irc/ftp or other url variant", "%1 (%2)", item
, protocol
) , this );
537 const QVariant
v( url
.url() );
539 act
-> setHelpText( prettyUrl
);
540 mMailingListActionMenu
->addAction( act
);
543 void MessageActions::editCurrentMessage()
545 if ( !mCurrentItem
.isValid() )
547 KMCommand
*command
= 0;
548 Akonadi::Collection col
= mCurrentItem
.parentCollection();
549 // edit, unlike send again, removes the message from the folder
550 // we only want that for templates and drafts folders
552 && ( KMKernel::self()->folderIsDraftOrOutbox( col
) ||
553 KMKernel::self()->folderIsTemplates( col
) )
555 command
= new KMEditMsgCommand( mParent
, mCurrentItem
, true );
557 command
= new KMEditMsgCommand( mParent
, mCurrentItem
, false );
561 void MessageActions::annotateMessage()
563 if ( !mCurrentItem
.isValid() )
566 KPIM::AnnotationEditDialog
*dialog
= new KPIM::AnnotationEditDialog( mCurrentItem
.url() );
567 dialog
->setAttribute( Qt::WA_DeleteOnClose
);
569 updateAnnotateAction();
572 void MessageActions::updateAnnotateAction()
574 if( mCurrentItem
.isValid() ) {
575 Nepomuk::Resource
resource( mCurrentItem
.url() );
576 if ( resource
.description().isEmpty() )
577 mAnnotateAction
->setText( i18n( "Add Note..." ) );
579 mAnnotateAction
->setText( i18n( "Edit Note...") );
583 #include "messageactions.moc"