kopete/libkopete
kopeteaccountmanager.h
Go to the documentation of this file.00001 /* 00002 kopeteaccountmanager.h - Kopete Account Manager 00003 00004 Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org> 00005 Copyright (c) 2003-2005 by Olivier Goffart <ogoffart@kde.org> 00006 00007 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org> 00008 00009 ************************************************************************* 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2 of the License, or (at your option) any later version. * 00015 * * 00016 ************************************************************************* 00017 */ 00018 00019 #ifndef __kopeteaccountmanager_h__ 00020 #define __kopeteaccountmanager_h__ 00021 00022 #include <QtCore/QObject> 00023 #include <QtGui/QColor> 00024 00025 #include "kopete_export.h" 00026 00027 #include "kopetestatusmessage.h" 00028 00029 namespace Kopete { 00030 00031 class Account; 00032 class Plugin; 00033 class Protocol; 00034 class Contact; 00035 class OnlineStatus; 00036 class StatusMessage; 00037 00047 class KOPETE_EXPORT AccountManager : public QObject 00048 { 00049 Q_OBJECT 00050 00051 public: 00061 static AccountManager* self(); 00062 00063 ~AccountManager(); 00064 00069 const QList<Account *> & accounts() const; 00070 00079 QList<Account*> accounts( Kopete::Protocol* protocol ) const; 00080 00087 Account* findAccount( const QString &protocolId, const QString &accountId ); 00088 00094 void removeAccount( Account *account ); 00095 00102 QColor guessColor( Protocol *protocol ) const ; 00103 00112 Account *registerAccount( Account *account ); 00113 00114 00120 enum SetOnlineStatusFlag { ConnectIfOffline=0x01 }; 00121 00122 00123 public slots: 00133 void setOnlineStatus( /*Kopete::OnlineStatusManager::Categories*/ uint category, 00134 const Kopete::StatusMessage &statusMessage = Kopete::StatusMessage(), uint flags=0); 00135 00141 void setStatusMessage(const QString &message); 00142 00147 void save(); 00148 00153 void load(); 00154 00155 00156 00157 signals: 00161 void accountRegistered( Kopete::Account *account ); 00162 00168 void accountUnregistered( const Kopete::Account *account ); 00169 00177 void accountOnlineStatusChanged(Kopete::Account *account, 00178 const Kopete::OnlineStatus &oldStatus, const Kopete::OnlineStatus &newStatus); 00179 00180 private: 00184 AccountManager(); 00185 00186 private slots: 00190 void networkConnected(); 00194 void networkDisconnected(); 00195 00196 void slotPluginLoaded( Kopete::Plugin *plugin ); 00197 void slotAccountOnlineStatusChanged(Kopete::Contact *c, 00198 const Kopete::OnlineStatus &oldStatus, const Kopete::OnlineStatus &newStatus); 00199 00204 void unregisterAccount( const Kopete::Account *account ); 00205 00206 private: 00207 bool isAnyAccountConnected() const; 00208 static AccountManager *s_self; 00209 class Private; 00210 Private *d; 00211 }; 00212 00213 } //END namespace Kopete 00214 00215 00216 #endif 00217 00218
KDE 4.2 API Reference