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 Collabora Ltd. <http://www.collabora.co.uk/>
    00005  * Copyright (C) 2008 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     QStringList validAccountPaths() const;
    00069     QStringList invalidAccountPaths() const;
    00070     QStringList allAccountPaths() const;
    00071
    00072     QList<AccountPtr> validAccounts();
    00073     QList<AccountPtr> invalidAccounts();
    00074     QList<AccountPtr> allAccounts();
    00075
    00076     AccountPtr accountForPath(const QString &path);
    00077     QList<AccountPtr> accountsForPaths(const QStringList &paths);
    00078
    00079     QStringList supportedAccountProperties() const;
    00080     PendingAccount *createAccount(const QString &connectionManager,
    00081             const QString &protocol, const QString &displayName,
    00082             const QVariantMap &parameters,
    00083             const QVariantMap &properties = QVariantMap());
    00084
    00085     // TODO: enabledAccounts(), accountsByProtocol(), ... ?
    00086
    00087     inline Client::DBus::PropertiesInterface *propertiesInterface() const
    00088     {
    00089         return OptionalInterfaceFactory<AccountManager>::interface<Client::DBus::PropertiesInterface>();
    00090     }
    00091
    00092 Q_SIGNALS:
    00093     void accountCreated(const QString &path);
    00094     void accountRemoved(const QString &path);
    00095     void accountValidityChanged(const QString &path, bool valid);
    00096
    00097 protected:
    00098     AccountManager();
    00099     AccountManager(const QDBusConnection &bus);
    00100
    00101     Client::AccountManagerInterface *baseInterface() const;
    00102
    00103 private Q_SLOTS:
    00104     void gotMainProperties(QDBusPendingCallWatcher *);
    00105     void onAccountValidityChanged(const QDBusObjectPath &, bool);
    00106     void onAccountRemoved(const QDBusObjectPath &);
    00107
    00108 private:
    00109     friend class PendingAccount;
    00110
    00111     struct Private;
    00112     friend struct Private;
    00113     Private *mPriv;
    00114 };
    00115
    00116 } // Tp
    00117
    00118 #endif