|
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: SecUi notification plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "secuinotificationdialogplugin.h" |
|
19 #include "secuinotificationdialog.h" |
|
20 #include "secuinotificationdialogpluginkeys.h" |
|
21 |
|
22 // This plugin implements one device dialog type |
|
23 static const struct { |
|
24 const char *mTypeString; |
|
25 } dialogInfos[] = { |
|
26 {SECUINOTIFICATIONDIALOG} |
|
27 }; |
|
28 |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // SecUiNotificationDialogPlugin::SecUiNotificationDialogPlugin() |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 SecUiNotificationDialogPlugin::SecUiNotificationDialogPlugin() : mError(KNoError) |
|
35 { |
|
36 } |
|
37 |
|
38 // ---------------------------------------------------------------------------- |
|
39 // SecUiNotificationDialogPlugin::~SecUiNotificationDialogPlugin() |
|
40 // ---------------------------------------------------------------------------- |
|
41 // |
|
42 SecUiNotificationDialogPlugin::~SecUiNotificationDialogPlugin() |
|
43 { |
|
44 } |
|
45 |
|
46 // ---------------------------------------------------------------------------- |
|
47 // SecUiNotificationDialogPlugin::accessAllowed() |
|
48 // ---------------------------------------------------------------------------- |
|
49 // |
|
50 bool SecUiNotificationDialogPlugin::accessAllowed(const QString &deviceDialogType, |
|
51 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
|
52 { |
|
53 Q_UNUSED(deviceDialogType) |
|
54 Q_UNUSED(parameters) |
|
55 Q_UNUSED(securityInfo) |
|
56 |
|
57 // All clients are allowed to use. |
|
58 // TODO: should access be limited to certain clients? |
|
59 return true; |
|
60 } |
|
61 |
|
62 // ---------------------------------------------------------------------------- |
|
63 // SecUiNotificationDialogPlugin::createDeviceDialog() |
|
64 // ---------------------------------------------------------------------------- |
|
65 // |
|
66 HbDeviceDialogInterface *SecUiNotificationDialogPlugin::createDeviceDialog( |
|
67 const QString &deviceDialogType, const QVariantMap ¶meters) |
|
68 { |
|
69 // Create device dialog widget |
|
70 Q_UNUSED(deviceDialogType) |
|
71 |
|
72 SecUiNotificationDialog *deviceDialog = new SecUiNotificationDialog(parameters); |
|
73 mError = deviceDialog->deviceDialogError(); |
|
74 if (mError != KNoError) { |
|
75 delete deviceDialog; |
|
76 deviceDialog = 0; |
|
77 } |
|
78 |
|
79 return deviceDialog; |
|
80 } |
|
81 |
|
82 // ---------------------------------------------------------------------------- |
|
83 // SecUiNotificationDialogPlugin::deviceDialogInfo() |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 bool SecUiNotificationDialogPlugin::deviceDialogInfo( const QString &deviceDialogType, |
|
87 const QVariantMap ¶meters, DeviceDialogInfo *info) const |
|
88 { |
|
89 // Return device dialog flags |
|
90 Q_UNUSED(deviceDialogType); |
|
91 Q_UNUSED(parameters); |
|
92 |
|
93 info->group = DeviceNotificationDialogGroup; |
|
94 info->flags = NoDeviceDialogFlags; |
|
95 info->priority = DefaultPriority; |
|
96 |
|
97 return true; |
|
98 } |
|
99 |
|
100 // ---------------------------------------------------------------------------- |
|
101 // SecUiNotificationDialogPlugin::deviceDialogTypes() |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 QStringList SecUiNotificationDialogPlugin::deviceDialogTypes() const |
|
105 { |
|
106 // Return device dialog types this plugin implements |
|
107 |
|
108 QStringList types; |
|
109 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
110 for(int i = 0; i < numTypes; ++i) { |
|
111 types.append(dialogInfos[i].mTypeString); |
|
112 } |
|
113 |
|
114 return types; |
|
115 } |
|
116 |
|
117 // ---------------------------------------------------------------------------- |
|
118 // SecUiNotificationDialogPlugin::pluginFlags() |
|
119 // ---------------------------------------------------------------------------- |
|
120 // |
|
121 HbDeviceDialogPlugin::PluginFlags SecUiNotificationDialogPlugin::pluginFlags() const |
|
122 { |
|
123 // Return plugin flags |
|
124 return NoPluginFlags; |
|
125 } |
|
126 |
|
127 // ---------------------------------------------------------------------------- |
|
128 // SecUiNotificationDialogPlugin::error() |
|
129 // ---------------------------------------------------------------------------- |
|
130 // |
|
131 int SecUiNotificationDialogPlugin::error() const |
|
132 { |
|
133 // Return last error |
|
134 return mError; |
|
135 } |
|
136 |
|
137 Q_EXPORT_PLUGIN2(secuinotificationdialogplugin,SecUiNotificationDialogPlugin) |