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
    00068 public:
    00069     static const Feature FeatureCore;
    00070     static const Feature FeatureAvatar;
    00071     static const Feature FeatureProtocolInfo;
    00072
    00073     static AccountPtr create(const QDBusConnection &bus,
    00074             const QString &busName, const QString &objectPath);
    00075     static AccountPtr create(const QString &busName,
    00076             const QString &objectPath);
    00077
    00078     virtual ~Account();
    00079
    00080     bool isValidAccount() const;
    00081
    00082     bool isEnabled() const;
    00083     PendingOperation *setEnabled(bool value);
    00084
    00085     QString cmName() const;
    00086
    00087     QString protocol() const;
    00088
    00089     QString displayName() const;
    00090     PendingOperation *setDisplayName(const QString &value);
    00091
    00092     QString icon() const;
    00093     PendingOperation *setIcon(const QString &value);
    00094
    00095     QString nickname() const;
    00096     PendingOperation *setNickname(const QString &value);
    00097
    00098     // requires spec 0.17.16
    00099     const Avatar &avatar() const;
    00100     PendingOperation *setAvatar(const Avatar &avatar);
    00101
    00102     QVariantMap parameters() const;
    00103     PendingStringList *updateParameters(const QVariantMap &set,
    00104             const QStringList &unset);
    00105     // requires spec 0.17.24
    00106     PendingOperation *reconnect();
    00107
    00108     // comes from the ConnectionManager
    00109     ProtocolInfo *protocolInfo() const;
    00110
    00111     bool connectsAutomatically() const;
    00112     PendingOperation *setConnectsAutomatically(bool value);
    00113
    00114     bool hasBeenOnline() const;
    00115
    00116     ConnectionStatus connectionStatus() const;
    00117     ConnectionStatusReason connectionStatusReason() const;
    00118     bool haveConnection() const;
    00119     ConnectionPtr connection() const;
    00120
    00121     SimplePresence automaticPresence() const;
    00122     PendingOperation *setAutomaticPresence(
    00123             const SimplePresence &value);
    00124
    00125     SimplePresence currentPresence() const;
    00126
    00127     SimplePresence requestedPresence() const;
    00128     PendingOperation *setRequestedPresence(
    00129             const SimplePresence &value);
    00130
    00131     QString uniqueIdentifier() const;
    00132
    00133     // doc as for advanced users
    00134     QString connectionObjectPath() const;
    00135
    00136     QString normalizedName() const;
    00137
    00138     PendingOperation *remove();
    00139
    00140     PendingChannelRequest *ensureTextChat(
    00141             const QString &contactIdentifier,
    00142             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00143             const QString &preferredHandler = QString());
    00144     PendingChannelRequest *ensureTextChat(
    00145             const ContactPtr &contact,
    00146             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00147             const QString &preferredHandler = QString());
    00148
    00149     PendingChannelRequest *ensureTextChatroom(
    00150             const QString &roomName,
    00151             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00152             const QString &preferredHandler = QString());
    00153
    00154     PendingChannelRequest *ensureMediaCall(
    00155             const QString &contactIdentifier,
    00156             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00157             const QString &preferredHandler = QString());
    00158     PendingChannelRequest *ensureMediaCall(
    00159             const ContactPtr &contact,
    00160             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00161             const QString &preferredHandler = QString());
    00162
    00163     PendingChannelRequest *ensureAudioCall(
    00164             const QString &contactIdentifier,
    00165             QDateTime userActionTime = QDateTime::currentDateTime(),
    00166             const QString &preferredHandler = QString());
    00167     PendingChannelRequest *ensureAudioCall(
    00168             const ContactPtr &contact,
    00169             QDateTime userActionTime = QDateTime::currentDateTime(),
    00170             const QString &preferredHandler = QString());
    00171
    00172     PendingChannelRequest *ensureVideoCall(
    00173             const QString &contactIdentifier,
    00174             bool withAudio = true,
    00175             QDateTime userActionTime = QDateTime::currentDateTime(),
    00176             const QString &preferredHandler = QString());
    00177     PendingChannelRequest *ensureVideoCall(
    00178             const ContactPtr &contact,
    00179             bool withAudio = true,
    00180             QDateTime userActionTime = QDateTime::currentDateTime(),
    00181             const QString &preferredHandler = QString());
    00182
    00183     PendingChannelRequest *createFileTransfer(
    00184             const QString &contactIdentifier,
    00185             const FileTransferChannelCreationProperties &properties,
    00186             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00187             const QString &preferredHandler = QString());
    00188     PendingChannelRequest *createFileTransfer(
    00189             const ContactPtr &contact,
    00190             const FileTransferChannelCreationProperties &properties,
    00191             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00192             const QString &preferredHandler = QString());
    00193
    00194     // advanced
    00195     PendingChannelRequest *createChannel(
    00196             const QVariantMap &requestedProperties,
    00197             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00198             const QString &preferredHandler = QString());
    00199     PendingChannelRequest *ensureChannel(
    00200             const QVariantMap &requestedProperties,
    00201             const QDateTime &userActionTime = QDateTime::currentDateTime(),
    00202             const QString &preferredHandler = QString());
    00203
    00204     inline Client::DBus::PropertiesInterface *propertiesInterface() const
    00205     {
    00206         return optionalInterface<Client::DBus::PropertiesInterface>(BypassInterfaceCheck);
    00207     }
    00208
    00209     inline Client::AccountInterfaceAvatarInterface *avatarInterface(
    00210             InterfaceSupportedChecking check = CheckInterfaceSupported) const
    00211     {
    00212         return optionalInterface<Client::AccountInterfaceAvatarInterface>(check);
    00213     }
    00214
    00215 Q_SIGNALS:
    00216     void displayNameChanged(const QString &);
    00217     void iconChanged(const QString &);
    00218     void nicknameChanged(const QString &);
    00219     void normalizedNameChanged(const QString &);
    00220     void validityChanged(bool);
    00221     void stateChanged(bool);
    00222     void connectsAutomaticallyPropertyChanged(bool);
    00223     void firstOnline();
    00224     void parametersChanged(const QVariantMap &);
    00225     void automaticPresenceChanged(const Tp::SimplePresence &) const;
    00226     void currentPresenceChanged(const Tp::SimplePresence &) const;
    00227     void requestedPresenceChanged(const Tp::SimplePresence &) const;
    00228     void avatarChanged(const Tp::Avatar &);
    00229     void connectionStatusChanged(Tp::ConnectionStatus,
    00230             Tp::ConnectionStatusReason);
    00231     void haveConnectionChanged(bool haveConnection);
    00232
    00233 protected:
    00234     Account(const QString &busName, const QString &objectPath);
    00235     Account(const QDBusConnection &bus,
    00236             const QString &busName, const QString &objectPath);
    00237
    00238     Client::AccountInterface *baseInterface() const;
    00239
    00240 private Q_SLOTS:
    00241     void gotMainProperties(QDBusPendingCallWatcher *);
    00242     void gotAvatar(QDBusPendingCallWatcher *);
    00243     void onAvatarChanged();
    00244     void onConnectionManagerReady(Tp::PendingOperation *);
    00245     void onPropertyChanged(const QVariantMap &delta);
    00246     void onRemoved();
    00247
    00248 private:
    00249     struct Private;
    00250     friend struct Private;
    00251     Private *mPriv;
    00252 };
    00253
    00254 } // Tp
    00255
    00256 #endif