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 <tqobject.h>
00026 #include <tqvaluelist.h>
00027 
00028 class TQWidget;
00029 class KAction;
00030 class KActionMenu;
00031 class KActionCollection;
00032 class KMMessage;
00033 
00034 namespace KMail {
00035 
00039 class MessageActions : public TQObject
00040 {
00041   Q_OBJECT
00042   TQ_OBJECT
00043   public:
00044     MessageActions( KActionCollection* ac, TQWidget *parent );
00045     void setMessageView( KMReaderWin *msgView );
00046 
00047     void setCurrentMessage( KMMessage *msg );
00048     void setSelectedSernums( const TQValueList<TQ_UINT32> &sernums );
00049     void setSelectedVisibleSernums( const TQValueList<TQ_UINT32> &sernums );
00050 
00051     KActionMenu* replyMenu() const { return mReplyActionMenu; }
00052     KAction* replyListAction() const { return mReplyListAction; }
00053     KAction* createTodoAction() const { return mCreateTodoAction; }
00054 
00055     KActionMenu* messageStatusMenu() const { return mStatusMenu; }
00056 
00057     KAction* editAction() const { return mEditAction; }
00058 
00059   signals:
00060 
00061     // This signal is emitted when a reply is triggered and the
00062     // action has finished.
00063     // This is useful for the stand-alone reader, it might want to close the window in
00064     // that case.
00065     void replyActionFinished();
00066 
00067   public slots:
00068     void editCurrentMessage();
00069 
00070   private:
00071     void updateActions();
00072     template<typename T> void replyCommand();
00073     void setMessageStatus( KMMsgStatus status, bool toggle = false );
00074 
00075   private slots:
00076     void slotReplyToMsg();
00077     void slotReplyAuthorToMsg();
00078     void slotReplyListToMsg();
00079     void slotReplyAllToMsg();
00080     void slotNoQuoteReplyToMsg();
00081     void slotCreateTodo();
00082     void slotSetMsgStatusNew();
00083     void slotSetMsgStatusUnread();
00084     void slotSetMsgStatusRead();
00085     void slotSetMsgStatusTodo();
00086     void slotSetMsgStatusFlag();
00087 
00088   private:
00089     TQWidget *mParent;
00090     KActionCollection *mActionCollection;
00091     KMMessage* mCurrentMessage;
00092     TQValueList<TQ_UINT32> mSelectedSernums;
00093     TQValueList<TQ_UINT32> mVisibleSernums;
00094     KMReaderWin *mMessageView;
00095 
00096     KActionMenu *mReplyActionMenu;
00097     KAction *mReplyAction, *mReplyAllAction, *mReplyAuthorAction,
00098             *mReplyListAction, *mNoQuoteReplyAction;
00099     KAction *mCreateTodoAction;
00100     KActionMenu *mStatusMenu;
00101     KToggleAction *mToggleFlagAction, *mToggleTodoAction;
00102     KAction *mEditAction;
00103 };
00104 
00105 }
00106 
00107 #endif
00108