TelepathyQt4: channel-dispatch-operation.h Source File

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

# channel-dispatch-operation.h

    00001 /*
    00002  * This file is part of TelepathyQt4
    00003  *
    00004  * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
    00005  * Copyright (C) 2009 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_channel_dispatch_operation_h_HEADER_GUARD_
    00023 #define _TelepathyQt4_channel_dispatch_operation_h_HEADER_GUARD_
    00024
    00025 #ifndef IN_TELEPATHY_QT4_HEADER
    00026 #error IN_TELEPATHY_QT4_HEADER
    00027 #endif
    00028
    00029 #include <TelepathyQt4/_gen/cli-channel-dispatch-operation.h>
    00030
    00031 #include <TelepathyQt4/Constants>
    00032 #include <TelepathyQt4/DBus>
    00033 #include <TelepathyQt4/DBusProxy>
    00034 #include <TelepathyQt4/Feature>
    00035 #include <TelepathyQt4/OptionalInterfaceFactory>
    00036 #include <TelepathyQt4/ReadinessHelper>
    00037 #include <TelepathyQt4/ReadyObject>
    00038 #include <TelepathyQt4/Types>
    00039 #include <TelepathyQt4/SharedPtr>
    00040
    00041 #include <QString>
    00042 #include <QStringList>
    00043 #include <QVariantMap>
    00044
    00045 namespace Tp
    00046 {
    00047
    00048 class PendingOperation;
    00049
    00050 class TELEPATHY_QT4_EXPORT ChannelDispatchOperation : public StatefulDBusProxy,
    00051                                  public OptionalInterfaceFactory<ChannelDispatchOperation>,
    00052                                  public ReadyObject,
    00053                                  public RefCounted
    00054 {
    00055     Q_OBJECT
    00056     Q_DISABLE_COPY(ChannelDispatchOperation)
    00057
    00058 public:
    00059     static const Feature FeatureCore;
    00060
    00061     static ChannelDispatchOperationPtr create(const QString &objectPath,
    00062             const QVariantMap &immutableProperties);
    00063     static ChannelDispatchOperationPtr create(const QDBusConnection &bus,
    00064             const QString &objectPath, const QVariantMap &immutableProperties);
    00065
    00066     virtual ~ChannelDispatchOperation();
    00067
    00068     ConnectionPtr connection() const;
    00069
    00070     AccountPtr account() const;
    00071
    00072     QList<ChannelPtr> channels() const;
    00073
    00074     QStringList possibleHandlers() const;
    00075
    00076     PendingOperation *handleWith(const QString &handler);
    00077
    00078     PendingOperation *claim();
    00079
    00080     inline Client::DBus::PropertiesInterface *propertiesInterface() const
    00081     {
    00082         return optionalInterface<Client::DBus::PropertiesInterface>(BypassInterfaceCheck);
    00083     }
    00084
    00085 Q_SIGNALS:
    00086     void channelLost(const ChannelPtr &channel, const QString &errorName,
    00087             const QString &errorMessage);
    00088
    00089 protected:
    00090     ChannelDispatchOperation(const QDBusConnection &bus,
    00091             const QString &objectPath, const QVariantMap &immutableProperties);
    00092
    00093     Client::ChannelDispatchOperationInterface *baseInterface() const;
    00094
    00095 private Q_SLOTS:
    00096     void onFinished();
    00097     void gotMainProperties(QDBusPendingCallWatcher *watcher);
    00098     void onConnectionReady(Tp::PendingOperation *op);
    00099     void onAccountReady(Tp::PendingOperation *op);
    00100     void onChannelReady(Tp::PendingOperation *op);
    00101     void onChannelLost(const QDBusObjectPath &channelObjectPath,
    00102         const QString &errorName, const QString &errorMessage);
    00103
    00104 private:
    00105     struct Private;
    00106     friend struct Private;
    00107     Private *mPriv;
    00108 };
    00109
    00110 } // Tp
    00111
    00112 #endif