Better wording
[kdepim.git] / kmail / messageactions.h
blob66d9e089d8f8f46e8bb8be4d1d08e38077c5c6b9
1 /*
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 "messagecomposer/messagefactory.h"
23 #include <KUrl>
25 #include <qobject.h>
27 class QWidget;
28 class QAction;
29 class KJob;
30 class KAction;
31 class KActionMenu;
32 class KActionCollection;
33 class KXMLGUIClient;
34 class KMReaderWin;
35 class KMenu;
37 namespace Akonadi {
38 class Item;
39 class Monitor;
42 namespace MessageCore {
43 class AsyncNepomukResourceRetriever;
46 namespace Nepomuk2 {
47 class Resource;
50 namespace TemplateParser {
51 class CustomTemplatesMenu;
54 namespace KMail {
56 /**
57 Manages common actions that can be performed on one or more messages.
59 class MessageActions : public QObject
61 Q_OBJECT
62 public:
63 explicit MessageActions( KActionCollection* ac, QWidget *parent );
64 ~MessageActions();
65 void setMessageView( KMReaderWin *msgView );
67 /**
68 * This function adds or updates the actions of the forward action menu, taking the
69 * preference whether to forward inline or as attachment by default into account.
70 * This has to be called when that preference config has been changed.
72 void setupForwardActions();
74 /**
75 * Sets up action list for forward menu.
77 void setupForwardingActionsList( KXMLGUIClient *guiClient );
79 void setCurrentMessage( const Akonadi::Item &item );
80 void setSelectedVisibleItems( const Akonadi::Item::List& items );
82 KActionMenu* replyMenu() const { return mReplyActionMenu; }
83 KAction* replyListAction() const { return mReplyListAction; }
84 KAction* createTodoAction() const { return mCreateTodoAction; }
85 KAction* forwardInlineAction() const { return mForwardInlineAction; }
86 KAction* forwardAttachedAction() const { return mForwardAttachedAction; }
87 KAction* redirectAction() const { return mRedirectAction; }
89 KActionMenu* messageStatusMenu() const { return mStatusMenu; }
90 KActionMenu *forwardMenu() const { return mForwardActionMenu; }
92 KAction* editAction() const { return mEditAction; }
93 KAction* annotateAction() const { return mAnnotateAction; }
94 KAction* printAction() const { return mPrintAction; }
95 KAction* printPreviewAction() const { return mPrintPreviewAction; }
96 KAction* listFilterAction() const { return mListFilterAction; }
98 KActionMenu* mailingListActionMenu() const { return mMailingListActionMenu; }
99 TemplateParser::CustomTemplatesMenu* customTemplatesMenu() const;
101 void addWebShortcutsMenu( KMenu *menu, const QString & text );
104 signals:
106 // This signal is emitted when a reply is triggered and the
107 // action has finished.
108 // This is useful for the stand-alone reader, it might want to close the window in
109 // that case.
110 void replyActionFinished();
112 public slots:
113 void editCurrentMessage();
114 void annotateMessage();
116 private:
117 void updateActions();
118 void replyCommand(MessageComposer::ReplyStrategy strategy);
119 void addMailingListAction( const QString &item, const KUrl &url );
120 void addMailingListActions( const QString &item, const KUrl::List &list );
121 void updateMailingListActions( const Akonadi::Item& messageItem );
122 void printMessage(bool preview);
125 private slots:
126 void updateAnnotateAction(const QUrl& url, const Nepomuk2::Resource& resource);
127 void slotItemModified( const Akonadi::Item & item, const QSet< QByteArray > & partIdentifiers );
128 void slotItemRemoved(const Akonadi::Item& item);
130 void slotReplyToMsg();
131 void slotReplyAuthorToMsg();
132 void slotReplyListToMsg();
133 void slotReplyAllToMsg();
134 void slotNoQuoteReplyToMsg();
135 void slotCreateTodo();
136 void slotRunUrl( QAction *urlAction );
137 void slotPrintMsg();
138 void slotPrintPreviewMsg();
140 void slotUpdateActionsFetchDone( KJob* job );
141 void slotMailingListFilter();
142 void slotHandleWebShortcutAction();
143 void slotConfigureWebShortcuts();
146 private:
147 QList<KAction*> mMailListActionList;
148 QWidget *mParent;
149 KActionCollection *mActionCollection;
150 Akonadi::Item mCurrentItem;
151 Akonadi::Item::List mVisibleItems;
152 KMReaderWin *mMessageView;
154 KActionMenu *mReplyActionMenu;
155 KAction *mReplyAction, *mReplyAllAction, *mReplyAuthorAction,
156 *mReplyListAction, *mNoQuoteReplyAction,
157 *mForwardInlineAction, *mForwardAttachedAction, *mRedirectAction;
158 KAction *mCreateTodoAction;
159 KActionMenu *mStatusMenu;
160 KActionMenu *mForwardActionMenu;
161 KActionMenu *mMailingListActionMenu;
162 KAction *mEditAction, *mAnnotateAction, *mPrintAction, *mPrintPreviewAction;
163 bool mKorganizerIsOnSystem;
164 Akonadi::Monitor *mMonitor;
165 MessageCore::AsyncNepomukResourceRetriever *mAsynNepomukRetriever;
166 TemplateParser::CustomTemplatesMenu *mCustomTemplatesMenu;
167 KAction *mListFilterAction;
172 #endif