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


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