kmail

messageactions.h

00001 /*
00002     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef KMAIL_MESSAGEACTIONS_H
00020 #define KMAIL_MESSAGEACTIONS_H
00021 
00022 #include "kmcommands.h"
00023 #include "kmreaderwin.h"
00024 
00025 #include <qobject.h>
00026 #include <qvaluelist.h>
00027 
00028 class QWidget;
00029 class KAction;
00030 class KActionMenu;
00031 class KActionCollection;
00032 class KMMessage;
00033 
00034 namespace KMail {
00035 
00039 class MessageActions : public QObject
00040 {
00041   Q_OBJECT
00042   public:
00043     MessageActions( KActionCollection* ac, QWidget *parent );
00044     void setMessageView( KMReaderWin *msgView );
00045 
00046     void setCurrentMessage( KMMessage *msg );
00047     void setSelectedSernums( const QValueList<Q_UINT32> &sernums );
00048     void setSelectedVisibleSernums( const QValueList<Q_UINT32> &sernums );
00049 
00050     KActionMenu* replyMenu() const { return mReplyActionMenu; }
00051     KAction* replyListAction() const { return mReplyListAction; }
00052     KAction* createTodoAction() const { return mCreateTodoAction; }
00053 
00054     KActionMenu* messageStatusMenu() const { return mStatusMenu; }
00055 
00056     KAction* editAction() const { return mEditAction; }
00057 
00058   signals:
00059 
00060     // This signal is emitted when a reply is triggered and the
00061     // action has finished.
00062     // This is useful for the stand-alone reader, it might want to close the window in
00063     // that case.
00064     void replyActionFinished();
00065 
00066   public slots:
00067     void editCurrentMessage();
00068 
00069   private:
00070     void updateActions();
00071     template<typename T> void replyCommand();
00072     void setMessageStatus( KMMsgStatus status, bool toggle = false );
00073 
00074   private slots:
00075     void slotReplyToMsg();
00076     void slotReplyAuthorToMsg();
00077     void slotReplyListToMsg();
00078     void slotReplyAllToMsg();
00079     void slotNoQuoteReplyToMsg();
00080     void slotCreateTodo();
00081     void slotSetMsgStatusNew();
00082     void slotSetMsgStatusUnread();
00083     void slotSetMsgStatusRead();
00084     void slotSetMsgStatusTodo();
00085     void slotSetMsgStatusFlag();
00086 
00087   private:
00088     QWidget *mParent;
00089     KActionCollection *mActionCollection;
00090     KMMessage* mCurrentMessage;
00091     QValueList<Q_UINT32> mSelectedSernums;
00092     QValueList<Q_UINT32> mVisibleSernums;
00093     KMReaderWin *mMessageView;
00094 
00095     KActionMenu *mReplyActionMenu;
00096     KAction *mReplyAction, *mReplyAllAction, *mReplyAuthorAction,
00097             *mReplyListAction, *mNoQuoteReplyAction;
00098     KAction *mCreateTodoAction;
00099     KActionMenu *mStatusMenu;
00100     KToggleAction *mToggleFlagAction, *mToggleTodoAction;
00101     KAction *mEditAction;
00102 };
00103 
00104 }
00105 
00106 #endif
00107 
KDE Home | KDE Accessibility Home | Description of Access Keys