--- /dev/null
+/*
+ * This file is part of QMAFW
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+ * reserved.
+ *
+ * Contact: Visa Smolander <visa.smolander@nokia.com>
+ *
+ * This software, including documentation, is protected by copyright controlled
+ * by Nokia Corporation. All rights are reserved. Copying, including
+ * reproducing, storing, adapting or translating, any or all of this material
+ * requires the prior written consent of Nokia Corporation. This material also
+ * contains confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ *
+ */
+
+#include <contextsubscriber/contextproperty.h>
+#include <contextsubscriber/contextproviderinfo.h>
+#include <contextsubscriber/contextpropertyinfo.h>
+#include <sys/creds.h>
+#include <QDebug>
+#include <QDBusConnectionInterface>
+
+ContextProperty *global_video_route_property = 0;
+ContextProperty *global_audio_route_property = 0;
+QString global_audio_route("");
+QString global_video_route("");
+ContextPropertyInfo propertyInfo("key");
+
+ContextProperty::ContextProperty(const QString& key, QObject*)
+{
+ if (key == "/com/nokia/policy/video_route" && global_video_route_property == 0)
+ {
+ global_video_route_property = this;
+ }
+ else if (key == "/com/nokia/policy/audio_route" && global_audio_route_property == 0)
+ {
+ global_audio_route_property = this;
+ }
+}
+
+ContextProperty::~ContextProperty()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ if (this == global_video_route_property)
+ {
+ global_video_route_property = 0;
+ }
+ else if (this == global_audio_route_property)
+ {
+ global_audio_route_property = 0;
+ }
+}
+
+// this non-const function is used to trigger the signal emissions
+void ContextProperty::ignoreCommander()
+{
+ Q_EMIT global_video_route_property->valueChanged();
+ Q_EMIT global_audio_route_property->valueChanged();
+}
+
+QString ContextProperty::key() const
+{
+ if (this == global_video_route_property)
+ {
+ return "/com/nokia/policy/video_route";
+ }
+ else if (this == global_audio_route_property)
+ {
+ return "/com/nokia/policy/audio_route";
+ }
+ else
+ {
+ return "";
+ }
+}
+
+QVariant ContextProperty::value() const
+{
+ if (this == global_video_route_property)
+ {
+ return QVariant(global_video_route);
+ }
+ else if (this == global_audio_route_property)
+ {
+ return QVariant(global_audio_route);
+ }
+ else
+ {
+ return QVariant();
+ }
+}
+
+const ContextPropertyInfo* ContextProperty::info() const
+{
+ return &propertyInfo;
+}
+
+ContextPropertyInfo::ContextPropertyInfo(const QString &key, QObject *parent)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(parent);
+}
+
+const QList<ContextProviderInfo> ContextPropertyInfo::providers() const
+{
+ QList<ContextProviderInfo> list;
+ list << ContextProviderInfo("contextkit-dbus", "system:com.nokia.policy.pcfd");
+ return list;
+}
+
+// d-bus stub
+bool QDBusError::isValid() const
+{
+ return false;
+}
+
+QDBusMessage::MessageType QDBusMessage::type() const
+{
+ if( this->member()=="GetConnectionUnixProcessID" )
+ {
+ return QDBusMessage::ReplyMessage;
+ }
+
+ return QDBusMessage::SignalMessage;
+}