src/hbplugins/devicedialogs/deviceprogressdialogplugin/hbdeviceprogressdialogplugin.cpp
equal
deleted
inserted
replaced
38 const char *mTypeString; |
38 const char *mTypeString; |
39 } dialogInfos[] = { |
39 } dialogInfos[] = { |
40 {"com.nokia.hb.deviceprogressdialog/1.0"} |
40 {"com.nokia.hb.deviceprogressdialog/1.0"} |
41 }; |
41 }; |
42 |
42 |
|
43 /// \cond |
43 class HbDeviceProgressDialogPluginPrivate |
44 class HbDeviceProgressDialogPluginPrivate |
44 { |
45 { |
45 public: |
46 public: |
46 HbDeviceProgressDialogPluginPrivate() {mError = NoError;} |
47 HbDeviceProgressDialogPluginPrivate() {mError = NoError;} |
47 |
48 |
48 int mError; |
49 int mError; |
49 }; |
50 }; |
|
51 /// \endcond |
50 |
52 |
51 // Constructor |
53 // Constructor |
52 HbDeviceProgressDialogPlugin::HbDeviceProgressDialogPlugin() |
54 HbDeviceProgressDialogPlugin::HbDeviceProgressDialogPlugin() |
53 { |
55 { |
54 TRACE_ENTRY |
56 TRACE_ENTRY |
68 bool HbDeviceProgressDialogPlugin::accessAllowed(const QString &deviceDialogType, |
70 bool HbDeviceProgressDialogPlugin::accessAllowed(const QString &deviceDialogType, |
69 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
71 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
70 { |
72 { |
71 TRACE_ENTRY |
73 TRACE_ENTRY |
72 Q_UNUSED(deviceDialogType) |
74 Q_UNUSED(deviceDialogType) |
|
75 |
|
76 #ifdef Q_OS_SYMBIAN |
|
77 // If show group is higher than normal, a swEvent capability is required |
|
78 if (showLevel(parameters) != NormalLevel) { |
|
79 return (securityInfo["sym-caps"].toInt() >> ECapabilitySwEvent) & 1; |
|
80 } else { |
|
81 return true; // all clients are allowed to use. |
|
82 } |
|
83 #else |
73 Q_UNUSED(parameters) |
84 Q_UNUSED(parameters) |
74 Q_UNUSED(securityInfo) |
85 Q_UNUSED(securityInfo) |
75 |
86 // All clients are allowed to use. |
76 // This plugin doesn't perform operations that may compromise security. All clients |
|
77 // are allowed to use. |
|
78 return true; |
87 return true; |
79 TRACE_EXIT |
88 #endif // Q_OS_SYMBIAN |
80 } |
89 } |
81 |
90 |
82 // Create device dialog widget |
91 // Create device dialog widget |
83 HbDeviceDialogInterface *HbDeviceProgressDialogPlugin::createDeviceDialog( |
92 HbDeviceDialogInterface *HbDeviceProgressDialogPlugin::createDeviceDialog( |
84 const QString &deviceDialogType, |
93 const QString &deviceDialogType, |
123 // Return information of device dialog the plugin creates |
132 // Return information of device dialog the plugin creates |
124 bool HbDeviceProgressDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, |
133 bool HbDeviceProgressDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, |
125 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
134 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
126 { |
135 { |
127 TRACE_ENTRY |
136 TRACE_ENTRY |
128 Q_UNUSED(parameters) |
|
129 Q_UNUSED(deviceDialogType) |
137 Q_UNUSED(deviceDialogType) |
130 |
138 |
|
139 unsigned int level = static_cast<unsigned int>(showLevel(parameters)); |
|
140 if (level > CriticalLevel) { |
|
141 return false; |
|
142 } |
|
143 |
131 info->group = GenericDeviceDialogGroup; |
144 info->group = GenericDeviceDialogGroup; |
132 info->flags = NoDeviceDialogFlags; |
145 info->flags = level == NormalLevel ? NoDeviceDialogFlags : SecurityCheck; |
133 info->priority = DefaultPriority; |
146 info->showLevel = static_cast<ShowLevel>(level); |
134 TRACE_EXIT |
|
135 return true; |
147 return true; |
136 } |
148 } |
137 |
149 |
138 // Return device dialog types this plugin implements |
150 // Return device dialog types this plugin implements |
139 QStringList HbDeviceProgressDialogPlugin::deviceDialogTypes() const |
151 QStringList HbDeviceProgressDialogPlugin::deviceDialogTypes() const |
161 { |
173 { |
162 TRACE_ENTRY |
174 TRACE_ENTRY |
163 TRACE_EXIT |
175 TRACE_EXIT |
164 return d->mError; |
176 return d->mError; |
165 } |
177 } |
|
178 |
|
179 // Search parameters for show group |
|
180 int HbDeviceProgressDialogPlugin::showLevel(const QVariantMap ¶meters) |
|
181 { |
|
182 int level = 0; |
|
183 const QString propertyName("showLevel"); |
|
184 if (parameters.contains(propertyName)) { |
|
185 level = parameters[propertyName].toInt(); |
|
186 } |
|
187 return level; |
|
188 } |