knode
knaccountmanager.h
Go to the documentation of this file.00001 /* 00002 KNode, the KDE newsreader 00003 Copyright (c) 1999-2005 the KNode authors. 00004 See file AUTHORS for details 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 You should have received a copy of the GNU General Public License 00011 along with this program; if not, write to the Free Software Foundation, 00012 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US 00013 */ 00014 00015 #ifndef KNACCOUNTMANAGER_H 00016 #define KNACCOUNTMANAGER_H 00017 00018 #include <qglobal.h> 00019 #include <QList> 00020 00021 namespace KWallet { 00022 class Wallet; 00023 } 00024 00025 class KNGroupManager; 00026 class KNNntpAccount; 00027 00028 00031 class KNAccountManager : public QObject 00032 { 00033 Q_OBJECT 00034 00035 public: 00040 KNAccountManager( KNGroupManager *gm, QObject * parent = 0 ); 00043 ~KNAccountManager(); 00044 00046 typedef QList<KNNntpAccount*> List; 00047 00049 void prepareShutdown(); 00050 00054 void setCurrentAccount( KNNntpAccount *a ); 00055 00059 bool newAccount( KNNntpAccount *a ); 00064 bool removeAccount( KNNntpAccount *a = 0 ); 00068 void editProperties( KNNntpAccount *a = 0 ); 00069 void accountRenamed(KNNntpAccount *a=0); 00070 00072 bool hasCurrentAccount() const { return c_urrentAccount != 0; } 00074 KNNntpAccount* currentAccount() const { return c_urrentAccount; } 00076 KNNntpAccount* account( int id ); 00078 List accounts() const { return mAccounts; } 00080 KNNntpAccount* first() const; 00081 00083 void loadPasswords(); 00085 void loadPasswordsAsync(); 00086 00088 static KWallet::Wallet* wallet(); 00089 00090 protected: 00091 void loadAccounts(); 00092 KNGroupManager *gManager; 00093 KNNntpAccount *c_urrentAccount; 00094 00095 signals: 00096 void accountAdded(KNNntpAccount *a); 00097 void accountRemoved(KNNntpAccount *a); // don't do anything with a, it will be deleted soon 00098 void accountModified(KNNntpAccount *a); 00100 void passwordsChanged(); 00101 00102 private slots: 00103 void slotWalletOpened( bool success ); 00104 00105 private: 00107 static void prepareWallet(); 00108 00109 private: 00110 List mAccounts; 00111 static KWallet::Wallet *mWallet; 00112 static bool mWalletOpenFailed; 00113 bool mAsyncOpening; 00114 00115 }; 00116 00117 #endif
KDE 4.2 API Reference