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     // API/ABI break TODO: make const
00106     QList<AccountPtr> allAccounts();
00107 
00108     // FIXME: (API/ABI break) Rename all xxxSet methods to just xxx
00109     AccountSetPtr validAccountsSet() const;
00110     AccountSetPtr invalidAccountsSet() const;
00111 
00112     AccountSetPtr enabledAccountsSet() const;
00113     AccountSetPtr disabledAccountsSet() const;
00114 
00115     AccountSetPtr onlineAccountsSet() const;
00116     AccountSetPtr offlineAccountsSet() const;
00117 
00118     AccountSetPtr textChatAccountsSet() const;
00119     AccountSetPtr textChatRoomAccountsSet() const;
00120 
00121     // FIXME: (API/ABI break) Rename SM related methods to contain SM in the name, like
00122     //                        streamedMediaAudioCallAccounts(), etc.
00123     AccountSetPtr mediaCallAccountsSet() const;
00124     AccountSetPtr audioCallAccountsSet() const;
00125     AccountSetPtr videoCallAccountsSet(bool withAudio = true) const;
00126 
00127     AccountSetPtr fileTransferAccountsSet() const;
00128 
00129     AccountSetPtr accountsByProtocol(
00130             const QString &protocolName) const;
00131 
00132     AccountSetPtr filterAccounts(const AccountFilterConstPtr &filter) const;
00133     AccountSetPtr filterAccounts(const QList<AccountFilterConstPtr> &filters) const;
00134     AccountSetPtr filterAccounts(const QVariantMap &filter) const;
00135 
00136     // API/ABI break TODO: make const
00137     AccountPtr accountForPath(const QString &path);
00138     // API/ABI break TODO: make const
00139     QList<AccountPtr> accountsForPaths(const QStringList &paths);
00140 
00141     QStringList supportedAccountProperties() const;
00142     PendingAccount *createAccount(const QString &connectionManager,
00143             const QString &protocol, const QString &displayName,
00144             const QVariantMap &parameters,
00145             const QVariantMap &properties = QVariantMap());
00146 
00147     TELEPATHY_QT4_DEPRECATED inline Client::DBus::PropertiesInterface *propertiesInterface() const
00148     {
00149         return OptionalInterfaceFactory<AccountManager>::interface<Client::DBus::PropertiesInterface>();
00150     }
00151 
00152 Q_SIGNALS:
00153     // FIXME: (API/ABI break) Remove accountCreated in favor of newAccount
00154     void accountCreated(const QString &path);
00155     // FIXME: (API/ABI break) Remove accountRemoved in favor of Account::removed
00156     void accountRemoved(const QString &path);
00157     // FIXME: (API/ABI break) Remove accountValidityChanged in favor of Account::validityChanged
00158     void accountValidityChanged(const QString &path,
00159             bool valid);
00160 
00161     // FIXME: (API/ABI break) Rename to accountCreated. Actually it should have being named
00162     //        accountCreated in the first place
00163     void newAccount(const Tp::AccountPtr &account);
00164 
00165 protected:
00166     TELEPATHY_QT4_DEPRECATED AccountManager();
00167     TELEPATHY_QT4_DEPRECATED AccountManager(const QDBusConnection &bus);
00168     AccountManager(const QDBusConnection &bus,
00169             const AccountFactoryConstPtr &accountFactory,
00170             const ConnectionFactoryConstPtr &connectionFactory,
00171             const ChannelFactoryConstPtr &channelFactory,
00172             const ContactFactoryConstPtr &contactFactory);
00173 
00174     Client::AccountManagerInterface *baseInterface() const;
00175 
00176     // FIXME: (API/ABI break) Remove connectNotify
00177     void connectNotify(const char *);
00178 
00179 private Q_SLOTS:
00180     void gotMainProperties(QDBusPendingCallWatcher *);
00181     void onAccountReady(Tp::PendingOperation *);
00182     void onAccountValidityChanged(const QDBusObjectPath &, bool);
00183     void onAccountRemoved(const QDBusObjectPath &);
00184 
00185 private:
00186     friend class PendingAccount;
00187 
00188     struct Private;
00189     friend struct Private;
00190     Private *mPriv;
00191 };
00192 
00193 } // Tp
00194 
00195 #endif


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