164 emit deviceDialogData(param); |
164 emit deviceDialogData(param); |
165 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SHOWEVENT_EXIT ); |
165 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SHOWEVENT_EXIT ); |
166 } |
166 } |
167 |
167 |
168 // --------------------------------------------------------- |
168 // --------------------------------------------------------- |
169 // AlarmAlertDialogPrivate::closeEvent |
169 // AlarmAlertDialogPrivate::hideEvent |
170 // rest of the details are commented in the header |
170 // rest of the details are commented in the header |
171 // --------------------------------------------------------- |
171 // --------------------------------------------------------- |
172 // |
172 // |
173 void AlarmAlertDialogPrivate::closeEvent(QCloseEvent *event) |
173 void AlarmAlertDialogPrivate::hideEvent(QHideEvent *event) |
174 { |
174 { |
175 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_CLOSEEVENT_ENTRY ); |
175 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HIDEEVENT_ENTRY ); |
|
176 HbDialog::hideEvent(event); |
|
177 emit deviceDialogClosed(); |
|
178 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HIDEEVENT_EXIT ); |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------- |
|
182 // AlarmAlertDialogPrivate::handleOrientationChange |
|
183 // rest of the details are commented in the header |
|
184 // --------------------------------------------------------- |
|
185 // |
|
186 void AlarmAlertDialogPrivate::handleOrientationChange(Qt::Orientation orientation) |
|
187 { |
|
188 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HANDLEORIENTATIONCHANGE_ENTRY ); |
|
189 QString section; |
|
190 QString filename; |
|
191 if (orientation == Qt::Horizontal) { |
|
192 section = "landscape"; |
|
193 } else { |
|
194 section = "portrait"; |
|
195 } |
|
196 bool loadSuccess = false; |
|
197 switch (mAlarmAlertType) { |
|
198 case ClockAlarm: |
|
199 mAlertDocLoader->load(alarmNormalUIClockDocml, section, &loadSuccess); |
|
200 break; |
|
201 case TodoAlarm: |
|
202 mAlertDocLoader->load(alarmNormalUITodoDocml, section, &loadSuccess); |
|
203 break; |
|
204 case CalendarAlarm: |
|
205 if (mIsTimedAlarm) { |
|
206 filename = alarmNormalUICalendarDocml; |
|
207 section = "timedAlarmportrait"; |
|
208 if(orientation == Qt::Horizontal) { |
|
209 section = "timedAlarmLandscape"; |
|
210 } |
|
211 } else { |
|
212 filename = alarmNormalUINonTimedCalendarDocml; |
|
213 section = "nonTimedAlarmPortrait"; |
|
214 if(orientation == Qt::Horizontal) { |
|
215 section = "nonTimedAlarmLandscape"; |
|
216 } |
|
217 } |
|
218 mAlertDocLoader->load(filename, section, &loadSuccess); |
|
219 break; |
|
220 default: |
|
221 break; |
|
222 } |
176 |
223 |
177 // Do not notify the client back if the close was initiated by client itself |
|
178 if(!mClosedByClient) { |
|
179 // Package the user response and send it |
|
180 QVariantMap param; |
|
181 param.insert(alarmCommand, mUserResponse); |
|
182 emit deviceDialogData(param); |
|
183 } |
|
184 // This signal has to be emitted so that the dialog can be cleaned up later |
|
185 emit deviceDialogClosed(); |
|
186 |
|
187 // Forward the call to the base class |
|
188 HbDialog::closeEvent(event); |
|
189 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_CLOSEEVENT_EXIT ); |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------- |
|
193 // AlarmAlertDialogPrivate::handleOrientationChange |
|
194 // rest of the details are commented in the header |
|
195 // --------------------------------------------------------- |
|
196 // |
|
197 void AlarmAlertDialogPrivate::handleOrientationChange () |
|
198 { |
|
199 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HANDLEORIENTATIONCHANGE_ENTRY ); |
|
200 // TODO: Need to change this as per the UI concept |
|
201 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HANDLEORIENTATIONCHANGE_EXIT ); |
224 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HANDLEORIENTATIONCHANGE_EXIT ); |
202 } |
225 } |
203 |
226 |
204 // --------------------------------------------------------- |
227 // --------------------------------------------------------- |
205 // AlarmAlertDialogPrivate::snoozed |
228 // AlarmAlertDialogPrivate::snoozed |
208 // |
231 // |
209 void AlarmAlertDialogPrivate::snoozed() |
232 void AlarmAlertDialogPrivate::snoozed() |
210 { |
233 { |
211 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_SNOOZED_ENTRY ); |
234 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_SNOOZED_ENTRY ); |
212 mUserResponse = Snooze; |
235 mUserResponse = Snooze; |
213 close(); |
236 QVariantMap param; |
|
237 param.insert(alarmCommand, mUserResponse); |
|
238 emit deviceDialogData(param); |
|
239 |
214 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SNOOZED_EXIT ); |
240 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SNOOZED_EXIT ); |
215 } |
241 } |
216 |
242 |
217 // --------------------------------------------------------- |
243 // --------------------------------------------------------- |
218 // AlarmAlertDialogPrivate::silenced |
244 // AlarmAlertDialogPrivate::silenced |
224 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_SILENCED_ENTRY ); |
250 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_SILENCED_ENTRY ); |
225 if (mIsSilenceKey) { |
251 if (mIsSilenceKey) { |
226 mUserResponse = Silence; |
252 mUserResponse = Silence; |
227 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
253 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
228 mIsSilenceKey = false; |
254 mIsSilenceKey = false; |
|
255 setDismissOnAction(true); |
229 QVariantMap param; |
256 QVariantMap param; |
230 param.insert(alarmCommand, mUserResponse); |
257 param.insert(alarmCommand, mUserResponse); |
231 emit deviceDialogData(param); |
258 emit deviceDialogData(param); |
232 }else { |
259 }else { |
233 mUserResponse = Snooze; |
260 snoozed(); |
234 close(); |
261 |
235 } |
262 } |
236 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SILENCED_EXIT ); |
263 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SILENCED_EXIT ); |
237 } |
264 } |
238 |
265 |
239 // --------------------------------------------------------- |
266 // --------------------------------------------------------- |
258 // |
285 // |
259 void AlarmAlertDialogPrivate::dismissed() |
286 void AlarmAlertDialogPrivate::dismissed() |
260 { |
287 { |
261 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_DISMISSED_ENTRY ); |
288 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_DISMISSED_ENTRY ); |
262 mUserResponse = Stop; |
289 mUserResponse = Stop; |
263 close(); |
290 QVariantMap param; |
|
291 param.insert(alarmCommand, mUserResponse); |
|
292 emit deviceDialogData(param); |
264 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_DISMISSED_EXIT ); |
293 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_DISMISSED_EXIT ); |
265 } |
294 } |
266 |
295 |
267 // --------------------------------------------------------- |
296 // --------------------------------------------------------- |
268 // AlarmAlertDialogPrivate::parseAndFetchParams |
297 // AlarmAlertDialogPrivate::parseAndFetchParams |
314 // Nothing can be done. Simply return |
343 // Nothing can be done. Simply return |
315 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SETUPNORMALUI_EXIT ); |
344 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_SETUPNORMALUI_EXIT ); |
316 return; |
345 return; |
317 } |
346 } |
318 mAlertDocLoader = alertDocLoader; |
347 mAlertDocLoader = alertDocLoader; |
|
348 |
|
349 mMainWindow = hbInstance->allMainWindows().first(); |
|
350 connect( |
|
351 mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), |
|
352 this, SLOT(handleOrientationChange(Qt::Orientation))); |
319 |
353 |
320 if (mAlarmAlertType == ClockAlarm) { |
354 if (mAlarmAlertType == ClockAlarm) { |
321 handleClockAlarms(); |
355 handleClockAlarms(); |
322 }else if(mAlarmAlertType == TodoAlarm) { |
356 }else if(mAlarmAlertType == TodoAlarm) { |
323 handleToDoAlarms(); |
357 handleToDoAlarms(); |
366 mAlertDocLoader->findObject("snoozeAction")); |
403 mAlertDocLoader->findObject("snoozeAction")); |
367 if (!snoozeAction) { |
404 if (!snoozeAction) { |
368 qFatal("Unable to load the snoozeAction softkey"); |
405 qFatal("Unable to load the snoozeAction softkey"); |
369 } |
406 } |
370 snoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
407 snoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
371 disconnect(snoozeAction, SIGNAL(triggered()), this, SLOT(close())); |
|
372 connect(snoozeAction, SIGNAL(triggered()), this, SLOT(snoozed())); |
408 connect(snoozeAction, SIGNAL(triggered()), this, SLOT(snoozed())); |
373 |
409 |
374 HbAction *stopAction = qobject_cast<HbAction*> ( |
410 HbAction *stopAction = qobject_cast<HbAction*> ( |
375 mAlertDocLoader->findObject("stopAction")); |
411 mAlertDocLoader->findObject("stopAction")); |
376 if (!stopAction) { |
412 if (!stopAction) { |
377 qFatal("Unable to load the stopAction softkey"); |
413 qFatal("Unable to load the stopAction softkey"); |
378 } |
414 } |
379 stopAction->setText(hbTrId("txt_calendar_button_alarm_stop")); |
415 stopAction->setText(hbTrId("txt_calendar_button_alarm_stop")); |
380 disconnect(stopAction, SIGNAL(triggered()), this, SLOT(close())); |
|
381 connect(stopAction, SIGNAL(triggered()), this, SLOT(dismissed())); |
416 connect(stopAction, SIGNAL(triggered()), this, SLOT(dismissed())); |
382 |
417 |
383 if (!mCanSnooze) { |
418 if (!mCanSnooze) { |
384 snoozeAction->setVisible(false); |
419 snoozeAction->setVisible(false); |
385 } |
420 } |
392 // --------------------------------------------------------- |
427 // --------------------------------------------------------- |
393 // |
428 // |
394 void AlarmAlertDialogPrivate::handleCalendarAlarms() |
429 void AlarmAlertDialogPrivate::handleCalendarAlarms() |
395 { |
430 { |
396 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HANDLECALENDARALARMS_ENTRY ); |
431 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HANDLECALENDARALARMS_ENTRY ); |
397 bool success = false; |
|
398 HbExtendedLocale locale = HbExtendedLocale::system(); |
432 HbExtendedLocale locale = HbExtendedLocale::system(); |
399 // Check if the alarm has the time info or not. |
433 // Check if the alarm has the time info or not. |
400 // For all day events the time label has to be hidden |
434 // For all day events the time label has to be hidden |
401 // So load the proper sections accordingly |
435 // So load the proper sections accordingly |
402 if ( mIsTimedAlarm ) { |
436 if ( mIsTimedAlarm ) { |
403 mAlertDocLoader->load( |
437 handleOrientationChange(mMainWindow->orientation()); |
404 alarmNormalUICalendarDocml, "calendarTimed",&success); |
|
405 if (!success) { |
|
406 qFatal("Unable to load the calendarTimed section"); |
|
407 } |
|
408 mAlarmDateTime = qobject_cast<HbLabel*> ( |
438 mAlarmDateTime = qobject_cast<HbLabel*> ( |
409 mAlertDocLoader->findWidget("alarmTime")); |
439 mAlertDocLoader->findWidget("alarmTime")); |
410 if (!mAlarmDateTime) { |
440 if (!mAlarmDateTime) { |
411 qFatal("Unable to find the alarmTime label"); |
441 qFatal("Unable to find the alarmTime label"); |
412 } |
442 } |
416 if (!alarmDate) { |
446 if (!alarmDate) { |
417 qFatal("Unable to find the alarmDate label"); |
447 qFatal("Unable to find the alarmDate label"); |
418 } |
448 } |
419 alarmDate->setPlainText(mAlarmDate); |
449 alarmDate->setPlainText(mAlarmDate); |
420 }else { |
450 }else { |
421 mAlertDocLoader->load( |
451 handleOrientationChange(mMainWindow->orientation()); |
422 alarmNormalUICalendarDocml, "nonTimedAlarm",&success); |
|
423 if (!success) { |
|
424 qFatal("Unable to load the nonTimedAlarm section"); |
|
425 } |
|
426 mAlarmDateTime = qobject_cast<HbLabel*> ( |
|
427 mAlertDocLoader->findWidget("alarmTime")); |
|
428 if (!mAlarmDateTime) { |
|
429 qFatal("Unable to find the alarmTime label"); |
|
430 } |
|
431 mAlarmDateTime->hide(); |
|
432 HbLabel *alarmDate = qobject_cast<HbLabel*> ( |
452 HbLabel *alarmDate = qobject_cast<HbLabel*> ( |
433 mAlertDocLoader->findWidget("alarmDate")); |
453 mAlertDocLoader->findWidget("alarmDate")); |
434 if (!alarmDate) { |
454 if (!alarmDate) { |
435 qFatal("Unable to find the alarmDate label"); |
455 qFatal("Unable to find the alarmDate label"); |
436 } |
456 } |
437 alarmDate->setPlainText(mAlarmDate); |
457 alarmDate->setPlainText(mAlarmDate); |
438 } |
458 } |
439 |
459 |
440 QGraphicsWidget *headingWidget = mAlertDocLoader->findWidget("heading"); |
|
441 if (!headingWidget) { |
|
442 qFatal("Unable to find the heading widget"); |
|
443 } |
|
444 mAlarmDescription = qobject_cast<HbLabel*> ( |
460 mAlarmDescription = qobject_cast<HbLabel*> ( |
445 mAlertDocLoader->findWidget("alarmDescription")); |
461 mAlertDocLoader->findWidget("alarmDescription")); |
446 if (!mAlarmDescription) { |
462 if (!mAlarmDescription) { |
447 qFatal("Unable to find the alarmDescription label"); |
463 qFatal("Unable to find the alarmDescription label"); |
448 } |
464 } |
464 mSnoozeAction = qobject_cast<HbAction*> ( |
480 mSnoozeAction = qobject_cast<HbAction*> ( |
465 mAlertDocLoader->findObject("snoozeAction")); |
481 mAlertDocLoader->findObject("snoozeAction")); |
466 if (!mSnoozeAction) { |
482 if (!mSnoozeAction) { |
467 qFatal("Unable to find the snoozeAction softkey"); |
483 qFatal("Unable to find the snoozeAction softkey"); |
468 } |
484 } |
469 disconnect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(close())); |
485 |
470 if (!mCanSnooze) { |
486 if (!mCanSnooze) { |
471 mSnoozeAction->setVisible(false); |
487 mSnoozeAction->setVisible(false); |
472 }else { |
488 }else { |
473 if(!mIsSilent) { |
489 if(!mIsSilent) { |
474 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_silence")); |
490 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_silence")); |
475 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(silenced())); |
491 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(silenced())); |
476 mIsSilenceKey = true; |
492 mIsSilenceKey = true; |
|
493 setDismissOnAction(false); |
477 } else { |
494 } else { |
478 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
495 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
479 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(snoozed())); |
496 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(snoozed())); |
480 } |
497 } |
481 } |
498 } |
483 mAlertDocLoader->findObject("stopAction")); |
500 mAlertDocLoader->findObject("stopAction")); |
484 if (!stopAction) { |
501 if (!stopAction) { |
485 qFatal("Unable to find the stopAction softkey"); |
502 qFatal("Unable to find the stopAction softkey"); |
486 } |
503 } |
487 stopAction->setText(hbTrId("txt_calendar_button_alarm_stop")); |
504 stopAction->setText(hbTrId("txt_calendar_button_alarm_stop")); |
488 disconnect(stopAction, SIGNAL(triggered()), this, SLOT(close())); |
|
489 connect(stopAction, SIGNAL(triggered()), this, SLOT(dismissed())); |
505 connect(stopAction, SIGNAL(triggered()), this, SLOT(dismissed())); |
490 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HANDLECALENDARALARMS_EXIT ); |
506 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HANDLECALENDARALARMS_EXIT ); |
491 } |
507 } |
492 |
508 |
493 // --------------------------------------------------------- |
509 // --------------------------------------------------------- |
496 // --------------------------------------------------------- |
512 // --------------------------------------------------------- |
497 // |
513 // |
498 void AlarmAlertDialogPrivate::handleToDoAlarms() |
514 void AlarmAlertDialogPrivate::handleToDoAlarms() |
499 { |
515 { |
500 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HANDLETODOALARMS_ENTRY ); |
516 OstTraceFunctionEntry0( ALARMALERTDIALOGPRIVATE_HANDLETODOALARMS_ENTRY ); |
|
517 |
|
518 handleOrientationChange(mMainWindow->orientation()); |
|
519 |
501 QGraphicsWidget *headingWidget = mAlertDocLoader->findWidget("heading"); |
520 QGraphicsWidget *headingWidget = mAlertDocLoader->findWidget("heading"); |
502 if (!headingWidget) { |
521 if (!headingWidget) { |
503 qFatal("Unable to load the heading widget"); |
522 qFatal("Unable to load the heading widget"); |
504 } |
523 } |
505 HbExtendedLocale locale = HbExtendedLocale::system(); |
524 HbExtendedLocale locale = HbExtendedLocale::system(); |
526 mSnoozeAction = qobject_cast<HbAction*> ( |
545 mSnoozeAction = qobject_cast<HbAction*> ( |
527 mAlertDocLoader->findObject("snoozeAction")); |
546 mAlertDocLoader->findObject("snoozeAction")); |
528 if (!mSnoozeAction) { |
547 if (!mSnoozeAction) { |
529 qFatal("Unable to load the snoozeAction softkey"); |
548 qFatal("Unable to load the snoozeAction softkey"); |
530 } |
549 } |
531 disconnect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(close())); |
550 |
532 if (!mCanSnooze) { |
551 if (!mCanSnooze) { |
533 mSnoozeAction->setVisible(false); |
552 mSnoozeAction->setVisible(false); |
534 }else { |
553 }else { |
535 if(!mIsSilent) { |
554 if(!mIsSilent) { |
536 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_silence")); |
555 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_silence")); |
537 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(silenced())); |
556 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(silenced())); |
538 mIsSilenceKey = true; |
557 mIsSilenceKey = true; |
|
558 setDismissOnAction(false); |
539 } else { |
559 } else { |
540 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
560 mSnoozeAction->setText(hbTrId("txt_calendar_button_alarm_snooze")); |
541 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(snoozed())); |
561 connect(mSnoozeAction, SIGNAL(triggered()), this, SLOT(snoozed())); |
542 } |
562 } |
543 } |
563 } |
545 mAlertDocLoader->findObject("stopAction")); |
565 mAlertDocLoader->findObject("stopAction")); |
546 if (!stopAction) { |
566 if (!stopAction) { |
547 qFatal("Unable to load the stopAction softkey"); |
567 qFatal("Unable to load the stopAction softkey"); |
548 } |
568 } |
549 stopAction->setText(hbTrId("txt_calendar_button_alarm_stop")); |
569 stopAction->setText(hbTrId("txt_calendar_button_alarm_stop")); |
550 disconnect(stopAction, SIGNAL(triggered()), this, SLOT(close())); |
|
551 connect(stopAction, SIGNAL(triggered()), this, SLOT(dismissed())); |
570 connect(stopAction, SIGNAL(triggered()), this, SLOT(dismissed())); |
552 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HANDLETODOALARMS_EXIT ); |
571 OstTraceFunctionExit0( ALARMALERTDIALOGPRIVATE_HANDLETODOALARMS_EXIT ); |
553 } |
572 } |
554 |
573 |
555 // End of file --Don't remove this. |
574 // End of file --Don't remove this. |