|
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 // alarmalertwidget_p.h |
|
18 |
|
19 // System includes |
|
20 #include <QDateTime> |
|
21 #include <QPointer> |
|
22 #include <hbdialog.h> |
|
23 #include <hbdevicedialoginterface.h> |
|
24 #include <hbeffect.h> |
|
25 |
|
26 // User includes |
|
27 #include "alarmalert.h" |
|
28 |
|
29 // Forward declarations |
|
30 class QGraphicsWidget; |
|
31 class QEvent; |
|
32 class HbTranslator; |
|
33 class HbMainWindow; |
|
34 class HbDocumentLoader; |
|
35 class HbLabel; |
|
36 class HbAction; |
|
37 class AlarmAlertDocLoader; |
|
38 |
|
39 const QString alarmNormalUICalendarDocml(":/xml/alarmalert_calendar_unlocked.docml"); |
|
40 const QString alarmNormalUIClockDocml(":/xml/alarmalert_clock_unlocked.docml"); |
|
41 const QString alarmNormalUITodoDocml(":/xml/alarmalert_todo_unlocked.docml"); |
|
42 |
|
43 // Class declaration |
|
44 /** |
|
45 * @class AlarmAlertDialogPrivate |
|
46 * @brief The device dialog implementation for alarm alert |
|
47 */ |
|
48 class AlarmAlertDialogPrivate : public HbDialog, public HbDeviceDialogInterface |
|
49 { |
|
50 Q_OBJECT |
|
51 |
|
52 public: |
|
53 |
|
54 /** |
|
55 * @brief Constructor |
|
56 * @param parameters The list of arguments sent by the client |
|
57 */ |
|
58 AlarmAlertDialogPrivate(const QVariantMap ¶meters); |
|
59 |
|
60 /** |
|
61 * @brief Destructor |
|
62 */ |
|
63 ~AlarmAlertDialogPrivate(); |
|
64 |
|
65 /** |
|
66 * @brief Sets the device dialog parameters to this dialog |
|
67 * @param parameters List of parameters to set |
|
68 */ |
|
69 bool setDeviceDialogParameters(const QVariantMap ¶meters); |
|
70 |
|
71 /** |
|
72 * @brief Called from the device dialog server to check |
|
73 * for any errors in dialog creation/display |
|
74 */ |
|
75 int deviceDialogError() const; |
|
76 |
|
77 /** |
|
78 * @brief Called from the device dialog server. |
|
79 * Closes the dialog if its being shown |
|
80 * @param byClient true if the close event is being |
|
81 * triggered by the client, false otherwise |
|
82 */ |
|
83 void closeDeviceDialog(bool byClient); |
|
84 |
|
85 /** |
|
86 * @brief Returns the device dialog instance |
|
87 */ |
|
88 HbDialog *deviceDialogWidget() const; |
|
89 |
|
90 /** |
|
91 * @brief Sets up the normal ui for alarms. |
|
92 * This UI is shown when the screen is unlocked |
|
93 */ |
|
94 void setupNormalUI(AlarmAlertDocLoader *alertDocLoader); |
|
95 |
|
96 protected: |
|
97 |
|
98 /** |
|
99 * @brief From QGraphicsWidget |
|
100 * @see QGraphicsWidget |
|
101 */ |
|
102 void showEvent(QShowEvent *event); |
|
103 |
|
104 /** |
|
105 * @brief From QGraphicsWidget |
|
106 * @see QGraphicsWidget |
|
107 */ |
|
108 void closeEvent(QCloseEvent *event); |
|
109 |
|
110 signals: |
|
111 |
|
112 /** |
|
113 * @brief Emitted when the dialog is about to be closed |
|
114 */ |
|
115 void deviceDialogClosed(); |
|
116 |
|
117 /** |
|
118 * @brief Used to send any information back to the client |
|
119 */ |
|
120 void deviceDialogData(QVariantMap data); |
|
121 |
|
122 private slots: |
|
123 |
|
124 /** |
|
125 * @brief Callback function for handling orientation changes |
|
126 */ |
|
127 void handleOrientationChange(); |
|
128 |
|
129 /** |
|
130 * @brief Called when the user snoozes the alarm |
|
131 */ |
|
132 void snoozed(); |
|
133 |
|
134 /** |
|
135 * @brief Called when the user dismisses the alarm |
|
136 */ |
|
137 void dismissed(); |
|
138 |
|
139 /** |
|
140 * @brief Called when the user silences the alarm |
|
141 */ |
|
142 void silenced(); |
|
143 |
|
144 /** |
|
145 * @brief Called when the alarmui is about to display. |
|
146 */ |
|
147 void aboutToDisplay(); |
|
148 |
|
149 private: |
|
150 /** |
|
151 * @brief Extracts the parameters sent by the client |
|
152 * @var parameters List of parameters |
|
153 */ |
|
154 void parseAndFetchParams(const QVariantMap ¶meters); |
|
155 |
|
156 /** |
|
157 * @brief handles the calendar alarms |
|
158 */ |
|
159 void handleCalendarAlarms(); |
|
160 |
|
161 /** |
|
162 * @brief handles the clock alarms |
|
163 */ |
|
164 void handleClockAlarms(); |
|
165 |
|
166 /** |
|
167 * @brief handles to-do alarms |
|
168 */ |
|
169 void handleToDoAlarms(); |
|
170 |
|
171 private: |
|
172 Q_DISABLE_COPY(AlarmAlertDialogPrivate) |
|
173 |
|
174 /** |
|
175 * @var mSlider |
|
176 * @brief Points to the slider icon |
|
177 */ |
|
178 QGraphicsWidget *mSlider; |
|
179 |
|
180 /** |
|
181 * TODO: Remove this when gestures are implemented |
|
182 */ |
|
183 QPointF mTapPoint; |
|
184 |
|
185 /** |
|
186 * @var mSubject |
|
187 * @brief Holds the alarm subject |
|
188 */ |
|
189 QString mSubject; |
|
190 |
|
191 /** |
|
192 * @var mLocation |
|
193 * @brief Holds the alarm location (for calendar alerts only) |
|
194 */ |
|
195 QString mLocation; |
|
196 |
|
197 /** |
|
198 * @var mAlarmTime |
|
199 * @brief Holds the alarm expiry time |
|
200 */ |
|
201 QString mAlarmTime; |
|
202 |
|
203 /** |
|
204 * @var mAlarmDate |
|
205 * @brief Holds the alarm expiry time |
|
206 */ |
|
207 QString mAlarmDate; |
|
208 |
|
209 /** |
|
210 * @var mTranslator |
|
211 * @brief translator for the localisation of strings |
|
212 */ |
|
213 HbTranslator *mTranslator; |
|
214 |
|
215 /** |
|
216 * @var mAlarmDescription |
|
217 * @brief Points to the alarm description label |
|
218 */ |
|
219 QPointer<HbLabel> mAlarmDescription; |
|
220 |
|
221 /** |
|
222 * @var mAlarmDateTime |
|
223 * @brief Points to the alarm expiry time label |
|
224 */ |
|
225 QPointer<HbLabel> mAlarmDateTime; |
|
226 |
|
227 /** |
|
228 * @var mAlarmIcon |
|
229 * @brief Points to the alarm icon label |
|
230 */ |
|
231 QPointer<HbLabel> mAlarmIcon; |
|
232 |
|
233 /** |
|
234 * @var mMainWindow |
|
235 * @brief The global main window reference. |
|
236 * Required for getting orientation change events |
|
237 */ |
|
238 HbMainWindow *mMainWindow; |
|
239 |
|
240 /** |
|
241 * @var mAlertDocLoader |
|
242 * @brief The document loader for loading docml's |
|
243 */ |
|
244 AlarmAlertDocLoader* mAlertDocLoader; |
|
245 |
|
246 /** |
|
247 * @var mSnoozeAction |
|
248 * @brief snooze softkey for alarm |
|
249 */ |
|
250 HbAction *mSnoozeAction; |
|
251 |
|
252 /** |
|
253 * @var mUserResponse |
|
254 * @brief Stores the user response |
|
255 */ |
|
256 int mUserResponse; |
|
257 |
|
258 /** |
|
259 * @var mAlarmAlertType |
|
260 * @brief Tells if the type of alert being displayed |
|
261 * is a clock /calendar/to-do alert |
|
262 */ |
|
263 AlarmType mAlarmAlertType; |
|
264 |
|
265 /** |
|
266 * @var mCanSnooze |
|
267 * @brief Tells whether the current alert can be snoozed. |
|
268 * true->alarm can be snoozed |
|
269 * false->alarm cannot be snoozed |
|
270 */ |
|
271 bool mCanSnooze; |
|
272 |
|
273 /** |
|
274 * @var mIsSilent |
|
275 * @brief Indicates if the alarm is silent or not |
|
276 */ |
|
277 bool mIsSilent; |
|
278 |
|
279 /** |
|
280 * @var mIsTimedAlarm |
|
281 * @brief Indicates if the alarm is has time info or not |
|
282 */ |
|
283 bool mIsTimedAlarm; |
|
284 |
|
285 /** |
|
286 * @var mClosedByClient |
|
287 * @brief Indicates if the alarm dialog is closed by the client |
|
288 */ |
|
289 bool mClosedByClient; |
|
290 |
|
291 /** |
|
292 * @var mIsSilenceKey |
|
293 * @brief Indicates if the silence softkey is shown for alarm |
|
294 */ |
|
295 bool mIsSilenceKey; |
|
296 }; |