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


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