00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TelepathyQt4_cli_account_manager_h_HEADER_GUARD_
00023 #define _TelepathyQt4_cli_account_manager_h_HEADER_GUARD_
00024
00025 #ifndef IN_TELEPATHY_QT4_HEADER
00026 #error IN_TELEPATHY_QT4_HEADER
00027 #endif
00028
00029 #include <TelepathyQt4/_gen/cli-account-manager.h>
00030
00031 #include <TelepathyQt4/Client/DBus>
00032 #include <TelepathyQt4/Client/DBusProxy>
00033 #include <TelepathyQt4/Client/OptionalInterfaceFactory>
00034
00035 #include <QDBusObjectPath>
00036 #include <QSharedPointer>
00037 #include <QString>
00038 #include <QVariantMap>
00039
00040 namespace Telepathy
00041 {
00042 namespace Client
00043 {
00044
00045 class Account;
00046 class AccountManager;
00047 class PendingAccount;
00048 class PendingReadyAccountManager;
00049
00050 class AccountManager : public StatelessDBusProxy,
00051 private OptionalInterfaceFactory<AccountManager>
00052 {
00053 Q_OBJECT
00054 Q_DISABLE_COPY(AccountManager)
00055
00056 public:
00057 enum Feature {
00058 _Padding = 0xFFFFFFFF
00059 };
00060 Q_DECLARE_FLAGS(Features, Feature)
00061
00062 AccountManager(QObject *parent = 0);
00063 AccountManager(const QDBusConnection &bus, QObject *parent = 0);
00064
00065 virtual ~AccountManager();
00066
00067 QStringList interfaces() const;
00068
00069 inline DBus::PropertiesInterface *propertiesInterface() const
00070 {
00071 return OptionalInterfaceFactory<AccountManager>::interface<DBus::PropertiesInterface>();
00072 }
00073
00074 QStringList validAccountPaths() const;
00075 QStringList invalidAccountPaths() const;
00076 QStringList allAccountPaths() const;
00077
00078 QList<QSharedPointer<Account> > validAccounts();
00079 QList<QSharedPointer<Account> > invalidAccounts();
00080 QList<QSharedPointer<Account> > allAccounts();
00081
00082 QSharedPointer<Account> accountForPath(const QString &path);
00083 QList<QSharedPointer<Account> > accountsForPaths(const QStringList &paths);
00084
00085 PendingAccount *createAccount(const QString &connectionManager,
00086 const QString &protocol, const QString &displayName,
00087 const QVariantMap ¶meters);
00088
00089
00090
00091 bool isReady(Features features = 0) const;
00092
00093 PendingReadyAccountManager *becomeReady(Features features = 0);
00094
00095 Q_SIGNALS:
00096 void accountCreated(const QString &path);
00097 void accountRemoved(const QString &path);
00098 void accountValidityChanged(const QString &path, bool valid);
00099
00100 protected:
00101 AccountManagerInterface *baseInterface() const;
00102
00103 private Q_SLOTS:
00104 void onGetAllAccountManagerReturn(QDBusPendingCallWatcher *);
00105 void onAccountValidityChanged(const QDBusObjectPath &, bool);
00106 void onAccountRemoved(const QDBusObjectPath &);
00107 void continueIntrospection();
00108
00109 private:
00110 void init();
00111 void callGetAll();
00112
00113 struct Private;
00114 friend struct Private;
00115 friend class PendingAccount;
00116 Private *mPriv;
00117 };
00118
00119 Q_DECLARE_OPERATORS_FOR_FLAGS(AccountManager::Features)
00120
00121 }
00122 }
00123
00124 #endif