accountmanager.h
00001 /* -*- mode: C++ -*- 00002 * kmail: KDE mail client 00003 * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 */ 00020 #ifndef accountmanager_h 00021 #define accountmanager_h 00022 00023 #include <tqobject.h> 00024 #include "kmaccount.h" 00025 #include <tdepimmacros.h> 00026 00027 class TQString; 00028 class TQStringList; 00029 00030 namespace KMail { 00035 class KDE_EXPORT AccountManager: public TQObject 00036 { 00037 Q_OBJECT 00038 00039 friend class ::KMAccount; 00040 00041 public: 00044 AccountManager(); 00045 ~AccountManager(); 00046 00048 void readConfig(void); 00049 00051 void writeConfig( bool withSync=true ); 00052 00055 KMAccount* create( const TQString& type, 00056 const TQString& name = TQString(), 00057 uint id = 0); 00058 00060 void add( KMAccount *account ); 00061 00064 KMAccount* findByName( const TQString& name ) const; 00065 00068 KMAccount* find( const uint id ) const; 00069 00072 bool remove( KMAccount* ); 00073 00075 const KMAccount* first() const { return first(); } 00076 KMAccount* first(); 00077 00079 const KMAccount* next() const { return next(); } 00080 KMAccount* next(); 00081 00083 void checkMail( bool interactive = true ); 00084 00086 void invalidateIMAPFolders(); 00087 00088 TQStringList getAccounts() const; 00089 00091 void cancelMailCheck(); 00092 00094 void readPasswords(); 00095 00096 public slots: 00097 void singleCheckMail( KMAccount *, bool interactive = true ); 00098 void singleInvalidateIMAPFolders( KMAccount * ); 00099 00100 void intCheckMail( int, bool interactive = true ); 00101 void processNextCheck( bool newMail ); 00102 00105 void addToTotalNewMailCount( const TQMap<TQString, int> & newInFolder ); 00106 00107 00108 signals: 00115 void checkedMail( bool newMail, bool interactive, 00116 const TQMap<TQString, int> & newInFolder ); 00118 void accountRemoved( KMAccount* account ); 00120 void accountAdded( KMAccount* account ); 00121 00122 private: 00124 uint createId(); 00125 00126 AccountList mAcctList; 00127 AccountList::Iterator mPtrListInterfaceProxyIterator; 00128 AccountList mAcctChecking; 00129 AccountList mAcctTodo; 00130 bool mNewMailArrived; 00131 bool mInteractive; 00132 int mTotalNewMailsArrived; 00133 00134 // for detailed (per folder) new mail notification 00135 TQMap<TQString, int> mTotalNewInFolder; 00136 00137 // if a summary should be displayed 00138 bool mDisplaySummary; 00139 }; 00140 00141 } // namespace KMail 00142 #endif /*accountmanager_h*/