diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-04-04 11:16:15 -0300 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-04-04 11:16:15 -0300 |
commit | 6c258da57b40dab608c31b6abdff93d2792bf9c0 (patch) | |
tree | a612356ddc67755b69ccbfe82c547936c38f6fba | |
parent | 10e13da5825e28e0f3ac9bfd8b387b5bcf4d499d (diff) |
DBusObject: Add utility class holding a QDBusConnection.
-rw-r--r-- | TelepathyQt/CMakeLists.txt | 3 | ||||
-rw-r--r-- | TelepathyQt/DBusObject | 13 | ||||
-rw-r--r-- | TelepathyQt/dbus-object.cpp | 56 | ||||
-rw-r--r-- | TelepathyQt/dbus-object.h | 57 |
4 files changed, 129 insertions, 0 deletions
diff --git a/TelepathyQt/CMakeLists.txt b/TelepathyQt/CMakeLists.txt index 047bcba9..feaea053 100644 --- a/TelepathyQt/CMakeLists.txt +++ b/TelepathyQt/CMakeLists.txt @@ -827,6 +827,7 @@ if(ENABLE_EXPERIMENTAL_SERVICE_SUPPORT) base-connection.cpp base-protocol.cpp dbus-error.cpp + dbus-object.cpp dbus-service.cpp abstract-adaptor.cpp) @@ -846,6 +847,8 @@ if(ENABLE_EXPERIMENTAL_SERVICE_SUPPORT) base-protocol.h DBusError dbus-error.h + DBusObject + dbus-object.h DBusService dbus-service.h Global diff --git a/TelepathyQt/DBusObject b/TelepathyQt/DBusObject new file mode 100644 index 00000000..309b2d42 --- /dev/null +++ b/TelepathyQt/DBusObject @@ -0,0 +1,13 @@ +#ifndef _TelepathyQt_DBusObject_HEADER_GUARD_ +#define _TelepathyQt_DBusObject_HEADER_GUARD_ + +#ifndef IN_TP_QT_HEADER +#define IN_TP_QT_HEADER +#endif + +#include <TelepathyQt/dbus-object.h> + +#undef IN_TP_QT_HEADER + +#endif +// vim:set ft=cpp: diff --git a/TelepathyQt/dbus-object.cpp b/TelepathyQt/dbus-object.cpp new file mode 100644 index 00000000..8cd2dc72 --- /dev/null +++ b/TelepathyQt/dbus-object.cpp @@ -0,0 +1,56 @@ +/** + * This file is part of TelepathyQt + * + * @copyright Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/> + * @copyright Copyright (C) 2012 Nokia Corporation + * @license LGPL 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <TelepathyQt/DBusObject> + +#include <QDBusConnection> + +namespace Tp +{ + +struct TP_QT_NO_EXPORT DBusObject::Private +{ + Private(const QDBusConnection &dbusConnection) + : dbusConnection(dbusConnection) + { + } + + QDBusConnection dbusConnection; +}; + +DBusObject::DBusObject(const QDBusConnection &dbusConnection, QObject *parent) + : QObject(parent), + mPriv(new Private(dbusConnection)) +{ +} + +DBusObject::~DBusObject() +{ + delete mPriv; +} + +QDBusConnection DBusObject::dbusConnection() const +{ + return mPriv->dbusConnection; +} + +} diff --git a/TelepathyQt/dbus-object.h b/TelepathyQt/dbus-object.h new file mode 100644 index 00000000..6836a23e --- /dev/null +++ b/TelepathyQt/dbus-object.h @@ -0,0 +1,57 @@ +/** + * This file is part of TelepathyQt + * + * @copyright Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/> + * @copyright Copyright (C) 2012 Nokia Corporation + * @license LGPL 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TelepathyQt_dbus_object_h_HEADER_GUARD_ +#define _TelepathyQt_dbus_object_h_HEADER_GUARD_ + +#ifndef IN_TP_QT_HEADER +#error IN_TP_QT_HEADER +#endif + +#include <TelepathyQt/Global> + +#include <QObject> + +class QDBusConnection; + +namespace Tp +{ + +class TP_QT_EXPORT DBusObject : public QObject +{ + Q_DISABLE_COPY(DBusObject) + +public: + DBusObject(const QDBusConnection &dbusConnection, QObject *parent = 0); + virtual ~DBusObject(); + + QDBusConnection dbusConnection() const; + +private: + class Private; + friend class Private; + Private *mPriv; +}; + +} + +#endif |