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