TelepathyQt4: account-manager.h Source File

| 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/DBus>
    00033 #include <TelepathyQt4/DBusProxy>
    00034 #include <TelepathyQt4/OptionalInterfaceFactory>
    00035 #include <TelepathyQt4/ReadinessHelper>
    00036 #include <TelepathyQt4/ReadyObject>
    00037 #include <TelepathyQt4/Types>
    00038 #include <TelepathyQt4/SharedPtr>
    00039
    00040 #include <QDBusObjectPath>
    00041 #include <QSet>
    00042 #include <QString>
    00043 #include <QVariantMap>
    00044
    00045 namespace Tp
    00046 {
    00047
    00048 class AccountManager;
    00049 class PendingAccount;
    00050 class PendingReady;
    00051
    00052 class TELEPATHY_QT4_EXPORT AccountManager : public StatelessDBusProxy,
    00053                        public OptionalInterfaceFactory<AccountManager>,
    00054                        public ReadyObject,
    00055                        public RefCounted
    00056 {
    00057     Q_OBJECT
    00058     Q_DISABLE_COPY(AccountManager)
    00059
    00060 public:
    00061     static const Feature FeatureCore;
    00062
    00063     static AccountManagerPtr create();
    00064     static AccountManagerPtr create(const QDBusConnection &bus);
    00065
    00066     virtual ~AccountManager();
    00067
    00068     TELEPATHY_QT4_DEPRECATED QStringList validAccountPaths() const;
    00069     TELEPATHY_QT4_DEPRECATED QStringList invalidAccountPaths() const;
    00070     TELEPATHY_QT4_DEPRECATED QStringList allAccountPaths() const;
    00071
    00072     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> validAccounts();
    00073     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> invalidAccounts();
    00074
    00075     QList<AccountPtr> allAccounts();
    00076
    00077     AccountSetPtr validAccountsSet() const;
    00078     AccountSetPtr invalidAccountsSet() const;
    00079
    00080     AccountSetPtr enabledAccountsSet() const;
    00081     AccountSetPtr disabledAccountsSet() const;
    00082
    00083     AccountSetPtr onlineAccountsSet() const;
    00084     AccountSetPtr offlineAccountsSet() const;
    00085
    00086     AccountSetPtr accountsByProtocol(
    00087             const QString &protocolName) const;
    00088
    00089     AccountSetPtr filterAccounts(const QVariantMap &filter) const;
    00090
    00091     TELEPATHY_QT4_DEPRECATED AccountPtr accountForPath(const QString &path);
    00092     TELEPATHY_QT4_DEPRECATED QList<AccountPtr> accountsForPaths(const QStringList &paths);
    00093
    00094     QStringList supportedAccountProperties() const;
    00095     PendingAccount *createAccount(const QString &connectionManager,
    00096             const QString &protocol, const QString &displayName,
    00097             const QVariantMap &parameters,
    00098             const QVariantMap &properties = QVariantMap());
    00099
    00100     inline Client::DBus::PropertiesInterface *propertiesInterface() const
    00101     {
    00102         return OptionalInterfaceFactory<AccountManager>::interface<Client::DBus::PropertiesInterface>();
    00103     }
    00104
    00105 Q_SIGNALS:
    00106     TELEPATHY_QT4_DEPRECATED void accountCreated(const QString &path);
    00107     TELEPATHY_QT4_DEPRECATED void accountRemoved(const QString &path);
    00108     TELEPATHY_QT4_DEPRECATED void accountValidityChanged(const QString &path,
    00109             bool valid);
    00110
    00111     void newAccount(const Tp::AccountPtr &account);
    00112
    00113 protected:
    00114     AccountManager();
    00115     AccountManager(const QDBusConnection &bus);
    00116
    00117     Client::AccountManagerInterface *baseInterface() const;
    00118
    00119 private Q_SLOTS:
    00120     void gotMainProperties(QDBusPendingCallWatcher *);
    00121     void onAccountReady(Tp::PendingOperation *);
    00122     void onAccountValidityChanged(const QDBusObjectPath &, bool);
    00123     void onAccountRemoved(const QDBusObjectPath &);
    00124
    00125 private:
    00126     friend class PendingAccount;
    00127
    00128     struct Private;
    00129     friend struct Private;
    00130     Private *mPriv;
    00131 };
    00132
    00133 } // Tp
    00134
    00135 #endif