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 
00014 #include "kmailIface.h"
00015 
00016 #define kmkernel KMKernel::self()
00017 #define kmconfig KMKernel::config()
00018 
00019 namespace KIO {
00020   class Job;
00021 }
00022 namespace KMail {
00023   class MailServiceImpl;
00024   class UndoStack;
00025 }
00026 using KMail::MailServiceImpl;
00027 using KMail::UndoStack;
00028 class KMMsgIndex;
00029 class QLabel;
00030 class KMFolder;
00031 class KMFolderMgr;
00032 class KMAcctMgr;
00033 class KMFilterMgr;
00034 class KMFilterActionDict;
00035 class KMSender;
00036 class KMIdentity;
00037 class KMKernel;
00038 class KMMsgDict;
00039 class IdentityManager;
00040 class KProcess;
00041 class KProgressDialog;
00042 class CryptPlugWrapperList;
00043 class ConfigureDialog;
00044 class KInstance;
00045 class QTimer;
00046 class KProgress;
00047 class KPassivePopup;
00048 class KMMainWin;
00049 class KMainWindow;
00050 class KMGroupware;
00051 class KMailICalIfaceImpl;
00052 class KMReaderWin;
00053 class KSystemTray;
00054 
00055 class KMKernel : public QObject, virtual public KMailIface
00056 {
00057   Q_OBJECT
00058 
00059 public:
00060   KMKernel (QObject *parent=0, const char *name=0);
00061   ~KMKernel ();
00062 
00064   void setCanExpire(bool expire);
00065   bool canExpire();
00066 
00069   void checkMail ();
00070   QStringList accounts();
00071   void checkAccount (const QString &account);
00073   int openComposer (const QString &to, const QString &cc, const QString &bcc,
00074                     const QString &subject, const QString &body, int hidden,
00075                     const KURL &messageFile, const KURL::List &attachURLs);
00077   int openComposer (const QString &to, const QString &cc, const QString &bcc,
00078                     const QString &subject, const QString &body, int hidden,
00079                     const KURL &messageFile, const KURL& attachURL)
00080   {
00081     return openComposer(to, cc, bcc, subject, body, hidden, messageFile, KURL::List(attachURL));
00082   }
00084   int openComposer (const QString &to, const QString &cc, const QString &bcc,
00085                     const QString &subject, const QString &body, int hidden,
00086                     const KURL &messageFile)
00087   {
00088     return openComposer(to, cc, bcc, subject, body, hidden, messageFile, KURL::List());
00089   }
00090   int openComposer (const QString &to, const QString &cc,
00091                     const QString &bcc, const QString &subject,
00092                     const QString &body, int hidden,
00093                     const QString &attachName,
00094                     const QCString &attachCte,
00095                     const QCString &attachData,
00096                     const QCString &attachType,
00097                     const QCString &attachSubType,
00098                     const QCString &attachParamAttr,
00099                     const QString &attachParamValue,
00100                     const QCString &attachContDisp);
00101   DCOPRef openComposer(const QString &to, const QString &cc,
00102                        const QString &bcc, const QString &subject,
00103                        const QString &body,bool hidden);
00104 
00105   int sendCertificate( const QString& to, const QByteArray& certData );
00106 
00107   void openReader() { openReader( false ); }
00108   void compactAllFolders();
00109   int dcopAddMessage(const QString & foldername, const QString & messageFile);
00110   int dcopAddMessage(const QString & foldername, const KURL & messageFile);
00111   void requestAddresses( QString filename );
00112   bool storeAddresses( QString addresses, QStringList delUIDs );
00113   QStringList folderList() const;
00114   DCOPRef getFolder( const QString& vpath );
00115   virtual bool showMail( Q_UINT32 serialNumber, QString messageId );
00118   static KMKernel *self() { return mySelf; }
00119   static KConfig *config();
00120 
00121   void init ();
00122   void cleanupImapFolders();
00123   void testDir(const char *_name);
00124   void recoverDeadLetters(void);
00125   void initFolders(KConfig* cfg);
00126   void closeAllKMTopLevelWidgets();
00127   void notClosedByUser();
00128   void cleanup(void);
00129   void quit();
00130   void transferMail(void);
00131   void ungrabPtrKb(void);
00132   void kmailMsgHandler(QtMsgType aType, const char* aMsg);
00133   bool doSessionManagement();
00134   bool firstInstance() { return the_firstInstance; }
00135   void setFirstInstance(bool value) { the_firstInstance = value; }
00136   void action (bool mailto, bool check, const QString &to, const QString &cc,
00137                const QString &bcc, const QString &subj, const QString &body,
00138            const KURL &messageFile, const KURL::List &attach);
00139   void byteArrayToRemoteFile(const QByteArray&, const KURL&,
00140                  bool overwrite = FALSE);
00141   bool folderIsDraftOrOutbox(const KMFolder *);
00142   bool folderIsTrash(KMFolder *);
00146   bool folderIsSentMailFolder( const KMFolder * );
00147 
00148   KInstance *xmlGuiInstance() { return mXmlGuiInstance; }
00149   void setXmlGuiInstance( KInstance *instance ) { mXmlGuiInstance = instance; }
00150 
00151   KMFolder *inboxFolder() { return the_inboxFolder; }
00152   KMFolder *outboxFolder() { return the_outboxFolder; }
00153   KMFolder *sentFolder() { return the_sentFolder; }
00154   KMFolder *trashFolder() { return the_trashFolder; }
00155   KMFolder *draftsFolder() { return the_draftsFolder; }
00156 
00157   KMFolderMgr *folderMgr() { return the_folderMgr; }
00158   KMFolderMgr *imapFolderMgr() { return the_imapFolderMgr; }
00159   KMFolderMgr *dimapFolderMgr() { return the_dimapFolderMgr; }
00160   KMFolderMgr *searchFolderMgr() { return the_searchFolderMgr; }
00161   UndoStack *undoStack() { return the_undoStack; }
00162   KMAcctMgr *acctMgr() { return the_acctMgr; }
00163   KMFilterMgr *filterMgr() { return the_filterMgr; }
00164   KMFilterMgr *popFilterMgr() { return the_popFilterMgr; }
00165   KMFilterActionDict *filterActionDict() { return the_filterActionDict; }
00166   KMSender *msgSender() { return the_msgSender; }
00167   KMMsgDict *msgDict();
00168   KMMsgIndex *msgIndex();
00169 
00170   KPIM::ThreadWeaver::Weaver *weaver() { return the_weaver; }
00172   IdentityManager *identityManager();
00173   CryptPlugWrapperList * cryptPlugList() const { return mCryptPlugList; }
00174 
00175   KMGroupware& groupware();
00176   KMailICalIfaceImpl& iCalIface();
00177 
00178   bool firstStart() { return the_firstStart; }
00179   QString previousVersion() { return the_previousVersion; }
00180   bool startingUp() { return the_startingUp; }
00181   void setStartingUp (bool flag) { the_startingUp = flag; }
00182   bool shuttingDown() { return the_shuttingDown; }
00183   void setShuttingDown(bool flag) { the_shuttingDown = flag; }
00184   void serverReady (bool flag) { the_server_is_ready = flag; }
00185 
00190   bool haveSystemTrayApplet();
00191 
00192   bool registerSystemTrayApplet( const KSystemTray* );
00193   bool unregisterSystemTrayApplet( const KSystemTray* );
00194 
00196   bool handleCommandLine( bool noArgsOpensReader );
00197   void emergencyExit( const QString& reason );
00198 
00200   unsigned long getNextMsgSerNum();
00201   QTextCodec *networkCodec() { return netCodec; }
00202 
00204   QByteArray getCollectedStdOut(KProcess*);
00206   QByteArray getCollectedStdErr(KProcess*);
00207 
00209   KMainWindow* mainWin();
00210 
00211   // ### The mContextMenuShown flag is necessary to work around bug# 56693
00212   // ### (kmail freeze with the complete desktop while pinentry-qt appears)
00213   // ### FIXME: Once the encryption support is asynchron this can be removed
00214   // ### again.
00215   void setContextMenuShown( bool flag ) { mContextMenuShown = flag; }
00216   bool contextMenuShown() const { return mContextMenuShown; }
00217 
00218 public slots:
00219   //Save contents of all open composer widnows to ~/dead.letter
00220   void dumpDeadLetters();
00221 
00235   void slotCollectStdOut(KProcess*,char*,int);
00237   void slotCollectStdErr(KProcess*,char*,int);
00238 
00244   void slotRequestConfigSync();
00245 
00247   void slotEmptyTrash();
00248 
00249   void slotShowConfigurationDialog();
00250 
00251 protected slots:
00252   void slotDataReq(KIO::Job*,QByteArray&);
00253   void slotResult(KIO::Job*);
00254   void cleanupLoop();
00255   void cleanupProgress();
00256 
00257 signals:
00258   void configChanged();
00259 
00260 private:
00261   void openReader( bool onlyCheck );
00262 
00263   KMFolder *the_inboxFolder;
00264   KMFolder *the_outboxFolder;
00265   KMFolder *the_sentFolder;
00266   KMFolder *the_trashFolder;
00267   KMFolder *the_draftsFolder;
00268 
00269   KMFolderMgr *the_folderMgr;
00270   KMFolderMgr *the_imapFolderMgr;
00271   KMFolderMgr *the_dimapFolderMgr;
00272   KMFolderMgr *the_searchFolderMgr;
00273   UndoStack *the_undoStack;
00274   KMAcctMgr *the_acctMgr;
00275   KMFilterMgr *the_filterMgr;
00276   KMFilterMgr *the_popFilterMgr;
00277   KMFilterActionDict *the_filterActionDict;
00278   mutable IdentityManager *mIdentityManager;
00279   KMSender *the_msgSender;
00280   KMMsgDict *the_msgDict;
00281   KMMsgIndex *the_msgIndex;
00282   struct putData
00283   {
00284     KURL url;
00285     QByteArray data;
00286     int offset;
00287   };
00288   QMap<KIO::Job *, putData> mPutJobs;
00289   QMap<KProcess*,QByteArray> mStdOutCollection;
00290   QMap<KProcess*,QByteArray> mStdErrCollection;
00293   QString the_previousVersion;
00295   bool the_firstStart;
00297   bool the_startingUp;
00299   bool the_shuttingDown;
00301   bool the_server_is_ready;
00303   bool closed_by_user;
00304   bool allowedToExpire;
00305   bool the_firstInstance;
00306   static KMKernel *mySelf;
00307 #if KDE_IS_VERSION( 3, 1, 92 )
00308   KSharedConfig::Ptr mConfig;
00309 #else
00310   static KConfig * myConfig;
00311 #endif
00312   QTextCodec *netCodec;
00313   KProgress *mProgress;
00314   KPassivePopup *mCleanupPopup;
00315   QLabel *mCleanupLabel;
00316   CryptPlugWrapperList *mCryptPlugList;
00317   KInstance* mXmlGuiInstance;
00318   ConfigureDialog *mConfigureDialog;
00319   QTimer *mDeadLetterTimer;
00320   int mDeadLetterInterval;
00321   KMGroupware * mGroupware;
00322   KMailICalIfaceImpl* mICalIface;
00323   // temporary mainwin
00324   KMMainWin *mWin;
00325   MailServiceImpl *mMailService;
00326 
00327   // true if the context menu of KMFolderTree or KMHeaders is shown
00328   // this is necessary to know in order to prevent a dead lock between the
00329   // context menus and the pinentry program
00330   bool mContextMenuShown;
00331 
00332   QValueList<const KSystemTray*> systemTrayApplets;
00333 
00334   /* Weaver */
00335   KPIM::ThreadWeaver::Weaver *the_weaver;
00336   KPIM::ThreadWeaver::WeaverThreadLogger *the_weaverLogger;
00337 };
00338 
00339 #endif
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:29 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003