2 * This file is part of QMAFW
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
7 * Contact: Visa Smolander <visa.smolander@nokia.com>
9 * This software, including documentation, is protected by copyright controlled
10 * by Nokia Corporation. All rights are reserved. Copying, including
11 * reproducing, storing, adapting or translating, any or all of this material
12 * requires the prior written consent of Nokia Corporation. This material also
13 * contains confidential information which may not be disclosed to others
14 * without the prior written consent of Nokia.
18 #include <contextsubscriber/contextproperty.h>
19 #include <contextsubscriber/contextproviderinfo.h>
20 #include <contextsubscriber/contextpropertyinfo.h>
21 #include <sys/creds.h>
23 #include <QDBusConnectionInterface>
25 ContextProperty *global_video_route_property = 0;
26 ContextProperty *global_audio_route_property = 0;
27 QString global_audio_route("");
28 QString global_video_route("");
29 ContextPropertyInfo propertyInfo("key");
31 ContextProperty::ContextProperty(const QString& key, QObject*)
33 if (key == "/com/nokia/policy/video_route" && global_video_route_property == 0)
35 global_video_route_property = this;
37 else if (key == "/com/nokia/policy/audio_route" && global_audio_route_property == 0)
39 global_audio_route_property = this;
43 ContextProperty::~ContextProperty()
45 qDebug() << __PRETTY_FUNCTION__;
46 if (this == global_video_route_property)
48 global_video_route_property = 0;
50 else if (this == global_audio_route_property)
52 global_audio_route_property = 0;
56 // this non-const function is used to trigger the signal emissions
57 void ContextProperty::ignoreCommander()
59 Q_EMIT global_video_route_property->valueChanged();
60 Q_EMIT global_audio_route_property->valueChanged();
63 QString ContextProperty::key() const
65 if (this == global_video_route_property)
67 return "/com/nokia/policy/video_route";
69 else if (this == global_audio_route_property)
71 return "/com/nokia/policy/audio_route";
79 QVariant ContextProperty::value() const
81 if (this == global_video_route_property)
83 return QVariant(global_video_route);
85 else if (this == global_audio_route_property)
87 return QVariant(global_audio_route);
95 const ContextPropertyInfo* ContextProperty::info() const
100 ContextPropertyInfo::ContextPropertyInfo(const QString &key, QObject *parent)
106 const QList<ContextProviderInfo> ContextPropertyInfo::providers() const
108 QList<ContextProviderInfo> list;
109 list << ContextProviderInfo("contextkit-dbus", "system:com.nokia.policy.pcfd");
114 bool QDBusError::isValid() const
119 QDBusMessage::MessageType QDBusMessage::type() const
121 if( this->member()=="GetConnectionUnixProcessID" )
123 return QDBusMessage::ReplyMessage;
126 return QDBusMessage::SignalMessage;