Use qtpaths directly
[kdepim.git] / kmail / messageactions.h
blob5b27e6655494c6e84f3507a34ab682ea7e76d4a8
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"
23 #include <QUrl>
25 #include <qobject.h>
27 class QWidget;
28 class QAction;
29 class KJob;
30 class QAction;
31 class KActionMenu;
32 class KActionCollection;
33 class KXMLGUIClient;
34 class KMReaderWin;
35 class QMenu;
37 namespace Akonadi
39 class Item;
42 namespace TemplateParser
44 class CustomTemplatesMenu;
47 namespace KIO
49 class KUriFilterSearchProviderActions;
51 namespace KMail
54 /**
55 Manages common actions that can be performed on one or more messages.
57 class MessageActions : public QObject
59 Q_OBJECT
60 public:
61 explicit MessageActions(KActionCollection *ac, QWidget *parent);
62 ~MessageActions();
63 void setMessageView(KMReaderWin *msgView);
65 /**
66 * This function adds or updates the actions of the forward action menu, taking the
67 * preference whether to forward inline or as attachment by default into account.
68 * This has to be called when that preference config has been changed.
70 void setupForwardActions(KActionCollection *ac);
72 /**
73 * Sets up action list for forward menu.
75 void setupForwardingActionsList(KXMLGUIClient *guiClient);
77 void setCurrentMessage(const Akonadi::Item &item, const Akonadi::Item::List &items = Akonadi::Item::List());
79 KActionMenu *replyMenu() const;
80 QAction *replyListAction() const;
81 QAction *forwardInlineAction() const;
82 QAction *forwardAttachedAction() const;
83 QAction *redirectAction() const;
85 KActionMenu *messageStatusMenu() const;
86 KActionMenu *forwardMenu() const;
88 QAction *editAction() const;
89 QAction *annotateAction() const;
90 QAction *printAction() const;
91 QAction *printPreviewAction() const;
92 QAction *listFilterAction() const;
94 KActionMenu *mailingListActionMenu() const;
95 TemplateParser::CustomTemplatesMenu *customTemplatesMenu() const;
97 void addWebShortcutsMenu(QMenu *menu, const QString &text);
99 QAction *debugBalooAction() const;
100 QAction *addFollowupReminderAction() const;
102 Q_SIGNALS:
103 // This signal is emitted when a reply is triggered and the
104 // action has finished.
105 // This is useful for the stand-alone reader, it might want to close the window in
106 // that case.
107 void replyActionFinished();
109 public Q_SLOTS:
110 void editCurrentMessage();
111 void annotateMessage();
113 private:
114 void updateActions();
115 void replyCommand(MessageComposer::ReplyStrategy strategy);
116 void addMailingListAction(const QString &item, const QUrl &url);
117 void addMailingListActions(const QString &item, const QList<QUrl> &list);
118 void updateMailingListActions(const Akonadi::Item &messageItem);
119 void printMessage(bool preview);
120 void clearMailingListActions();
122 private Q_SLOTS:
123 void slotItemModified(const Akonadi::Item &item, const QSet< QByteArray > &partIdentifiers);
124 void slotItemRemoved(const Akonadi::Item &item);
126 void slotReplyToMsg();
127 void slotReplyAuthorToMsg();
128 void slotReplyListToMsg();
129 void slotReplyAllToMsg();
130 void slotNoQuoteReplyToMsg();
131 void slotRunUrl(QAction *urlAction);
132 void slotPrintMsg();
133 void slotPrintPreviewMsg();
135 void slotUpdateActionsFetchDone(KJob *job);
136 void slotMailingListFilter();
137 void slotDebugBaloo();
139 void slotAddFollowupReminder();
140 private:
141 QList<QAction *> mMailListActionList;
142 QWidget *mParent;
143 Akonadi::Item mCurrentItem;
144 Akonadi::Item::List mVisibleItems;
145 KMReaderWin *mMessageView;
147 KActionMenu *mReplyActionMenu;
148 QAction *mReplyAction;
149 QAction *mReplyAllAction;
150 QAction *mReplyAuthorAction;
151 QAction *mReplyListAction;
152 QAction *mNoQuoteReplyAction;
153 QAction *mForwardInlineAction;
154 QAction *mForwardAttachedAction;
155 QAction *mRedirectAction;
156 KActionMenu *mStatusMenu;
157 KActionMenu *mForwardActionMenu;
158 KActionMenu *mMailingListActionMenu;
159 QAction *mEditAction;
160 QAction *mAnnotateAction;
161 QAction *mPrintAction;
162 QAction *mPrintPreviewAction;
163 TemplateParser::CustomTemplatesMenu *mCustomTemplatesMenu;
164 QAction *mListFilterAction;
165 QAction *mAddFollowupReminderAction;
166 QAction *mDebugBalooAction;
167 KIO::KUriFilterSearchProviderActions *mWebShortcutMenuManager;
172 #endif