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 00125 int sendCertificate( const QString& to, const QByteArray& certData ); 00126 00127 void openReader() { openReader( false ); } 00128 int dcopAddMessage(const QString & foldername, const QString & messageFile); 00129 int dcopAddMessage(const QString & foldername, const KURL & messageFile); 00130 QStringList folderList() const; 00131 DCOPRef getFolder( const QString& vpath ); 00132 void selectFolder( QString folder ); 00133 int timeOfLastMessageCountChange() const; 00134 virtual bool showMail( Q_UINT32 serialNumber, QString messageId ); 00135 virtual QString getFrom( Q_UINT32 serialNumber ); 00136 int viewMessage( const KURL & messageFile ); 00137 00140 static KMKernel *self() { return mySelf; } 00141 static KConfig *config(); 00142 00143 void init(); 00144 void readConfig(); 00145 void cleanupImapFolders(); 00146 void testDir(const char *_name); 00147 void recoverDeadLetters(void); 00148 void initFolders(KConfig* cfg); 00149 void closeAllKMailWindows(); 00150 void cleanup(void); 00151 void quit(); 00152 void transferMail(void); 00153 void ungrabPtrKb(void); 00154 void kmailMsgHandler(QtMsgType aType, const char* aMsg); 00155 bool doSessionManagement(); 00156 bool firstInstance() { return the_firstInstance; } 00157 void setFirstInstance(bool value) { the_firstInstance = value; } 00158 void action (bool mailto, bool check, const QString &to, const QString &cc, 00159 const QString &bcc, const QString &subj, const QString &body, 00160 const KURL &messageFile, const KURL::List &attach); 00161 void byteArrayToRemoteFile(const QByteArray&, const KURL&, 00162 bool overwrite = FALSE); 00163 bool folderIsDraftOrOutbox(const KMFolder *); 00164 bool folderIsTrash(KMFolder *); 00168 bool folderIsSentMailFolder( const KMFolder * ); 00172 KMFolder* findFolderById( const QString& idString ); 00173 00174 KInstance *xmlGuiInstance() { return mXmlGuiInstance; } 00175 void setXmlGuiInstance( KInstance *instance ) { mXmlGuiInstance = instance; } 00176 00177 KMFolder *inboxFolder() { return the_inboxFolder; } 00178 KMFolder *outboxFolder() { return the_outboxFolder; } 00179 KMFolder *sentFolder() { return the_sentFolder; } 00180 KMFolder *trashFolder() { return the_trashFolder; } 00181 KMFolder *draftsFolder() { return the_draftsFolder; } 00182 00183 KMFolderMgr *folderMgr() { return the_folderMgr; } 00184 KMFolderMgr *imapFolderMgr() { return the_imapFolderMgr; } 00185 KMFolderMgr *dimapFolderMgr() { return the_dimapFolderMgr; } 00186 KMFolderMgr *searchFolderMgr() { return the_searchFolderMgr; } 00187 UndoStack *undoStack() { return the_undoStack; } 00188 KMAcctMgr *acctMgr() { return the_acctMgr; } 00189 KMFilterMgr *filterMgr() { return the_filterMgr; } 00190 KMFilterMgr *popFilterMgr() { return the_popFilterMgr; } 00191 KMFilterActionDict *filterActionDict() { return the_filterActionDict; } 00192 KMSender *msgSender() { return the_msgSender; } 00193 KMMsgDict *msgDict(); 00194 KMMsgIndex *msgIndex(); 00195 00196 KPIM::ThreadWeaver::Weaver *weaver() { return the_weaver; } 00198 KPIM::IdentityManager *identityManager(); 00199 00200 JobScheduler* jobScheduler() { return mJobScheduler; } 00201 00203 void compactAllFolders(); 00205 void expireAllFoldersNow(); 00206 00207 KMGroupware& groupware(); 00208 KMailICalIfaceImpl& iCalIface(); 00209 00210 bool firstStart() { return the_firstStart; } 00211 QString previousVersion() { return the_previousVersion; } 00212 bool startingUp() { return the_startingUp; } 00213 void setStartingUp (bool flag) { the_startingUp = flag; } 00214 bool shuttingDown() { return the_shuttingDown; } 00215 void setShuttingDown(bool flag) { the_shuttingDown = flag; } 00216 void serverReady (bool flag) { the_server_is_ready = flag; } 00217 00222 bool haveSystemTrayApplet(); 00223 00224 bool registerSystemTrayApplet( const KSystemTray* ); 00225 bool unregisterSystemTrayApplet( const KSystemTray* ); 00226 00228 bool handleCommandLine( bool noArgsOpensReader ); 00229 void emergencyExit( const QString& reason ); 00230 00232 unsigned long getNextMsgSerNum(); 00233 QTextCodec *networkCodec() { return netCodec; } 00234 00236 KMainWindow* mainWin(); 00237 00238 // ### The mContextMenuShown flag is necessary to work around bug# 56693 00239 // ### (kmail freeze with the complete desktop while pinentry-qt appears) 00240 // ### FIXME: Once the encryption support is asynchron this can be removed 00241 // ### again. 00242 void setContextMenuShown( bool flag ) { mContextMenuShown = flag; } 00243 bool contextMenuShown() const { return mContextMenuShown; } 00244 00249 ::KIMProxy* imProxy(); 00250 00255 bool mailCheckAborted() const; 00259 void enableMailCheck(); 00265 void abortMailCheck(); 00266 00267 bool canQueryClose(); 00268 00272 void messageCountChanged(); 00273 00274 public slots: 00275 00277 void dumpDeadLetters(); 00278 00284 void slotRequestConfigSync(); 00285 00287 void slotEmptyTrash(); 00288 00289 void slotShowConfigurationDialog(); 00290 void slotRunBackgroundTasks(); 00291 00292 protected slots: 00293 void slotDataReq(KIO::Job*,QByteArray&); 00294 void slotResult(KIO::Job*); 00295 void slotConfigChanged(); 00296 00297 signals: 00298 void configChanged(); 00299 void folderRemoved( KMFolder* aFolder ); 00300 00301 private: 00302 void openReader( bool onlyCheck ); 00303 KMMainWidget *getKMMainWidget(); 00304 00305 KMFolder *the_inboxFolder; 00306 KMFolder *the_outboxFolder; 00307 KMFolder *the_sentFolder; 00308 KMFolder *the_trashFolder; 00309 KMFolder *the_draftsFolder; 00310 00311 KMFolderMgr *the_folderMgr; 00312 KMFolderMgr *the_imapFolderMgr; 00313 KMFolderMgr *the_dimapFolderMgr; 00314 KMFolderMgr *the_searchFolderMgr; 00315 UndoStack *the_undoStack; 00316 KMAcctMgr *the_acctMgr; 00317 KMFilterMgr *the_filterMgr; 00318 KMFilterMgr *the_popFilterMgr; 00319 KMFilterActionDict *the_filterActionDict; 00320 mutable KPIM::IdentityManager *mIdentityManager; 00321 KMSender *the_msgSender; 00322 KMMsgDict *the_msgDict; 00323 KMMsgIndex *the_msgIndex; 00324 struct putData 00325 { 00326 KURL url; 00327 QByteArray data; 00328 int offset; 00329 }; 00330 QMap<KIO::Job *, putData> mPutJobs; 00333 QString the_previousVersion; 00335 bool the_firstStart; 00337 bool the_startingUp; 00339 bool the_shuttingDown; 00341 bool the_server_is_ready; 00343 bool closed_by_user; 00344 bool the_firstInstance; 00345 bool mMailCheckAborted; 00346 static KMKernel *mySelf; 00347 KSharedConfig::Ptr mConfig; 00348 QTextCodec *netCodec; 00349 KInstance* mXmlGuiInstance; 00350 ConfigureDialog *mConfigureDialog; 00351 QTimer *mDeadLetterTimer; 00352 int mDeadLetterInterval; 00353 QTimer *mBackgroundTasksTimer; 00354 KMGroupware * mGroupware; 00355 KMailICalIfaceImpl* mICalIface; 00356 JobScheduler* mJobScheduler; 00357 // temporary mainwin 00358 KMMainWin *mWin; 00359 MailServiceImpl *mMailService; 00360 00361 // the time of the last change of the unread or total count of a folder; 00362 // this can be queried via DCOP in order to determine whether the counts 00363 // need to be updated (e.g. in the Summary in Kontact) 00364 int mTimeOfLastMessageCountChange; 00365 00366 // true if the context menu of KMFolderTree or KMHeaders is shown 00367 // this is necessary to know in order to prevent a dead lock between the 00368 // context menus and the pinentry program 00369 bool mContextMenuShown; 00370 00371 QValueList<const KSystemTray*> systemTrayApplets; 00372 00373 /* Weaver */ 00374 KPIM::ThreadWeaver::Weaver *the_weaver; 00375 KPIM::ThreadWeaver::WeaverThreadLogger *the_weaverLogger; 00376 }; 00377 00378 #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 Fri Aug 27 12:52:39 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003