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 #ifndef KMAIL_MESSAGEACTIONS_H
20 #define KMAIL_MESSAGEACTIONS_H
22 #include "kmcommands.h"
23 #include "kmreaderwin.h"
33 class KActionCollection
;
41 namespace MessageCore
{
42 class AsyncNepomukResourceRetriever
;
52 Manages common actions that can be performed on one or more messages.
54 class MessageActions
: public QObject
58 MessageActions( KActionCollection
* ac
, QWidget
*parent
);
60 void setMessageView( KMReaderWin
*msgView
);
63 * This function adds or updates the actions of the forward action menu, taking the
64 * preference whether to forward inline or as attachment by default into account.
65 * This has to be called when that preference config has been changed.
67 void setupForwardActions();
70 * Sets up action list for forward menu.
72 void setupForwardingActionsList( KXMLGUIClient
*guiClient
);
74 void setCurrentMessage( const Akonadi::Item
&item
);
75 void setSelectedItem( const Akonadi::Item::List
& items
);
76 void setSelectedVisibleItems( const Akonadi::Item::List
& items
);
78 KActionMenu
* replyMenu() const { return mReplyActionMenu
; }
79 KAction
* replyListAction() const { return mReplyListAction
; }
80 KAction
* createTodoAction() const { return mCreateTodoAction
; }
81 KAction
* forwardInlineAction() const { return mForwardInlineAction
; }
82 KAction
* forwardAttachedAction() const { return mForwardAttachedAction
; }
83 KAction
* redirectAction() const { return mRedirectAction
; }
85 KActionMenu
* messageStatusMenu() const { return mStatusMenu
; }
86 KActionMenu
*forwardMenu() const { return mForwardActionMenu
; }
88 KAction
* editAction() const { return mEditAction
; }
89 KAction
* annotateAction() const { return mAnnotateAction
; }
90 KAction
* printAction() const { return mPrintAction
; }
92 KActionMenu
* mailingListActionMenu() const { return mMailingListActionMenu
; }
96 // This signal is emitted when a reply is triggered and the
97 // action has finished.
98 // This is useful for the stand-alone reader, it might want to close the window in
100 void replyActionFinished();
103 void editCurrentMessage();
104 void annotateMessage();
107 void updateActions();
108 template<typename T
> void replyCommand();
109 void addMailingListAction( const QString
&item
, const KUrl
&url
);
110 void addMailingListActions( const QString
&item
, const KUrl::List
&list
);
111 void updateMailingListActions( const Akonadi::Item
& messageItem
);
114 void updateAnnotateAction(const QUrl
& url
, const Nepomuk::Resource
& resource
);
115 void slotItemModified( const Akonadi::Item
& item
, const QSet
< QByteArray
> & partIdentifiers
);
116 void slotItemRemoved(const Akonadi::Item
& item
);
118 void slotReplyToMsg();
119 void slotReplyAuthorToMsg();
120 void slotReplyListToMsg();
121 void slotReplyAllToMsg();
122 void slotNoQuoteReplyToMsg();
123 void slotCreateTodo();
124 void slotRunUrl( QAction
*urlAction
);
126 void slotUpdateActionsFetchDone( KJob
* job
);
130 KActionCollection
*mActionCollection
;
131 Akonadi::Item mCurrentItem
;
132 Akonadi::Item::List mSelectedItems
;
133 Akonadi::Item::List mVisibleItems
;
134 KMReaderWin
*mMessageView
;
136 KActionMenu
*mReplyActionMenu
;
137 KAction
*mReplyAction
, *mReplyAllAction
, *mReplyAuthorAction
,
138 *mReplyListAction
, *mNoQuoteReplyAction
,
139 *mForwardInlineAction
, *mForwardAttachedAction
, *mRedirectAction
;
140 KAction
*mCreateTodoAction
;
141 KActionMenu
*mStatusMenu
;
142 KActionMenu
*mForwardActionMenu
;
143 KActionMenu
*mMailingListActionMenu
;
144 KAction
*mEditAction
, *mAnnotateAction
, *mPrintAction
;
145 bool mKorganizerIsOnSystem
;
146 Akonadi::Monitor
*mMonitor
;
147 MessageCore::AsyncNepomukResourceRetriever
*mAsynNepomukRetriever
;