102 // |
102 // |
103 void CalenDeleteUi::ConstructL() |
103 void CalenDeleteUi::ConstructL() |
104 { |
104 { |
105 OstTraceFunctionEntry0( CALENDELETEUI_CONSTRUCTL_ENTRY ); |
105 OstTraceFunctionEntry0( CALENDELETEUI_CONSTRUCTL_ENTRY ); |
106 |
106 |
107 iController.RegisterForNotificationsL( this, ECalenNotifyCancelDelete ); |
107 RArray<TCalenNotification> notifications; |
|
108 notifications.Append(ECalenNotifyCancelDelete); |
|
109 notifications.Append(ECalenNotifyCloseDialogs); |
|
110 |
|
111 iController.RegisterForNotificationsL( this, notifications ); |
|
112 |
|
113 notifications.Close(); |
|
114 |
108 iMoreEntriesToDelete = EFalse; |
115 iMoreEntriesToDelete = EFalse; |
109 iDisplayQuery = EFalse; |
116 iDisplayQuery = EFalse; |
110 iEntriesToDelete = KEntriesToDelete; |
117 iEntriesToDelete = KEntriesToDelete; |
111 |
118 |
112 OstTraceFunctionExit0( CALENDELETEUI_CONSTRUCTL_EXIT ); |
119 OstTraceFunctionExit0( CALENDELETEUI_CONSTRUCTL_EXIT ); |
383 { |
395 { |
384 OstTraceFunctionEntry0( CALENDELETEUI_DATEQUERY_ENTRY ); |
396 OstTraceFunctionEntry0( CALENDELETEUI_DATEQUERY_ENTRY ); |
385 |
397 |
386 // Create a popup with datepicker to select the date. |
398 // Create a popup with datepicker to select the date. |
387 HbDialog *popUp = new HbDialog(); |
399 HbDialog *popUp = new HbDialog(); |
|
400 popUp->setParent(this); |
388 popUp->setDismissPolicy(HbDialog::NoDismiss); |
401 popUp->setDismissPolicy(HbDialog::NoDismiss); |
389 popUp->setTimeout(HbDialog::NoTimeout ); |
402 popUp->setTimeout(HbDialog::NoTimeout ); |
390 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
403 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
391 popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_set_date"))); |
404 popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_set_date"))); |
392 |
405 |
404 mDeleteAction = new HbAction( |
417 mDeleteAction = new HbAction( |
405 hbTrId("txt_common_button_delete"), popUp); |
418 hbTrId("txt_common_button_delete"), popUp); |
406 popUp->addAction(mDeleteAction); |
419 popUp->addAction(mDeleteAction); |
407 mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"),popUp); |
420 mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"),popUp); |
408 popUp->addAction(mCancelAction); |
421 popUp->addAction(mCancelAction); |
|
422 // Close the popup once closeDialogs() is received |
|
423 connect(this, SIGNAL(closeDialogs()), popUp, SLOT(close())); |
409 // Show the popup |
424 // Show the popup |
410 popUp->open(this, SLOT(handleDateQuery(HbAction*))); |
425 popUp->open(this, SLOT(handleDateQuery(HbAction*))); |
411 |
426 |
412 OstTraceFunctionExit0( CALENDELETEUI_DATEQUERY_EXIT ); |
427 OstTraceFunctionExit0( CALENDELETEUI_DATEQUERY_EXIT ); |
413 } |
428 } |
466 void CalenDeleteUi::showRepeatingEntryDeleteQuery() |
481 void CalenDeleteUi::showRepeatingEntryDeleteQuery() |
467 { |
482 { |
468 OstTraceFunctionEntry0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_ENTRY ); |
483 OstTraceFunctionEntry0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_ENTRY ); |
469 |
484 |
470 HbDialog *popUp = new HbDialog(); |
485 HbDialog *popUp = new HbDialog(); |
|
486 popUp->setParent(this); |
471 popUp->setDismissPolicy(HbDialog::NoDismiss); |
487 popUp->setDismissPolicy(HbDialog::NoDismiss); |
472 popUp->setTimeout(HbDialog::NoTimeout); |
488 popUp->setTimeout(HbDialog::NoTimeout); |
473 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
489 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
474 |
490 |
475 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
491 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
489 popUp->setContentWidget(editWidget); |
505 popUp->setContentWidget(editWidget); |
490 popUp->setHeadingWidget(new HbLabel( |
506 popUp->setHeadingWidget(new HbLabel( |
491 hbTrId("txt_calendar_title_delete_repeated_entry"))); |
507 hbTrId("txt_calendar_title_delete_repeated_entry"))); |
492 |
508 |
493 // Add cancel action |
509 // Add cancel action |
494 HbAction *cancelAction = new HbAction( |
510 mCancelAction = new HbAction( |
495 hbTrId("txt_common_button_cancel_singledialog")); |
511 hbTrId("txt_common_button_cancel_singledialog")); |
496 popUp->addAction(cancelAction); |
512 popUp->addAction(mCancelAction); |
497 connect(editButtonList, SIGNAL(itemSelected(int)), this, |
513 connect(editButtonList, SIGNAL(itemSelected(int)), this, |
498 SLOT(handleRepeatedEntryDelete(int))); |
514 SLOT(handleRepeatedEntryDelete(int))); |
499 connect(editButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close())); |
515 connect(editButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close())); |
500 connect(cancelAction, SIGNAL(triggered()), this, |
516 // Close the popup once closeDialogs() is received |
501 SLOT(handleDeleteCancel())); |
517 connect(this, SIGNAL(closeDialogs()), popUp, SLOT(close())); |
502 |
|
503 // Show the popup |
518 // Show the popup |
504 popUp->open(); |
519 popUp->open(this, SLOT(handleCancelAndClose(HbAction*))); |
505 |
520 |
506 OstTraceFunctionExit0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_EXIT ); |
521 OstTraceFunctionExit0( CALENDELETEUI_SHOWREPEATINGENTRYDELETEQUERY_EXIT ); |
507 } |
522 } |
508 |
523 |
509 // ---------------------------------------------------------------------------- |
524 // ---------------------------------------------------------------------------- |
510 // CalenDeleteUi::handleDeleteCancel |
525 // CalenDeleteUi::handleCancelAndClose |
511 // Handles the cancel action |
526 // Handles the cancel action and the close of the popup |
512 // (other items were commented in a header). |
527 // (other items were commented in a header). |
513 // ---------------------------------------------------------------------------- |
528 // ---------------------------------------------------------------------------- |
514 // |
529 // |
515 void CalenDeleteUi::handleDeleteCancel() |
530 void CalenDeleteUi::handleCancelAndClose(HbAction* action) |
516 { |
531 { |
517 OstTraceFunctionEntry0( CALENDELETEUI_HANDLEDELETECANCEL_ENTRY ); |
532 OstTraceFunctionEntry0( CALENDELETEUI_HANDLECANCELANDCLOSE_ENTRY ); |
518 |
533 if(action == mCancelAction || !action) { |
519 iController.BroadcastNotification(ECalenNotifyDeleteFailed); |
534 // If the user presses cancel button broadcast ECalenNotifyDeleteFailed |
520 |
535 // Action will be null if the popup is closed by itself |
521 OstTraceFunctionExit0( CALENDELETEUI_HANDLEDELETECANCEL_EXIT ); |
536 // without pressing any buttons. So in this case also notification |
|
537 // has to be broadcasted as ECalenNotifyDeleteFailed |
|
538 |
|
539 iController.BroadcastNotification(ECalenNotifyDeleteFailed); |
|
540 } |
|
541 mCancelAction = NULL; |
|
542 OstTraceFunctionExit0( CALENDELETEUI_HANDLECANCELANDCLOSE_EXIT ); |
522 } |
543 } |
523 |
544 |
524 void CalenDeleteUi::handleRepeatedEntryDelete(int index) |
545 void CalenDeleteUi::handleRepeatedEntryDelete(int index) |
525 { |
546 { |
526 OstTraceFunctionEntry0( CALENDELETEUI_HANDLEREPEATEDENTRYDELETE_ENTRY ); |
547 OstTraceFunctionEntry0( CALENDELETEUI_HANDLEREPEATEDENTRYDELETE_ENTRY ); |
613 mDeleteAction = new HbAction( |
635 mDeleteAction = new HbAction( |
614 hbTrId("txt_common_button_delete"), popup); |
636 hbTrId("txt_common_button_delete"), popup); |
615 popup->addAction(mDeleteAction); |
637 popup->addAction(mDeleteAction); |
616 mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"), popup); |
638 mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"), popup); |
617 popup->addAction(mCancelAction); |
639 popup->addAction(mCancelAction); |
|
640 // Close the popup once closeDialogs() is received |
|
641 connect(this, SIGNAL(closeDialogs()), popup, SLOT(close())); |
|
642 // Show the popup |
618 popup->open(this, SLOT(handleDeletion(HbAction*))); |
643 popup->open(this, SLOT(handleDeletion(HbAction*))); |
619 |
644 |
620 OstTraceFunctionExit0( CALENDELETEUI_SHOWDELETEQUERY_EXIT ); |
645 OstTraceFunctionExit0( CALENDELETEUI_SHOWDELETEQUERY_EXIT ); |
621 } |
646 } |
622 |
647 |