00001
00023 #ifndef _TelepathyQt_account_manager_h_HEADER_GUARD_
00024 #define _TelepathyQt_account_manager_h_HEADER_GUARD_
00025
00026 #ifndef IN_TP_QT_HEADER
00027 #error IN_TP_QT_HEADER
00028 #endif
00029
00030 #include <TelepathyQt/_gen/cli-account-manager.h>
00031
00032 #include <TelepathyQt/Account>
00033 #include <TelepathyQt/AccountFactory>
00034 #include <TelepathyQt/ChannelFactory>
00035 #include <TelepathyQt/ConnectionFactory>
00036 #include <TelepathyQt/ContactFactory>
00037 #include <TelepathyQt/StatelessDBusProxy>
00038 #include <TelepathyQt/Filter>
00039 #include <TelepathyQt/OptionalInterfaceFactory>
00040 #include <TelepathyQt/SharedPtr>
00041 #include <TelepathyQt/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 TP_QT_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 audioCallAccounts() const;
00101 AccountSetPtr videoCallAccounts() const;
00102
00103 TP_QT_DEPRECATED AccountSetPtr streamedMediaCallAccounts() const;
00104 TP_QT_DEPRECATED AccountSetPtr streamedMediaAudioCallAccounts() const;
00105 TP_QT_DEPRECATED AccountSetPtr streamedMediaVideoCallAccounts() const;
00106 TP_QT_DEPRECATED AccountSetPtr streamedMediaVideoCallWithAudioAccounts() const;
00107
00108 AccountSetPtr fileTransferAccounts() const;
00109
00110 AccountSetPtr accountsByProtocol(const QString &protocolName) const;
00111
00112 AccountSetPtr filterAccounts(const AccountFilterConstPtr &filter) const;
00113 AccountSetPtr filterAccounts(const QVariantMap &filter) const;
00114
00115 AccountPtr accountForObjectPath(const QString &path) const;
00116 TP_QT_DEPRECATED AccountPtr accountForPath(const QString &path) const;
00117 QList<AccountPtr> accountsForObjectPaths(const QStringList &paths) const;
00118 TP_QT_DEPRECATED QList<AccountPtr> accountsForPaths(const QStringList &paths) const;
00119
00120 QStringList supportedAccountProperties() const;
00121 PendingAccount *createAccount(const QString &connectionManager,
00122 const QString &protocol, const QString &displayName,
00123 const QVariantMap ¶meters,
00124 const QVariantMap &properties = QVariantMap());
00125
00126 Q_SIGNALS:
00127 void newAccount(const Tp::AccountPtr &account);
00128
00129 protected:
00130 AccountManager(const QDBusConnection &bus,
00131 const AccountFactoryConstPtr &accountFactory,
00132 const ConnectionFactoryConstPtr &connectionFactory,
00133 const ChannelFactoryConstPtr &channelFactory,
00134 const ContactFactoryConstPtr &contactFactory,
00135 const Feature &coreFeature);
00136
00137 Client::AccountManagerInterface *baseInterface() const;
00138
00139 private Q_SLOTS:
00140 TP_QT_NO_EXPORT void introspectMain();
00141 TP_QT_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
00142 TP_QT_NO_EXPORT void onAccountReady(Tp::PendingOperation *op);
00143 TP_QT_NO_EXPORT void onAccountValidityChanged(const QDBusObjectPath &objectPath,
00144 bool valid);
00145 TP_QT_NO_EXPORT void onAccountRemoved(const QDBusObjectPath &objectPath);
00146
00147 private:
00148 friend class PendingAccount;
00149
00150 struct Private;
00151 friend struct Private;
00152 Private *mPriv;
00153 };
00154
00155 }
00156
00157 #endif