kmail

kmcommands.h
1 #ifndef KMCommands_h
2 #define KMCommands_h
3 
4 #include <tqdatetime.h>
5 #include <tqguardedptr.h>
6 #include <tqptrlist.h>
7 #include <tqvaluelist.h>
8 #include <tqvaluevector.h>
9 #include <tqtimer.h>
10 #include <tqfont.h>
11 #include <tdeio/job.h>
12 #include "kmmsgbase.h" // for KMMsgStatus
13 #include <mimelib/string.h>
14 #include <tdemacros.h>
15 #include <kservice.h>
16 #include <tdetempfile.h>
17 
18 class TQPopupMenu;
19 class TDEMainWindow;
20 class TDEAction;
21 class KProgressDialog;
22 class TDEProcess;
23 class KMFilter;
24 class KMFolder;
25 class KMFolderImap;
26 class KMFolderNode;
27 class KMHeaders;
28 class KMMainWidget;
29 class KMMessage;
30 class KMMsgBase;
31 class KMReaderWin;
32 class partNode;
33 class DwBodyPart;
34 class DwEntity;
35 namespace TDEIO { class Job; }
36 namespace KMail {
37  class Composer;
38  class FolderJob;
39  class EditorWatcher;
40  class HeaderStyle;
41  class HeaderStrategy;
42 }
43 namespace GpgME { class Error; }
44 namespace Kleo { class SpecialJob; }
45 
46 typedef TQMap<int,KMFolder*> KMMenuToFolder;
47 typedef TQMap<partNode*, KMMessage*> PartNodeMessageMap;
48 
49 class TDE_EXPORT KMCommand : public TQObject
50 {
51  TQ_OBJECT
52 
53  friend class LaterDeleterWithCommandCompletion;
54 
55 public:
56  enum Result { Undefined, OK, Canceled, Failed };
57 
58  // Trival constructor, don't retrieve any messages
59  KMCommand( TQWidget *parent = 0 );
60  // Retrieve all messages in msgList when start is called.
61  KMCommand( TQWidget *parent, const TQPtrList<KMMsgBase> &msgList );
62  // Retrieve the single message msgBase when start is called.
63  KMCommand( TQWidget *parent, KMMsgBase *msgBase );
64  // Retrieve the single message msgBase when start is called.
65  KMCommand( TQWidget *parent, KMMessage *message );
66  virtual ~KMCommand();
67 
72  void keepFolderOpen( KMFolder *folder );
73 
77  Result result();
78 
79 public slots:
80  // Retrieve messages then calls execute
81  void start();
82 
83  // advance the progressbar, emitted by the folderjob
84  void slotProgress( unsigned long done, unsigned long total );
85 
86 signals:
87 
89  void messagesTransfered( KMCommand::Result result );
90 
92  void completed( KMCommand *command );
93 
94 protected:
95  // Returns list of messages retrieved
96  const TQPtrList<KMMessage> retrievedMsgs() const;
97  // Returns the single message retrieved
98  KMMessage *retrievedMessage() const;
99  // Returns the parent widget
100  TQWidget *parentWidget() const;
101 
102  bool deletesItself() { return mDeletesItself; }
108  void setDeletesItself( bool deletesItself )
109  { mDeletesItself = deletesItself; }
110 
111  bool emitsCompletedItself() { return mEmitsCompletedItself; }
118  void setEmitsCompletedItself( bool emitsCompletedItself )
119  { mEmitsCompletedItself = emitsCompletedItself; }
120 
124  void setResult( Result result )
125  { mResult = result; }
126 
127 private:
128  // execute should be implemented by derived classes
129  virtual Result execute() = 0;
130 
133  void transferSelectedMsgs();
134 
135 private slots:
137  virtual void slotStart();
138 
139  void slotPostTransfer( KMCommand::Result result );
141  void slotMsgTransfered(KMMessage* msg);
143  void slotJobFinished();
145  void slotTransferCancelled();
146 
147 private:
148  // ProgressDialog for transferring messages
149  KProgressDialog* mProgressDialog;
150  //Currently only one async command allowed at a time
151  static int mCountJobs;
152  int mCountMsgs;
153  Result mResult;
154  bool mDeletesItself : 1;
155  bool mEmitsCompletedItself : 1;
156 
157  TQWidget *mParent;
158  TQPtrList<KMMessage> mRetrievedMsgs;
159  TQPtrList<KMMsgBase> mMsgList;
160  TQValueList<TQGuardedPtr<KMFolder> > mFolders;
161 };
162 
163 class TDE_EXPORT KMMailtoComposeCommand : public KMCommand
164 {
165  TQ_OBJECT
166 
167 
168 public:
169  KMMailtoComposeCommand( const KURL &url, KMMessage *msg=0 );
170 
171 private:
172  virtual Result execute();
173 
174  KURL mUrl;
175  KMMessage *mMessage;
176 };
177 
178 class TDE_EXPORT KMMailtoReplyCommand : public KMCommand
179 {
180  TQ_OBJECT
181 
182 
183 public:
184  KMMailtoReplyCommand( TQWidget *parent, const KURL &url,
185  KMMessage *msg, const TQString &selection );
186 
187 private:
188  virtual Result execute();
189 
190  KURL mUrl;
191  TQString mSelection;
192 };
193 
194 class TDE_EXPORT KMMailtoForwardCommand : public KMCommand
195 {
196  TQ_OBJECT
197 
198 
199 public:
200  KMMailtoForwardCommand( TQWidget *parent, const KURL &url,
201  KMMessage *msg );
202 
203 private:
204  virtual Result execute();
205 
206  KURL mUrl;
207 };
208 
209 class TDE_EXPORT KMMailtoAddAddrBookCommand : public KMCommand
210 {
211  TQ_OBJECT
212 
213 
214 public:
215  KMMailtoAddAddrBookCommand( const KURL &url, TQWidget *parent );
216 
217 private:
218  virtual Result execute();
219 
220  KURL mUrl;
221 };
222 
223 class TDE_EXPORT KMAddBookmarksCommand : public KMCommand
224 {
225  TQ_OBJECT
226 
227 
228 public:
229  KMAddBookmarksCommand( const KURL &url, TQWidget *parent );
230 
231 private:
232  virtual Result execute();
233 
234  KURL mUrl;
235 };
236 
237 
238 class TDE_EXPORT KMMailtoOpenAddrBookCommand : public KMCommand
239 {
240  TQ_OBJECT
241 
242 
243 public:
244  KMMailtoOpenAddrBookCommand( const KURL &url, TQWidget *parent );
245 
246 private:
247  virtual Result execute();
248 
249  KURL mUrl;
250 };
251 
252 class TDE_EXPORT KMUrlCopyCommand : public KMCommand
253 {
254  TQ_OBJECT
255 
256 
257 public:
258  KMUrlCopyCommand( const KURL &url, KMMainWidget *mainWidget = 0 );
259 
260 private:
261  virtual Result execute();
262 
263  KURL mUrl;
264  KMMainWidget *mMainWidget;
265 };
266 
267 class TDE_EXPORT KMUrlOpenCommand : public KMCommand
268 {
269  TQ_OBJECT
270 
271 
272 public:
273  KMUrlOpenCommand( const KURL &url, KMReaderWin *readerWin );
274 
275 private:
276  virtual Result execute();
277 
278  KURL mUrl;
279  KMReaderWin *mReaderWin;
280 };
281 
282 class TDE_EXPORT KMUrlSaveCommand : public KMCommand
283 {
284  TQ_OBJECT
285 
286 
287 public:
288  KMUrlSaveCommand( const KURL &url, TQWidget *parent );
289 
290 private slots:
291  void slotUrlSaveResult( TDEIO::Job *job );
292 
293 private:
294  virtual Result execute();
295 
296  KURL mUrl;
297 };
298 
299 class TDE_EXPORT KMEditMsgCommand : public KMCommand
300 {
301  TQ_OBJECT
302 
303 
304 public:
305  KMEditMsgCommand( TQWidget *parent, KMMessage *msg );
306 
307 private:
308  virtual Result execute();
309 };
310 
311 class TDE_EXPORT KMUseTemplateCommand : public KMCommand
312 {
313  TQ_OBJECT
314 
315 
316 public:
317  KMUseTemplateCommand( TQWidget *parent, KMMessage *msg );
318 
319 private:
320  virtual Result execute();
321 };
322 
323 class TDE_EXPORT KMShowMsgSrcCommand : public KMCommand
324 {
325  TQ_OBJECT
326 
327 
328 public:
329  KMShowMsgSrcCommand( TQWidget *parent, KMMessage *msg,
330  bool fixedFont );
331  virtual Result execute();
332 
333 private:
334  bool mFixedFont;
335  bool mMsgWasComplete;
336 };
337 
338 class TDE_EXPORT KMSaveMsgCommand : public KMCommand
339 {
340  TQ_OBJECT
341 
342 
343 public:
344  KMSaveMsgCommand( TQWidget *parent, const TQPtrList<KMMsgBase> &msgList );
345  KMSaveMsgCommand( TQWidget *parent, KMMessage * msg );
346  KURL url();
347 
348 private:
349  virtual Result execute();
350 
351 private slots:
352  void slotSaveDataReq();
353  void slotSaveResult(TDEIO::Job *job);
355  void slotMessageRetrievedForSaving(KMMessage *msg);
356 
357 private:
358  static const int MAX_CHUNK_SIZE = 64*1024;
359  KURL mUrl;
360  TQValueList<unsigned long> mMsgList;
361  TQValueList<KMMsgBase *> mUngetMsgs;
362  unsigned int mMsgListIndex;
363  KMMessage *mStandAloneMessage;
364  TQByteArray mData;
365  int mOffset;
366  size_t mTotalSize;
367  TDEIO::TransferJob *mJob;
368 };
369 
370 class TDE_EXPORT KMOpenMsgCommand : public KMCommand
371 {
372  TQ_OBJECT
373 
374 
375 public:
376  KMOpenMsgCommand( TQWidget *parent, const KURL & url = KURL(),
377  const TQString & encoding = TQString() );
378 
379 private:
380  virtual Result execute();
381 
382 private slots:
383  void slotDataArrived( TDEIO::Job *job, const TQByteArray & data );
384  void slotResult( TDEIO::Job *job );
385 
386 private:
387  static const int MAX_CHUNK_SIZE = 64*1024;
388  KURL mUrl;
389  DwString mMsgString;
390  TDEIO::TransferJob *mJob;
391  const TQString mEncoding;
392 };
393 
394 class TDE_EXPORT KMSaveAttachmentsCommand : public KMCommand
395 {
396  TQ_OBJECT
397 
398 public:
403  KMSaveAttachmentsCommand( TQWidget *parent, KMMessage *msg );
408  KMSaveAttachmentsCommand( TQWidget *parent, const TQPtrList<KMMsgBase>& msgs );
417  KMSaveAttachmentsCommand( TQWidget *parent, TQPtrList<partNode> &attachments,
418  KMMessage *msg, bool encoded = false );
419 
420 private slots:
421  void slotSaveAll();
422 
423 private:
424  virtual Result execute();
425  Result saveItem( partNode *node, const KURL& url );
426 
427 private:
428  PartNodeMessageMap mAttachmentMap;
429  bool mImplicitAttachments;
430  bool mEncoded;
431 };
432 
433 class TDE_EXPORT KMReplyToCommand : public KMCommand
434 {
435  TQ_OBJECT
436 
437 
438 public:
439  KMReplyToCommand( TQWidget *parent, KMMessage *msg,
440  const TQString &selection = TQString() );
441 
442 private:
443  virtual Result execute();
444 
445 private:
446  TQString mSelection;
447 };
448 
449 class TDE_EXPORT KMNoQuoteReplyToCommand : public KMCommand
450 {
451  TQ_OBJECT
452 
453 
454 public:
455  KMNoQuoteReplyToCommand( TQWidget *parent, KMMessage *msg );
456 
457 private:
458  virtual Result execute();
459 };
460 
461 class KMReplyListCommand : public KMCommand
462 {
463  TQ_OBJECT
464 
465 
466 public:
467  KMReplyListCommand( TQWidget *parent, KMMessage *msg,
468  const TQString &selection = TQString() );
469 
470 private:
471  virtual Result execute();
472 
473 private:
474  TQString mSelection;
475 };
476 
477 class TDE_EXPORT KMReplyToAllCommand : public KMCommand
478 {
479  TQ_OBJECT
480 
481 
482 public:
483  KMReplyToAllCommand( TQWidget *parent, KMMessage *msg,
484  const TQString &selection = TQString() );
485 
486 private:
487  virtual Result execute();
488 
489 private:
490  TQString mSelection;
491 };
492 
493 class TDE_EXPORT KMReplyAuthorCommand : public KMCommand
494 {
495  TQ_OBJECT
496 
497 
498 public:
499  KMReplyAuthorCommand( TQWidget *parent, KMMessage *msg,
500  const TQString &selection = TQString() );
501 
502 private:
503  virtual Result execute();
504 
505 private:
506  TQString mSelection;
507 };
508 
509 class TDE_EXPORT KMForwardInlineCommand : public KMCommand
510 {
511  TQ_OBJECT
512 
513 
514 public:
515  KMForwardInlineCommand( TQWidget *parent, const TQPtrList<KMMsgBase> &msgList,
516  uint identity = 0 );
517  KMForwardInlineCommand( TQWidget *parent, KMMessage * msg,
518  uint identity = 0 );
519 
520 private:
521  virtual Result execute();
522 
523 private:
524  uint mIdentity;
525 };
526 
527 class TDE_EXPORT KMForwardAttachedCommand : public KMCommand
528 {
529  TQ_OBJECT
530 
531 
532 public:
533  KMForwardAttachedCommand( TQWidget *parent, const TQPtrList<KMMsgBase> &msgList,
534  uint identity = 0, KMail::Composer *win = 0 );
535  KMForwardAttachedCommand( TQWidget *parent, KMMessage * msg,
536  uint identity = 0, KMail::Composer *win = 0 );
537 
538 private:
539  virtual Result execute();
540 
541  uint mIdentity;
542  TQGuardedPtr<KMail::Composer> mWin;
543 };
544 
545 class TDE_EXPORT KMForwardDigestCommand : public KMCommand
546 {
547  TQ_OBJECT
548 
549 
550 public:
551  KMForwardDigestCommand( TQWidget *parent, const TQPtrList<KMMsgBase> &msgList,
552  uint identity = 0, KMail::Composer *win = 0 );
553  KMForwardDigestCommand( TQWidget *parent, KMMessage * msg,
554  uint identity = 0, KMail::Composer *win = 0 );
555 
556 private:
557  virtual Result execute();
558 
559  uint mIdentity;
560  TQGuardedPtr<KMail::Composer> mWin;
561 };
562 
563 class TDE_EXPORT KMRedirectCommand : public KMCommand
564 {
565  TQ_OBJECT
566 
567 
568 public:
569  KMRedirectCommand( TQWidget *parent, KMMessage *msg );
570 
571 private:
572  virtual Result execute();
573 };
574 
575 class TDE_EXPORT KMCustomReplyToCommand : public KMCommand
576 {
577  TQ_OBJECT
578 
579 
580 public:
581  KMCustomReplyToCommand( TQWidget *parent, KMMessage *msg,
582  const TQString &selection,
583  const TQString &tmpl );
584 
585 private:
586  virtual Result execute();
587 
588 private:
589  TQString mSelection;
590  TQString mTemplate;
591 };
592 
593 class TDE_EXPORT KMCustomReplyAllToCommand : public KMCommand
594 {
595  TQ_OBJECT
596 
597 
598 public:
599  KMCustomReplyAllToCommand( TQWidget *parent, KMMessage *msg,
600  const TQString &selection,
601  const TQString &tmpl );
602 
603 private:
604  virtual Result execute();
605 
606 private:
607  TQString mSelection;
608  TQString mTemplate;
609 };
610 
611 class TDE_EXPORT KMCustomForwardCommand : public KMCommand
612 {
613  TQ_OBJECT
614 
615 
616 public:
617  KMCustomForwardCommand( TQWidget *parent, const TQPtrList<KMMsgBase> &msgList,
618  uint identity, const TQString &tmpl );
619  KMCustomForwardCommand( TQWidget *parent, KMMessage * msg,
620  uint identity, const TQString &tmpl );
621 
622 private:
623  virtual Result execute();
624 
625  uint mIdentity;
626  TQString mTemplate;
627 };
628 
629 class TDE_EXPORT KMPrintCommand : public KMCommand
630 {
631  TQ_OBJECT
632 
633 
634 public:
635  KMPrintCommand( TQWidget *parent, KMMessage *msg,
636  const KMail::HeaderStyle *headerStyle = 0,
637  const KMail::HeaderStrategy *headerStrategy = 0,
638  bool htmlOverride = false,
639  bool htmlLoadExtOverride = false,
640  bool useFixedFont = false,
641  const TQString & encoding = TQString() );
642 
643  void setOverrideFont( const TQFont& );
644 
645 private:
646  virtual Result execute();
647 
648  const KMail::HeaderStyle *mHeaderStyle;
649  const KMail::HeaderStrategy *mHeaderStrategy;
650  bool mHtmlOverride;
651  bool mHtmlLoadExtOverride;
652  bool mUseFixedFont;
653  TQFont mOverrideFont;
654  TQString mEncoding;
655 };
656 
657 class TDE_EXPORT KMSeStatusCommand : public KMCommand
658 {
659  TQ_OBJECT
660 
661 
662 public:
663  // Serial numbers
664  KMSeStatusCommand( KMMsgStatus status, const TQValueList<TQ_UINT32> &,
665  bool toggle=false );
666 
667 private:
668  virtual Result execute();
669 
670  KMMsgStatus mStatus;
671  TQValueList<TQ_UINT32> mSerNums;
672  TQValueList<int> mIds;
673  bool mToggle;
674 };
675 
676 class TDE_EXPORT KMFilterCommand : public KMCommand
677 {
678  TQ_OBJECT
679 
680 
681 public:
682  KMFilterCommand( const TQCString &field, const TQString &value );
683 
684 private:
685  virtual Result execute();
686 
687  TQCString mField;
688  TQString mValue;
689 };
690 
691 
692 class TDE_EXPORT KMFilterActionCommand : public KMCommand
693 {
694  TQ_OBJECT
695 
696 
697 public:
698  KMFilterActionCommand( TQWidget *parent,
699  const TQPtrList<KMMsgBase> &msgList,
700  KMFilter *filter );
701 
702 private:
703  virtual Result execute();
704  TQValueList<TQ_UINT32> serNumList;
705  KMFilter *mFilter;
706 };
707 
708 
709 class TDE_EXPORT KMMetaFilterActionCommand : public TQObject
710 {
711  TQ_OBJECT
712 
713 
714 public:
715  KMMetaFilterActionCommand( KMFilter *filter, KMHeaders *headers,
716  KMMainWidget *main );
717 
718 public slots:
719  void start();
720 
721 private:
722  KMFilter *mFilter;
723  KMHeaders *mHeaders;
724  KMMainWidget *mMainWidget;
725 };
726 
727 class TDE_EXPORT FolderShortcutCommand : public TQObject
728 {
729  TQ_OBJECT
730 
731 
732 public:
733  FolderShortcutCommand( KMMainWidget* mainwidget, KMFolder *folder );
734  ~FolderShortcutCommand();
735 
736 public slots:
737  void start();
741  void setAction( TDEAction* );
742 
743 private:
744  KMMainWidget *mMainWidget;
745  KMFolder *mFolder;
746  TDEAction *mAction;
747 };
748 
749 
750 class TDE_EXPORT KMMailingListFilterCommand : public KMCommand
751 {
752  TQ_OBJECT
753 
754 
755 public:
756  KMMailingListFilterCommand( TQWidget *parent, KMMessage *msg );
757 
758 private:
759  virtual Result execute();
760 };
761 
762 
770 class TDE_EXPORT KMMenuCommand : public KMCommand
771 {
772  TQ_OBJECT
773 
774 
775 public:
776  static void folderToPopupMenu(bool move, TQObject *receiver,
777  KMMenuToFolder *aMenuToFolder, TQPopupMenu *menu );
778 
779  static void makeFolderMenu(KMFolderNode* item, bool move,
780  TQObject *receiver, KMMenuToFolder *aMenuToFolder, TQPopupMenu *menu );
781 };
782 
783 class TDE_EXPORT KMCopyCommand : public KMMenuCommand
784 {
785  TQ_OBJECT
786 
787 
788 public:
789  KMCopyCommand( KMFolder* destFolder,
790  const TQPtrList<KMMsgBase> &msgList );
791  KMCopyCommand( KMFolder* destFolder, KMMessage *msg );
792 
793 protected slots:
794  void slotJobFinished( KMail::FolderJob *job );
795 
796  void slotFolderComplete( KMFolderImap*, bool success );
797 
798 private:
799  virtual Result execute();
800 
801  KMFolder *mDestFolder;
802  TQPtrList<KMMsgBase> mMsgList;
803  TQValueList<KMail::FolderJob*> mPendingJobs;
804 };
805 
806 namespace KPIM {
807  class ProgressItem;
808 }
809 class TDE_EXPORT KMMoveCommand : public KMMenuCommand
810 {
811  TQ_OBJECT
812 
813 
814 public:
815  KMMoveCommand( KMFolder* destFolder, const TQPtrList<KMMsgBase> &msgList );
816  KMMoveCommand( KMFolder* destFolder, KMMessage * msg );
817  KMMoveCommand( KMFolder* destFolder, KMMsgBase * msgBase );
818  KMFolder* destFolder() const { return mDestFolder; }
819 
820 public slots:
821  void slotImapFolderCompleted(KMFolderImap *folder, bool success);
822  void slotMsgAddedToDestFolder(KMFolder *folder, TQ_UINT32 serNum);
823  void slotMoveCanceled();
824 
825 protected:
826  // Needed for KMDeleteCommand for "move to trash"
827  KMMoveCommand( TQ_UINT32 sernum );
828  void setDestFolder( KMFolder* folder ) { mDestFolder = folder; }
829  void addMsg( KMMsgBase *msg ) { mSerNumList.append( msg->getMsgSerNum() ); }
830  TQValueVector<KMFolder*> mOpenedFolders;
831 
832 private:
833  virtual Result execute();
834  void completeMove( Result result );
835 
836  KMFolder *mDestFolder;
837  TQValueList<TQ_UINT32> mSerNumList;
838  // List of serial numbers that have to be transferred to a host.
839  // Ticked off as they come in via msgAdded signals.
840  TQValueList<TQ_UINT32> mLostBoys;
841  KPIM::ProgressItem *mProgressItem;
842  bool mCompleteWithAddedMsg;
843 };
844 
845 class TDE_EXPORT KMDeleteMsgCommand : public KMMoveCommand
846 {
847  TQ_OBJECT
848 
849 
850 public:
851  KMDeleteMsgCommand( KMFolder* srcFolder, const TQPtrList<KMMsgBase> &msgList );
852  KMDeleteMsgCommand( KMFolder* srcFolder, KMMessage * msg );
853  KMDeleteMsgCommand( TQ_UINT32 sernum );
854 
855 private:
856  static KMFolder * findTrashFolder( KMFolder * srcFolder );
857 
858 };
859 
860 class TDE_EXPORT KMUrlClickedCommand : public KMCommand
861 {
862  TQ_OBJECT
863 
864 
865 public:
866  KMUrlClickedCommand( const KURL &url, uint identity,
867  KMReaderWin *readerWin, bool mHtmlPref, KMMainWidget *mainWidget = 0 );
868 
869 private:
870  virtual Result execute();
871 
872  KURL mUrl;
873  uint mIdentity;
874  KMReaderWin *mReaderWin;
875  bool mHtmlPref;
876  KMMainWidget *mMainWidget;
877 };
878 
879 class TDE_EXPORT KMLoadPartsCommand : public KMCommand
880 {
881  TQ_OBJECT
882 
883 
884 public:
885  KMLoadPartsCommand( TQPtrList<partNode>& parts, KMMessage* msg );
886  KMLoadPartsCommand( partNode* node, KMMessage* msg );
887  KMLoadPartsCommand( PartNodeMessageMap& partMap );
888 
889 public slots:
890  void slotPartRetrieved( KMMessage* msg, TQString partSpecifier );
891 
892 signals:
893  void partsRetrieved();
894 
895 private:
896  // Retrieve parts then calls execute
897  virtual void slotStart();
898 
899  virtual Result execute();
900 
901  int mNeedsRetrieval;
902  PartNodeMessageMap mPartMap;
903 };
904 
905 class TDE_EXPORT KMResendMessageCommand : public KMCommand
906 {
907  TQ_OBJECT
908 
909 
910 public:
911  KMResendMessageCommand( TQWidget *parent, KMMessage *msg=0 );
912 
913 private:
914  virtual Result execute();
915 };
916 
917 class TDE_EXPORT KMMailingListCommand : public KMCommand
918 {
919  TQ_OBJECT
920 
921 public:
922  KMMailingListCommand( TQWidget *parent, KMFolder *folder );
923 private:
924  virtual Result execute();
925 private slots:
926  void commandCompleted( KMCommand *command );
927 protected:
928  virtual KURL::List urls() const =0;
929 protected:
930  KMFolder *mFolder;
931 };
932 
933 class TDE_EXPORT KMMailingListPostCommand : public KMMailingListCommand
934 {
935  TQ_OBJECT
936 
937 public:
938  KMMailingListPostCommand( TQWidget *parent, KMFolder *folder );
939 protected:
940  virtual KURL::List urls() const;
941 };
942 
943 class TDE_EXPORT KMMailingListSubscribeCommand : public KMMailingListCommand
944 {
945  TQ_OBJECT
946 
947 public:
948  KMMailingListSubscribeCommand( TQWidget *parent, KMFolder *folder );
949 protected:
950  virtual KURL::List urls() const;
951 };
952 
953 class TDE_EXPORT KMMailingListUnsubscribeCommand : public KMMailingListCommand
954 {
955  TQ_OBJECT
956 
957 public:
958  KMMailingListUnsubscribeCommand( TQWidget *parent, KMFolder *folder );
959 protected:
960  virtual KURL::List urls() const;
961 };
962 
963 class TDE_EXPORT KMMailingListArchivesCommand : public KMMailingListCommand
964 {
965  TQ_OBJECT
966 
967 public:
968  KMMailingListArchivesCommand( TQWidget *parent, KMFolder *folder );
969 protected:
970  virtual KURL::List urls() const;
971 };
972 
973 class TDE_EXPORT KMMailingListHelpCommand : public KMMailingListCommand
974 {
975  TQ_OBJECT
976 
977 public:
978  KMMailingListHelpCommand( TQWidget *parent, KMFolder *folder );
979 protected:
980  virtual KURL::List urls() const;
981 };
982 
983 class TDE_EXPORT KMIMChatCommand : public KMCommand
984 {
985  TQ_OBJECT
986 
987 
988 public:
989  KMIMChatCommand( const KURL &url, KMMessage *msg=0 );
990 
991 private:
998  virtual Result execute();
999 
1000  KURL mUrl;
1001  KMMessage *mMessage;
1002 };
1003 
1004 class TDE_EXPORT KMHandleAttachmentCommand : public KMCommand
1005 {
1006  TQ_OBJECT
1007 
1008 
1009 public:
1011  enum AttachmentAction
1012  {
1013  Open = 1,
1014  OpenWith = 2,
1015  View = 3,
1016  Save = 4,
1017  Properties = 5,
1018  ChiasmusEncrypt = 6
1019  };
1029  KMHandleAttachmentCommand( partNode* node, KMMessage* msg, int atmId,
1030  const TQString& atmName, AttachmentAction action, KService::Ptr offer, TQWidget* parent );
1031 
1032 
1033 signals:
1034  void showAttachment( int id, const TQString& name );
1035 
1036 private:
1037  virtual Result execute();
1038 
1039  TQString createAtmFileLink() const;
1040 
1042  KService::Ptr getServiceOffer();
1043 
1045  void atmOpen();
1046 
1048  void atmOpenWith();
1049 
1054  void atmView();
1055 
1057  void atmSave();
1058 
1060  void atmProperties();
1061 
1063  void atmEncryptWithChiasmus();
1064 
1065 private slots:
1067  virtual void slotStart();
1068 
1073  void slotPartComplete();
1074 
1075  void slotAtmDecryptWithChiasmusResult( const GpgME::Error &, const TQVariant & );
1076  void slotAtmDecryptWithChiasmusUploadResult( TDEIO::Job * );
1077 
1078 private:
1079  partNode* mNode;
1080  KMMessage* mMsg;
1081  int mAtmId;
1082  TQString mAtmName;
1083  AttachmentAction mAction;
1084  KService::Ptr mOffer;
1085  Kleo::SpecialJob *mJob;
1086 
1087 };
1088 
1089 
1091 class TDE_EXPORT AttachmentModifyCommand : public KMCommand
1092 {
1093  TQ_OBJECT
1094 
1095  public:
1096  AttachmentModifyCommand( partNode *node, KMMessage *msg, TQWidget *parent );
1097  AttachmentModifyCommand( int nodeId, KMMessage *msg, TQWidget *parent );
1099 
1100  protected:
1101  void storeChangedMessage( KMMessage* msg );
1102  virtual Result doAttachmentModify() = 0;
1103 
1104  protected:
1105  int mPartIndex;
1106  TQ_UINT32 mSernum;
1107 
1108  private:
1109  Result execute();
1110 
1111  private slots:
1112  void messageStoreResult( KMFolderImap* folder, bool success );
1113  void messageDeleteResult( KMCommand *cmd );
1114 
1115  private:
1116  TQGuardedPtr<KMFolder> mFolder;
1117 };
1118 
1119 class TDE_EXPORT KMDeleteAttachmentCommand : public AttachmentModifyCommand
1120 {
1121  TQ_OBJECT
1122 
1123  public:
1124  KMDeleteAttachmentCommand( partNode *node, KMMessage *msg, TQWidget *parent );
1125  KMDeleteAttachmentCommand( int nodeId, KMMessage *msg, TQWidget *parent );
1126  ~KMDeleteAttachmentCommand();
1127 
1128  protected:
1129  Result doAttachmentModify();
1130 };
1131 
1132 
1133 class TDE_EXPORT KMEditAttachmentCommand : public AttachmentModifyCommand
1134 {
1135  TQ_OBJECT
1136 
1137  public:
1138  KMEditAttachmentCommand( partNode *node, KMMessage *msg, TQWidget *parent );
1139  KMEditAttachmentCommand( int nodeId, KMMessage *msg, TQWidget *parent );
1140  ~KMEditAttachmentCommand();
1141 
1142  protected:
1143  Result doAttachmentModify();
1144 
1145  private slots:
1146  void editDone( KMail::EditorWatcher *watcher );
1147 
1148  private:
1149  KTempFile mTempFile;
1150 };
1151 
1152 class TDE_EXPORT CreateTodoCommand : public KMCommand
1153 {
1154  TQ_OBJECT
1155 
1156  public:
1157  CreateTodoCommand( TQWidget *parent, KMMessage *msg );
1158 
1159  private:
1160  Result execute();
1161 };
1162 
1163 #endif /*KMCommands_h*/
Base class for commands modifying attachements of existing messages.
Definition: kmcommands.h:1092
Mail folder.
Definition: kmfolder.h:69
The widget that shows the contents of folders.
Definition: kmheaders.h:47
Returns a popupmenu containing a hierarchy of folder names.
Definition: kmcommands.h:771
This is a Mime Message.
Definition: kmmessage.h:68
This class implements a "reader window", that is a window used for reading or viewing messages.
Definition: kmreaderwin.h:75
Starts an editor for the given URL and emits an signal when editing has been finished.
Definition: editorwatcher.h:39
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:51
folderdiaquotatab.h
Definition: aboutdata.cpp:40