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     // API/ABI break TODO: Remove these and have just all-default-argument versions with the factory
00069     // params
00070     static AccountManagerPtr create();
00071     static AccountManagerPtr create(const QDBusConnection &bus);
00072 
00073     // Needs to not have an accountFactory default param to not conflict with the above variants
00074     // until the API/ABI break
00075     static AccountManagerPtr create(
00076             const AccountFactoryConstPtr &accountFactory,
00077             const ConnectionFactoryConstPtr &connectionFactory =
00078                 ConnectionFactory::create(QDBusConnection::sessionBus()),
00079             const ChannelFactoryConstPtr &channelFactory =
00080                 ChannelFactory::create(QDBusConnection::sessionBus()),
00081             const ContactFactoryConstPtr &contactFactory =
00082                 ContactFactory::create());
00083 
00084     // The bus-taking variant should never have default factories unless the bus is the last param
00085     // which would be illogical?
00086     static AccountManagerPtr create(const QDBusConnection &bus,
00087             const AccountFactoryConstPtr &accountFactory,
00088             const ConnectionFactoryConstPtr &connectionFactory,
00089             const ChannelFactoryConstPtr &channelFactory,
00090             const ContactFactoryConstPtr &contactFactory =
00091                 ContactFactory::create());
00092 
00093     virtual ~AccountManager();
00094 
00095     AccountFactoryConstPtr accountFactory() const;
00096     ConnectionFactoryConstPtr connectionFactory() const;
00097     ChannelFactoryConstPtr channelFactory() const;
00098     ContactFactoryConstPtr contactFactory() const;
00099 
00100     TELEPATHY_QT4_DEPRECATED QStringList validAccountPaths() const;
00101     TELEPATHY_QT4_DEPRECATED QStringList invalidAccountPaths() const;
00102     TELEPATHY_QT4_DEPRECATED QStringList allAccountPaths() const;
00103 
00104     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> validAccounts();
00105     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> invalidAccounts();
00106 
00107     QList<AccountPtr> allAccounts();
00108 
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     AccountSetPtr mediaCallAccountsSet() const;
00121     AccountSetPtr audioCallAccountsSet() const;
00122     AccountSetPtr videoCallAccountsSet(bool withAudio = true) const;
00123     AccountSetPtr fileTransferAccountsSet() const;
00124 
00125     AccountSetPtr accountsByProtocol(
00126             const QString &protocolName) const;
00127 
00128     AccountSetPtr filterAccounts(const AccountFilterConstPtr &filter) const;
00129     AccountSetPtr filterAccounts(const QList<AccountFilterConstPtr> &filters) const;
00130     AccountSetPtr filterAccounts(const QVariantMap &filter) const;
00131 
00132     TELEPATHY_QT4_DEPRECATED AccountPtr accountForPath(const QString &path);
00133     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> accountsForPaths(const QStringList &paths);
00134 
00135     QStringList supportedAccountProperties() const;
00136     PendingAccount *createAccount(const QString &connectionManager,
00137             const QString &protocol, const QString &displayName,
00138             const QVariantMap &parameters,
00139             const QVariantMap &properties = QVariantMap());
00140 
00141     inline Client::DBus::PropertiesInterface *propertiesInterface() const
00142     {
00143         return OptionalInterfaceFactory<AccountManager>::interface<Client::DBus::PropertiesInterface>();
00144     }
00145 
00146 Q_SIGNALS:
00147     TELEPATHY_QT4_DEPRECATED void accountCreated(const QString &path);
00148     TELEPATHY_QT4_DEPRECATED void accountRemoved(const QString &path);
00149     TELEPATHY_QT4_DEPRECATED void accountValidityChanged(const QString &path,
00150             bool valid);
00151 
00152     void newAccount(const Tp::AccountPtr &account);
00153 
00154 protected:
00155     AccountManager();
00156     AccountManager(const QDBusConnection &bus);
00157     AccountManager(const QDBusConnection &bus,
00158             const AccountFactoryConstPtr &accountFactory,
00159             const ConnectionFactoryConstPtr &connectionFactory,
00160             const ChannelFactoryConstPtr &channelFactory,
00161             const ContactFactoryConstPtr &contactFactory);
00162 
00163     Client::AccountManagerInterface *baseInterface() const;
00164 
00165 private Q_SLOTS:
00166     void gotMainProperties(QDBusPendingCallWatcher *);
00167     void onAccountReady(Tp::PendingOperation *);
00168     void onAccountValidityChanged(const QDBusObjectPath &, bool);
00169     void onAccountRemoved(const QDBusObjectPath &);
00170 
00171 private:
00172     friend class PendingAccount;
00173 
00174     struct Private;
00175     friend struct Private;
00176     Private *mPriv;
00177 };
00178 
00179 } // Tp
00180 
00181 #endif


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