From ff57a31b95c48d75e49641177a8805193ea7ddaf Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 11 Sep 2011 00:22:17 +0200 Subject: Initial import. --- fakepropertyadaptor.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 fakepropertyadaptor.cpp (limited to 'fakepropertyadaptor.cpp') diff --git a/fakepropertyadaptor.cpp b/fakepropertyadaptor.cpp new file mode 100644 index 0000000..0a65c31 --- /dev/null +++ b/fakepropertyadaptor.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +#include "fakepropertyadaptor.h" + +FakePropertyAdaptor::FakePropertyAdaptor(FakeProperty* property) : + QDBusAbstractAdaptor(property), _property(property) +{ +} + +QString FakePropertyAdaptor::objectPath() const +{ + if (_property->key().startsWith("/")) + return QString(_property->key()); + + return QString("/org/maemo/contextkit/") + + QString(_property->key()).replace(".", "/").replace(QRegExp("[^A-Za-z0-9_/]"), "_"); +} + +void FakePropertyAdaptor::Subscribe(const QDBusMessage& msg, QVariantList& values, quint64& timestamp) +{ + qDebug() << "subscribe from " << msg.service(); + Get(values, timestamp); +} + +void FakePropertyAdaptor::Unsubscribe(const QDBusMessage& msg) +{ + qDebug() << "unsubscribe from " << msg.service(); +} + +void FakePropertyAdaptor::Get(QVariantList& values, quint64& timestamp) +{ + values << _property->value(); + timestamp = -1LL; +} -- cgit v1.2.3