TelepathyQt4: account.h Source File

| 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/FileTransferChannelCreationProperties>
    00035 #include <TelepathyQt4/OptionalInterfaceFactory>
    00036 #include <TelepathyQt4/ReadinessHelper>
    00037 #include <TelepathyQt4/ReadyObject>
    00038 #include <TelepathyQt4/Types>
    00039 #include <TelepathyQt4/Constants>
    00040 #include <TelepathyQt4/SharedPtr>
    00041
    00042 #include <QSet>
    00043 #include <QString>
    00044 #include <QStringList>
    00045 #include <QVariantMap>
    00046
    00047 namespace Tp
    00048 {
    00049
    00050 class Account;
    00051 class Connection;
    00052 class PendingChannelRequest;
    00053 class PendingConnection;
    00054 class PendingOperation;
    00055 class PendingReady;
    00056 class PendingStringList;
    00057 class ProtocolInfo;
    00058
    00059 class TELEPATHY_QT4_EXPORT Account : public StatelessDBusProxy,
    00060                 public OptionalInterfaceFactory<Account>,
    00061                 public ReadyObject,
    00062                 public RefCounted
    00063
    00064 {
    00065     Q_OBJECT
    00066     Q_DISABLE_COPY(Account)
    00067     Q_PROPERTY(bool valid READ isValidAccount NOTIFY validityChanged)
    00068     Q_PROPERTY(bool enabled READ isEnabled NOTIFY stateChanged)
    00069     Q_PROPERTY(QString cmName READ cmName)
    00070     Q_PROPERTY(QString protocolName READ protocolName)
    00071     Q_PROPERTY(QString serviceName READ serviceName NOTIFY serviceNameChanged)
    00072     Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
    00073     Q_PROPERTY(QString iconName READ iconName NOTIFY iconNameChanged)
    00074     Q_PROPERTY(QString nickname READ nickname NOTIFY nicknameChanged)
    00075     Q_PROPERTY(Avatar avatar READ avatar NOTIFY avatarChanged)
    00076     Q_PROPERTY(QVariantMap parameters READ parameters NOTIFY parametersChanged)
    00077     Q_PROPERTY(bool hasBeenOnline READ hasBeenOnline)
    00078     Q_PROPERTY(bool connectsAutomatically READ connectsAutomatically NOTIFY connectsAutomaticallyPropertyChanged)
    00079     Q_PROPERTY(ConnectionStatus connectionStatus READ connectionStatus)
    00080     Q_PROPERTY(ConnectionStatusReason connectionStatusReason READ connectionStatusReason)
    00081     Q_PROPERTY(QString connectionError READ connectionError)
    00082     Q_PROPERTY(QVariantMap connectionErrorDetails READ connectionErrorDetails)
    00083     Q_PROPERTY(bool haveConnection READ haveConnection NOTIFY haveConnectionChanged)
    00084     Q_PROPERTY(ConnectionPtr connection READ connection)
    00085     Q_PROPERTY(bool changingPresence READ isChangingPresence NOTIFY changingPresence)
    00086     Q_PROPERTY(SimplePresence automaticPresence READ automaticPresence NOTIFY automaticPresenceChanged)
    00087     Q_PROPERTY(SimplePresence currentPresence READ currentPresence NOTIFY currentPresenceChanged)
    00088     Q_PROPERTY(SimplePresence requestedPresence READ requestedPresence NOTIFY requestedPresenceChanged)
    00089     Q_PROPERTY(bool online READ isOnline NOTIFY onlinenessChanged)
    00090     Q_PROPERTY(QString uniqueIdentifier READ uniqueIdentifier)
    00091     Q_PROPERTY(QString connectionObjectPath READ connectionObjectPath)
    00092     Q_PROPERTY(QString normalizedName READ normalizedName NOTIFY normalizedNameChanged)
    00093
    00094 public:
    00095     static const Feature FeatureCore;
    00096     static const Feature FeatureAvatar;
    00097     static const Feature FeatureProtocolInfo;
    00098
    00099     static AccountPtr create(const QString &busName,
    00100             const QString &objectPath);
    00101     static AccountPtr create(const QDBusConnection &bus,
    00102             const QString &busName, const QString &objectPath);
    00103
    00104     virtual ~Account();
    00105
    00106     bool isValidAccount() const;
    00107
    00108     bool isEnabled() const;
    00109     PendingOperation *setEnabled(bool value);
    00110
    00111     QString cmName() const;
    00112
    00113     TELEPATHY_QT4_DEPRECATED QString protocol() const;
    00114     QString protocolName() const;
    00115
    00116     QString serviceName() const;
    00117     PendingOperation *setServiceName(const QString &value);
    00118
    00119     QString displayName() const;
    00120     PendingOperation *setDisplayName(const QString &value);
    00121
    00122     TELEPATHY_QT4_DEPRECATED QString icon() const;
    00123     QString iconName() const;
    00124     TELEPATHY_QT4_DEPRECATED PendingOperation *setIcon(const QString &value);
    00125     PendingOperation *setIconName(const QString &value);
    00126
    00127     QString nickname() const;
    00128     PendingOperation *setNickname(const QString &value);
    00129
    00130     const Avatar &avatar() const;
    00131     PendingOperation *setAvatar(const Avatar &avatar);
    00132
    00133     QVariantMap parameters() const;
    00134     PendingStringList *updateParameters(const QVariantMap &set,
    00135             const QStringList &unset);
    00136
    00137     // comes from the ConnectionManager
    00138     ProtocolInfo *protocolInfo() const;
    00139
    00140     bool connectsAutomatically() const;
    00141     PendingOperation *setConnectsAutomatically(bool value);
    00142
    00143     bool hasBeenOnline() const;
    00144
    00145     ConnectionStatus connectionStatus() const;
    00146     ConnectionStatusReason connectionStatusReason() const;
    00147     QString connectionError() const;
    00148     QVariantMap connectionErrorDetails() const;
    00149     bool haveConnection() const;
    00150     ConnectionPtr connection() const;
    00151
    00152     bool isChangingPresence() const;
    00153
    00154     SimplePresence automaticPresence() const;
    00155     PendingOperation *setAutomaticPresence(
    00156             const SimplePresence &value);
    00157
    00158     SimplePresence currentPresence() const;
    00159
    00160     SimplePresence requestedPresence() const;
    00161     PendingOperation *setRequestedPresence(
    00162             const SimplePresence &value);
    00163
    00164     bool isOnline() const;
    00165
    00166     QString uniqueIdentifier() const;
    00167
    00168     // doc as for advanced users
    00169     QString connectionObjectPath() const;
    00170
    00171     QString normalizedName() const;
    00172
    00173     PendingOperation *reconnect();
    00174
    00175     PendingOperation *remove();
    00176
    00177     PendingChannelRequest *ensureTextChat(
    00178             const QString &contactIdentifier,
    00179             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00180             const QString &preferredHandler = QString());
    00181     PendingChannelRequest *ensureTextChat(
    00182             const ContactPtr &contact,
    00183             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00184             const QString &preferredHandler = QString());
    00185
    00186     PendingChannelRequest *ensureTextChatroom(
    00187             const QString &roomName,
    00188             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00189             const QString &preferredHandler = QString());
    00190
    00191     PendingChannelRequest *ensureMediaCall(
    00192             const QString &contactIdentifier,
    00193             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00194             const QString &preferredHandler = QString());
    00195     PendingChannelRequest *ensureMediaCall(
    00196             const ContactPtr &contact,
    00197             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00198             const QString &preferredHandler = QString());
    00199
    00200     PendingChannelRequest *ensureAudioCall(
    00201             const QString &contactIdentifier,
    00202             QDateTime userActionTime = QDateTime::currentDateTime(),
    00203             const QString &preferredHandler = QString());
    00204     PendingChannelRequest *ensureAudioCall(
    00205             const ContactPtr &contact,
    00206             QDateTime userActionTime = QDateTime::currentDateTime(),
    00207             const QString &preferredHandler = QString());
    00208
    00209     PendingChannelRequest *ensureVideoCall(
    00210             const QString &contactIdentifier,
    00211             bool withAudio = true,
    00212             QDateTime userActionTime = QDateTime::currentDateTime(),
    00213             const QString &preferredHandler = QString());
    00214     PendingChannelRequest *ensureVideoCall(
    00215             const ContactPtr &contact,
    00216             bool withAudio = true,
    00217             QDateTime userActionTime = QDateTime::currentDateTime(),
    00218             const QString &preferredHandler = QString());
    00219
    00220     PendingChannelRequest *createFileTransfer(
    00221             const QString &contactIdentifier,
    00222             const FileTransferChannelCreationProperties &properties,
    00223             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00224             const QString &preferredHandler = QString());
    00225     PendingChannelRequest *createFileTransfer(
    00226             const ContactPtr &contact,
    00227             const FileTransferChannelCreationProperties &properties,
    00228             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00229             const QString &preferredHandler = QString());
    00230
    00231     PendingChannelRequest *createConferenceMediaCall(
    00232             const QList<ChannelPtr> &channels,
    00233             const QStringList &initialInviteeContactsIdentifiers = QStringList(),
    00234             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00235             const QString &preferredHandler = QString());
    00236     PendingChannelRequest *createConferenceMediaCall(
    00237             const QList<ChannelPtr> &channels,
    00238             const QList<ContactPtr> &initialInviteeContacts = QList<ContactPtr>(),
    00239             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00240             const QString &preferredHandler = QString());
    00241
    00242     PendingChannelRequest *createConferenceTextChat(
    00243             const QList<ChannelPtr> &channels,
    00244             const QList<ContactPtr> &initialInviteeContacts = QList<ContactPtr>(),
    00245             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00246             const QString &preferredHandler = QString());
    00247     PendingChannelRequest *createConferenceTextChat(
    00248             const QList<ChannelPtr> &channels,
    00249             const QStringList &initialInviteeContactsIdentifiers = QStringList(),
    00250             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00251             const QString &preferredHandler = QString());
    00252
    00253     PendingChannelRequest *createConferenceTextChatRoom(
    00254             const QString &roomName,
    00255             const QList<ChannelPtr> &channels,
    00256             const QStringList &initialInviteeContactsIdentifiers = QStringList(),
    00257             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00258             const QString &preferredHandler = QString());
    00259     PendingChannelRequest *createConferenceTextChatRoom(
    00260             const QString &roomName,
    00261             const QList<ChannelPtr> &channels,
    00262             const QList<ContactPtr> &initialInviteeContacts = QList<ContactPtr>(),
    00263             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00264             const QString &preferredHandler = QString());
    00265
    00266     // advanced
    00267     PendingChannelRequest *createChannel(
    00268             const QVariantMap &requestedProperties,
    00269             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00270             const QString &preferredHandler = QString());
    00271     PendingChannelRequest *ensureChannel(
    00272             const QVariantMap &requestedProperties,
    00273             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00274             const QString &preferredHandler = QString());
    00275
    00276     inline Client::DBus::PropertiesInterface *propertiesInterface() const
    00277     {
    00278         return optionalInterface<Client::DBus::PropertiesInterface>(BypassInterfaceCheck);
    00279     }
    00280
    00281     inline Client::AccountInterfaceAvatarInterface *avatarInterface(
    00282             InterfaceSupportedChecking check = CheckInterfaceSupported) const
    00283     {
    00284         return optionalInterface<Client::AccountInterfaceAvatarInterface>(check);
    00285     }
    00286
    00287 Q_SIGNALS:
    00288     void removed();
    00289     void serviceNameChanged(const QString &serviceName);
    00290     void displayNameChanged(const QString &displayName);
    00291     TELEPATHY_QT4_DEPRECATED void iconChanged(const QString &iconName);
    00292     void iconNameChanged(const QString &iconName);
    00293     void nicknameChanged(const QString &nickname);
    00294     void normalizedNameChanged(const QString &normalizedName);
    00295     void validityChanged(bool validity);
    00296     void stateChanged(bool state);
    00297     void connectsAutomaticallyPropertyChanged(bool connectsAutomatically);
    00298     void firstOnline();
    00299     void parametersChanged(const QVariantMap &parameters);
    00300     void changingPresence(bool value);
    00301     void automaticPresenceChanged(const Tp::SimplePresence &automaticPresence) const;
    00302     void currentPresenceChanged(const Tp::SimplePresence &currentPresence) const;
    00303     void requestedPresenceChanged(const Tp::SimplePresence &requestedPresence) const;
    00304     void onlinenessChanged(bool online);
    00305     void avatarChanged(const Tp::Avatar &avatar);
    00306     TELEPATHY_QT4_DEPRECATED void connectionStatusChanged(Tp::ConnectionStatus status,
    00307             Tp::ConnectionStatusReason statusReason);
    00308     void statusChanged(Tp::ConnectionStatus status,
    00309             Tp::ConnectionStatusReason statusReason,
    00310             const QString &error, const QVariantMap &errorDetails);
    00311     void haveConnectionChanged(bool haveConnection);
    00312
    00313     void propertyChanged(const QString &propertyName);
    00314
    00315 protected:
    00316     Account(const QString &busName, const QString &objectPath);
    00317     Account(const QDBusConnection &bus,
    00318             const QString &busName, const QString &objectPath);
    00319
    00320     Client::AccountInterface *baseInterface() const;
    00321
    00322 private Q_SLOTS:
    00323     void gotMainProperties(QDBusPendingCallWatcher *);
    00324     void gotAvatar(QDBusPendingCallWatcher *);
    00325     void onAvatarChanged();
    00326     void onConnectionManagerReady(Tp::PendingOperation *);
    00327     void onPropertyChanged(const QVariantMap &delta);
    00328     void onRemoved();
    00329
    00330 private:
    00331     struct Private;
    00332     friend struct Private;
    00333
    00334     void notify(const char *propertyName);
    00335
    00336     Private *mPriv;
    00337 };
    00338
    00339 } // Tp
    00340
    00341 #endif