kmail Library API Documentation

kmkernel.h

00001 // -*- mode: C++; c-file-style: "gnu" -*- 00002 00003 #ifndef _KMCONTROL 00004 #define _KMCONTROL 00005 00006 #include <qobject.h> 00007 #include <qstring.h> 00008 #include <weaver.h> 00009 #include <weaverlogger.h> 00010 00011 #include <kconfig.h> 00012 #include <kdeversion.h> 00013 #include "kimproxy.h" 00014 00015 #include "kmailIface.h" 00016 00017 #define kmkernel KMKernel::self() 00018 #define kmconfig KMKernel::config() 00019 00020 namespace KIO { 00021 class Job; 00022 } 00023 namespace KMail { 00024 class MailServiceImpl; 00025 class UndoStack; 00026 class JobScheduler; 00027 } 00028 namespace KPIM { class ProgressDialog; } 00029 using KMail::MailServiceImpl; 00030 using KMail::UndoStack; 00031 using KMail::JobScheduler; 00032 using KPIM::ProgressDialog; 00033 class KMMsgIndex; 00034 class QLabel; 00035 class KMFolder; 00036 class KMFolderMgr; 00037 class KMAcctMgr; 00038 class KMFilterMgr; 00039 class KMFilterActionDict; 00040 class KMSender; 00041 namespace KPIM { 00042 class Identity; 00043 class IdentityManager; 00044 } 00045 class KMKernel; 00046 class KMMsgDict; 00047 class KProcess; 00048 class KProgressDialog; 00049 class ConfigureDialog; 00050 class KInstance; 00051 class QTimer; 00052 class KProgress; 00053 class KPassivePopup; 00054 class KMMainWin; 00055 class KMainWindow; 00056 class KMGroupware; 00057 class KMailICalIfaceImpl; 00058 class KMReaderWin; 00059 class KSystemTray; 00060 class KMMainWidget; 00061 00062 class KMKernel : public QObject, virtual public KMailIface 00063 { 00064 Q_OBJECT 00065 00066 public: 00067 KMKernel (QObject *parent=0, const char *name=0); 00068 ~KMKernel (); 00069 00072 void checkMail (); 00073 QStringList accounts(); 00074 void checkAccount (const QString &account); 00076 int openComposer (const QString &to, const QString &cc, const QString &bcc, 00077 const QString &subject, const QString &body, int hidden, 00078 const KURL &messageFile, const KURL::List &attachURLs); 00080 int openComposer (const QString &to, const QString &cc, const QString &bcc, 00081 const QString &subject, const QString &body, int hidden, 00082 const KURL &messageFile, const KURL& attachURL) 00083 { 00084 return openComposer(to, cc, bcc, subject, body, hidden, messageFile, KURL::List(attachURL)); 00085 } 00087 int openComposer (const QString &to, const QString &cc, const QString &bcc, 00088 const QString &subject, const QString &body, int hidden, 00089 const KURL &messageFile) 00090 { 00091 return openComposer(to, cc, bcc, subject, body, hidden, messageFile, KURL::List()); 00092 } 00096 int openComposer (const QString &to, const QString &cc, 00097 const QString &bcc, const QString &subject, 00098 const QString &body, int hidden, 00099 const QString &attachName, 00100 const QCString &attachCte, 00101 const QCString &attachData, 00102 const QCString &attachType, 00103 const QCString &attachSubType, 00104 const QCString &attachParamAttr, 00105 const QString &attachParamValue, 00106 const QCString &attachContDisp); 00107 00108 int openComposer (const QString &to, const QString &cc, 00109 const QString &bcc, const QString &subject, 00110 const QString &body, int hidden, 00111 const QString &attachName, 00112 const QCString &attachCte, 00113 const QCString &attachData, 00114 const QCString &attachType, 00115 const QCString &attachSubType, 00116 const QCString &attachParamAttr, 00117 const QString &attachParamValue, 00118 const QCString &attachContDisp, 00119 const QCString &attachCharset); 00120 00121 DCOPRef openComposer(const QString &to, const QString &cc, 00122 const QString &bcc, const QString &subject, 00123 const QString &body,bool hidden); 00124 00126 DCOPRef newMessage(); 00127 00128 int sendCertificate( const QString& to, const QByteArray& certData ); 00129 00130 void openReader() { openReader( false ); } 00131 int dcopAddMessage(const QString & foldername, const QString & messageFile); 00132 int dcopAddMessage(const QString & foldername, const KURL & messageFile); 00133 QStringList folderList() const; 00134 DCOPRef getFolder( const QString& vpath ); 00135 void selectFolder( QString folder ); 00136 int timeOfLastMessageCountChange() const; 00137 virtual bool showMail( Q_UINT32 serialNumber, QString messageId ); 00138 virtual QString getFrom( Q_UINT32 serialNumber ); 00139 int viewMessage( const KURL & messageFile ); 00140 00143 static KMKernel *self() { return mySelf; } 00144 static KConfig *config(); 00145 00146 void init(); 00147 void readConfig(); 00148 void cleanupImapFolders(); 00149 void testDir(const char *_name); 00150 void recoverDeadLetters(void); 00151 void initFolders(KConfig* cfg); 00152 void closeAllKMailWindows(); 00153 void cleanup(void); 00154 void quit(); 00155 void transferMail(void); 00156 bool transferMailToPointMail(void); 00157 00158 void ungrabPtrKb(void); 00159 void kmailMsgHandler(QtMsgType aType, const char* aMsg); 00160 bool doSessionManagement(); 00161 bool firstInstance() { return the_firstInstance; } 00162 void setFirstInstance(bool value) { the_firstInstance = value; } 00163 void action (bool mailto, bool check, const QString &to, const QString &cc, 00164 const QString &bcc, const QString &subj, const QString &body, 00165 const KURL &messageFile, const KURL::List &attach); 00166 void byteArrayToRemoteFile(const QByteArray&, const KURL&, 00167 bool overwrite = FALSE); 00168 bool folderIsDraftOrOutbox(const KMFolder *); 00169 bool folderIsTrash(KMFolder *); 00173 bool folderIsSentMailFolder( const KMFolder * ); 00177 KMFolder* findFolderById( const QString& idString ); 00178 00179 KInstance *xmlGuiInstance() { return mXmlGuiInstance; } 00180 void setXmlGuiInstance( KInstance *instance ) { mXmlGuiInstance = instance; } 00181 00182 KMFolder *inboxFolder() { return the_inboxFolder; } 00183 KMFolder *outboxFolder() { return the_outboxFolder; } 00184 KMFolder *sentFolder() { return the_sentFolder; } 00185 KMFolder *trashFolder() { return the_trashFolder; } 00186 KMFolder *draftsFolder() { return the_draftsFolder; } 00187 00188 KMFolderMgr *folderMgr() { return the_folderMgr; } 00189 KMFolderMgr *imapFolderMgr() { return the_imapFolderMgr; } 00190 KMFolderMgr *dimapFolderMgr() { return the_dimapFolderMgr; } 00191 KMFolderMgr *searchFolderMgr() { return the_searchFolderMgr; } 00192 UndoStack *undoStack() { return the_undoStack; } 00193 KMAcctMgr *acctMgr() { return the_acctMgr; } 00194 KMFilterMgr *filterMgr() { return the_filterMgr; } 00195 KMFilterMgr *popFilterMgr() { return the_popFilterMgr; } 00196 KMFilterActionDict *filterActionDict() { return the_filterActionDict; } 00197 KMSender *msgSender() { return the_msgSender; } 00198 KMMsgDict *msgDict(); 00199 KMMsgIndex *msgIndex(); 00200 00201 KPIM::ThreadWeaver::Weaver *weaver() { return the_weaver; } 00203 KPIM::IdentityManager *identityManager(); 00204 00205 JobScheduler* jobScheduler() { return mJobScheduler; } 00206 00208 void compactAllFolders(); 00210 void expireAllFoldersNow(); 00211 00212 KMGroupware& groupware(); 00213 KMailICalIfaceImpl& iCalIface(); 00214 00215 bool firstStart() { return the_firstStart; } 00216 QString previousVersion() { return the_previousVersion; } 00217 bool startingUp() { return the_startingUp; } 00218 void setStartingUp (bool flag) { the_startingUp = flag; } 00219 bool shuttingDown() { return the_shuttingDown; } 00220 void setShuttingDown(bool flag) { the_shuttingDown = flag; } 00221 void serverReady (bool flag) { the_server_is_ready = flag; } 00222 00227 bool haveSystemTrayApplet(); 00228 00229 bool registerSystemTrayApplet( const KSystemTray* ); 00230 bool unregisterSystemTrayApplet( const KSystemTray* ); 00231 00233 bool handleCommandLine( bool noArgsOpensReader ); 00234 void emergencyExit( const QString& reason ); 00235 00237 unsigned long getNextMsgSerNum(); 00238 QTextCodec *networkCodec() { return netCodec; } 00239 00241 KMainWindow* mainWin(); 00242 00243 // ### The mContextMenuShown flag is necessary to work around bug# 56693 00244 // ### (kmail freeze with the complete desktop while pinentry-qt appears) 00245 // ### FIXME: Once the encryption support is asynchron this can be removed 00246 // ### again. 00247 void setContextMenuShown( bool flag ) { mContextMenuShown = flag; } 00248 bool contextMenuShown() const { return mContextMenuShown; } 00249 00254 ::KIMProxy* imProxy(); 00255 00260 bool mailCheckAborted() const; 00264 void enableMailCheck(); 00270 void abortMailCheck(); 00271 00272 bool canQueryClose(); 00273 00277 void messageCountChanged(); 00278 00279 public slots: 00280 00282 void dumpDeadLetters(); 00283 00289 void slotRequestConfigSync(); 00290 00292 void slotEmptyTrash(); 00293 00294 void slotShowConfigurationDialog(); 00295 void slotRunBackgroundTasks(); 00296 00297 protected slots: 00298 void slotDataReq(KIO::Job*,QByteArray&); 00299 void slotResult(KIO::Job*); 00300 void slotConfigChanged(); 00301 00302 signals: 00303 void configChanged(); 00304 void folderRemoved( KMFolder* aFolder ); 00305 00306 private: 00307 void openReader( bool onlyCheck ); 00308 KMMainWidget *getKMMainWidget(); 00309 00310 KMFolder *the_inboxFolder; 00311 KMFolder *the_outboxFolder; 00312 KMFolder *the_sentFolder; 00313 KMFolder *the_trashFolder; 00314 KMFolder *the_draftsFolder; 00315 00316 KMFolderMgr *the_folderMgr; 00317 KMFolderMgr *the_imapFolderMgr; 00318 KMFolderMgr *the_dimapFolderMgr; 00319 KMFolderMgr *the_searchFolderMgr; 00320 UndoStack *the_undoStack; 00321 KMAcctMgr *the_acctMgr; 00322 KMFilterMgr *the_filterMgr; 00323 KMFilterMgr *the_popFilterMgr; 00324 KMFilterActionDict *the_filterActionDict; 00325 mutable KPIM::IdentityManager *mIdentityManager; 00326 KMSender *the_msgSender; 00327 KMMsgDict *the_msgDict; 00328 KMMsgIndex *the_msgIndex; 00329 struct putData 00330 { 00331 KURL url; 00332 QByteArray data; 00333 int offset; 00334 }; 00335 QMap<KIO::Job *, putData> mPutJobs; 00338 QString the_previousVersion; 00340 bool the_firstStart; 00342 bool the_startingUp; 00344 bool the_shuttingDown; 00346 bool the_server_is_ready; 00348 bool closed_by_user; 00349 bool the_firstInstance; 00350 bool mMailCheckAborted; 00351 static KMKernel *mySelf; 00352 KSharedConfig::Ptr mConfig; 00353 QTextCodec *netCodec; 00354 KInstance* mXmlGuiInstance; 00355 ConfigureDialog *mConfigureDialog; 00356 QTimer *mDeadLetterTimer; 00357 int mDeadLetterInterval; 00358 QTimer *mBackgroundTasksTimer; 00359 KMGroupware * mGroupware; 00360 KMailICalIfaceImpl* mICalIface; 00361 JobScheduler* mJobScheduler; 00362 // temporary mainwin 00363 KMMainWin *mWin; 00364 MailServiceImpl *mMailService; 00365 00366 // the time of the last change of the unread or total count of a folder; 00367 // this can be queried via DCOP in order to determine whether the counts 00368 // need to be updated (e.g. in the Summary in Kontact) 00369 int mTimeOfLastMessageCountChange; 00370 00371 // true if the context menu of KMFolderTree or KMHeaders is shown 00372 // this is necessary to know in order to prevent a dead lock between the 00373 // context menus and the pinentry program 00374 bool mContextMenuShown; 00375 00376 QValueList<const KSystemTray*> systemTrayApplets; 00377 00378 /* Weaver */ 00379 KPIM::ThreadWeaver::Weaver *the_weaver; 00380 KPIM::ThreadWeaver::WeaverThreadLogger *the_weaverLogger; 00381 }; 00382 00383 #endif
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003