• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmail

kmkernel.h

Go to the documentation of this file.
00001 // -*- mode: C++; c-file-style: "gnu" -*-
00002 
00003 #ifndef _KMKERNEL_H
00004 #define _KMKERNEL_H
00005 
00006 #include <QByteArray>
00007 #include <QList>
00008 #include <QObject>
00009 #include <QString>
00010 #include <QPointer>
00011 #include <QDBusObjectPath>
00012 #include <threadweaver/ThreadWeaver.h>
00013 
00014 #include <kconfig.h>
00015 #include <kdeversion.h>
00016 #include <kurl.h>
00017 
00018 #include "kmail_export.h"
00019 #include "kmmsgbase.h"
00020 #include "kmmessagetag.h"
00021 #include "globalsettings.h"
00022 #include <kcomponentdata.h>
00023 
00024 #define kmkernel KMKernel::self()
00025 #define kmconfig KMKernel::config()
00026 
00027 namespace KIO {
00028   class Job;
00029 }
00030 namespace KWallet {
00031   class Wallet;
00032 }
00033 
00034 class KJob;
00039 namespace KMail {
00040   class MailServiceImpl;
00041   class UndoStack;
00042   class JobScheduler;
00043   class MessageSender;
00044   class AccountManager;
00045   class FolderAdaptor;
00046 }
00047 namespace KPIM { class ProgressDialog; }
00048 using KMail::MailServiceImpl;
00049 using KMail::AccountManager;
00050 using KMail::UndoStack;
00051 using KMail::JobScheduler;
00052 using KPIM::ProgressDialog;
00053 class QLabel;
00054 class KMFolder;
00055 class KMFolderMgr;
00056 class KMFilterMgr;
00057 class KMFilterActionDict;
00058 class KMSender;
00059 namespace KPIMIdentities {
00060   class Identity;
00061   class IdentityManager;
00062 }
00063 class KMKernel;
00064 class KComponentData;
00065 class QTimer;
00066 class KMMainWin;
00067 class KMainWindow;
00068 class KMailICalIfaceImpl;
00069 class KSystemTrayIcon;
00070 class KMMainWidget;
00071 class ConfigureDialog;
00072 class KMMessageTagMgr;
00073 
00083 class KMAIL_EXPORT KMKernel : public QObject
00084 {
00085   Q_OBJECT
00086   Q_CLASSINFO("D-Bus Interface", "org.kde.kmail.kmail")
00087 
00088 public:
00089   explicit KMKernel (QObject *parent=0, const char *name=0);
00090   ~KMKernel ();
00091 
00096 public Q_SLOTS:
00097 
00098   Q_SCRIPTABLE void checkMail();
00099   Q_SCRIPTABLE void openReader() { openReader( false ); }
00100 
00104   Q_SCRIPTABLE void compactAllFolders();
00105 
00110   Q_SCRIPTABLE void pauseBackgroundJobs();
00111 
00116   Q_SCRIPTABLE void resumeBackgroundJobs();
00117 
00122   Q_SCRIPTABLE void stopNetworkJobs();
00123 
00128   Q_SCRIPTABLE void resumeNetworkJobs();
00129 
00130   Q_SCRIPTABLE QStringList folderList() const;
00131 
00132   Q_SCRIPTABLE QStringList accounts();
00133 
00139   Q_SCRIPTABLE void checkAccount( const QString & account );
00140 
00141   Q_SCRIPTABLE void selectFolder( const QString & folder );
00142 
00143   Q_SCRIPTABLE QString getFolder( const QString & vpath );
00144 
00145   Q_SCRIPTABLE bool canQueryClose();
00146 
00150   Q_SCRIPTABLE void setDefaultTransport( const QString & transport );
00151 
00152   Q_SCRIPTABLE int timeOfLastMessageCountChange() const;
00153 
00154   Q_SCRIPTABLE int dbusAddMessage( const QString & foldername,
00155                                    const QString & messageFile,
00156                                    const QString & MsgStatusFlags = QString() );
00157 
00161   Q_SCRIPTABLE int dbusAddMessage_fastImport( const QString & foldername,
00162                                               const QString & messageFile,
00163                                               const QString & MsgStatusFlags = QString() );
00164 
00165   Q_SCRIPTABLE void dbusResetAddMessage();
00166 
00167   Q_SCRIPTABLE int sendCertificate( const QString & to,
00168                                     const QByteArray & certData );
00169 
00170   Q_SCRIPTABLE bool handleCommandLine( bool noArgsOpensReader );
00171 
00172   Q_SCRIPTABLE QString debugScheduler();
00173 
00177   Q_SCRIPTABLE int openComposer( const QString & to,
00178                                  const QString & cc,
00179                                  const QString & bcc,
00180                                  const QString & subject,
00181                                  const QString & body,
00182                                  bool hidden,
00183                                  const QString & messageFile,
00184                                  const QStringList & attachmentPaths,
00185                                  const QStringList & customHeaders );
00186 
00187   Q_SCRIPTABLE int openComposer( const QString & to,
00188                                  const QString & cc,
00189                                  const QString & bcc,
00190                                  const QString & subject,
00191                                  const QString & body,
00192                                  bool hidden,
00193                                  const QString & attachName,
00194                                  const QByteArray & attachCte,
00195                                  const QByteArray  &attachData,
00196                                  const QByteArray & attachType,
00197                                  const QByteArray & attachSubType,
00198                                  const QByteArray & attachParamAttr,
00199                                  const QString & attachParamValue,
00200                                  const QByteArray & attachContDisp,
00201                                  const QByteArray & attachCharset,
00202                                  unsigned int identity );
00203 
00204   Q_SCRIPTABLE QDBusObjectPath openComposer( const QString & to,
00205                                              const QString & cc,
00206                                              const QString & bcc,
00207                                              const QString & subject,
00208                                              const QString & body,
00209                                              bool hidden );
00210 
00214   Q_SCRIPTABLE QDBusObjectPath newMessage( const QString & to,
00215                                            const QString & cc,
00216                                            const QString & bcc,
00217                                            bool hidden,
00218                                            bool useFolderId,
00219                                            const QString & messageFile,
00220                                            const QString & attachURL );
00221 
00222   Q_SCRIPTABLE bool showMail( quint32 serialNumber, const QString & messageId );
00223 
00224   Q_SCRIPTABLE QString getFrom( quint32 serialNumber );
00225 
00226   Q_SCRIPTABLE QString debugSernum( quint32 serialNumber );
00227 
00228   Q_SCRIPTABLE int viewMessage( const KUrl & messageFile );
00229 
00230 Q_SIGNALS:
00231 
00232   Q_SCRIPTABLE void unreadCountChanged();
00233 
00239 public:
00240 
00246   static bool askToGoOnline();
00247 
00252   static bool isOffline();
00253 
00256   static KMKernel *self();
00257   static KConfig *config();
00258 
00259   void init();
00260   void setupDBus();
00261   void readConfig();
00262   void cleanupImapFolders();
00263   void testDir(const char *_name);
00264   void recoverDeadLetters();
00265   void initFolders(KConfig* cfg);
00266   void closeAllKMailWindows();
00267   void cleanup(void);
00268   void quit();
00274   bool transferMail( QString & destinationDir );
00275   bool doSessionManagement();
00276   bool firstInstance() { return the_firstInstance; }
00277   void setFirstInstance(bool value) { the_firstInstance = value; }
00278   void action( bool mailto, bool check, const QString &to, const QString &cc,
00279                const QString &bcc, const QString &subj, const QString &body,
00280                const KUrl &messageFile, const KUrl::List &attach,
00281                const QStringList &customHeaders );
00282   void byteArrayToRemoteFile( const QByteArray&, const KUrl&,
00283                               bool overwrite = false );
00284   bool folderIsDraftOrOutbox(const KMFolder *);
00285   bool folderIsDrafts(const KMFolder *);
00286   bool folderIsTemplates(const KMFolder *);
00287   bool folderIsTrash(KMFolder *);
00291   bool folderIsSentMailFolder( const KMFolder * );
00295   KMFolder* findFolderById( const QString& idString );
00296 
00297   const KComponentData &xmlGuiInstance() { return mXmlGuiInstance; }
00298   void setXmlGuiInstance( const KComponentData &instance ) { mXmlGuiInstance = instance; }
00299 
00300   KMFolder *inboxFolder() { return the_inboxFolder; }
00301   KMFolder *outboxFolder() { return the_outboxFolder; }
00302   KMFolder *sentFolder() { return the_sentFolder; }
00303   KMFolder *trashFolder() { return the_trashFolder; }
00304   KMFolder *draftsFolder() { return the_draftsFolder; }
00305   KMFolder *templatesFolder() { return the_templatesFolder; }
00306 
00307   KMFolderMgr *folderMgr() { return the_folderMgr; }
00308   KMFolderMgr *imapFolderMgr() { return the_imapFolderMgr; }
00309   KMFolderMgr *dimapFolderMgr() { return the_dimapFolderMgr; }
00310   KMFolderMgr *searchFolderMgr() { return the_searchFolderMgr; }
00311   UndoStack *undoStack() { return the_undoStack; }
00312   AccountManager *acctMgr() { return the_acctMgr; }
00313   KMFilterMgr *filterMgr() { return the_filterMgr; }
00314   KMFilterMgr *popFilterMgr() { return the_popFilterMgr; }
00315   KMFilterActionDict *filterActionDict() { return the_filterActionDict; }
00316   KMail::MessageSender *msgSender();
00317   KMMessageTagMgr *msgTagMgr() { return the_msgTagMgr; }
00318 
00319   ThreadWeaver::Weaver *weaver() { return the_weaver; }
00321   KPIMIdentities::IdentityManager *identityManager();
00322 
00323   JobScheduler* jobScheduler() { return mJobScheduler; }
00324 
00326   void expireAllFoldersNow();
00327 
00328   KMailICalIfaceImpl& iCalIface();
00329 
00330   bool firstStart() const { return the_firstStart; }
00332   void firstStartDone() { the_firstStart = false; }
00333   QString previousVersion() const { return the_previousVersion; }
00334   bool startingUp() const { return the_startingUp; }
00335   void setStartingUp (bool flag) { the_startingUp = flag; }
00336   bool shuttingDown() const { return the_shuttingDown; }
00337   void setShuttingDown(bool flag) { the_shuttingDown = flag; }
00338   void serverReady (bool flag) { the_server_is_ready = flag; }
00339 
00343   static QString localDataPath();
00344 
00349   bool haveSystemTrayApplet();
00350 
00351   bool registerSystemTrayApplet( const KSystemTrayIcon* );
00352   bool unregisterSystemTrayApplet( const KSystemTrayIcon* );
00353 
00355   void emergencyExit( const QString& reason );
00356 
00358   unsigned long getNextMsgSerNum();
00359   QTextCodec *networkCodec() { return netCodec; }
00360 
00362   KMainWindow* mainWin();
00363 
00364   // ### The mContextMenuShown flag is necessary to work around bug# 56693
00365   // ### (kmail freeze with the complete desktop while pinentry-qt appears)
00366   // ### FIXME: Once the encryption support is asynchron this can be removed
00367   // ### again.
00368   void setContextMenuShown( bool flag ) { mContextMenuShown = flag; }
00369   bool contextMenuShown() const { return mContextMenuShown; }
00370 
00375   bool mailCheckAborted() const;
00379   void enableMailCheck();
00385   void abortMailCheck();
00386 
00390   void messageCountChanged();
00391 
00393   KWallet::Wallet *wallet();
00394 
00396   KMMainWidget *getKMMainWidget();
00397 
00399   QList< QPointer<KMFolder> > allFolders();
00400 
00401   void raise();
00402 
00405   void updatedTemplates();
00406 
00407 public slots:
00408 
00410   void dumpDeadLetters();
00411 
00417   void slotRequestConfigSync();
00418 
00420   void slotEmptyTrash();
00421 
00422   void slotShowConfigurationDialog();
00423   void slotRunBackgroundTasks();
00424 
00425   void slotConfigChanged();
00426 
00427 protected slots:
00428   void slotDataReq(KIO::Job*,QByteArray&);
00429   void slotResult(KJob*);
00430 
00431 signals:
00432   void configChanged();
00433   void folderRemoved( KMFolder* aFolder );
00434   void onlineStatusChanged( GlobalSettings::EnumNetworkState::type );
00435   void customTemplatesChanged();
00436 
00437 private slots:
00439   void transportRemoved( int id, const QString &name );
00441   void transportRenamed( int id, const QString &oldName, const QString &newName );
00442 
00443 private:
00444   void openReader( bool onlyCheck );
00445   KMFolder *currentFolder();
00446 
00447   KMFolder *the_inboxFolder;
00448   KMFolder *the_outboxFolder;
00449   KMFolder *the_sentFolder;
00450   KMFolder *the_trashFolder;
00451   KMFolder *the_draftsFolder;
00452   KMFolder *the_templatesFolder;
00453 
00454   KMFolderMgr *the_folderMgr;
00455   KMFolderMgr *the_imapFolderMgr;
00456   KMFolderMgr *the_dimapFolderMgr;
00457   KMFolderMgr *the_searchFolderMgr;
00458   UndoStack *the_undoStack;
00459   AccountManager *the_acctMgr;
00460   KMFilterMgr *the_filterMgr;
00461   KMFilterMgr *the_popFilterMgr;
00462   KMFilterActionDict *the_filterActionDict;
00463   mutable KPIMIdentities::IdentityManager *mIdentityManager;
00464   KMSender *the_msgSender;
00465   KMMessageTagMgr *the_msgTagMgr;
00466   struct putData
00467   {
00468     KUrl url;
00469     QByteArray data;
00470     int offset;
00471   };
00472   QMap<KIO::Job *, putData> mPutJobs;
00475   QString the_previousVersion;
00477   bool the_firstStart;
00479   bool the_startingUp;
00481   bool the_shuttingDown;
00483   bool the_server_is_ready;
00485   bool closed_by_user;
00486   bool the_firstInstance;
00487   bool mMailCheckAborted;
00488 
00489   KSharedConfig::Ptr mConfig;
00490   QTextCodec *netCodec;
00491   KComponentData mXmlGuiInstance;
00492   ConfigureDialog *mConfigureDialog;
00493 
00494   QTimer *mBackgroundTasksTimer;
00495   KMailICalIfaceImpl* mICalIface;
00496   JobScheduler* mJobScheduler;
00497   // temporary mainwin
00498   KMMainWin *mWin;
00499   MailServiceImpl *mMailService;
00500 
00501   // the time of the last change of the unread or total count of a folder;
00502   // this can be queried via D-Bus in order to determine whether the counts
00503   // need to be updated (e.g. in the Summary in Kontact)
00504   int mTimeOfLastMessageCountChange;
00505 
00506   // true if the context menu of KMFolderTree or KMHeaders is shown
00507   // this is necessary to know in order to prevent a dead lock between the
00508   // context menus and the pinentry program
00509   bool mContextMenuShown;
00510 
00511   QList<const KSystemTrayIcon*> systemTrayApplets;
00512 
00513   /* Weaver */
00514   ThreadWeaver::Weaver *the_weaver;
00515 
00516   KWallet::Wallet *mWallet;
00517 
00518   // variables used by dbusAddMessage()
00519   QStringList           mAddMessageMsgIds;
00520   QString               mAddMessageLastFolder;
00521   KMFolder             *mAddMsgCurrentFolder;
00522   KMail::FolderAdaptor *folderAdaptor;
00523 };
00524 
00525 #endif // _KMKERNEL_H

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal