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 <QObject>
00030 
00031 class QDBusConnection;
00032 class QDBusError;
00033 
00034 namespace Tp
00035 {
00036 
00037 class DBusProxy : public QObject
00038 {
00039     Q_OBJECT
00040     Q_DISABLE_COPY(DBusProxy)
00041 
00042 public:
00043     DBusProxy(const QDBusConnection &dbusConnection, const QString &busName,
00044             const QString &objectPath, QObject *parent = 0);
00045     virtual ~DBusProxy();
00046 
00047     QDBusConnection dbusConnection() const;
00048     QString busName() const;
00049     QString objectPath() const;
00050 
00051     bool isValid() const;
00052     QString invalidationReason() const;
00053     QString invalidationMessage() const;
00054 
00055 Q_SIGNALS:
00056     void invalidated(Tp::DBusProxy *proxy,
00057             const QString &errorName, const QString &errorMessage);
00058 
00059 protected:
00060     void setBusName(const QString &busName);
00061     void invalidate(const QString &reason, const QString &message);
00062     void invalidate(const QDBusError &error);
00063 
00064 private Q_SLOTS:
00065     void emitInvalidated();
00066 
00067 private:
00068     struct Private;
00069     friend struct Private;
00070     Private *mPriv;
00071 };
00072 
00073 class StatelessDBusProxy : public DBusProxy
00074 {
00075     Q_OBJECT
00076     Q_DISABLE_COPY(StatelessDBusProxy)
00077 
00078 public:
00079     StatelessDBusProxy(const QDBusConnection &dbusConnection,
00080         const QString &busName, const QString &objectPath,
00081         QObject *parent = 0);
00082 
00083     virtual ~StatelessDBusProxy();
00084 
00085 private:
00086     struct Private;
00087     friend struct Private;
00088     Private *mPriv;
00089 };
00090 
00091 class StatefulDBusProxy : public DBusProxy
00092 {
00093     Q_OBJECT
00094     Q_DISABLE_COPY(StatefulDBusProxy)
00095 
00096 public:
00097     StatefulDBusProxy(const QDBusConnection &dbusConnection,
00098         const QString &busName, const QString &objectPath,
00099         QObject *parent = 0);
00100 
00101     virtual ~StatefulDBusProxy();
00102 
00103 private Q_SLOTS:
00104     void onServiceOwnerChanged(const QString &name, const QString &oldOwner,
00105             const QString &newOwner);
00106 
00107 private:
00108     struct Private;
00109     friend struct Private;
00110     Private *mPriv;
00111 };
00112 
00113 } // Tp
00114 
00115 #endif


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