00001
00002
00003 #ifndef KMCommands_h
00004 #define KMCommands_h
00005
00006 #include <qdatetime.h>
00007 #include <qguardedptr.h>
00008 #include <qptrlist.h>
00009 #include <qvaluelist.h>
00010 #include <qvaluevector.h>
00011 #include <qtimer.h>
00012 #include <qfont.h>
00013 #include <kio/job.h>
00014 #include "kmmsgbase.h"
00015 #include <mimelib/string.h>
00016 #include <kdepimmacros.h>
00017 #include <kservice.h>
00018 #include <ktempfile.h>
00019
00020 class QPopupMenu;
00021 class KMainWindow;
00022 class KAction;
00023 class KProgressDialog;
00024 class KProcess;
00025 class KMFilter;
00026 class KMFolder;
00027 class KMFolderImap;
00028 class KMFolderNode;
00029 class KMHeaders;
00030 class KMMainWidget;
00031 class KMMessage;
00032 class KMMsgBase;
00033 class KMReaderWin;
00034 class partNode;
00035 class DwBodyPart;
00036 class DwEntity;
00037 namespace KIO { class Job; }
00038 namespace KMail {
00039 class Composer;
00040 class FolderJob;
00041 class EditorWatcher;
00042 }
00043 namespace GpgME { class Error; }
00044 namespace Kleo { class SpecialJob; }
00045
00046 typedef QMap<int,KMFolder*> KMMenuToFolder;
00047 typedef QMap<partNode*, KMMessage*> PartNodeMessageMap;
00048
00049 class KDE_EXPORT KMCommand : public QObject
00050 {
00051 Q_OBJECT
00052 friend class LaterDeleterWithCommandCompletion;
00053
00054 public:
00055 enum Result { Undefined, OK, Canceled, Failed };
00056
00057
00058 KMCommand( QWidget *parent = 0 );
00059
00060 KMCommand( QWidget *parent, const QPtrList<KMMsgBase> &msgList );
00061
00062 KMCommand( QWidget *parent, KMMsgBase *msgBase );
00063
00064 KMCommand( QWidget *parent, KMMessage *message );
00065 virtual ~KMCommand();
00066
00071 void keepFolderOpen( KMFolder *folder );
00072
00076 Result result();
00077
00078 public slots:
00079
00080 void start();
00081
00082
00083 void slotProgress( unsigned long done, unsigned long total );
00084
00085 signals:
00086 void messagesTransfered( KMCommand::Result result );
00089 void completed( KMCommand *command );
00090
00091 protected:
00092
00093 const QPtrList<KMMessage> retrievedMsgs() const;
00094
00095 KMMessage *retrievedMessage() const;
00096
00097 QWidget *parentWidget() const;
00098
00099 bool deletesItself() { return mDeletesItself; }
00105 void setDeletesItself( bool deletesItself )
00106 { mDeletesItself = deletesItself; }
00107
00108 bool emitsCompletedItself() { return mEmitsCompletedItself; }
00115 void setEmitsCompletedItself( bool emitsCompletedItself )
00116 { mEmitsCompletedItself = emitsCompletedItself; }
00117
00121 void setResult( Result result )
00122 { mResult = result; }
00123
00124 private:
00125
00126 virtual Result execute() = 0;
00127
00130 void transferSelectedMsgs();
00131
00132 private slots:
00134 virtual void slotStart();
00135
00136 void slotPostTransfer( KMCommand::Result result );
00138 void slotMsgTransfered(KMMessage* msg);
00140 void slotJobFinished();
00142 void slotTransferCancelled();
00143
00144 private:
00145
00146 KProgressDialog* mProgressDialog;
00147
00148 static int mCountJobs;
00149 int mCountMsgs;
00150 Result mResult;
00151 bool mDeletesItself : 1;
00152 bool mEmitsCompletedItself : 1;
00153
00154 QWidget *mParent;
00155 QPtrList<KMMessage> mRetrievedMsgs;
00156 QPtrList<KMMsgBase> mMsgList;
00157 QValueList<QGuardedPtr<KMFolder> > mFolders;
00158 };
00159
00160 class KDE_EXPORT KMMailtoComposeCommand : public KMCommand
00161 {
00162 Q_OBJECT
00163
00164 public:
00165 KMMailtoComposeCommand( const KURL &url, KMMessage *msg=0 );
00166
00167 private:
00168 virtual Result execute();
00169
00170 KURL mUrl;
00171 KMMessage *mMessage;
00172 };
00173
00174 class KDE_EXPORT KMMailtoReplyCommand : public KMCommand
00175 {
00176 Q_OBJECT
00177
00178 public:
00179 KMMailtoReplyCommand( QWidget *parent, const KURL &url,
00180 KMMessage *msg, const QString &selection );
00181
00182 private:
00183 virtual Result execute();
00184
00185 KURL mUrl;
00186 QString mSelection;
00187 };
00188
00189 class KDE_EXPORT KMMailtoForwardCommand : public KMCommand
00190 {
00191 Q_OBJECT
00192
00193 public:
00194 KMMailtoForwardCommand( QWidget *parent, const KURL &url,
00195 KMMessage *msg );
00196
00197 private:
00198 virtual Result execute();
00199
00200 KURL mUrl;
00201 };
00202
00203 class KDE_EXPORT KMMailtoAddAddrBookCommand : public KMCommand
00204 {
00205 Q_OBJECT
00206
00207 public:
00208 KMMailtoAddAddrBookCommand( const KURL &url, QWidget *parent );
00209
00210 private:
00211 virtual Result execute();
00212
00213 KURL mUrl;
00214 };
00215
00216 class KDE_EXPORT KMAddBookmarksCommand : public KMCommand
00217 {
00218 Q_OBJECT
00219
00220 public:
00221 KMAddBookmarksCommand( const KURL &url, QWidget *parent );
00222
00223 private:
00224 virtual Result execute();
00225
00226 KURL mUrl;
00227 };
00228
00229
00230 class KDE_EXPORT KMMailtoOpenAddrBookCommand : public KMCommand
00231 {
00232 Q_OBJECT
00233
00234 public:
00235 KMMailtoOpenAddrBookCommand( const KURL &url, QWidget *parent );
00236
00237 private:
00238 virtual Result execute();
00239
00240 KURL mUrl;
00241 };
00242
00243 class KDE_EXPORT KMUrlCopyCommand : public KMCommand
00244 {
00245 Q_OBJECT
00246
00247 public:
00248 KMUrlCopyCommand( const KURL &url, KMMainWidget *mainWidget = 0 );
00249
00250 private:
00251 virtual Result execute();
00252
00253 KURL mUrl;
00254 KMMainWidget *mMainWidget;
00255 };
00256
00257 class KDE_EXPORT KMUrlOpenCommand : public KMCommand
00258 {
00259 Q_OBJECT
00260
00261 public:
00262 KMUrlOpenCommand( const KURL &url, KMReaderWin *readerWin );
00263
00264 private:
00265 virtual Result execute();
00266
00267 KURL mUrl;
00268 KMReaderWin *mReaderWin;
00269 };
00270
00271 class KDE_EXPORT KMUrlSaveCommand : public KMCommand
00272 {
00273 Q_OBJECT
00274
00275 public:
00276 KMUrlSaveCommand( const KURL &url, QWidget *parent );
00277
00278 private slots:
00279 void slotUrlSaveResult( KIO::Job *job );
00280
00281 private:
00282 virtual Result execute();
00283
00284 KURL mUrl;
00285 };
00286
00287 class KDE_EXPORT KMEditMsgCommand : public KMCommand
00288 {
00289 Q_OBJECT
00290
00291 public:
00292 KMEditMsgCommand( QWidget *parent, KMMessage *msg );
00293
00294 private:
00295 virtual Result execute();
00296 };
00297
00298 class KDE_EXPORT KMUseTemplateCommand : public KMCommand
00299 {
00300 Q_OBJECT
00301
00302 public:
00303 KMUseTemplateCommand( QWidget *parent, KMMessage *msg );
00304
00305 private:
00306 virtual Result execute();
00307 };
00308
00309 class KDE_EXPORT KMShowMsgSrcCommand : public KMCommand
00310 {
00311 Q_OBJECT
00312
00313 public:
00314 KMShowMsgSrcCommand( QWidget *parent, KMMessage *msg,
00315 bool fixedFont );
00316 virtual Result execute();
00317
00318 private:
00319 bool mFixedFont;
00320 bool mMsgWasComplete;
00321 };
00322
00323 class KDE_EXPORT KMSaveMsgCommand : public KMCommand
00324 {
00325 Q_OBJECT
00326
00327 public:
00328 KMSaveMsgCommand( QWidget *parent, const QPtrList<KMMsgBase> &msgList );
00329 KMSaveMsgCommand( QWidget *parent, KMMessage * msg );
00330 KURL url();
00331
00332 private:
00333 virtual Result execute();
00334
00335 private slots:
00336 void slotSaveDataReq();
00337 void slotSaveResult(KIO::Job *job);
00339 void slotMessageRetrievedForSaving(KMMessage *msg);
00340
00341 private:
00342 static const int MAX_CHUNK_SIZE = 64*1024;
00343 KURL mUrl;
00344 QValueList<unsigned long> mMsgList;
00345 unsigned int mMsgListIndex;
00346 KMMessage *mStandAloneMessage;
00347 QByteArray mData;
00348 int mOffset;
00349 size_t mTotalSize;
00350 KIO::TransferJob *mJob;
00351 };
00352
00353 class KDE_EXPORT KMOpenMsgCommand : public KMCommand
00354 {
00355 Q_OBJECT
00356
00357 public:
00358 KMOpenMsgCommand( QWidget *parent, const KURL & url = KURL(),
00359 const QString & encoding = QString() );
00360
00361 private:
00362 virtual Result execute();
00363
00364 private slots:
00365 void slotDataArrived( KIO::Job *job, const QByteArray & data );
00366 void slotResult( KIO::Job *job );
00367
00368 private:
00369 static const int MAX_CHUNK_SIZE = 64*1024;
00370 KURL mUrl;
00371 DwString mMsgString;
00372 KIO::TransferJob *mJob;
00373 const QString mEncoding;
00374 };
00375
00376 class KDE_EXPORT KMSaveAttachmentsCommand : public KMCommand
00377 {
00378 Q_OBJECT
00379 public:
00384 KMSaveAttachmentsCommand( QWidget *parent, KMMessage *msg );
00389 KMSaveAttachmentsCommand( QWidget *parent, const QPtrList<KMMsgBase>& msgs );
00398 KMSaveAttachmentsCommand( QWidget *parent, QPtrList<partNode> &attachments,
00399 KMMessage *msg, bool encoded = false );
00400
00401 private slots:
00402 void slotSaveAll();
00403
00404 private:
00405 virtual Result execute();
00406 Result saveItem( partNode *node, const KURL& url );
00407
00408 private:
00409 PartNodeMessageMap mAttachmentMap;
00410 bool mImplicitAttachments;
00411 bool mEncoded;
00412 };
00413
00414 class KDE_EXPORT KMReplyToCommand : public KMCommand
00415 {
00416 Q_OBJECT
00417
00418 public:
00419 KMReplyToCommand( QWidget *parent, KMMessage *msg,
00420 const QString &selection = QString::null );
00421
00422 private:
00423 virtual Result execute();
00424
00425 private:
00426 QString mSelection;
00427 };
00428
00429 class KDE_EXPORT KMNoQuoteReplyToCommand : public KMCommand
00430 {
00431 Q_OBJECT
00432
00433 public:
00434 KMNoQuoteReplyToCommand( QWidget *parent, KMMessage *msg );
00435
00436 private:
00437 virtual Result execute();
00438 };
00439
00440 class KMReplyListCommand : public KMCommand
00441 {
00442 Q_OBJECT
00443
00444 public:
00445 KMReplyListCommand( QWidget *parent, KMMessage *msg,
00446 const QString &selection = QString::null );
00447
00448 private:
00449 virtual Result execute();
00450
00451 private:
00452 QString mSelection;
00453 };
00454
00455 class KDE_EXPORT KMReplyToAllCommand : public KMCommand
00456 {
00457 Q_OBJECT
00458
00459 public:
00460 KMReplyToAllCommand( QWidget *parent, KMMessage *msg,
00461 const QString &selection = QString::null );
00462
00463 private:
00464 virtual Result execute();
00465
00466 private:
00467 QString mSelection;
00468 };
00469
00470 class KDE_EXPORT KMReplyAuthorCommand : public KMCommand
00471 {
00472 Q_OBJECT
00473
00474 public:
00475 KMReplyAuthorCommand( QWidget *parent, KMMessage *msg,
00476 const QString &selection = QString::null );
00477
00478 private:
00479 virtual Result execute();
00480
00481 private:
00482 QString mSelection;
00483 };
00484
00485 class KDE_EXPORT KMForwardInlineCommand : public KMCommand
00486 {
00487 Q_OBJECT
00488
00489 public:
00490 KMForwardInlineCommand( QWidget *parent, const QPtrList<KMMsgBase> &msgList,
00491 uint identity = 0 );
00492 KMForwardInlineCommand( QWidget *parent, KMMessage * msg,
00493 uint identity = 0 );
00494
00495 private:
00496 virtual Result execute();
00497
00498 private:
00499 uint mIdentity;
00500 };
00501
00502 class KDE_EXPORT KMForwardAttachedCommand : public KMCommand
00503 {
00504 Q_OBJECT
00505
00506 public:
00507 KMForwardAttachedCommand( QWidget *parent, const QPtrList<KMMsgBase> &msgList,
00508 uint identity = 0, KMail::Composer *win = 0 );
00509 KMForwardAttachedCommand( QWidget *parent, KMMessage * msg,
00510 uint identity = 0, KMail::Composer *win = 0 );
00511
00512 private:
00513 virtual Result execute();
00514
00515 uint mIdentity;
00516 QGuardedPtr<KMail::Composer> mWin;
00517 };
00518
00519 class KDE_EXPORT KMForwardDigestCommand : public KMCommand
00520 {
00521 Q_OBJECT
00522
00523 public:
00524 KMForwardDigestCommand( QWidget *parent, const QPtrList<KMMsgBase> &msgList,
00525 uint identity = 0, KMail::Composer *win = 0 );
00526 KMForwardDigestCommand( QWidget *parent, KMMessage * msg,
00527 uint identity = 0, KMail::Composer *win = 0 );
00528
00529 private:
00530 virtual Result execute();
00531
00532 uint mIdentity;
00533 QGuardedPtr<KMail::Composer> mWin;
00534 };
00535
00536 class KDE_EXPORT KMRedirectCommand : public KMCommand
00537 {
00538 Q_OBJECT
00539
00540 public:
00541 KMRedirectCommand( QWidget *parent, KMMessage *msg );
00542
00543 private:
00544 virtual Result execute();
00545 };
00546
00547 class KDE_EXPORT KMCustomReplyToCommand : public KMCommand
00548 {
00549 Q_OBJECT
00550
00551 public:
00552 KMCustomReplyToCommand( QWidget *parent, KMMessage *msg,
00553 const QString &selection,
00554 const QString &tmpl );
00555
00556 private:
00557 virtual Result execute();
00558
00559 private:
00560 QString mSelection;
00561 QString mTemplate;
00562 };
00563
00564 class KDE_EXPORT KMCustomReplyAllToCommand : public KMCommand
00565 {
00566 Q_OBJECT
00567
00568 public:
00569 KMCustomReplyAllToCommand( QWidget *parent, KMMessage *msg,
00570 const QString &selection,
00571 const QString &tmpl );
00572
00573 private:
00574 virtual Result execute();
00575
00576 private:
00577 QString mSelection;
00578 QString mTemplate;
00579 };
00580
00581 class KDE_EXPORT KMCustomForwardCommand : public KMCommand
00582 {
00583 Q_OBJECT
00584
00585 public:
00586 KMCustomForwardCommand( QWidget *parent, const QPtrList<KMMsgBase> &msgList,
00587 uint identity, const QString &tmpl );
00588 KMCustomForwardCommand( QWidget *parent, KMMessage * msg,
00589 uint identity, const QString &tmpl );
00590
00591 private:
00592 virtual Result execute();
00593
00594 uint mIdentity;
00595 QString mTemplate;
00596 };
00597
00598 class KDE_EXPORT KMPrintCommand : public KMCommand
00599 {
00600 Q_OBJECT
00601
00602 public:
00603 KMPrintCommand( QWidget *parent, KMMessage *msg,
00604 bool htmlOverride=false,
00605 bool htmlLoadExtOverride=false,
00606 bool useFixedFont = false,
00607 const QString & encoding = QString() );
00608
00609 void setOverrideFont( const QFont& );
00610
00611 private:
00612 virtual Result execute();
00613
00614 bool mHtmlOverride;
00615 bool mHtmlLoadExtOverride;
00616 bool mUseFixedFont;
00617 QFont mOverrideFont;
00618 QString mEncoding;
00619 };
00620
00621 class KDE_EXPORT KMSetStatusCommand : public KMCommand
00622 {
00623 Q_OBJECT
00624
00625 public:
00626
00627 KMSetStatusCommand( KMMsgStatus status, const QValueList<Q_UINT32> &,
00628 bool toggle=false );
00629
00630 private:
00631 virtual Result execute();
00632
00633 KMMsgStatus mStatus;
00634 QValueList<Q_UINT32> mSerNums;
00635 QValueList<int> mIds;
00636 bool mToggle;
00637 };
00638
00639 class KDE_EXPORT KMFilterCommand : public KMCommand
00640 {
00641 Q_OBJECT
00642
00643 public:
00644 KMFilterCommand( const QCString &field, const QString &value );
00645
00646 private:
00647 virtual Result execute();
00648
00649 QCString mField;
00650 QString mValue;
00651 };
00652
00653
00654 class KDE_EXPORT KMFilterActionCommand : public KMCommand
00655 {
00656 Q_OBJECT
00657
00658 public:
00659 KMFilterActionCommand( QWidget *parent,
00660 const QPtrList<KMMsgBase> &msgList,
00661 KMFilter *filter );
00662
00663 private:
00664 virtual Result execute();
00665 QValueList<Q_UINT32> serNumList;
00666 KMFilter *mFilter;
00667 };
00668
00669
00670 class KDE_EXPORT KMMetaFilterActionCommand : public QObject
00671 {
00672 Q_OBJECT
00673
00674 public:
00675 KMMetaFilterActionCommand( KMFilter *filter, KMHeaders *headers,
00676 KMMainWidget *main );
00677
00678 public slots:
00679 void start();
00680
00681 private:
00682 KMFilter *mFilter;
00683 KMHeaders *mHeaders;
00684 KMMainWidget *mMainWidget;
00685 };
00686
00687 class KDE_EXPORT FolderShortcutCommand : public QObject
00688 {
00689 Q_OBJECT
00690
00691 public:
00692 FolderShortcutCommand( KMMainWidget* mainwidget, KMFolder *folder );
00693 ~FolderShortcutCommand();
00694
00695 public slots:
00696 void start();
00700 void setAction( KAction* );
00701
00702 private:
00703 KMMainWidget *mMainWidget;
00704 KMFolder *mFolder;
00705 KAction *mAction;
00706 };
00707
00708
00709 class KDE_EXPORT KMMailingListFilterCommand : public KMCommand
00710 {
00711 Q_OBJECT
00712
00713 public:
00714 KMMailingListFilterCommand( QWidget *parent, KMMessage *msg );
00715
00716 private:
00717 virtual Result execute();
00718 };
00719
00720
00728 class KDE_EXPORT KMMenuCommand : public KMCommand
00729 {
00730 Q_OBJECT
00731
00732 public:
00733 static void folderToPopupMenu(bool move, QObject *receiver,
00734 KMMenuToFolder *aMenuToFolder, QPopupMenu *menu );
00735
00736 static void makeFolderMenu(KMFolderNode* item, bool move,
00737 QObject *receiver, KMMenuToFolder *aMenuToFolder, QPopupMenu *menu );
00738 };
00739
00740 class KDE_EXPORT KMCopyCommand : public KMMenuCommand
00741 {
00742 Q_OBJECT
00743
00744 public:
00745 KMCopyCommand( KMFolder* destFolder,
00746 const QPtrList<KMMsgBase> &msgList );
00747 KMCopyCommand( KMFolder* destFolder, KMMessage *msg );
00748
00749 protected slots:
00750 void slotJobFinished( KMail::FolderJob *job );
00751
00752 void slotFolderComplete( KMFolderImap*, bool success );
00753
00754 private:
00755 virtual Result execute();
00756
00757 KMFolder *mDestFolder;
00758 QPtrList<KMMsgBase> mMsgList;
00759 QValueList<KMail::FolderJob*> mPendingJobs;
00760 };
00761
00762 namespace KPIM {
00763 class ProgressItem;
00764 }
00765 class KDE_EXPORT KMMoveCommand : public KMMenuCommand
00766 {
00767 Q_OBJECT
00768
00769 public:
00770 KMMoveCommand( KMFolder* destFolder, const QPtrList<KMMsgBase> &msgList );
00771 KMMoveCommand( KMFolder* destFolder, KMMessage * msg );
00772 KMMoveCommand( KMFolder* destFolder, KMMsgBase * msgBase );
00773 KMFolder* destFolder() const { return mDestFolder; }
00774
00775 public slots:
00776 void slotImapFolderCompleted(KMFolderImap *folder, bool success);
00777 void slotMsgAddedToDestFolder(KMFolder *folder, Q_UINT32 serNum);
00778 void slotMoveCanceled();
00779
00780 protected:
00781
00782 KMMoveCommand( Q_UINT32 sernum );
00783 void setDestFolder( KMFolder* folder ) { mDestFolder = folder; }
00784 void addMsg( KMMsgBase *msg ) { mSerNumList.append( msg->getMsgSerNum() ); }
00785 QValueVector<KMFolder*> mOpenedFolders;
00786
00787 private:
00788 virtual Result execute();
00789 void completeMove( Result result );
00790
00791 KMFolder *mDestFolder;
00792 QValueList<Q_UINT32> mSerNumList;
00793
00794
00795 QValueList<Q_UINT32> mLostBoys;
00796 KPIM::ProgressItem *mProgressItem;
00797 bool mCompleteWithAddedMsg;
00798 };
00799
00800 class KDE_EXPORT KMDeleteMsgCommand : public KMMoveCommand
00801 {
00802 Q_OBJECT
00803
00804 public:
00805 KMDeleteMsgCommand( KMFolder* srcFolder, const QPtrList<KMMsgBase> &msgList );
00806 KMDeleteMsgCommand( KMFolder* srcFolder, KMMessage * msg );
00807 KMDeleteMsgCommand( Q_UINT32 sernum );
00808
00809 private:
00810 static KMFolder * findTrashFolder( KMFolder * srcFolder );
00811
00812 };
00813
00814 class KDE_EXPORT KMUrlClickedCommand : public KMCommand
00815 {
00816 Q_OBJECT
00817
00818 public:
00819 KMUrlClickedCommand( const KURL &url, uint identity,
00820 KMReaderWin *readerWin, bool mHtmlPref, KMMainWidget *mainWidget = 0 );
00821
00822 private:
00823 virtual Result execute();
00824
00825 KURL mUrl;
00826 uint mIdentity;
00827 KMReaderWin *mReaderWin;
00828 bool mHtmlPref;
00829 KMMainWidget *mMainWidget;
00830 };
00831
00832 class KDE_EXPORT KMLoadPartsCommand : public KMCommand
00833 {
00834 Q_OBJECT
00835
00836 public:
00837 KMLoadPartsCommand( QPtrList<partNode>& parts, KMMessage* msg );
00838 KMLoadPartsCommand( partNode* node, KMMessage* msg );
00839 KMLoadPartsCommand( PartNodeMessageMap& partMap );
00840
00841 public slots:
00842 void slotPartRetrieved( KMMessage* msg, QString partSpecifier );
00843
00844 signals:
00845 void partsRetrieved();
00846
00847 private:
00848
00849 virtual void slotStart();
00850
00851 virtual Result execute();
00852
00853 int mNeedsRetrieval;
00854 PartNodeMessageMap mPartMap;
00855 };
00856
00857 class KDE_EXPORT KMResendMessageCommand : public KMCommand
00858 {
00859 Q_OBJECT
00860
00861 public:
00862 KMResendMessageCommand( QWidget *parent, KMMessage *msg=0 );
00863
00864 private:
00865 virtual Result execute();
00866 };
00867
00868 class KDE_EXPORT KMMailingListCommand : public KMCommand
00869 {
00870 Q_OBJECT
00871 public:
00872 KMMailingListCommand( QWidget *parent, KMFolder *folder );
00873 private:
00874 virtual Result execute();
00875 private slots:
00876 void commandCompleted( KMCommand *command );
00877 protected:
00878 virtual KURL::List urls() const =0;
00879 protected:
00880 KMFolder *mFolder;
00881 };
00882
00883 class KDE_EXPORT KMMailingListPostCommand : public KMMailingListCommand
00884 {
00885 Q_OBJECT
00886 public:
00887 KMMailingListPostCommand( QWidget *parent, KMFolder *folder );
00888 protected:
00889 virtual KURL::List urls() const;
00890 };
00891
00892 class KDE_EXPORT KMMailingListSubscribeCommand : public KMMailingListCommand
00893 {
00894 Q_OBJECT
00895 public:
00896 KMMailingListSubscribeCommand( QWidget *parent, KMFolder *folder );
00897 protected:
00898 virtual KURL::List urls() const;
00899 };
00900
00901 class KDE_EXPORT KMMailingListUnsubscribeCommand : public KMMailingListCommand
00902 {
00903 Q_OBJECT
00904 public:
00905 KMMailingListUnsubscribeCommand( QWidget *parent, KMFolder *folder );
00906 protected:
00907 virtual KURL::List urls() const;
00908 };
00909
00910 class KDE_EXPORT KMMailingListArchivesCommand : public KMMailingListCommand
00911 {
00912 Q_OBJECT
00913 public:
00914 KMMailingListArchivesCommand( QWidget *parent, KMFolder *folder );
00915 protected:
00916 virtual KURL::List urls() const;
00917 };
00918
00919 class KDE_EXPORT KMMailingListHelpCommand : public KMMailingListCommand
00920 {
00921 Q_OBJECT
00922 public:
00923 KMMailingListHelpCommand( QWidget *parent, KMFolder *folder );
00924 protected:
00925 virtual KURL::List urls() const;
00926 };
00927
00928 class KDE_EXPORT KMIMChatCommand : public KMCommand
00929 {
00930 Q_OBJECT
00931
00932 public:
00933 KMIMChatCommand( const KURL &url, KMMessage *msg=0 );
00934
00935 private:
00942 virtual Result execute();
00943
00944 KURL mUrl;
00945 KMMessage *mMessage;
00946 };
00947
00948 class KDE_EXPORT KMHandleAttachmentCommand : public KMCommand
00949 {
00950 Q_OBJECT
00951
00952 public:
00954 enum AttachmentAction
00955 {
00956 Open = 1,
00957 OpenWith = 2,
00958 View = 3,
00959 Save = 4,
00960 Properties = 5,
00961 ChiasmusEncrypt = 6
00962 };
00972 KMHandleAttachmentCommand( partNode* node, KMMessage* msg, int atmId,
00973 const QString& atmName, AttachmentAction action, KService::Ptr offer, QWidget* parent );
00974
00975
00976 signals:
00977 void showAttachment( int id, const QString& name );
00978
00979 private:
00980 virtual Result execute();
00981
00982 QString createAtmFileLink() const;
00983
00985 KService::Ptr getServiceOffer();
00986
00988 void atmOpen();
00989
00991 void atmOpenWith();
00992
00997 void atmView();
00998
01000 void atmSave();
01001
01003 void atmProperties();
01004
01006 void atmEncryptWithChiasmus();
01007
01008 private slots:
01010 virtual void slotStart();
01011
01016 void slotPartComplete();
01017
01018 void slotAtmDecryptWithChiasmusResult( const GpgME::Error &, const QVariant & );
01019 void slotAtmDecryptWithChiasmusUploadResult( KIO::Job * );
01020
01021 private:
01022 partNode* mNode;
01023 KMMessage* mMsg;
01024 int mAtmId;
01025 QString mAtmName;
01026 AttachmentAction mAction;
01027 KService::Ptr mOffer;
01028 Kleo::SpecialJob *mJob;
01029
01030 };
01031
01032
01034 class KDE_EXPORT AttachmentModifyCommand : public KMCommand
01035 {
01036 Q_OBJECT
01037 public:
01038 AttachmentModifyCommand( partNode *node, KMMessage *msg, QWidget *parent );
01039 ~AttachmentModifyCommand();
01040
01041 protected:
01042 void storeChangedMessage( KMMessage* msg );
01043 DwBodyPart* findPart( KMMessage* msg, int index );
01044 virtual Result doAttachmentModify() = 0;
01045
01046 protected:
01047 int mPartIndex;
01048 Q_UINT32 mSernum;
01049
01050 private:
01051 Result execute();
01052 DwBodyPart* findPartInternal( DwEntity* root, int index, int &accu );
01053
01054 private slots:
01055 void messageStoreResult( KMFolderImap* folder, bool success );
01056 void messageDeleteResult( KMCommand *cmd );
01057
01058 private:
01059 QGuardedPtr<KMFolder> mFolder;
01060 };
01061
01062 class KDE_EXPORT KMDeleteAttachmentCommand : public AttachmentModifyCommand
01063 {
01064 Q_OBJECT
01065 public:
01066 KMDeleteAttachmentCommand( partNode *node, KMMessage *msg, QWidget *parent );
01067 ~KMDeleteAttachmentCommand();
01068
01069 protected:
01070 Result doAttachmentModify();
01071 };
01072
01073
01074 class KDE_EXPORT KMEditAttachmentCommand : public AttachmentModifyCommand
01075 {
01076 Q_OBJECT
01077 public:
01078 KMEditAttachmentCommand( partNode *node, KMMessage *msg, QWidget *parent );
01079 ~KMEditAttachmentCommand();
01080
01081 protected:
01082 Result doAttachmentModify();
01083
01084 private slots:
01085 void editDone( KMail::EditorWatcher *watcher );
01086
01087 private:
01088 KTempFile mTempFile;
01089 };
01090
01091 class KDE_EXPORT CreateTodoCommand : public KMCommand
01092 {
01093 Q_OBJECT
01094 public:
01095 CreateTodoCommand( QWidget *parent, KMMessage *msg );
01096
01097 private:
01098 Result execute();
01099 };
01100
01101 #endif