kmail

kmmainwidget.h
1 /*
2  This file is part of KMail, the KDE mail client.
3  Copyright (c) 2002 Don Sanders <sanders@kde.org>
4 
5  Based on the work of Stefan Taferner <taferner@kde.org>
6 
7  KMail is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License, version 2, as
9  published by the Free Software Foundation.
10 
11  KMail is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef __KMMAINWIDGET
22 #define __KMMAINWIDGET
23 
24 #include <kurl.h>
25 #include <kxmlguiclient.h>
26 #include <tqguardedptr.h>
27 #include <tqlistview.h>
28 #include <tqvbox.h>
29 #include <tqvaluevector.h>
30 
31 #include "kmreaderwin.h" //for inline actions
32 #include "kmkernel.h" // for access to config
33 #include "messageactions.h"
34 #include <tdeaction.h>
35 
36 class TQVBoxLayout;
37 class TQSplitter;
38 class TQSignalMapper;
39 
40 class TDEActionMenu;
41 class TDEActionCollection;
42 class TDEConfig;
43 class TDERadioAction;
44 class TDEToggleAction;
45 class KMenuBar;
46 class KStatusBarLabel;
47 
48 class KMFolder;
49 class KMFolderDir;
50 class KMFolderTree;
51 class KMFolderTreeItem;
52 class KMCommand;
53 class KMMetaFilterActionCommand;
54 class FolderShortcutCommand;
55 class KMMessage;
56 class KMFolder;
57 class KMAccount;
58 class KMSystemTray;
59 class KMHeaders;
60 
61 template <typename T> class TQValueList;
62 template <typename T, typename S> class TQMap;
63 template <typename T> class TQGuardedPtr;
64 
65 namespace TDEIO {
66  class Job;
67 }
68 
69 namespace KMail {
70  class Vacation;
71  class SieveDebugDialog;
72  class FolderJob;
73  class HeaderListQuickSearch;
74  class SearchWindow;
75  class ImapAccountBase;
76  class FavoriteFolderView;
77 }
78 
79 typedef TQMap<int,KMFolder*> KMMenuToFolder;
80 
81 
82 class TDE_EXPORT KMMainWidget : public TQWidget
83 {
84  TQ_OBJECT
85 
86 
87 public:
88  KMMainWidget(TQWidget *parent, const char *name,
89  KXMLGUIClient *aGUIClient,
90  TDEActionCollection *actionCollection,
91  TDEConfig*config = KMKernel::config() );
92  virtual ~KMMainWidget();
93  void destruct();
94 
96  virtual void readPreConfig(void);
97 
99  virtual void readFolderConfig(void);
100 
102  virtual void writeFolderConfig(void);
103 
105  virtual void readConfig(void);
106 
108  virtual void writeConfig(void);
109 
111  KMReaderWin* messageView(void) const { return mMsgView; }
112  KMFolderTree* folderTree(void) const { return mFolderTree; }
113  KMail::FavoriteFolderView *favoriteFolderView() const { return mFavoriteFolderView; }
114 
115  static void cleanup();
116 
117  TDEAction *action( const char *name ) { return mActionCollection->action( name ); }
118  TDEActionMenu *customReplyAction() const { return mCustomReplyActionMenu; }
119  TDEActionMenu *customReplyAllAction() const { return mCustomReplyAllActionMenu; }
120  TDEActionMenu *forwardMenu() const { return mForwardActionMenu; }
121  TDEAction *forwardInlineAction() const { return mForwardInlineAction; }
122  TDEAction *forwardAttachedAction() const { return mForwardAttachedAction; }
123  TDEAction *forwardDigestAction() const { return mForwardDigestAction; }
124  TDEAction *redirectAction() const { return mRedirectAction; }
125  TDEActionMenu *customForwardAction() const { return mCustomForwardActionMenu; }
126  TDEActionMenu *filterMenu() const { return mFilterMenu; }
127  TDEAction *printAction() const { return mPrintAction; }
128  TDEAction *trashAction() const { return mTrashAction; }
129  TDEAction *deleteAction() const { return mDeleteAction; }
130  TDEAction *trashThreadAction() const { return mTrashThreadAction; }
131  TDEAction *deleteThreadAction() const { return mDeleteThreadAction; }
132  TDEAction *saveAsAction() const { return mSaveAsAction; }
133  TDEAction *editAction() const { return mMsgActions->editAction(); }
134  TDEAction *useAction() const { return mUseAction; }
135  TDEAction *sendAgainAction() const { return mSendAgainAction; }
136  TDEAction *applyAllFiltersAction() const { return mApplyAllFiltersAction; }
137  TDEAction *findInMessageAction() const { return mFindInMessageAction; }
138  TDEAction *saveAttachmentsAction() const { return mSaveAttachmentsAction; }
139  TDEAction *openAction() const { return mOpenAction; }
140  TDEAction *viewSourceAction() const { return mViewSourceAction; }
141  KMail::MessageActions *messageActions() const { return mMsgActions; }
142 
143  TDEActionMenu *statusMenu() const{ return mMsgActions->messageStatusMenu(); }
144  TDEActionMenu *threadStatusMenu() const { return mThreadStatusMenu; }
145  TDEActionMenu *moveActionMenu() const{ return mMoveActionMenu; }
146  TDEActionMenu *mopyActionMenu() const { return mCopyActionMenu; }
147  TDEActionMenu *applyFilterActionsMenu() const { return mApplyFilterActionsMenu; }
148 
149  TDEToggleAction *watchThreadAction() const { return mWatchThreadAction; }
150  TDEToggleAction *ignoreThreadAction() const { return mIgnoreThreadAction; }
151 
152  KMHeaders *headers() const { return mHeaders; }
153  void toggleSystemTray();
154 
155  void updateListFilterAction();
156 
159  static const TQValueList<KMMainWidget*>* mainWidgetList() { return s_mainWidgetList; }
160 
161  KMSystemTray *systray() const;
162 
165  bool shortcutIsValid( const TDEShortcut& ) const;
166 
167 
168  void modifyFolder( KMFolderTreeItem* folderItem );
169 
174  void setAccelsEnabled( bool enabled = true );
175 
179  void setupForwardingActionsList();
180 
181  KStatusBarLabel* vacationScriptIndicator() const { return mVacationScriptIndicator; }
182  void updateVactionScripStatus() { updateVactionScripStatus( mVacationIndicatorActive ); }
183 
184 public slots:
185  void slotMoveMsgToFolder( KMFolder *dest);
186  void slotTrashMsg(); // move to trash
187 
188  virtual void show();
189  virtual void hide();
191  void slotCheckMail();
192 
197  void folderSelected( KMFolder*, bool forceJumpToUnread = false );
198 
200  void folderSelected();
201 
203  void folderSelectedUnread( KMFolder* );
204 
205  void slotMsgSelected( KMMessage * );
209  void slotMsgActivated( KMMessage * );
210 
211  void slotMsgChanged();
212 
214  void slotSelectFolder(KMFolder*);
215  void slotSelectMessage(KMMessage*);
216 
217  void slotReplaceMsgByUnencryptedVersion();
218 
220  void updateMessageMenu();
222  void startUpdateMessageActionsTimer();
224  void updateMessageActions();
225 
227  void slotSubscriptionDialog();
228 
230  void slotLocalSubscriptionDialog();
231 
233  void slotFolderTreeColumnsChanged();
234 
236  void clearFilterActions();
237  void initializeFilterActions();
238 
240  void initializeIMAPActions() { initializeIMAPActions( true ); }
241 
243  void initializeFolderShortcutActions();
244 
246  void slotShortcutChanged( KMFolder *folder );
247 
248  void updateCustomTemplateMenus();
249  void slotEditVacation();
250 
251 signals:
252  void messagesTransfered( bool );
253  void captionChangeRequest( const TQString & caption );
254 
255 protected:
256  void setupActions();
257  void createWidgets();
258  void activatePanners();
259  void showMsg( KMReaderWin *win, KMMessage *msg );
260  void updateFileMenu();
261  void newFromTemplate( KMMessage *msg );
262 
263  TDEActionCollection * actionCollection() const { return mActionCollection; }
264 
268  TDEConfig * config();
269 
270 protected slots:
271  void slotCheckOneAccount(int);
272  void slotMailChecked( bool newMail, bool sendOnCheck,
273  const TQMap<TQString, int> & newInFolder );
274  void getAccountMenu();
275  void getTransportMenu();
276  void slotHelp();
277  void slotFilter();
278  void slotPopFilter();
279  void slotManageSieveScripts();
280  void slotAddrBook();
281  void slotImport();
282  void slotViewChange();
283  void slotCompose();
284  void slotPostToML();
285  void slotModifyFolder();
286  void slotFolderMailingListProperties();
287  void slotFolderShortcutCommand();
288  void slotExpireFolder();
289  void slotExpireAll();
290  void slotInvalidateIMAPFolders();
291  void slotMarkAllAsRead();
292  void slotArchiveFolder();
293  void slotRemoveFolder();
294  void slotEmptyFolder();
295  void slotCompactFolder();
296  void slotRefreshFolder();
297  void slotTroubleshootFolder();
298  void slotCompactAll();
299  void slotOverrideHtml();
300  void slotOverrideHtmlLoadExt();
301  void slotOverrideThread();
302  void slotToggleSubjectThreading();
303  void slotMessageQueuedOrDrafted();
304  void slotUseTemplate();
305  //void slotTrashMsg(); // move to trash
306  void slotDeleteMsg( bool confirmDelete = true ); // completely delete message
307  void slotTrashThread();
308  void slotDeleteThread( bool confirmDelete = true ); // completely delete thread
309  void slotUndo();
310  void slotReadOn();
311  void slotSaveMsg();
312  void slotOpenMsg();
313  void slotSaveAttachments();
314  void slotJumpToFolder();
315  void slotMoveMsg();
316  //void slotMoveMsgToFolder( KMFolder *dest);
317  void slotCopyMsgToFolder( KMFolder *dest);
318  void slotCopyMsg();
319  void slotResendMsg();
320  void slotCheckVacation();
321  void slotDebugSieve();
322  void slotStartCertManager();
323  void slotStartWatchGnuPG();
324  void slotApplyFilters();
325  void slotExpandThread();
326  void slotExpandAllThreads();
327  void slotCollapseThread();
328  void slotCollapseAllThreads();
329  void slotShowMsgSrc();
330  void slotSetThreadStatusNew();
331  void slotSetThreadStatusUnread();
332  void slotSetThreadStatusRead();
333  void slotSetThreadStatusTodo();
334  void slotSetThreadStatusFlag();
335  void slotSetThreadStatusWatched();
336  void slotSetThreadStatusIgnored();
337  void slotToggleUnread();
338  void slotToggleTotalColumn();
339  void slotToggleSizeColumn();
340  void slotSendQueued();
341  void slotSendQueuedVia( int item );
342  void slotOnlineStatus();
343  void slotUpdateOnlineStatus( GlobalSettings::EnumNetworkState::type );
344  void slotMsgPopup(KMMessage &msg, const KURL &aUrl, const TQPoint&);
345  void slotMarkAll();
346  void slotMemInfo();
347  void slotSearch();
348  void slotSearchClosed();
349  void slotFind();
350  void slotIntro();
351  void slotShowStartupFolder();
353  void slotShowTip();
354  void slotAntiSpamWizard();
355  void slotAntiVirusWizard();
356  void slotFilterLogViewer();
357 
359  void slotNextMessage();
360  void slotNextUnreadMessage();
361  void slotNextImportantMessage();
362  void slotNextUnreadFolder();
363  void slotPrevMessage();
364  void slotPrevUnreadMessage();
365  void slotPrevImportantMessage();
366  void slotPrevUnreadFolder();
367 
369  void slotDisplayCurrentMessage();
370 
371  void slotShowNewFromTemplate();
372  void slotNewFromTemplate( int );
373 
375  void slotUpdateUndo();
376 
378  virtual void moveSelectedToFolder( int menuId );
380  virtual void copySelectedToFolder( int menuId );
382  void updateFolderMenu();
385  void updateMarkAsReadAction();
386 
388  void slotToggleShowQuickSearch();
389 
391  void slotEditNotifications();
392  void slotEditKeys();
393 
395  void slotChangeCaption(TQListViewItem*);
396  void removeDuplicates();
397 
398  void slotCustomReplyToMsg( int tid );
399  void slotCustomReplyAllToMsg( int tid );
400  void slotForwardInlineMsg();
401  void slotForwardAttachedMsg();
402  void slotForwardDigestMsg();
403  void slotRedirectMsg();
404  void slotCustomForwardMsg( int tid );
405  void slotNoQuoteReplyToMsg();
406  void slotSubjectFilter();
407  void slotMailingListFilter();
408  void slotFromFilter();
409  void slotToFilter();
410  void slotPrintMsg();
411  void slotCreateTodo();
412 
413  void slotConfigChanged();
415  void slotFolderRemoved( KMFolder *folder );
416 
418  void slotShowBusySplash();
421  void showOfflinePage();
422 
423 private:
425  TQString overrideEncoding() const;
426 
427  void initializeIMAPActions( bool setState );
428 
432  KMail::ImapAccountBase* findCurrentImapAccountBase();
433 
437  TQString findCurrentImapPath();
438 
444  void setupForwardActions();
445 
446  void setupFolderView();
447 
448 private slots:
449  void slotRequestFullSearchFromQuickSearch();
450  void updateVactionScripStatus( bool active );
451 
452 private:
453  // Message actions
454  TDEAction *mTrashAction, *mDeleteAction, *mTrashThreadAction,
455  *mDeleteThreadAction, *mSaveAsAction, *mUseAction,
456  *mSendAgainAction, *mApplyAllFiltersAction, *mFindInMessageAction,
457  *mSaveAttachmentsAction, *mOpenAction, *mViewSourceAction,
458  *mFavoritesCheckMailAction,
459  *mMoveMsgToFolderAction;
460  // Composition actions
461  TDEAction *mPrintAction,
462  *mForwardInlineAction, *mForwardAttachedAction, *mForwardDigestAction,
463  *mRedirectAction;
464  TDEActionMenu *mForwardActionMenu;
465  // Filter actions
466  TDEActionMenu *mFilterMenu;
467  TDEAction *mSubjectFilterAction, *mFromFilterAction, *mToFilterAction,
468  *mListFilterAction;
469  TDEActionMenu *mTemplateMenu;
470 
471  // Custom template actions menu
472  TDEActionMenu *mCustomReplyActionMenu,
473  *mCustomReplyAllActionMenu,
474  *mCustomForwardActionMenu;
475  // Signal mappers for custom template actions
476  TQSignalMapper *mCustomReplyMapper,
477  *mCustomReplyAllMapper,
478  *mCustomForwardMapper;
479 
480  TDEActionMenu *mThreadStatusMenu,
481  *mMoveActionMenu, *mCopyActionMenu, *mApplyFilterActionsMenu;
482  TDEAction *mMarkThreadAsNewAction;
483  TDEAction *mMarkThreadAsReadAction;
484  TDEAction *mMarkThreadAsUnreadAction;
485  TDEToggleAction *mToggleThreadTodoAction;
486  TDEToggleAction *mToggleThreadFlagAction;
487 
488  TDEToggleAction *mWatchThreadAction, *mIgnoreThreadAction;
489 
491  TDERadioAction* mUnreadColumnToggle;
492  TDERadioAction* mUnreadTextToggle;
493  TDEToggleAction* mTotalColumnToggle;
494  TDEToggleAction* mSizeColumnToggle;
495 
496  TDEToggleAction *mToggleShowQuickSearchAction;
497 
498  KMFolderTree *mFolderTree;
499  KMail::FavoriteFolderView *mFavoriteFolderView;
500  TQWidget *mFolderView;
501  TQSplitter *mFolderViewParent;
502  KMReaderWin *mMsgView;
503  TQSplitter *mPanner1, *mPanner2;
504  TQSplitter *mFolderViewSplitter;
505  KMHeaders *mHeaders;
506  TQVBox *mSearchAndHeaders;
507  TDEToolBar *mSearchToolBar;
508  KMail::HeaderListQuickSearch *mQuickSearchLine;
509  TQGuardedPtr<KMFolder> mFolder;
510  KMFolder *mTemplateFolder;
511  TQPopupMenu *mViewMenu, *mBodyPartsMenu;
512  TDEAction *mlistFilterAction;
513  bool mIntegrated;
514  bool mBeepOnNew;
515  bool mConfirmEmpty;
516  TQString mStartupFolder;
517  int mMessageStatusId;
518  TQValueList<int> mPanner1Sep, mPanner2Sep;
519  KURL mUrlCurrent;
520  TQPopupMenu *mActMenu;
521  TQPopupMenu *mSendMenu;
522  TQPopupMenu *mFileMenu;
523 
524  bool mLongFolderList;
525 
526  bool mStartupDone;
527  KMMenuToFolder mMenuToFolder;
528  int copyId, moveId, htmlId, threadId;
529  bool mHtmlPref, mHtmlLoadExtPref, mThreadPref,
530  mFolderHtmlPref, mFolderHtmlLoadExtPref, mFolderThreadPref,
531  mFolderThreadSubjPref, mReaderWindowActive, mReaderWindowBelow;
532  bool mEnableFavoriteFolderView;
533 
534 // TQPopupMenu *mMessageMenu;
535  KMail::SearchWindow *mSearchWin;
536 
537  TDEAction *mNewFolderAction, *mModifyFolderAction, *mRemoveFolderAction, *mExpireFolderAction,
538  *mCompactFolderAction, *mRefreshFolderAction, *mEmptyFolderAction,
539  *mMarkAllAsReadAction, *mFolderMailingListPropertiesAction,
540  *mFolderShortCutCommandAction, *mTroubleshootFolderAction,
541  *mRemoveDuplicatesAction, *mArchiveFolderAction;
542  TDEToggleAction *mPreferHtmlAction, *mPreferHtmlLoadExtAction, *mThreadMessagesAction;
543  TDEToggleAction *mThreadBySubjectAction;
544  TDEToggleAction *mFolderAction, *mHeaderAction, *mMimeAction;
545 
546  TQTimer *menutimer;
547  TQTimer *mShowBusySplashTimer;
548 
549  TQGuardedPtr<KMail::Vacation> mVacation;
550 #if !defined(NDEBUG)
551  TQGuardedPtr<KMail::SieveDebugDialog> mSieveDebugDialog;
552 #endif
553  TDEActionCollection *mActionCollection;
554  TDEActionSeparator *mToolbarActionSeparator;
555  TQVBoxLayout *mTopLayout;
556  bool mDestructed, mForceJumpToUnread, mShowingOfflineScreen;
557  TQPtrList<TDEAction> mFilterMenuActions;
558  TQPtrList<TDEAction> mFilterTBarActions;
559  TQPtrList<KMMetaFilterActionCommand> mFilterCommands;
560  TQDict<FolderShortcutCommand> mFolderShortcutCommands;
561  TQGuardedPtr <KMail::FolderJob> mJob;
562 
563  TQValueVector<TQString> mCustomTemplates;
564  TQPtrList<TDEAction> mCustomTemplateActions;
565 
566  KMSystemTray *mSystemTray;
567  TDEConfig *mConfig;
568  KXMLGUIClient *mGUIClient;
569 
570  KMail::MessageActions *mMsgActions;
571 
572  static TQValueList<KMMainWidget*>* s_mainWidgetList;
573 
574  KStatusBarLabel *mVacationScriptIndicator;
575  bool mVacationIndicatorActive;
576 };
577 
578 #endif
579 
KMail list that manages the contents of one directory that may contain folders and/or other directori...
Definition: kmfolderdir.h:16
Mail folder.
Definition: kmfolder.h:69
The widget that shows the contents of folders.
Definition: kmheaders.h:47
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
KMSystemTray extends KSystemTray and handles system tray notification for KMail.
Definition: kmsystemtray.h:42
Manages common actions that can be performed on one or more messages.
The SearchWindow class provides a dialog for triggering a search on folders and storing that search a...
Definition: searchwindow.h:69
folderdiaquotatab.h
Definition: aboutdata.cpp:40