|
1 /* |
|
2 * Copyright (c) 2009 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: Message notification plugin class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtPlugin> |
|
19 |
|
20 #include <hbdevicedialog.h> |
|
21 #include "msgnotificationdialogplugin.h" |
|
22 #include "msgnotificationdialogwidget.h" |
|
23 |
|
24 |
|
25 // This plugin implements one device dialog type |
|
26 static const struct { |
|
27 const char *mTypeString; |
|
28 } dialogInfos[] = { |
|
29 {"com.nokia.messaging.newmsgnotificationdialog/1.0"} |
|
30 }; |
|
31 |
|
32 // Constants |
|
33 const int NoError = 0; |
|
34 |
|
35 // ---------------------------------------------------------------------------- |
|
36 // MsgNotificationDialogPlugin::MsgNotificationDialogPlugin |
|
37 // @see msgnotificationdialogplugin.h |
|
38 // ---------------------------------------------------------------------------- |
|
39 MsgNotificationDialogPlugin::MsgNotificationDialogPlugin() |
|
40 { |
|
41 } |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // MsgNotificationDialogPlugin::~MsgNotificationDialogPlugin |
|
45 // @see msgnotificationdialogplugin.h |
|
46 // ---------------------------------------------------------------------------- |
|
47 MsgNotificationDialogPlugin::~MsgNotificationDialogPlugin() |
|
48 { |
|
49 } |
|
50 |
|
51 // ---------------------------------------------------------------------------- |
|
52 // MsgNotificationDialogPlugin::accessAllowed |
|
53 // @see msgnotificationdialogplugin.h |
|
54 // ---------------------------------------------------------------------------- |
|
55 bool MsgNotificationDialogPlugin::accessAllowed(const QString &deviceDialogType, |
|
56 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
|
57 { |
|
58 // Check if client is allowed to use device dialog widget |
|
59 Q_UNUSED(deviceDialogType) |
|
60 Q_UNUSED(parameters) |
|
61 Q_UNUSED(securityInfo) |
|
62 |
|
63 // This plugin doesn't perform operations that may compromise security. |
|
64 // All clients are allowed to use. |
|
65 return true; |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // MsgNotificationDialogPlugin::createDeviceDialog |
|
70 // @see msgnotificationdialogplugin.h |
|
71 // ---------------------------------------------------------------------------- |
|
72 HbDeviceDialogInterface *MsgNotificationDialogPlugin::createDeviceDialog( |
|
73 const QString &deviceDialogType, const QVariantMap ¶meters) |
|
74 { |
|
75 // Create device dialog widget |
|
76 Q_UNUSED(deviceDialogType) |
|
77 mError = NoError; |
|
78 |
|
79 HbDeviceDialogInterface *ret(0); |
|
80 QVariantMap params = parameters; |
|
81 |
|
82 MsgNotificationDialogWidget *deviceDialog = |
|
83 new MsgNotificationDialogWidget(params); |
|
84 mError = deviceDialog->deviceDialogError(); |
|
85 if (mError != NoError) { |
|
86 delete deviceDialog; |
|
87 deviceDialog = 0; |
|
88 } |
|
89 ret = deviceDialog; |
|
90 |
|
91 return ret; |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // MsgNotificationDialogPlugin::deviceDialogInfo |
|
96 // @see msgnotificationdialogplugin.h |
|
97 // ---------------------------------------------------------------------------- |
|
98 bool MsgNotificationDialogPlugin::deviceDialogInfo( |
|
99 const QString &deviceDialogType, |
|
100 const QVariantMap ¶meters, |
|
101 DeviceDialogInfo *info) const |
|
102 { |
|
103 // Return device dialog flags |
|
104 Q_UNUSED(deviceDialogType); |
|
105 Q_UNUSED(parameters); |
|
106 |
|
107 info->group = DeviceNotificationDialogGroup; |
|
108 info->flags = NoDeviceDialogFlags; |
|
109 info->priority = DefaultPriority; |
|
110 |
|
111 return true; |
|
112 } |
|
113 |
|
114 // ---------------------------------------------------------------------------- |
|
115 // MsgNotificationDialogPlugin::deviceDialogTypes |
|
116 // @see msgnotificationdialogplugin.h |
|
117 // ---------------------------------------------------------------------------- |
|
118 QStringList MsgNotificationDialogPlugin::deviceDialogTypes() const |
|
119 { |
|
120 // Return device dialog types this plugin implements |
|
121 |
|
122 QStringList types; |
|
123 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
124 for(int i = 0; i < numTypes; i++) { |
|
125 types.append(dialogInfos[i].mTypeString); |
|
126 } |
|
127 |
|
128 return types; |
|
129 } |
|
130 |
|
131 // ---------------------------------------------------------------------------- |
|
132 // MsgNotificationDialogPlugin::pluginFlags |
|
133 // @see msgnotificationdialogplugin.h |
|
134 // ---------------------------------------------------------------------------- |
|
135 HbDeviceDialogPlugin::PluginFlags MsgNotificationDialogPlugin:: |
|
136 pluginFlags() const |
|
137 { |
|
138 // Return plugin flags |
|
139 return NoPluginFlags; |
|
140 } |
|
141 |
|
142 // ---------------------------------------------------------------------------- |
|
143 // MsgNotificationDialogPlugin::error |
|
144 // @see msgnotificationdialogplugin.h |
|
145 // ---------------------------------------------------------------------------- |
|
146 int MsgNotificationDialogPlugin::error() const |
|
147 { |
|
148 // Return last error |
|
149 return mError; |
|
150 } |
|
151 |
|
152 Q_EXPORT_PLUGIN2(msgnotificationdialogplugin,MsgNotificationDialogPlugin) |