kmail
accountmanager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef accountmanager_h
00020 #define accountmanager_h
00021
00022 #include "kmail_export.h"
00023 #include "kmaccount.h"
00024 #include <QObject>
00025
00026 class QString;
00027 class QStringList;
00028
00029 namespace KMail {
00034 class KMAIL_EXPORT AccountManager: public QObject
00035 {
00036 Q_OBJECT
00037 friend class ::KMAccount;
00038
00039 public:
00044 AccountManager();
00045 ~AccountManager();
00046
00050 void readConfig( void );
00051
00055 void writeConfig( bool withSync = true );
00056
00062 KMAccount *create( const KAccount::Type aType,
00063 const QString &name = QString(),
00064 uint id = 0 );
00065
00069 void add( KMAccount *account );
00070
00072 bool isUnique( const QString &name ) const;
00073
00075 QString makeUnique( const QString &aName ) const;
00076
00081 KMAccount *findByName( const QString &name ) const;
00082
00086 KMAccount *find( const uint id ) const;
00087
00093 bool isEnabled( const uint id ) const { return !mDisabledAccounts.contains(id); }
00094
00099 bool remove( KMAccount *account );
00100
00104 QList<KMAccount*>::iterator begin();
00105
00110 QList<KMAccount*>::iterator end();
00111
00115 void checkMail( bool interactive = true );
00116
00120 void invalidateIMAPFolders();
00121
00122 QStringList getAccounts() const;
00123
00125 void cancelMailCheck();
00126
00130 void readPasswords();
00131
00132 public slots:
00133 void singleCheckMail( KMAccount *account, bool interactive = true );
00134 void singleInvalidateIMAPFolders( KMAccount *account );
00135
00136 void intCheckMail( int, bool interactive = true );
00137 void processNextCheck( bool newMail );
00138
00143 void addToTotalNewMailCount( const QMap<QString, int> &newInFolder );
00144
00145 signals:
00152 void checkedMail( bool newMail, bool interactive,
00153 const QMap<QString, int> &newInFolder );
00154
00158 void accountRemoved( KMAccount *account );
00159
00163 void accountAdded( KMAccount *account );
00164
00165 private:
00169 uint createId();
00170
00171 AccountList mAcctList;
00172 AccountList mAcctChecking;
00173 AccountList mAcctTodo;
00174 bool mNewMailArrived;
00175 bool mInteractive;
00176 int mTotalNewMailsArrived;
00177
00178
00179 QMap<QString, int> mTotalNewInFolder;
00180
00181
00182 bool mDisplaySummary;
00183
00184
00185 QSet<uint> mDisabledAccounts;
00186 };
00187
00188 }
00189 #endif