|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtPlugin> |
|
19 |
|
20 #include <hbdevicedialog.h> |
|
21 #include <devicedialogconsts.h> |
|
22 #include "devicemanagementnotifierplugin_p.h" |
|
23 #include "devicemanagementnotifierwidget_p.h" |
|
24 #include "omacppinquerydialog.h" |
|
25 |
|
26 |
|
27 Q_EXPORT_PLUGIN2(devicemanagementnotifiersplugin, devicemanagementnotifierplugin) |
|
28 |
|
29 // This plugin implements one device dialog type |
|
30 static const struct |
|
31 { |
|
32 const char *mTypeString; |
|
33 } dialogInfos[] = |
|
34 { |
|
35 { |
|
36 devicedialogtype |
|
37 } |
|
38 |
|
39 }; |
|
40 |
|
41 class devicemanagementnotifierpluginprivate |
|
42 { |
|
43 public: |
|
44 devicemanagementnotifierpluginprivate() {mError = 0;} |
|
45 |
|
46 int mError; |
|
47 }; |
|
48 |
|
49 // Constructor |
|
50 devicemanagementnotifierplugin::devicemanagementnotifierplugin() |
|
51 { |
|
52 |
|
53 d = new devicemanagementnotifierpluginprivate; |
|
54 |
|
55 } |
|
56 |
|
57 // Destructor |
|
58 devicemanagementnotifierplugin::~devicemanagementnotifierplugin() |
|
59 { |
|
60 |
|
61 delete d; |
|
62 |
|
63 } |
|
64 |
|
65 // Check if client is allowed to use device dialog widget |
|
66 bool devicemanagementnotifierplugin::accessAllowed(const QString &deviceDialogType, |
|
67 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
|
68 { |
|
69 |
|
70 // This plugin doesn't perform operations that may compromise security. |
|
71 // All clients are allowed to use. |
|
72 return true; |
|
73 |
|
74 } |
|
75 |
|
76 // Create device dialog widget |
|
77 HbDeviceDialogInterface *devicemanagementnotifierplugin::createDeviceDialog( |
|
78 const QString &deviceDialogType, const QVariantMap ¶meters) |
|
79 { |
|
80 // Find the dialog key |
|
81 QVariantMap::const_iterator i = parameters.find(keydialog); |
|
82 if (i != parameters.end()) |
|
83 { |
|
84 int dialogtype = i.value().toInt(); |
|
85 //Compare the dialog with the constant declared |
|
86 if (dialogtype == EOmaCPPinDialog) |
|
87 { |
|
88 // Return specific object for showing appropriate dialog |
|
89 return new omacppinquerydialog(parameters); |
|
90 } |
|
91 |
|
92 } |
|
93 return new devicemanagementnotifierwidget(parameters); |
|
94 |
|
95 } |
|
96 |
|
97 // Return information of device dialog the plugin creates |
|
98 bool devicemanagementnotifierplugin::deviceDialogInfo(const QString &deviceDialogType, |
|
99 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
|
100 { |
|
101 info->group = GenericDeviceDialogGroup; |
|
102 info->flags = NoDeviceDialogFlags; |
|
103 info->priority = DefaultPriority; |
|
104 return true; |
|
105 } |
|
106 |
|
107 // Return device dialog types this plugin implements |
|
108 QStringList devicemanagementnotifierplugin::deviceDialogTypes() const |
|
109 { |
|
110 |
|
111 QStringList types; |
|
112 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
113 for(int i = 0; i < numTypes; i++) { |
|
114 types.append(dialogInfos[i].mTypeString); |
|
115 } |
|
116 |
|
117 return types; |
|
118 } |
|
119 |
|
120 // Return plugin flags |
|
121 HbDeviceDialogPlugin::PluginFlags devicemanagementnotifierplugin::pluginFlags() const |
|
122 { |
|
123 |
|
124 return NoPluginFlags; |
|
125 } |
|
126 |
|
127 // Return last error |
|
128 int devicemanagementnotifierplugin::error() const |
|
129 { |
|
130 return d->mError; |
|
131 } |