Home · All Classes · All Namespaces · Modules · Functions · Files

account.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_h_HEADER_GUARD_
00023 #define _TelepathyQt4_account_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.h>
00030 
00031 #include <TelepathyQt4/Connection>
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/Constants>
00039 #include <TelepathyQt4/SharedPtr>
00040 
00041 #include <QSet>
00042 #include <QString>
00043 #include <QStringList>
00044 #include <QVariantMap>
00045 
00046 namespace Tp
00047 {
00048 
00049 class Account;
00050 class Connection;
00051 class PendingChannelRequest;
00052 class PendingConnection;
00053 class PendingOperation;
00054 class PendingReady;
00055 class PendingStringList;
00056 class ProtocolInfo;
00057 
00058 class Account : public StatelessDBusProxy,
00059                 public OptionalInterfaceFactory<Account>,
00060                 public ReadyObject,
00061                 public RefCounted
00062 
00063 {
00064     Q_OBJECT
00065     Q_DISABLE_COPY(Account)
00066 
00067 public:
00068     static const Feature FeatureCore;
00069     static const Feature FeatureAvatar;
00070     static const Feature FeatureProtocolInfo;
00071 
00072     static AccountPtr create(const QDBusConnection &bus,
00073             const QString &busName, const QString &objectPath);
00074     static AccountPtr create(const QString &busName,
00075             const QString &objectPath);
00076 
00077     virtual ~Account();
00078 
00079     bool isValidAccount() const;
00080 
00081     bool isEnabled() const;
00082     PendingOperation *setEnabled(bool value);
00083 
00084     QString cmName() const;
00085 
00086     QString protocol() const;
00087 
00088     QString displayName() const;
00089     PendingOperation *setDisplayName(const QString &value);
00090 
00091     QString icon() const;
00092     PendingOperation *setIcon(const QString &value);
00093 
00094     QString nickname() const;
00095     PendingOperation *setNickname(const QString &value);
00096 
00097     // requires spec 0.17.16
00098     const Avatar &avatar() const;
00099     PendingOperation *setAvatar(const Avatar &avatar);
00100 
00101     QVariantMap parameters() const;
00102     PendingStringList *updateParameters(const QVariantMap &set,
00103             const QStringList &unset);
00104     // requires spec 0.17.24
00105     PendingOperation *reconnect();
00106 
00107     // comes from the ConnectionManager
00108     ProtocolInfo *protocolInfo() const;
00109 
00110     bool connectsAutomatically() const;
00111     PendingOperation *setConnectsAutomatically(bool value);
00112 
00113     bool hasBeenOnline() const;
00114 
00115     ConnectionStatus connectionStatus() const;
00116     ConnectionStatusReason connectionStatusReason() const;
00117     bool haveConnection() const;
00118     ConnectionPtr connection() const;
00119 
00120     SimplePresence automaticPresence() const;
00121     PendingOperation *setAutomaticPresence(
00122             const SimplePresence &value);
00123 
00124     SimplePresence currentPresence() const;
00125 
00126     SimplePresence requestedPresence() const;
00127     PendingOperation *setRequestedPresence(
00128             const SimplePresence &value);
00129 
00130     QString uniqueIdentifier() const;
00131 
00132     // doc as for advanced users
00133     QString connectionObjectPath() const;
00134 
00135     QString normalizedName() const;
00136 
00137     PendingOperation *remove();
00138 
00139     PendingChannelRequest *ensureTextChat(
00140             const QString &contactIdentifier,
00141             QDateTime userActionTime = QDateTime::currentDateTime(),
00142             const QString &preferredHandler = QString());
00143     PendingChannelRequest *ensureTextChat(
00144             const ContactPtr &contact,
00145             QDateTime userActionTime = QDateTime::currentDateTime(),
00146             const QString &preferredHandler = QString());
00147 
00148     PendingChannelRequest *ensureTextChatroom(
00149             const QString &roomName,
00150             QDateTime userActionTime = QDateTime::currentDateTime(),
00151             const QString &preferredHandler = QString());
00152 
00153     PendingChannelRequest *ensureMediaCall(
00154             const QString &contactIdentifier,
00155             QDateTime userActionTime = QDateTime::currentDateTime(),
00156             const QString &preferredHandler = QString());
00157     PendingChannelRequest *ensureMediaCall(
00158             const ContactPtr &contact,
00159             QDateTime userActionTime = QDateTime::currentDateTime(),
00160             const QString &preferredHandler = QString());
00161 
00162     // advanced
00163     PendingChannelRequest *createChannel(
00164             const QVariantMap &requestedProperties,
00165             QDateTime userActionTime = QDateTime::currentDateTime(),
00166             const QString &preferredHandler = QString());
00167     PendingChannelRequest *ensureChannel(
00168             const QVariantMap &requestedProperties,
00169             QDateTime userActionTime = QDateTime::currentDateTime(),
00170             const QString &preferredHandler = QString());
00171 
00172     inline Client::DBus::PropertiesInterface *propertiesInterface() const
00173     {
00174         return optionalInterface<Client::DBus::PropertiesInterface>(BypassInterfaceCheck);
00175     }
00176 
00177     inline Client::AccountInterfaceAvatarInterface *avatarInterface(
00178             InterfaceSupportedChecking check = CheckInterfaceSupported) const
00179     {
00180         return optionalInterface<Client::AccountInterfaceAvatarInterface>(check);
00181     }
00182 
00183 Q_SIGNALS:
00184     void displayNameChanged(const QString &);
00185     void iconChanged(const QString &);
00186     void nicknameChanged(const QString &);
00187     void normalizedNameChanged(const QString &);
00188     void validityChanged(bool);
00189     void stateChanged(bool);
00190     void connectsAutomaticallyPropertyChanged(bool);
00191     void firstOnline();
00192     void parametersChanged(const QVariantMap &);
00193     void automaticPresenceChanged(const Tp::SimplePresence &) const;
00194     void currentPresenceChanged(const Tp::SimplePresence &) const;
00195     void requestedPresenceChanged(const Tp::SimplePresence &) const;
00196     void avatarChanged(const Tp::Avatar &);
00197     void connectionStatusChanged(Tp::ConnectionStatus,
00198             Tp::ConnectionStatusReason);
00199     void haveConnectionChanged(bool haveConnection);
00200 
00201 protected:
00202     Account(const QString &busName, const QString &objectPath);
00203     Account(const QDBusConnection &bus,
00204             const QString &busName, const QString &objectPath);
00205 
00206     Client::AccountInterface *baseInterface() const;
00207 
00208 private Q_SLOTS:
00209     void gotMainProperties(QDBusPendingCallWatcher *);
00210     void gotAvatar(QDBusPendingCallWatcher *);
00211     void onAvatarChanged();
00212     void onConnectionManagerReady(Tp::PendingOperation *);
00213     void onPropertyChanged(const QVariantMap &delta);
00214     void onRemoved();
00215 
00216 private:
00217     struct Private;
00218     friend struct Private;
00219     Private *mPriv;
00220 };
00221 
00222 } // Tp
00223 
00224 #endif


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