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

dbus-proxy.h

00001 /*
00002  * This file is part of TelepathyQt4
00003  *
00004  * Copyright (C) 2008-2009 Collabora Ltd. <http://www.collabora.co.uk/>
00005  * Copyright (C) 2008-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_dbus_proxy_h_HEADER_GUARD_
00023 #define _TelepathyQt4_dbus_proxy_h_HEADER_GUARD_
00024 
00025 #ifndef IN_TELEPATHY_QT4_HEADER
00026 #error IN_TELEPATHY_QT4_HEADER
00027 #endif
00028 
00029 #include <TelepathyQt4/Global>
00030 
00031 #include <QObject>
00032 
00033 class QDBusConnection;
00034 class QDBusError;
00035 
00036 namespace Tp
00037 {
00038 
00039 class TestBackdoors;
00040 
00041 class TELEPATHY_QT4_EXPORT DBusProxy : public QObject
00042 {
00043     Q_OBJECT
00044     Q_DISABLE_COPY(DBusProxy)
00045 
00046 public:
00047     DBusProxy(const QDBusConnection &dbusConnection, const QString &busName,
00048             const QString &objectPath, QObject *parent = 0);
00049     virtual ~DBusProxy();
00050 
00051     QDBusConnection dbusConnection() const;
00052     QString busName() const;
00053     QString objectPath() const;
00054 
00055     bool isValid() const;
00056     QString invalidationReason() const;
00057     QString invalidationMessage() const;
00058 
00059 Q_SIGNALS:
00060     void invalidated(Tp::DBusProxy *proxy,
00061             const QString &errorName, const QString &errorMessage);
00062 
00063 protected:
00064     void setBusName(const QString &busName);
00065     void invalidate(const QString &reason, const QString &message);
00066     void invalidate(const QDBusError &error);
00067 
00068 private Q_SLOTS:
00069     void emitInvalidated();
00070 
00071 private:
00072     friend class TestBackdoors;
00073 
00074     struct Private;
00075     friend struct Private;
00076     Private *mPriv;
00077 };
00078 
00079 class TELEPATHY_QT4_EXPORT StatelessDBusProxy : public DBusProxy
00080 {
00081     Q_OBJECT
00082     Q_DISABLE_COPY(StatelessDBusProxy)
00083 
00084 public:
00085     StatelessDBusProxy(const QDBusConnection &dbusConnection,
00086         const QString &busName, const QString &objectPath,
00087         QObject *parent = 0);
00088 
00089     virtual ~StatelessDBusProxy();
00090 
00091 private:
00092     struct Private;
00093     friend struct Private;
00094     Private *mPriv;
00095 };
00096 
00097 class TELEPATHY_QT4_EXPORT StatefulDBusProxy : public DBusProxy
00098 {
00099     Q_OBJECT
00100     Q_DISABLE_COPY(StatefulDBusProxy)
00101 
00102 public:
00103     StatefulDBusProxy(const QDBusConnection &dbusConnection,
00104         const QString &busName, const QString &objectPath,
00105         QObject *parent = 0);
00106 
00107     virtual ~StatefulDBusProxy();
00108 
00109     static QString uniqueNameFrom(const QDBusConnection &bus, const QString &wellKnownOrUnique);
00110     static QString uniqueNameFrom(const QDBusConnection &bus, const QString &wellKnownOrUnique,
00111             QString &error, QString &message);
00112 
00113 private Q_SLOTS:
00114     void onServiceOwnerChanged(const QString &name, const QString &oldOwner,
00115             const QString &newOwner);
00116 
00117 private:
00118     struct Private;
00119     friend struct Private;
00120     Private *mPriv;
00121 };
00122 
00123 } // Tp
00124 
00125 #endif


Copyright © 2008-2010 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.4.4