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


Copyright © 2009 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.1.8