00001 /* 00002 * This file is part of TelepathyQt4 00003 * 00004 * Copyright (C) 2008 basysKom GmbH 00005 * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/> 00006 * Copyright (C) 2008 Nokia Corporation 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 #ifndef TelepathyQt4_Prototype_AccountManager_H_ 00023 #define TelepathyQt4_Prototype_AccountManager_H_ 00024 00025 #include <QDBusObjectPath> 00026 #include <QObject> 00027 #include <QPointer> 00028 00029 #include <TelepathyQt4/Prototype/Account.h> 00030 00031 #ifdef DEPRECATED_ENABLED__ 00032 #define ATTRIBUTE_DEPRECATED __attribute__((deprecated)) 00033 #else 00034 #define ATTRIBUTE_DEPRECATED 00035 #endif 00036 00037 00038 namespace TpPrototype { 00039 // 00040 class AccountManagerPrivate; 00041 00057 class AccountManager : public QObject 00058 { 00059 Q_OBJECT 00060 public: 00065 static AccountManager* instance(); 00066 00072 int count() ATTRIBUTE_DEPRECATED; 00073 00079 QList<QPointer<Account> > accountList(); 00080 00084 QList<QPointer<Account> > accountListOfEnabledAccounts(); 00085 00097 bool createAccount( const QString& connectionManager, const QString& protocol, const QString& displayName, const QVariantMap& parameters ); 00098 00104 bool removeAccount( Account* account ); 00105 00106 signals: 00112 void signalAccountsUpdated(); 00113 00118 void signalNewAccountAvailable( TpPrototype::Account* account ); 00119 00129 void signalAboutToRemoveAccount( TpPrototype::Account* account ); 00130 00136 void signalAccountRemoved(); 00137 00142 void signalAccountUpdated( TpPrototype::Account* account ); 00143 00144 protected: 00148 AccountManager( QObject* parent = NULL ); 00149 ~AccountManager(); 00150 00151 protected slots: 00152 void slotAccountValidityChanged( const QDBusObjectPath& account, bool valid ); 00153 void slotAccountRemoved( const QDBusObjectPath& account ); 00154 void slotAccountRemoved(); 00155 void slotAccountUpdated(); 00156 00157 private: 00158 void init(); 00159 00160 AccountManagerPrivate * const d; 00161 static AccountManager* m_pInstance; 00162 }; 00163 00164 } 00165 00166 #endif