blob: 0a65c31944269e158000340e246de01e7d9c43c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <QtCore/QRegExp>
#include <QtCore/QDebug>
#include <QtDBus/QDBusMessage>
#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;
}
|