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_cli_dbus_proxy_h_HEADER_GUARD_
00023 #define _TelepathyQt4_cli_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 
00046     enum InterfaceSupportedChecking
00047     {
00048         CheckInterfaceSupported,
00049         BypassInterfaceCheck
00050     };
00051 
00052     virtual ~DBusProxy();
00053 
00054     QDBusConnection dbusConnection() const;
00055     QString busName() const;
00056     QString objectPath() const;
00057 
00058     bool isValid() const;
00059     QString invalidationReason() const;
00060     QString invalidationMessage() const;
00061 
00062 protected:
00063     void setBusName(const QString &busName);
00064     void invalidate(const QString &reason, const QString &message);
00065     void invalidate(const QDBusError &error);
00066 
00067 Q_SIGNALS:
00068     void invalidated(Tp::DBusProxy *proxy,
00069             const QString &errorName, const QString &errorMessage);
00070 
00071 private Q_SLOTS:
00072     void emitInvalidated();
00073 
00074 private:
00075     class Private;
00076     friend class Private;
00077     Private *mPriv;
00078 };
00079 
00080 class StatelessDBusProxy : public DBusProxy
00081 {
00082     Q_OBJECT
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     class Private;
00093     friend class Private;
00094     Private *mPriv;
00095 };
00096 
00097 class StatefulDBusProxy : public DBusProxy
00098 {
00099     Q_OBJECT
00100 
00101 public:
00102     StatefulDBusProxy(const QDBusConnection &dbusConnection,
00103         const QString &busName, const QString &objectPath,
00104         QObject *parent = 0);
00105 
00106     virtual ~StatefulDBusProxy();
00107 
00108 private Q_SLOTS:
00109     void onServiceOwnerChanged(const QString &name, const QString &oldOwner,
00110             const QString &newOwner);
00111 
00112 private:
00113     class Private;
00114     friend class Private;
00115     Private *mPriv;
00116 };
00117 
00118 } // Tp
00119 
00120 #endif


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