00001
00023 #ifndef _TelepathyQt4_account_manager_h_HEADER_GUARD_
00024 #define _TelepathyQt4_account_manager_h_HEADER_GUARD_
00025
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029
00030 #include <TelepathyQt4/_gen/cli-account-manager.h>
00031
00032 #include <TelepathyQt4/Account>
00033 #include <TelepathyQt4/AccountFactory>
00034 #include <TelepathyQt4/ChannelFactory>
00035 #include <TelepathyQt4/ConnectionFactory>
00036 #include <TelepathyQt4/ContactFactory>
00037 #include <TelepathyQt4/StatelessDBusProxy>
00038 #include <TelepathyQt4/Filter>
00039 #include <TelepathyQt4/OptionalInterfaceFactory>
00040 #include <TelepathyQt4/SharedPtr>
00041 #include <TelepathyQt4/Types>
00042
00043 #include <QDBusObjectPath>
00044 #include <QSet>
00045 #include <QString>
00046 #include <QVariantMap>
00047
00048 namespace Tp
00049 {
00050
00051 class PendingAccount;
00052
00053 class TELEPATHY_QT4_EXPORT AccountManager : public StatelessDBusProxy,
00054 public OptionalInterfaceFactory<AccountManager>
00055 {
00056 Q_OBJECT
00057 Q_DISABLE_COPY(AccountManager)
00058
00059 public:
00060 static const Feature FeatureCore;
00061
00062 static AccountManagerPtr create(const QDBusConnection &bus);
00063 static AccountManagerPtr create(
00064 const AccountFactoryConstPtr &accountFactory =
00065 AccountFactory::create(QDBusConnection::sessionBus(), Account::FeatureCore),
00066 const ConnectionFactoryConstPtr &connectionFactory =
00067 ConnectionFactory::create(QDBusConnection::sessionBus()),
00068 const ChannelFactoryConstPtr &channelFactory =
00069 ChannelFactory::create(QDBusConnection::sessionBus()),
00070 const ContactFactoryConstPtr &contactFactory =
00071 ContactFactory::create());
00072 static AccountManagerPtr create(const QDBusConnection &bus,
00073 const AccountFactoryConstPtr &accountFactory,
00074 const ConnectionFactoryConstPtr &connectionFactory,
00075 const ChannelFactoryConstPtr &channelFactory,
00076 const ContactFactoryConstPtr &contactFactory =
00077 ContactFactory::create());
00078
00079 virtual ~AccountManager();
00080
00081 AccountFactoryConstPtr accountFactory() const;
00082 ConnectionFactoryConstPtr connectionFactory() const;
00083 ChannelFactoryConstPtr channelFactory() const;
00084 ContactFactoryConstPtr contactFactory() const;
00085
00086 QList<AccountPtr> allAccounts() const;
00087
00088 AccountSetPtr validAccounts() const;
00089 AccountSetPtr invalidAccounts() const;
00090
00091 AccountSetPtr enabledAccounts() const;
00092 AccountSetPtr disabledAccounts() const;
00093
00094 AccountSetPtr onlineAccounts() const;
00095 AccountSetPtr offlineAccounts() const;
00096
00097 AccountSetPtr textChatAccounts() const;
00098 AccountSetPtr textChatroomAccounts() const;
00099
00100 AccountSetPtr streamedMediaCallAccounts() const;
00101 AccountSetPtr streamedMediaAudioCallAccounts() const;
00102 AccountSetPtr streamedMediaVideoCallAccounts() const;
00103 AccountSetPtr streamedMediaVideoCallWithAudioAccounts() const;
00104
00105 AccountSetPtr fileTransferAccounts() const;
00106
00107 AccountSetPtr accountsByProtocol(const QString &protocolName) const;
00108
00109 AccountSetPtr filterAccounts(const AccountFilterConstPtr &filter) const;
00110 AccountSetPtr filterAccounts(const QVariantMap &filter) const;
00111
00112 AccountPtr accountForPath(const QString &path) const;
00113 QList<AccountPtr> accountsForPaths(const QStringList &paths) const;
00114
00115 QStringList supportedAccountProperties() const;
00116 PendingAccount *createAccount(const QString &connectionManager,
00117 const QString &protocol, const QString &displayName,
00118 const QVariantMap ¶meters,
00119 const QVariantMap &properties = QVariantMap());
00120
00121 Q_SIGNALS:
00122 void newAccount(const Tp::AccountPtr &account);
00123
00124 protected:
00125 AccountManager(const QDBusConnection &bus,
00126 const AccountFactoryConstPtr &accountFactory,
00127 const ConnectionFactoryConstPtr &connectionFactory,
00128 const ChannelFactoryConstPtr &channelFactory,
00129 const ContactFactoryConstPtr &contactFactory,
00130 const Feature &coreFeature);
00131
00132 Client::AccountManagerInterface *baseInterface() const;
00133
00134 private Q_SLOTS:
00135 TELEPATHY_QT4_NO_EXPORT void introspectMain();
00136 TELEPATHY_QT4_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
00137 TELEPATHY_QT4_NO_EXPORT void onAccountReady(Tp::PendingOperation *op);
00138 TELEPATHY_QT4_NO_EXPORT void onAccountValidityChanged(const QDBusObjectPath &objectPath,
00139 bool valid);
00140 TELEPATHY_QT4_NO_EXPORT void onAccountRemoved(const QDBusObjectPath &objectPath);
00141
00142 private:
00143 friend class PendingAccount;
00144
00145 struct Private;
00146 friend struct Private;
00147 Private *mPriv;
00148 };
00149
00150 }
00151
00152 #endif