src/hbplugins/devicedialogs/devicenotificationdialogplugin/hbdevicenotificationdialogplugin.cpp
changeset 23 e6ad4ef83b23
parent 0 16d8024aca5e
child 28 b7da29130b0e
--- a/src/hbplugins/devicedialogs/devicenotificationdialogplugin/hbdevicenotificationdialogplugin.cpp	Wed Aug 18 10:05:37 2010 +0300
+++ b/src/hbplugins/devicedialogs/devicenotificationdialogplugin/hbdevicenotificationdialogplugin.cpp	Thu Sep 02 20:44:51 2010 +0300
@@ -70,13 +70,20 @@
 {
     TRACE_ENTRY
     Q_UNUSED(deviceDialogType)
+
+#ifdef Q_OS_SYMBIAN
+    // If show group is higher than normal, a swEvent capability is required
+    if (showLevel(parameters) != NormalLevel) {
+        return (securityInfo["sym-caps"].toInt() >> ECapabilitySwEvent) & 1;
+    } else {
+        return true; // all clients are allowed to use.
+    }
+#else
     Q_UNUSED(parameters)
     Q_UNUSED(securityInfo)
-
-    // This plugin doesn't perform operations that may compromise security. All clients
-    // are allowed to use.
+    // All clients are allowed to use.
     return true;
-    TRACE_EXIT
+#endif // Q_OS_SYMBIAN
 }
 
 // Create device dialog widget
@@ -109,13 +116,14 @@
 {
     TRACE_ENTRY
     Q_UNUSED(deviceDialogType);
-    Q_UNUSED(parameters);
 
+    unsigned int level = static_cast<unsigned int>(showLevel(parameters));
+    if (level > CriticalLevel) {
+        return false;
+    }
     info->group = DeviceNotificationDialogGroup;
-    info->flags = NoDeviceDialogFlags;
-    info->priority = DefaultPriority;
-
-    TRACE_EXIT
+    info->flags = level == NormalLevel ? NoDeviceDialogFlags : SecurityCheck;
+    info->showLevel = static_cast<ShowLevel>(level);
     return true;
 }
 
@@ -147,3 +155,14 @@
     TRACE_EXIT
     return d->mError;
 }
+
+// Search parameters for show group
+int HbDeviceNotificationDialogPlugin::showLevel(const QVariantMap &parameters)
+{
+    int level = NormalLevel;
+    const QString propertyName("showLevel");
+    if (parameters.contains(propertyName)) {
+        level = parameters[propertyName].toInt(); 
+    }
+    return level;
+}