Home · All Classes · All Namespaces · Modules · Functions · Files

account-manager.h

00001 /*
00002  * This file is part of TelepathyQt4
00003  *
00004  * Copyright (C) 2008-2010 Collabora Ltd. <http://www.collabora.co.uk/>
00005  * Copyright (C) 2008-2010 Nokia Corporation
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #ifndef _TelepathyQt4_account_manager_h_HEADER_GUARD_
00023 #define _TelepathyQt4_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/Account>
00032 #include <TelepathyQt4/AccountFactory>
00033 #include <TelepathyQt4/ChannelFactory>
00034 #include <TelepathyQt4/ConnectionFactory>
00035 #include <TelepathyQt4/ContactFactory>
00036 #include <TelepathyQt4/DBus>
00037 #include <TelepathyQt4/DBusProxy>
00038 #include <TelepathyQt4/Filter>
00039 #include <TelepathyQt4/OptionalInterfaceFactory>
00040 #include <TelepathyQt4/ReadinessHelper>
00041 #include <TelepathyQt4/ReadyObject>
00042 #include <TelepathyQt4/Types>
00043 #include <TelepathyQt4/SharedPtr>
00044 
00045 #include <QDBusObjectPath>
00046 #include <QSet>
00047 #include <QString>
00048 #include <QVariantMap>
00049 
00050 namespace Tp
00051 {
00052 
00053 class AccountManager;
00054 class PendingAccount;
00055 class PendingReady;
00056 
00057 class TELEPATHY_QT4_EXPORT AccountManager : public StatelessDBusProxy,
00058                        public OptionalInterfaceFactory<AccountManager>,
00059                        public ReadyObject,
00060                        public RefCounted
00061 {
00062     Q_OBJECT
00063     Q_DISABLE_COPY(AccountManager)
00064 
00065 public:
00066     static const Feature FeatureCore;
00067 
00068     // FIXME: (API/ABI break) Remove both constructors that don't take factories as params.
00069     static AccountManagerPtr create();
00070     static AccountManagerPtr create(const QDBusConnection &bus);
00071 
00072     // FIXME: (API/ABI break) Add a default parameter to accountFactory once the create methods
00073     //        above are removed
00074     static AccountManagerPtr create(
00075             const AccountFactoryConstPtr &accountFactory,
00076             const ConnectionFactoryConstPtr &connectionFactory =
00077                 ConnectionFactory::create(QDBusConnection::sessionBus()),
00078             const ChannelFactoryConstPtr &channelFactory =
00079                 ChannelFactory::create(QDBusConnection::sessionBus()),
00080             const ContactFactoryConstPtr &contactFactory =
00081                 ContactFactory::create());
00082     // The bus-taking variant should never have default factories unless the bus is the last param
00083     // which would be illogical?
00084     static AccountManagerPtr create(const QDBusConnection &bus,
00085             const AccountFactoryConstPtr &accountFactory,
00086             const ConnectionFactoryConstPtr &connectionFactory,
00087             const ChannelFactoryConstPtr &channelFactory,
00088             const ContactFactoryConstPtr &contactFactory =
00089                 ContactFactory::create());
00090 
00091     virtual ~AccountManager();
00092 
00093     AccountFactoryConstPtr accountFactory() const;
00094     ConnectionFactoryConstPtr connectionFactory() const;
00095     ChannelFactoryConstPtr channelFactory() const;
00096     ContactFactoryConstPtr contactFactory() const;
00097 
00098     TELEPATHY_QT4_DEPRECATED QStringList validAccountPaths() const;
00099     TELEPATHY_QT4_DEPRECATED QStringList invalidAccountPaths() const;
00100     TELEPATHY_QT4_DEPRECATED QStringList allAccountPaths() const;
00101 
00102     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> validAccounts();
00103     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> invalidAccounts();
00104 
00105     QList<AccountPtr> allAccounts();
00106 
00107     // FIXME: (API/ABI break) Rename all xxxSet methods to just xxx
00108     AccountSetPtr validAccountsSet() const;
00109     AccountSetPtr invalidAccountsSet() const;
00110 
00111     AccountSetPtr enabledAccountsSet() const;
00112     AccountSetPtr disabledAccountsSet() const;
00113 
00114     AccountSetPtr onlineAccountsSet() const;
00115     AccountSetPtr offlineAccountsSet() const;
00116 
00117     AccountSetPtr textChatAccountsSet() const;
00118     AccountSetPtr textChatRoomAccountsSet() const;
00119 
00120     // FIXME: (API/ABI break) Rename SM related methods to contain SM in the name, like
00121     //                        streamedMediaAudioCallAccounts(), etc.
00122     AccountSetPtr mediaCallAccountsSet() const;
00123     AccountSetPtr audioCallAccountsSet() const;
00124     AccountSetPtr videoCallAccountsSet(bool withAudio = true) const;
00125 
00126     AccountSetPtr fileTransferAccountsSet() const;
00127 
00128     AccountSetPtr accountsByProtocol(
00129             const QString &protocolName) const;
00130 
00131     AccountSetPtr filterAccounts(const AccountFilterConstPtr &filter) const;
00132     AccountSetPtr filterAccounts(const QList<AccountFilterConstPtr> &filters) const;
00133     AccountSetPtr filterAccounts(const QVariantMap &filter) const;
00134 
00135     AccountPtr accountForPath(const QString &path);
00136     QList<AccountPtr> accountsForPaths(const QStringList &paths);
00137 
00138     QStringList supportedAccountProperties() const;
00139     PendingAccount *createAccount(const QString &connectionManager,
00140             const QString &protocol, const QString &displayName,
00141             const QVariantMap &parameters,
00142             const QVariantMap &properties = QVariantMap());
00143 
00144     TELEPATHY_QT4_DEPRECATED inline Client::DBus::PropertiesInterface *propertiesInterface() const
00145     {
00146         return OptionalInterfaceFactory<AccountManager>::interface<Client::DBus::PropertiesInterface>();
00147     }
00148 
00149 Q_SIGNALS:
00150     // FIXME: (API/ABI break) Remove accountCreated in favor of newAccount
00151     void accountCreated(const QString &path);
00152     // FIXME: (API/ABI break) Remove accountRemoved in favor of Account::removed
00153     void accountRemoved(const QString &path);
00154     // FIXME: (API/ABI break) Remove accountValidityChanged in favor of Account::validityChanged
00155     void accountValidityChanged(const QString &path,
00156             bool valid);
00157 
00158     // FIXME: (API/ABI break) Rename to accountCreated. Actually it should have being named
00159     //        accountCreated in the first place
00160     void newAccount(const Tp::AccountPtr &account);
00161 
00162 protected:
00163     TELEPATHY_QT4_DEPRECATED AccountManager();
00164     TELEPATHY_QT4_DEPRECATED AccountManager(const QDBusConnection &bus);
00165     AccountManager(const QDBusConnection &bus,
00166             const AccountFactoryConstPtr &accountFactory,
00167             const ConnectionFactoryConstPtr &connectionFactory,
00168             const ChannelFactoryConstPtr &channelFactory,
00169             const ContactFactoryConstPtr &contactFactory);
00170 
00171     Client::AccountManagerInterface *baseInterface() const;
00172 
00173     // FIXME: (API/ABI break) Remove connectNotify
00174     void connectNotify(const char *);
00175 
00176 private Q_SLOTS:
00177     void gotMainProperties(QDBusPendingCallWatcher *);
00178     void onAccountReady(Tp::PendingOperation *);
00179     void onAccountValidityChanged(const QDBusObjectPath &, bool);
00180     void onAccountRemoved(const QDBusObjectPath &);
00181 
00182 private:
00183     friend class PendingAccount;
00184 
00185     struct Private;
00186     friend struct Private;
00187     Private *mPriv;
00188 };
00189 
00190 } // Tp
00191 
00192 #endif


Copyright © 2008-2010 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.3.13