00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __KMMAINWIDGET
00022 #define __KMMAINWIDGET
00023
00024 #include <kurl.h>
00025 #include <kxmlguiclient.h>
00026 #include <qguardedptr.h>
00027 #include <qlistview.h>
00028 #include <qvbox.h>
00029 #include <qvaluevector.h>
00030
00031 #include "kmreaderwin.h"
00032 #include "kmkernel.h"
00033 #include "messageactions.h"
00034 #include <kaction.h>
00035
00036 class QVBoxLayout;
00037 class QSplitter;
00038 class QSignalMapper;
00039
00040 class KActionMenu;
00041 class KActionCollection;
00042 class KConfig;
00043 class KRadioAction;
00044 class KToggleAction;
00045 class KMenuBar;
00046 class KStatusBarLabel;
00047
00048 class KMFolder;
00049 class KMFolderDir;
00050 class KMFolderTree;
00051 class KMFolderTreeItem;
00052 class KMCommand;
00053 class KMMetaFilterActionCommand;
00054 class FolderShortcutCommand;
00055 class KMMessage;
00056 class KMFolder;
00057 class KMAccount;
00058 class KMSystemTray;
00059 class KMHeaders;
00060
00061 template <typename T> class QValueList;
00062 template <typename T, typename S> class QMap;
00063 template <typename T> class QGuardedPtr;
00064
00065 namespace KIO {
00066 class Job;
00067 }
00068
00069 namespace KMail {
00070 class Vacation;
00071 class SieveDebugDialog;
00072 class FolderJob;
00073 class HeaderListQuickSearch;
00074 class SearchWindow;
00075 class ImapAccountBase;
00076 class FavoriteFolderView;
00077 }
00078
00079 typedef QMap<int,KMFolder*> KMMenuToFolder;
00080
00081
00082 class KDE_EXPORT KMMainWidget : public QWidget
00083 {
00084 Q_OBJECT
00085
00086 public:
00087 KMMainWidget(QWidget *parent, const char *name,
00088 KXMLGUIClient *aGUIClient,
00089 KActionCollection *actionCollection,
00090 KConfig*config = KMKernel::config() );
00091 virtual ~KMMainWidget();
00092 void destruct();
00093
00095 virtual void readPreConfig(void);
00096
00098 virtual void readFolderConfig(void);
00099
00101 virtual void writeFolderConfig(void);
00102
00104 virtual void readConfig(void);
00105
00107 virtual void writeConfig(void);
00108
00110 KMReaderWin* messageView(void) const { return mMsgView; }
00111 KMFolderTree* folderTree(void) const { return mFolderTree; }
00112 KMail::FavoriteFolderView *favoriteFolderView() const { return mFavoriteFolderView; }
00113
00114 static void cleanup();
00115
00116 KAction *action( const char *name ) { return mActionCollection->action( name ); }
00117 KActionMenu *customReplyAction() const { return mCustomReplyActionMenu; }
00118 KActionMenu *customReplyAllAction() const { return mCustomReplyAllActionMenu; }
00119 KActionMenu *forwardMenu() const { return mForwardActionMenu; }
00120 KAction *forwardInlineAction() const { return mForwardInlineAction; }
00121 KAction *forwardAttachedAction() const { return mForwardAttachedAction; }
00122 KAction *forwardDigestAction() const { return mForwardDigestAction; }
00123 KAction *redirectAction() const { return mRedirectAction; }
00124 KActionMenu *customForwardAction() const { return mCustomForwardActionMenu; }
00125 KActionMenu *filterMenu() const { return mFilterMenu; }
00126 KAction *printAction() const { return mPrintAction; }
00127 KAction *trashAction() const { return mTrashAction; }
00128 KAction *deleteAction() const { return mDeleteAction; }
00129 KAction *trashThreadAction() const { return mTrashThreadAction; }
00130 KAction *deleteThreadAction() const { return mDeleteThreadAction; }
00131 KAction *saveAsAction() const { return mSaveAsAction; }
00132 KAction *editAction() const { return mMsgActions->editAction(); }
00133 KAction *useAction() const { return mUseAction; }
00134 KAction *sendAgainAction() const { return mSendAgainAction; }
00135 KAction *applyAllFiltersAction() const { return mApplyAllFiltersAction; }
00136 KAction *findInMessageAction() const { return mFindInMessageAction; }
00137 KAction *saveAttachmentsAction() const { return mSaveAttachmentsAction; }
00138 KAction *openAction() const { return mOpenAction; }
00139 KAction *viewSourceAction() const { return mViewSourceAction; }
00140 KMail::MessageActions *messageActions() const { return mMsgActions; }
00141
00142 KActionMenu *statusMenu() const{ return mMsgActions->messageStatusMenu(); }
00143 KActionMenu *threadStatusMenu() const { return mThreadStatusMenu; }
00144 KActionMenu *moveActionMenu() const{ return mMoveActionMenu; }
00145 KActionMenu *mopyActionMenu() const { return mCopyActionMenu; }
00146 KActionMenu *applyFilterActionsMenu() const { return mApplyFilterActionsMenu; }
00147
00148 KToggleAction *watchThreadAction() const { return mWatchThreadAction; }
00149 KToggleAction *ignoreThreadAction() const { return mIgnoreThreadAction; }
00150
00151 KMHeaders *headers() const { return mHeaders; }
00152 void toggleSystemTray();
00153
00154 void updateListFilterAction();
00155
00158 static const QValueList<KMMainWidget*>* mainWidgetList() { return s_mainWidgetList; }
00159
00160 KMSystemTray *systray() const;
00161
00164 bool shortcutIsValid( const KShortcut& ) const;
00165
00166
00167 void modifyFolder( KMFolderTreeItem* folderItem );
00168
00173 void setAccelsEnabled( bool enabled = true );
00174
00178 void setupForwardingActionsList();
00179
00180 KStatusBarLabel* vacationScriptIndicator() const { return mVacationScriptIndicator; }
00181 void updateVactionScriptStatus() { updateVactionScriptStatus( mVacationIndicatorActive ); }
00182
00183 public slots:
00184 void slotMoveMsgToFolder( KMFolder *dest);
00185 void slotTrashMsg();
00186
00187 virtual void show();
00188 virtual void hide();
00190 void slotCheckMail();
00191
00196 void folderSelected( KMFolder*, bool forceJumpToUnread = false );
00197
00199 void folderSelected();
00200
00202 void folderSelectedUnread( KMFolder* );
00203
00204 void slotMsgSelected(KMMessage*);
00205 void slotMsgChanged();
00206
00208 void slotSelectFolder(KMFolder*);
00209 void slotSelectMessage(KMMessage*);
00210
00211 void slotReplaceMsgByUnencryptedVersion();
00212
00214 void updateMessageMenu();
00216 void startUpdateMessageActionsTimer();
00218 void updateMessageActions();
00219
00221 void slotSubscriptionDialog();
00222
00224 void slotLocalSubscriptionDialog();
00225
00227 void slotFolderTreeColumnsChanged();
00228
00230 void clearFilterActions();
00231 void initializeFilterActions();
00232
00234 void initializeIMAPActions() { initializeIMAPActions( true ); }
00235
00237 void initializeFolderShortcutActions();
00238
00240 void slotShortcutChanged( KMFolder *folder );
00241
00242 void updateCustomTemplateMenus();
00243 void slotEditVacation();
00244
00245 signals:
00246 void messagesTransfered( bool );
00247 void captionChangeRequest( const QString & caption );
00248
00249 protected:
00250 void setupActions();
00251 void createWidgets();
00252 void activatePanners();
00253 void showMsg( KMReaderWin *win, KMMessage *msg );
00254 void updateFileMenu();
00255 void newFromTemplate( KMMessage *msg );
00256
00257 KActionCollection * actionCollection() const { return mActionCollection; }
00258
00262 KConfig * config();
00263
00264 protected slots:
00265 void slotCheckOneAccount(int);
00266 void slotMailChecked( bool newMail, bool sendOnCheck,
00267 const QMap<QString, int> & newInFolder );
00268 void getAccountMenu();
00269 void getTransportMenu();
00270 void slotHelp();
00271 void slotFilter();
00272 void slotPopFilter();
00273 void slotManageSieveScripts();
00274 void slotAddrBook();
00275 void slotImport();
00276 void slotViewChange();
00277 void slotCompose();
00278 void slotPostToML();
00279 void slotModifyFolder();
00280 void slotFolderMailingListProperties();
00281 void slotFolderShortcutCommand();
00282 void slotExpireFolder();
00283 void slotExpireAll();
00284 void slotInvalidateIMAPFolders();
00285 void slotMarkAllAsRead();
00286 void slotRemoveFolder();
00287 void slotEmptyFolder();
00288 void slotCompactFolder();
00289 void slotRefreshFolder();
00290 void slotTroubleshootFolder();
00291 void slotCompactAll();
00292 void slotOverrideHtml();
00293 void slotOverrideHtmlLoadExt();
00294 void slotOverrideThread();
00295 void slotToggleSubjectThreading();
00296 void slotMessageQueuedOrDrafted();
00297 void slotUseTemplate();
00298
00299 void slotDeleteMsg( bool confirmDelete = true );
00300 void slotTrashThread();
00301 void slotDeleteThread( bool confirmDelete = true );
00302 void slotUndo();
00303 void slotReadOn();
00304 void slotSaveMsg();
00305 void slotOpenMsg();
00306 void slotSaveAttachments();
00307 void slotJumpToFolder();
00308 void slotMoveMsg();
00309
00310 void slotCopyMsgToFolder( KMFolder *dest);
00311 void slotCopyMsg();
00312 void slotResendMsg();
00313 void slotCheckVacation();
00314 void slotDebugSieve();
00315 void slotStartCertManager();
00316 void slotStartWatchGnuPG();
00317 void slotApplyFilters();
00318 void slotExpandThread();
00319 void slotExpandAllThreads();
00320 void slotCollapseThread();
00321 void slotCollapseAllThreads();
00322 void slotShowMsgSrc();
00323 void slotSetThreadStatusNew();
00324 void slotSetThreadStatusUnread();
00325 void slotSetThreadStatusRead();
00326 void slotSetThreadStatusTodo();
00327 void slotSetThreadStatusFlag();
00328 void slotSetThreadStatusWatched();
00329 void slotSetThreadStatusIgnored();
00330 void slotToggleUnread();
00331 void slotToggleTotalColumn();
00332 void slotToggleSizeColumn();
00333 void slotSendQueued();
00334 void slotSendQueuedVia( int item );
00335 void slotOnlineStatus();
00336 void slotUpdateOnlineStatus( GlobalSettings::EnumNetworkState::type );
00337 void slotMsgPopup(KMMessage &msg, const KURL &aUrl, const QPoint&);
00338 void slotMarkAll();
00339 void slotMemInfo();
00340 void slotSearch();
00341 void slotSearchClosed();
00342 void slotFind();
00343 void slotIntro();
00344 void slotShowStartupFolder();
00346 void slotShowTip();
00347 void slotAntiSpamWizard();
00348 void slotAntiVirusWizard();
00349 void slotFilterLogViewer();
00350
00352 void slotNextMessage();
00353 void slotNextUnreadMessage();
00354 void slotNextImportantMessage();
00355 void slotNextUnreadFolder();
00356 void slotPrevMessage();
00357 void slotPrevUnreadMessage();
00358 void slotPrevImportantMessage();
00359 void slotPrevUnreadFolder();
00360
00362 void slotDisplayCurrentMessage();
00363 void slotMsgActivated( KMMessage* );
00364
00365 void slotShowNewFromTemplate();
00366 void slotNewFromTemplate( int );
00367
00369 void slotUpdateUndo();
00370
00372 virtual void moveSelectedToFolder( int menuId );
00374 virtual void copySelectedToFolder( int menuId );
00376 void updateFolderMenu();
00379 void updateMarkAsReadAction();
00380
00382 void slotEditNotifications();
00383 void slotEditKeys();
00384
00386 void slotChangeCaption(QListViewItem*);
00387 void removeDuplicates();
00388
00389 void slotCustomReplyToMsg( int tid );
00390 void slotCustomReplyAllToMsg( int tid );
00391 void slotForwardInlineMsg();
00392 void slotForwardAttachedMsg();
00393 void slotForwardDigestMsg();
00394 void slotRedirectMsg();
00395 void slotCustomForwardMsg( int tid );
00396 void slotNoQuoteReplyToMsg();
00397 void slotSubjectFilter();
00398 void slotMailingListFilter();
00399 void slotFromFilter();
00400 void slotToFilter();
00401 void slotPrintMsg();
00402 void slotCreateTodo();
00403
00404 void slotConfigChanged();
00406 void slotFolderRemoved( KMFolder *folder );
00407
00409 void slotShowBusySplash();
00412 void showOfflinePage();
00413
00414 private:
00416 QString overrideEncoding() const;
00417
00418 void initializeIMAPActions( bool setState );
00419
00423 KMail::ImapAccountBase* findCurrentImapAccountBase();
00424
00428 QString findCurrentImapPath();
00429
00430 void setupFolderView();
00431
00432 private slots:
00433 void slotRequestFullSearchFromQuickSearch();
00434 void updateVactionScriptStatus( bool active );
00435
00436 private:
00437
00438 KAction *mTrashAction, *mDeleteAction, *mTrashThreadAction,
00439 *mDeleteThreadAction, *mSaveAsAction, *mUseAction,
00440 *mSendAgainAction, *mApplyAllFiltersAction, *mFindInMessageAction,
00441 *mSaveAttachmentsAction, *mOpenAction, *mViewSourceAction,
00442 *mFavoritesCheckMailAction;
00443
00444 KAction *mPrintAction,
00445 *mForwardInlineAction, *mForwardAttachedAction, *mForwardDigestAction,
00446 *mRedirectAction;
00447 KActionMenu *mForwardActionMenu;
00448
00449 KActionMenu *mFilterMenu;
00450 KAction *mSubjectFilterAction, *mFromFilterAction, *mToFilterAction,
00451 *mListFilterAction;
00452 KActionMenu *mTemplateMenu;
00453
00454
00455 KActionMenu *mCustomReplyActionMenu,
00456 *mCustomReplyAllActionMenu,
00457 *mCustomForwardActionMenu;
00458
00459 QSignalMapper *mCustomReplyMapper,
00460 *mCustomReplyAllMapper,
00461 *mCustomForwardMapper;
00462
00463 KActionMenu *mThreadStatusMenu,
00464 *mMoveActionMenu, *mCopyActionMenu, *mApplyFilterActionsMenu;
00465 KAction *mMarkThreadAsNewAction;
00466 KAction *mMarkThreadAsReadAction;
00467 KAction *mMarkThreadAsUnreadAction;
00468 KToggleAction *mToggleThreadTodoAction;
00469 KToggleAction *mToggleThreadFlagAction;
00470
00471 KToggleAction *mWatchThreadAction, *mIgnoreThreadAction;
00472
00474 KRadioAction* mUnreadColumnToggle;
00475 KRadioAction* mUnreadTextToggle;
00476 KToggleAction* mTotalColumnToggle;
00477 KToggleAction* mSizeColumnToggle;
00478
00479 QVBox *mSearchAndTree;
00480 QHBox *mFolderQuickSearch;
00481 KMFolderTree *mFolderTree;
00482 KMail::FavoriteFolderView *mFavoriteFolderView;
00483 QWidget *mFolderView;
00484 QSplitter *mFolderViewParent;
00485 KMReaderWin *mMsgView;
00486 QSplitter *mPanner1, *mPanner2;
00487 QSplitter *mFolderViewSplitter;
00488 KMHeaders *mHeaders;
00489 QVBox *mSearchAndHeaders;
00490 KToolBar *mSearchToolBar;
00491 KMail::HeaderListQuickSearch *mQuickSearchLine;
00492 QGuardedPtr<KMFolder> mFolder;
00493 KMFolder *mTemplateFolder;
00494 QPopupMenu *mViewMenu, *mBodyPartsMenu;
00495 KAction *mlistFilterAction;
00496 bool mIntegrated;
00497 bool mBeepOnNew;
00498 bool mConfirmEmpty;
00499 QString mStartupFolder;
00500 int mMessageStatusId;
00501 QValueList<int> mPanner1Sep, mPanner2Sep;
00502 KURL mUrlCurrent;
00503 QPopupMenu *mActMenu;
00504 QPopupMenu *mSendMenu;
00505 QPopupMenu *mFileMenu;
00506
00507 bool mLongFolderList;
00508
00509 bool mStartupDone;
00510 KMMenuToFolder mMenuToFolder;
00511 int copyId, moveId, htmlId, threadId;
00512 bool mHtmlPref, mHtmlLoadExtPref, mThreadPref,
00513 mFolderHtmlPref, mFolderHtmlLoadExtPref, mFolderThreadPref,
00514 mFolderThreadSubjPref, mReaderWindowActive, mReaderWindowBelow;
00515 bool mEnableFavoriteFolderView;
00516 bool mEnableFolderQuickSearch;
00517 bool mEnableQuickSearch;
00518
00519
00520 KMail::SearchWindow *mSearchWin;
00521
00522 KAction *mNewFolderAction, *mModifyFolderAction, *mRemoveFolderAction, *mExpireFolderAction,
00523 *mCompactFolderAction, *mRefreshFolderAction, *mEmptyFolderAction,
00524 *mMarkAllAsReadAction, *mFolderMailingListPropertiesAction,
00525 *mFolderShortCutCommandAction, *mTroubleshootFolderAction,
00526 *mRemoveDuplicatesAction;
00527 KToggleAction *mPreferHtmlAction, *mPreferHtmlLoadExtAction, *mThreadMessagesAction;
00528 KToggleAction *mThreadBySubjectAction;
00529 KToggleAction *mFolderAction, *mHeaderAction, *mMimeAction;
00530
00531 QTimer *menutimer;
00532 QTimer *mShowBusySplashTimer;
00533
00534 QGuardedPtr<KMail::Vacation> mVacation;
00535 #if !defined(NDEBUG)
00536 QGuardedPtr<KMail::SieveDebugDialog> mSieveDebugDialog;
00537 #endif
00538 KActionCollection *mActionCollection;
00539 KActionSeparator *mToolbarActionSeparator;
00540 QVBoxLayout *mTopLayout;
00541 bool mDestructed, mForceJumpToUnread, mShowingOfflineScreen;
00542 QPtrList<KAction> mFilterMenuActions;
00543 QPtrList<KAction> mFilterTBarActions;
00544 QPtrList<KMMetaFilterActionCommand> mFilterCommands;
00545 QDict<FolderShortcutCommand> mFolderShortcutCommands;
00546 QGuardedPtr <KMail::FolderJob> mJob;
00547
00548 QValueVector<QString> mCustomTemplates;
00549 QPtrList<KAction> mCustomTemplateActions;
00550
00551 KMSystemTray *mSystemTray;
00552 KConfig *mConfig;
00553 KXMLGUIClient *mGUIClient;
00554
00555 KMail::MessageActions *mMsgActions;
00556
00557 static QValueList<KMMainWidget*>* s_mainWidgetList;
00558
00559 KStatusBarLabel *mVacationScriptIndicator;
00560 bool mVacationIndicatorActive;
00561 };
00562
00563 #endif
00564