|
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 // alarmalertplugin.h |
|
18 |
|
19 // System includes |
|
20 #include <QString> |
|
21 #include <QVariantMap> |
|
22 #include <hbdevicedialog.h> |
|
23 |
|
24 // User includes |
|
25 #include "alarmalertplugin.h" |
|
26 #include "alarmalertwidget_p.h" |
|
27 #include "alarmalert.h" |
|
28 #include "alarmalertdocloader.h" |
|
29 #include "OstTraceDefinitions.h" |
|
30 #ifdef OST_TRACE_COMPILER_IN_USE |
|
31 #include "alarmalertpluginTraces.h" |
|
32 #endif |
|
33 |
|
34 // Plugin export |
|
35 Q_EXPORT_PLUGIN2(alarmalertplugin, AlarmAlertPlugin); |
|
36 |
|
37 // --------------------------------------------------------- |
|
38 // AlarmAlertPlugin::AlarmAlertPlugin |
|
39 // rest of the details are commented in the header |
|
40 // --------------------------------------------------------- |
|
41 // |
|
42 AlarmAlertPlugin::AlarmAlertPlugin() |
|
43 { |
|
44 OstTraceFunctionEntry0( ALARMALERTPLUGIN_ALARMALERTPLUGIN_ENTRY ); |
|
45 // No implementation yet |
|
46 OstTraceFunctionExit0( ALARMALERTPLUGIN_ALARMALERTPLUGIN_EXIT ); |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------- |
|
50 // AlarmAlertPlugin::~AlarmAlertPlugin |
|
51 // rest of the details are commented in the header |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 AlarmAlertPlugin::~AlarmAlertPlugin() |
|
55 { |
|
56 OstTraceFunctionEntry0( DUP1_ALARMALERTPLUGIN_ALARMALERTPLUGIN_ENTRY ); |
|
57 // No implementation yet |
|
58 OstTraceFunctionExit0( DUP1_ALARMALERTPLUGIN_ALARMALERTPLUGIN_EXIT ); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // AlarmAlertPlugin::accessAllowed |
|
63 // rest of the details are commented in the header |
|
64 // --------------------------------------------------------- |
|
65 // |
|
66 bool AlarmAlertPlugin::accessAllowed(const QString &deviceDialogType, |
|
67 const QVariantMap ¶meters, |
|
68 const QVariantMap &securityInfo) const |
|
69 { |
|
70 OstTraceFunctionEntry0( ALARMALERTPLUGIN_ACCESSALLOWED_ENTRY ); |
|
71 Q_UNUSED(securityInfo); |
|
72 Q_UNUSED(parameters); |
|
73 Q_UNUSED(deviceDialogType); |
|
74 |
|
75 // No implementation yet |
|
76 OstTraceFunctionExit0( ALARMALERTPLUGIN_ACCESSALLOWED_EXIT ); |
|
77 return true; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------- |
|
81 // AlarmAlertPlugin::deviceDialogInfo |
|
82 // rest of the details are commented in the header |
|
83 // --------------------------------------------------------- |
|
84 // |
|
85 bool AlarmAlertPlugin::deviceDialogInfo(const QString &deviceDialogType, |
|
86 const QVariantMap ¶meters, |
|
87 DeviceDialogInfo *info) const |
|
88 { |
|
89 OstTraceFunctionEntry0( ALARMALERTPLUGIN_DEVICEDIALOGINFO_ENTRY ); |
|
90 Q_UNUSED(deviceDialogType); |
|
91 Q_UNUSED(parameters); |
|
92 |
|
93 info->group = CriticalGroup; |
|
94 info->priority = DefaultPriority; |
|
95 info->flags = NoDeviceDialogFlags; |
|
96 OstTraceFunctionExit0( ALARMALERTPLUGIN_DEVICEDIALOGINFO_EXIT ); |
|
97 return true; |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------- |
|
101 // AlarmAlertPlugin::deviceDialogTypes |
|
102 // rest of the details are commented in the header |
|
103 // --------------------------------------------------------- |
|
104 // |
|
105 QStringList AlarmAlertPlugin::deviceDialogTypes() const |
|
106 { |
|
107 OstTraceFunctionEntry0( ALARMALERTPLUGIN_DEVICEDIALOGTYPES_ENTRY ); |
|
108 // Return the device dialog type this plugin supports |
|
109 QStringList dialogType; |
|
110 dialogType.append(ALARM_ALERT_PLUGIN); |
|
111 OstTraceFunctionExit0( ALARMALERTPLUGIN_DEVICEDIALOGTYPES_EXIT ); |
|
112 return dialogType; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------- |
|
116 // AlarmAlertPlugin::pluginFlags |
|
117 // rest of the details are commented in the header |
|
118 // --------------------------------------------------------- |
|
119 // |
|
120 HbDeviceDialogPlugin::PluginFlags AlarmAlertPlugin::pluginFlags() const |
|
121 { |
|
122 OstTraceFunctionEntry0( ALARMALERTPLUGIN_PLUGINFLAGS_ENTRY ); |
|
123 OstTraceFunctionExit0( ALARMALERTPLUGIN_PLUGINFLAGS_EXIT ); |
|
124 return NoPluginFlags; |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // AlarmAlertPlugin::error |
|
129 // rest of the details are commented in the header |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 int AlarmAlertPlugin::error() const |
|
133 { |
|
134 OstTraceFunctionEntry0( ALARMALERTPLUGIN_ERROR_ENTRY ); |
|
135 // TODO: Need to handle any error that might occur |
|
136 OstTraceFunctionExit0( ALARMALERTPLUGIN_ERROR_EXIT ); |
|
137 return 0; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // AlarmAlertPlugin::createDeviceDialog |
|
142 // rest of the details are commented in the header |
|
143 // --------------------------------------------------------- |
|
144 // |
|
145 HbDeviceDialogInterface *AlarmAlertPlugin::createDeviceDialog(const QString &deviceDialogType, |
|
146 const QVariantMap ¶meters) |
|
147 { |
|
148 OstTraceFunctionEntry0( ALARMALERTPLUGIN_CREATEDEVICEDIALOG_ENTRY ); |
|
149 Q_UNUSED(deviceDialogType); |
|
150 |
|
151 // Create and return the alarm alert dialog |
|
152 HbDeviceDialogInterface *ret(0); |
|
153 AlarmAlertDocLoader *alertDocLoader = new AlarmAlertDocLoader(parameters); |
|
154 // Get the type of alarm to load the proper docml |
|
155 QVariantMap::const_iterator iter = parameters.constBegin(); |
|
156 int count = parameters.size(); |
|
157 AlarmType alertType = OtherAlarm; |
|
158 while (iter != parameters.constEnd()) { |
|
159 QString key(iter.key()); |
|
160 if (alarmType == key) { |
|
161 alertType = static_cast <AlarmType> (iter.value().toInt()); |
|
162 } |
|
163 iter++; |
|
164 } |
|
165 bool loadSuccess = false; |
|
166 if (alertType == ClockAlarm) { |
|
167 alertDocLoader->load(alarmNormalUIClockDocml, &loadSuccess); |
|
168 }else if (alertType == TodoAlarm) { |
|
169 alertDocLoader->load(alarmNormalUITodoDocml, &loadSuccess); |
|
170 }else if(alertType == CalendarAlarm) { |
|
171 alertDocLoader->load(alarmNormalUICalendarDocml, &loadSuccess); |
|
172 } |
|
173 if(!loadSuccess) { |
|
174 qFatal("Unable to load the docml"); |
|
175 } |
|
176 AlarmAlertDialogPrivate *alertDialog = qobject_cast<AlarmAlertDialogPrivate*> (alertDocLoader->findWidget("dialog")); |
|
177 alertDialog->setupNormalUI(alertDocLoader); |
|
178 ret = alertDialog; |
|
179 OstTraceFunctionExit0( ALARMALERTPLUGIN_CREATEDEVICEDIALOG_EXIT ); |
|
180 return ret; |
|
181 } |