|
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: Prompt Dialog plugin implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <hbdevicedialoginterface.h> |
|
20 #include <QVariantMap> |
|
21 #include "cellularpromptdialogplugin.h" |
|
22 #include "cellularpromptdialog.h" |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "cellularpromptdialogpluginTraces.h" |
|
26 #endif |
|
27 |
|
28 |
|
29 /* Initializes the resource file */ |
|
30 inline void initMyResource() { Q_INIT_RESOURCE(promptdialog); } |
|
31 /* removes the resource file */ |
|
32 inline void cleanupMyResource() { Q_CLEANUP_RESOURCE(promptdialog); } |
|
33 |
|
34 |
|
35 Q_EXPORT_PLUGIN2(cellularpromptdialogplugin, CellularPromptDialogPlugin) |
|
36 |
|
37 |
|
38 // This plugin implements one device dialog type |
|
39 static const struct { |
|
40 const char *mTypeString; |
|
41 } dialogInfos[] = { |
|
42 {"com.nokia.ipconnmgmt.promptdialog/1.0"} |
|
43 }; |
|
44 |
|
45 /** |
|
46 * Constructor |
|
47 */ |
|
48 CellularPromptDialogPlugin::CellularPromptDialogPlugin() |
|
49 { |
|
50 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_CELLULARPROMPTDIALOGPLUGIN_ENTRY ); |
|
51 |
|
52 // Initializes the resource file which contains the |
|
53 // docml building up the dialog |
|
54 initMyResource(); |
|
55 |
|
56 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_CELLULARPROMPTDIALOGPLUGIN_EXIT ); |
|
57 } |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 CellularPromptDialogPlugin::~CellularPromptDialogPlugin() |
|
63 { |
|
64 OstTraceFunctionEntry0( DUP1_CELLULARPROMPTDIALOGPLUGIN_DCELLULARPROMPTDIALOGPLUGIN_ENTRY ); |
|
65 |
|
66 // Remove the loaded resources |
|
67 cleanupMyResource(); |
|
68 |
|
69 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_DCELLULARPROMPTDIALOGPLUGIN_EXIT ); |
|
70 } |
|
71 |
|
72 /** |
|
73 * Create device dialog widget |
|
74 */ |
|
75 HbDeviceDialogInterface *CellularPromptDialogPlugin::createDeviceDialog( |
|
76 const QString &deviceDialogType, |
|
77 const QVariantMap ¶meters) |
|
78 { |
|
79 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_CREATEDEVICEDIALOG_ENTRY ); |
|
80 |
|
81 Q_UNUSED(deviceDialogType) |
|
82 CellularPromptDialog* dialog = new CellularPromptDialog(parameters); |
|
83 |
|
84 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_CREATEDEVICEDIALOG_EXIT ); |
|
85 return dialog; |
|
86 } |
|
87 |
|
88 /** |
|
89 * Check if client is allowed to use device dialog widget |
|
90 */ |
|
91 bool CellularPromptDialogPlugin::accessAllowed(const QString &deviceDialogType, |
|
92 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
|
93 { |
|
94 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_ACCESSALLOWED_ENTRY ); |
|
95 |
|
96 Q_UNUSED(deviceDialogType) |
|
97 Q_UNUSED(parameters) |
|
98 Q_UNUSED(securityInfo) |
|
99 |
|
100 // This plugin doesn't perform operations that may compromise security. |
|
101 // All clients are allowed to use. |
|
102 return true; |
|
103 } |
|
104 |
|
105 /** |
|
106 * Return information of device dialog the plugin creates |
|
107 */ |
|
108 bool CellularPromptDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, |
|
109 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
|
110 { |
|
111 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_DEVICEDIALOGINFO_ENTRY ); |
|
112 |
|
113 Q_UNUSED(parameters) |
|
114 Q_UNUSED(deviceDialogType) |
|
115 |
|
116 info->group = GenericDeviceDialogGroup; |
|
117 info->flags = NoDeviceDialogFlags; |
|
118 info->priority = DefaultPriority; |
|
119 |
|
120 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_DEVICEDIALOGINFO_EXIT ); |
|
121 return true; |
|
122 } |
|
123 |
|
124 /** |
|
125 * Return device dialog types this plugin implements |
|
126 */ |
|
127 QStringList CellularPromptDialogPlugin::deviceDialogTypes() const |
|
128 { |
|
129 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_DEVICEDIALOGTYPES_ENTRY ); |
|
130 |
|
131 QStringList types; |
|
132 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
133 for(int i = 0; i < numTypes; i++) { |
|
134 types.append(dialogInfos[i].mTypeString); |
|
135 } |
|
136 |
|
137 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_DEVICEDIALOGTYPES_EXIT ); |
|
138 return types; |
|
139 } |
|
140 |
|
141 /** |
|
142 * Return plugin flags |
|
143 */ |
|
144 CellularPromptDialogPlugin::PluginFlags CellularPromptDialogPlugin::pluginFlags() const |
|
145 { |
|
146 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_PLUGINFLAGS_ENTRY ); |
|
147 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_PLUGINFLAGS_EXIT ); |
|
148 return NoPluginFlags; |
|
149 } |
|
150 |
|
151 /** |
|
152 * The last error is not stored, not supported |
|
153 */ |
|
154 int CellularPromptDialogPlugin::error() const |
|
155 { |
|
156 OstTraceFunctionEntry0( CELLULARPROMPTDIALOGPLUGIN_ERROR_ENTRY ); |
|
157 OstTraceFunctionExit0( CELLULARPROMPTDIALOGPLUGIN_ERROR_EXIT ); |
|
158 return 0; |
|
159 } |
|
160 |