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 "devicemanagementnotifierplugin_p.h" |
|
22 #include "devicemanagementnotifierwidget_p.h" |
|
23 |
|
24 |
|
25 Q_EXPORT_PLUGIN2(devicemanagementnotifiersplugin, devicemanagementnotifierplugin) |
|
26 |
|
27 // This plugin implements one device dialog type |
|
28 static const struct { |
|
29 const char *mTypeString; |
|
30 } dialogInfos[] = { |
|
31 {"com.nokia.hb.devicemanagementdialog/1.0"} |
|
32 }; |
|
33 |
|
34 class devicemanagementnotifierpluginprivate |
|
35 { |
|
36 public: |
|
37 devicemanagementnotifierpluginprivate() {mError = 0;} |
|
38 |
|
39 int mError; |
|
40 }; |
|
41 |
|
42 // Constructor |
|
43 devicemanagementnotifierplugin::devicemanagementnotifierplugin() |
|
44 { |
|
45 |
|
46 d = new devicemanagementnotifierpluginprivate; |
|
47 |
|
48 } |
|
49 |
|
50 // Destructor |
|
51 devicemanagementnotifierplugin::~devicemanagementnotifierplugin() |
|
52 { |
|
53 |
|
54 delete d; |
|
55 |
|
56 } |
|
57 |
|
58 // Check if client is allowed to use device dialog widget |
|
59 bool devicemanagementnotifierplugin::accessAllowed(const QString &deviceDialogType, |
|
60 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
|
61 { |
|
62 |
|
63 |
|
64 // This plugin doesn't perform operations that may compromise security. |
|
65 // All clients are allowed to use. |
|
66 return true; |
|
67 |
|
68 } |
|
69 |
|
70 // Create device dialog widget |
|
71 HbDeviceDialogInterface *devicemanagementnotifierplugin::createDeviceDialog( |
|
72 const QString &deviceDialogType, const QVariantMap ¶meters) |
|
73 { |
|
74 return new devicemanagementnotifierwidget(parameters); |
|
75 } |
|
76 |
|
77 // Return information of device dialog the plugin creates |
|
78 bool devicemanagementnotifierplugin::deviceDialogInfo(const QString &deviceDialogType, |
|
79 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
|
80 { |
|
81 |
|
82 |
|
83 return true; |
|
84 } |
|
85 |
|
86 // Return device dialog types this plugin implements |
|
87 QStringList devicemanagementnotifierplugin::deviceDialogTypes() const |
|
88 { |
|
89 |
|
90 QStringList types; |
|
91 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
92 for(int i = 0; i < numTypes; i++) { |
|
93 types.append(dialogInfos[i].mTypeString); |
|
94 } |
|
95 |
|
96 return types; |
|
97 } |
|
98 |
|
99 // Return plugin flags |
|
100 HbDeviceDialogPlugin::PluginFlags devicemanagementnotifierplugin::pluginFlags() const |
|
101 { |
|
102 |
|
103 return NoPluginFlags; |
|
104 } |
|
105 |
|
106 // Return last error |
|
107 int devicemanagementnotifierplugin::error() const |
|
108 { |
|
109 return d->mError; |
|
110 } |
|