348 default: |
347 default: |
349 break; |
348 break; |
350 } |
349 } |
351 mNewEntryDateTime = entry.startTime(); |
350 mNewEntryDateTime = entry.startTime(); |
352 mLaunchCalendar = launchCalendar; |
351 mLaunchCalendar = launchCalendar; |
353 showEditor(entry); |
352 openEditor(entry); |
354 } |
353 } |
355 |
354 |
356 /*! |
355 /*! |
357 Queries user whether to edit whole series or just this single occurence |
356 Queries user whether to edit whole series or just this single occurence |
358 */ |
357 */ |
359 void CalenEditorPrivate::showEditOccurencePopup() |
358 void CalenEditorPrivate::showEditOccurencePopup() |
360 { |
359 { |
361 HbDialog popUp; |
360 HbDialog *popUp = new HbDialog(); |
362 popUp.setDismissPolicy(HbDialog::NoDismiss); |
361 popUp->setDismissPolicy(HbDialog::NoDismiss); |
363 popUp.setTimeout(HbDialog::NoTimeout); |
362 popUp->setTimeout(HbDialog::NoTimeout); |
364 |
363 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
|
364 |
365 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
365 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
366 HbWidget *editWidget = new HbWidget(); |
366 HbWidget *editWidget = new HbWidget(); |
367 editWidget->setLayout(layout); |
367 editWidget->setLayout(layout); |
368 |
368 |
369 HbRadioButtonList *editButtonList = new HbRadioButtonList(); |
369 HbRadioButtonList *editButtonList = new HbRadioButtonList(); |
374 |
374 |
375 editButtonList->setItems(list); |
375 editButtonList->setItems(list); |
376 |
376 |
377 layout->addItem(editButtonList); |
377 layout->addItem(editButtonList); |
378 |
378 |
379 popUp.setContentWidget(editWidget); |
379 popUp->setContentWidget(editWidget); |
380 popUp.setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_edit"))); |
380 popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_edit"))); |
381 |
381 |
382 // Create secondary action |
382 // Create cancel action |
383 HbAction *cancelAction = |
383 HbAction *cancelAction = |
384 new HbAction(hbTrId("txt_calendar_button_softkey1_cancel")); |
384 new HbAction(hbTrId("txt_calendar_button_softkey1_cancel")); |
385 popUp.setSecondaryAction(cancelAction); |
385 popUp->addAction(cancelAction); |
386 connect(editButtonList, SIGNAL(itemSelected(int)), this, |
386 connect(editButtonList, SIGNAL(itemSelected(int)), this, |
387 SLOT(handleEditOccurence(int))); |
387 SLOT(handleEditOccurence(int))); |
388 connect(editButtonList, SIGNAL(itemSelected(int)), &popUp, SLOT(close())); |
388 connect(editButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close())); |
389 |
|
390 connect(cancelAction, SIGNAL(triggered()), &popUp, SLOT(close())); |
|
391 connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancel())); |
389 connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancel())); |
392 |
390 |
393 // Show the popup |
391 // Show the popup |
394 popUp.exec(); |
392 popUp->open(); |
395 } |
393 } |
396 |
394 |
397 /*! |
395 /*! |
398 Slot to handle User selection for series editing or single occurence popup |
396 Slot to handle User selection for series editing or single occurence popup |
399 */ |
397 */ |
407 case 1: |
405 case 1: |
408 // User wants to edit all the occurences |
406 // User wants to edit all the occurences |
409 mEditRange = ThisAndAll; |
407 mEditRange = ThisAndAll; |
410 break; |
408 break; |
411 } |
409 } |
|
410 // If user has selected to edit all the occurences, |
|
411 // then get the parent of it |
|
412 AgendaEntry entryToBeEdited = mEntry; |
|
413 if (mEditRange == ThisAndAll) { |
|
414 entryToBeEdited = mAgendaUtil->parentEntry(mEntry); |
|
415 } |
|
416 showEditor(entryToBeEdited); |
412 } |
417 } |
413 |
418 |
414 /*! |
419 /*! |
415 Slot to handle cancel action on the popup |
420 Slot to handle cancel action on the popup |
416 */ |
421 */ |
417 void CalenEditorPrivate::handleCancel() |
422 void CalenEditorPrivate::handleCancel() |
418 { |
423 { |
419 // User has chosen not to edit the event, hence return |
424 // User has chosen not to edit the event, hence return |
420 mEditRange = UserCancelled; |
425 mEditRange = UserCancelled; |
421 } |
426 // Do cleanup and return |
422 |
427 emit q_ptr->dialogClosed(); |
423 /*! |
428 return; |
424 Displays the editor. |
429 } |
425 */ |
430 |
426 void CalenEditorPrivate::showEditor(AgendaEntry entry) |
431 /*! |
427 { |
432 Opens the editor. |
428 |
433 */ |
|
434 void CalenEditorPrivate::openEditor(AgendaEntry entry) |
|
435 { |
429 if (0 < entry.id()) { |
436 if (0 < entry.id()) { |
430 mNewEntry = false; |
437 mNewEntry = false; |
431 } |
438 } |
432 |
|
433 AgendaEntry entryToBeEdited = entry; |
|
434 if (!mNewEntry) { |
439 if (!mNewEntry) { |
435 // Before we do anything, check in the entry is repeating |
440 // Before we do anything, check in the entry is repeating |
436 // OR its a child item |
441 // OR its a child item |
437 mIsChild = !(entry.recurrenceId().isNull()); |
442 mIsChild = !(entry.recurrenceId().isNull()); |
438 bool isRepeating = entry.isRepeating(); |
443 bool isRepeating = entry.isRepeating(); |
|
444 // For later reference |
|
445 mEntry = entry; |
439 if (mIsChild || isRepeating) { |
446 if (mIsChild || isRepeating) { |
440 // Query user if he wants to edit whole series |
447 // Query user if he wants to edit whole series |
441 // or just this occurence |
448 // or just this occurence |
442 showEditOccurencePopup(); |
449 showEditOccurencePopup(); |
443 // If user has selected to edit all the occurences, |
450 return; |
444 // then get the parent of it |
451 }else { |
445 if (mEditRange == ThisAndAll) { |
|
446 entryToBeEdited = mAgendaUtil->parentEntry(entry); |
|
447 } else if (mEditRange == UserCancelled) { |
|
448 // Do cleanup and return |
|
449 emit q_ptr->dialogClosed(); |
|
450 return; |
|
451 } |
|
452 } else { |
|
453 mEditRange = ThisAndAll; |
452 mEditRange = ThisAndAll; |
454 } |
453 } |
455 } |
454 } |
456 |
455 showEditor(entry); |
457 mOriginalEntry = new AgendaEntry(entryToBeEdited); |
456 } |
458 mEditedEntry = new AgendaEntry(entryToBeEdited); |
457 |
|
458 /*! |
|
459 Displays the editor. |
|
460 */ |
|
461 void CalenEditorPrivate::showEditor(AgendaEntry entry) |
|
462 { |
|
463 mOriginalEntry = new AgendaEntry(entry); |
|
464 mEditedEntry = new AgendaEntry(entry); |
459 |
465 |
460 if (!mEditedEntry->description().isEmpty()) { |
466 if (!mEditedEntry->description().isEmpty()) { |
461 mDescriptionItemAdded = true; |
467 mDescriptionItemAdded = true; |
462 } |
468 } |
463 // Construct the view using docloader |
469 // Construct the view using docloader |
464 setUpView(); |
470 setUpView(); |
465 |
471 |
466 // Set the title text. |
472 // Set the title text. |
467 mEditorView->setTitle(hbTrId("txt_calendar_title_calendar")); |
473 mEditorView->setTitle(hbTrId("txt_calendar_title_calendar")); |
468 |
474 |
469 mSoftKeyAction = new HbAction(Hb::BackAction); |
475 mSoftKeyAction = new HbAction(Hb::BackNaviAction); |
470 mEditorView->setNavigationAction(mSoftKeyAction); |
476 mEditorView->setNavigationAction(mSoftKeyAction); |
471 connect(mSoftKeyAction, SIGNAL(triggered()), this, |
477 connect(mSoftKeyAction, SIGNAL(triggered()), this, |
472 SLOT(saveAndCloseEditor())); |
478 SLOT(saveAndCloseEditor())); |
473 |
479 |
474 // Create the data handler |
480 // Create the data handler |
475 mDataHandler = new CalenEditorDataHandler(this,mEditedEntry, mOriginalEntry); |
481 mDataHandler = new CalenEditorDataHandler(this,mEditedEntry, mOriginalEntry); |
476 } |
482 } |
477 |
483 |
478 /*! |
484 /*! |
512 |
518 |
513 HbAction *deleteEventAction = qobject_cast<HbAction *> ( |
519 HbAction *deleteEventAction = qobject_cast<HbAction *> ( |
514 mEditorDocLoader->findObject( |
520 mEditorDocLoader->findObject( |
515 CALEN_EDITOR_DELETE_EVENT_ACTION)); |
521 CALEN_EDITOR_DELETE_EVENT_ACTION)); |
516 connect(deleteEventAction, SIGNAL(triggered()), this, |
522 connect(deleteEventAction, SIGNAL(triggered()), this, |
517 SLOT(handleDeleteAction())); |
523 SLOT(showDeleteConfirmationQuery())); |
518 |
524 |
519 if (!mNewEntry) { |
525 if (!mNewEntry) { |
520 //TODO: Add the text id based on the entry type Anniversary or meeting |
526 //TODO: Add the text id based on the entry type Anniversary or meeting |
521 headingWidget->setHeading(hbTrId("txt_calendar_subhead_event")); |
527 headingWidget->setHeading(hbTrId("txt_calendar_subhead_event")); |
522 } |
528 } |
580 // Add the fields to the DataForm. |
586 // Add the fields to the DataForm. |
581 addSubjectItem(); |
587 addSubjectItem(); |
582 |
588 |
583 // Add all day check box for new entry creation or while editing |
589 // Add all day check box for new entry creation or while editing |
584 // parent entry or existing non repeating event |
590 // parent entry or existing non repeating event |
585 if (mNewEntry) { |
591 if (mNewEntry || (mEditRange == ThisAndAll)) { |
586 addAllDayCheckBoxItem(); |
592 addAllDayCheckBoxItem(); |
587 } else { |
593 } |
588 if (!mEditedEntry->isRepeating() || (mEditRange == ThisAndAll)) { |
|
589 addAllDayCheckBoxItem(); |
|
590 } |
|
591 } |
|
592 |
|
593 addCustomItemFrom(); |
594 addCustomItemFrom(); |
594 addCustomItemTo(); |
595 addCustomItemTo(); |
595 addCustomItemLocation(); |
596 addCustomItemLocation(); |
596 addReminderItem(); |
597 addReminderItem(); |
597 // Add the repeat information only if particular occurence is not being |
598 // Add the repeat information only if particular occurence is not being |
598 if (mEditRange == ThisAndAll) { |
599 if (mEditRange == ThisAndAll) { |
599 addRepeatItem(); |
600 addRepeatItem(); |
600 } |
601 } |
601 |
|
602 mCalenEditorForm->setModel(mCalenEditorModel); |
602 mCalenEditorForm->setModel(mCalenEditorModel); |
603 } |
603 } |
604 |
604 |
605 /*! |
605 /*! |
606 Appends the Subject Item to the Data form Model. |
606 Appends the Subject Item to the Data form Model. |
791 AgendaEntry parentEntry = mAgendaUtil->parentEntry(*mEditedEntry); |
791 AgendaEntry parentEntry = mAgendaUtil->parentEntry(*mEditedEntry); |
792 int durationInSeconds = parentEntry.durationInSecs(); |
792 int durationInSeconds = parentEntry.durationInSecs(); |
793 QDateTime endTime = |
793 QDateTime endTime = |
794 mEditedEntry-> startTime().addSecs(durationInSeconds); |
794 mEditedEntry-> startTime().addSecs(durationInSeconds); |
795 |
795 |
796 // set this to the original entr as well as edited entry |
796 // set this to the original entry as well as edited entry |
797 mOriginalEntry->setStartAndEndTime(mOriginalEntry->startTime(), |
797 mOriginalEntry->setStartAndEndTime(mOriginalEntry->startTime(), |
798 endTime); |
798 endTime); |
799 mEditedEntry->setStartAndEndTime(mEditedEntry->startTime(), endTime); |
799 mEditedEntry->setStartAndEndTime(mEditedEntry->startTime(), endTime); |
800 } |
800 } |
801 fromDateTime = mEditedEntry->startTime(); |
801 fromDateTime = mEditedEntry->startTime(); |
857 mViewFromItem->setDateRange( |
857 mViewFromItem->setDateRange( |
858 prevInstanceStartTime.addDays(1).date(), |
858 prevInstanceStartTime.addDays(1).date(), |
859 nextInstanceStartTime.addDays(-1).date()); |
859 nextInstanceStartTime.addDays(-1).date()); |
860 mViewToItem->setDateRange(prevInstanceEndTime.date().addDays(1), |
860 mViewToItem->setDateRange(prevInstanceEndTime.date().addDays(1), |
861 nextInstanceEndTime.date().addDays(-1)); |
861 nextInstanceEndTime.date().addDays(-1)); |
|
862 |
|
863 // If repeating daily then disable the date fields as |
|
864 // date cannot be changed |
|
865 if (mEditedEntry->repeatRule().type() == AgendaRepeatRule::DailyRule) { |
|
866 mViewFromItem->disableFromToDateField(); |
|
867 } |
862 } |
868 } |
863 } else { |
869 } else { |
864 toDateTime = fromDateTime.addSecs(60 * 60); |
870 toDateTime = fromDateTime.addSecs(60 * 60); |
865 } |
871 } |
866 mViewToItem->populateDateTime(toDateTime, false); |
872 mViewToItem->populateDateTime(toDateTime, false); |
869 mEditedEntry->setStartAndEndTime(fromDateTime, toDateTime); |
875 mEditedEntry->setStartAndEndTime(fromDateTime, toDateTime); |
870 // Set the default start time to the Original entry if its a new event. |
876 // Set the default start time to the Original entry if its a new event. |
871 if (mNewEntry) { |
877 if (mNewEntry) { |
872 mOriginalEntry->setStartAndEndTime(fromDateTime, toDateTime); |
878 mOriginalEntry->setStartAndEndTime(fromDateTime, toDateTime); |
873 } |
879 } |
874 if (mAllDayCheckBoxItem |
880 if ((mAllDayCheckBoxItem && |
875 && (mAllDayCheckBoxItem->contentWidgetData("checkState") |
881 (mAllDayCheckBoxItem->contentWidgetData("checkState") == Qt::Checked)) |
876 == Qt::Checked)) { |
882 || (!mNewEntry && mEditedEntry->type() == AgendaEntry::TypeEvent)) { |
877 // If the all day option is checked, we need to |
883 // If the all day option is checked, we need to |
878 // disable the time fields |
884 // disable the time fields |
879 enableFromTotimeFileds(false, mEditedEntry->startTime(), |
885 enableFromTotimeFileds(false, mEditedEntry->startTime(), |
880 mEditedEntry->endTime()); |
886 mEditedEntry->endTime()); |
881 } |
887 } |
896 else { |
902 else { |
897 itemIndex = LocationItem - 1; |
903 itemIndex = LocationItem - 1; |
898 } |
904 } |
899 QModelIndex index = mCalenEditorModel->index(itemIndex, 0); |
905 QModelIndex index = mCalenEditorModel->index(itemIndex, 0); |
900 mViewLocationItem = qobject_cast<CalenEditorCustomItem *> |
906 mViewLocationItem = qobject_cast<CalenEditorCustomItem *> |
901 (mCalenEditorForm->dataFormViewItem(index)); |
907 (mCalenEditorForm->itemByIndex(index)); |
902 |
908 |
903 connect(mViewLocationItem, SIGNAL(locationTextChanged(const QString)), |
909 connect(mViewLocationItem, SIGNAL(locationTextChanged(const QString)), |
904 this, SLOT(handleLocationChange(const QString))); |
910 this, SLOT(handleLocationChange(const QString))); |
905 |
911 |
906 mViewLocationItem->populateLocation(mEditedEntry->location()); |
912 mViewLocationItem->populateLocation(mEditedEntry->location()); |
907 } |
913 } |
908 /*! |
914 /*! |
909 Save the changed start time of the event. |
915 Save the changed start time of the event. |
910 */ |
916 */ |
933 |
939 |
934 if (mEditRange == ThisAndAll) { |
940 if (mEditRange == ThisAndAll) { |
935 // update the repeat choices depending on the meeting duration |
941 // update the repeat choices depending on the meeting duration |
936 mRepeatField->updateRepeatChoices(); |
942 mRepeatField->updateRepeatChoices(); |
937 } |
943 } |
|
944 |
|
945 updateReminderChoices(); |
|
946 } |
|
947 |
|
948 void CalenEditorPrivate::updateReminderChoices() |
|
949 { |
|
950 QDate referenceDate; |
|
951 |
|
952 // Start date or repeat until date will be the reference to decide |
|
953 // whether the event is in past or future. |
|
954 if (mRepeatField && mRepeatField->isRepeatUntilItemAdded()) { |
|
955 referenceDate = mRepeatField->repeatUntilDate(); |
|
956 } else { |
|
957 referenceDate = mEditedEntry->startTime().date(); |
|
958 } |
|
959 |
|
960 // Check if all day event or not. |
|
961 if (isAllDayEvent()) { |
|
962 int currentIndex = mReminderField->currentReminderIndex(); |
|
963 mReminderField->updateReminderChoicesForAllDay(referenceDate); |
|
964 int numberOfReminderChoices = mReminderField->reminderItemsCount(); |
|
965 if (currentIndex >= numberOfReminderChoices) { |
|
966 currentIndex = 0; |
|
967 mReminderField->disableReminderTimeField(); |
|
968 } |
|
969 mReminderField->setCurrentIndex(currentIndex); |
|
970 if(currentIndex == 0 && mReminderField->isReminderTimeForAllDayAdded()) { |
|
971 mReminderField->removeReminderTimeField(); |
|
972 } |
|
973 } else { |
|
974 if ((referenceDate < QDate::currentDate()) |
|
975 || (referenceDate == QDate::currentDate() |
|
976 && (mEditedEntry->startTime().time() < QTime::currentTime()))) |
|
977 { |
|
978 mReminderField->setReminderOff(); |
|
979 } else { |
|
980 // Enabled implies future. If changing from future to future do not |
|
981 // do anything. |
|
982 if (!mReminderField->isReminderFieldEnabled()) { |
|
983 mReminderField->setReminderChoices(); |
|
984 } |
|
985 } |
|
986 } |
938 } |
987 } |
939 |
988 |
940 /*! |
989 /*! |
941 Save the changed end time of the event. |
990 Save the changed end time of the event. |
942 */ |
991 */ |
943 void CalenEditorPrivate::saveToDateTime(QDateTime& toDateTime) |
992 void CalenEditorPrivate::saveToDateTime(QDateTime& toDateTime) |
944 { |
993 { |
945 QDateTime startTime = mEditedEntry->startTime(); |
994 QDateTime startTime = mEditedEntry->startTime(); |
|
995 bool fromDateChanged = false; |
946 // Update the start time accordingly on UI - duration will be 60 mins |
996 // Update the start time accordingly on UI - duration will be 60 mins |
947 // bydefault for new entry and if it crosses the starttime |
997 // bydefault for new entry and if it crosses the starttime |
948 if (mNewEntry && toDateTime < startTime) { |
998 if (mNewEntry && toDateTime < startTime) { |
949 startTime = toDateTime.addSecs(-3600); |
999 startTime = toDateTime.addSecs(-3600); |
950 } else { // for exisitng entry |
1000 fromDateChanged = true; |
|
1001 } else { |
|
1002 // for exisitng entry |
951 // we need to see if user has moved end time before the start time |
1003 // we need to see if user has moved end time before the start time |
952 // then substract the duration of the meeting that was saved earlier to |
1004 // then substract the duration of the meeting that was saved earlier to |
953 // the new end time to get the new start time |
1005 // the new end time to get the new start time |
954 if (toDateTime < startTime) { |
1006 if (toDateTime < startTime) { |
955 int duration = mEditedEntry->durationInSecs(); |
1007 int duration = mEditedEntry->durationInSecs(); |
956 startTime = toDateTime.addSecs(-duration); |
1008 startTime = toDateTime.addSecs(-duration); |
|
1009 fromDateChanged = true; |
957 } |
1010 } |
958 } |
1011 } |
959 // Set the new start time to the form |
1012 // Set the new start time to the form |
960 if (mViewFromItem) { |
1013 if (mViewFromItem) { |
961 mViewFromItem->populateDateTime(startTime, true); |
1014 mViewFromItem->populateDateTime(startTime, true); |
966 |
1019 |
967 if (mEditRange == ThisAndAll) { |
1020 if (mEditRange == ThisAndAll) { |
968 // update the repeat choices depending on the meeting duration |
1021 // update the repeat choices depending on the meeting duration |
969 mRepeatField->updateRepeatChoices(); |
1022 mRepeatField->updateRepeatChoices(); |
970 } |
1023 } |
|
1024 |
|
1025 // Update reminder choices if start time got changed. |
|
1026 if (fromDateChanged) { |
|
1027 updateReminderChoices(); |
|
1028 } |
971 } |
1029 } |
972 |
1030 |
973 /*! |
1031 /*! |
974 Populates the repeat item. |
1032 Populates the repeat item. |
975 */ |
1033 */ |
976 void CalenEditorPrivate::populateRepeatItem() |
1034 void CalenEditorPrivate::populateRepeatItem() |
977 { |
1035 { |
978 // Check if all day has been added or not |
1036 // Check if all day has been added or not |
979 // and calculate the index accordingly |
1037 // and calculate the index accordingly |
|
1038 // all day added implies reminder time field is also added |
980 int index; |
1039 int index; |
981 if (mIsAllDayItemAdded) { |
1040 if (mIsAllDayItemAdded && !isReminderTimeForAllDayAdded()) { |
|
1041 index = RepeatItem - 1; |
|
1042 } else if (!mNewEntry && isReminderTimeForAllDayAdded()) { |
982 index = RepeatItem; |
1043 index = RepeatItem; |
983 } else { |
1044 } else { |
984 index = RepeatItem - 1; |
1045 index = RepeatItem - 2; |
985 } |
1046 } |
986 |
1047 |
987 mRepeatField->populateRepeatItem(index); |
1048 mRepeatField->populateRepeatItem(index); |
988 } |
1049 } |
989 |
1050 |
1094 QTime tempEndQTime = tempEndTime.time(); |
1155 QTime tempEndQTime = tempEndTime.time(); |
1095 tempEndQTime.setHMS(23, 59, 59); |
1156 tempEndQTime.setHMS(23, 59, 59); |
1096 tempEndTime.setTime(tempEndQTime); |
1157 tempEndTime.setTime(tempEndQTime); |
1097 |
1158 |
1098 enableFromTotimeFileds(false, tempSartTime, tempEndTime); |
1159 enableFromTotimeFileds(false, tempSartTime, tempEndTime); |
|
1160 QDate referenceDate; |
|
1161 if (mRepeatField->isRepeatUntilItemAdded()) { |
|
1162 referenceDate = mRepeatField->repeatUntilDate(); |
|
1163 } else { |
|
1164 referenceDate = mEditedEntry->startTime().date(); |
|
1165 } |
|
1166 mReminderField->updateReminderChoicesForAllDay(referenceDate); |
|
1167 // If the reminder field is enabled and it is not off |
|
1168 // it implies default alarm day and time is being displayed. |
|
1169 if (mReminderField->isReminderFieldEnabled() && |
|
1170 mReminderField->currentReminderIndex() != 0) { |
|
1171 // Set the default alarm for all day. |
|
1172 mReminderField->setDefaultAlarmForAllDay(); |
|
1173 } else { |
|
1174 // Remove reminder time field. |
|
1175 mReminderField->removeReminderTimeField(); |
|
1176 } |
1099 } else { |
1177 } else { |
1100 // AllDayCheckBox in un-checked |
1178 // AllDayCheckBox in un-checked |
1101 // Set From/To times buttons editable |
1179 // Set From/To times buttons editable |
1102 // Update Start/End Times with Edited entry values |
1180 // Update Start/End Times with Edited entry values |
1103 enableFromTotimeFileds(true, mEditedEntry->startTime(), |
1181 enableFromTotimeFileds(true, mEditedEntry->startTime(), |
1104 mEditedEntry->endTime()); |
1182 mEditedEntry->endTime()); |
1105 |
1183 int index; |
|
1184 if (mIsAllDayItemAdded) { |
|
1185 index = ReminderTimeForAllDayItem; |
|
1186 } else { |
|
1187 index = ReminderTimeForAllDayItem - 1; |
|
1188 } |
|
1189 mReminderField->removeReminderTimeField(); |
|
1190 mReminderField->setReminderChoices(); |
|
1191 updateReminderChoices(); |
1106 } |
1192 } |
1107 addDiscardAction(); |
1193 addDiscardAction(); |
1108 } |
1194 } |
1109 |
1195 |
1110 /*! |
1196 /*! |
1223 text.append(hbTrId("txt_calendar_info_delete_anniversary")); |
1306 text.append(hbTrId("txt_calendar_info_delete_anniversary")); |
1224 break; |
1307 break; |
1225 } |
1308 } |
1226 } |
1309 } |
1227 |
1310 |
1228 popup.setText(text); |
1311 popup->setText(text); |
1229 |
1312 |
1230 popup.setPrimaryAction(new HbAction(hbTrId("txt_calendar_button_delete"), |
1313 QList<QAction*> list = popup->actions(); |
1231 &popup)); |
1314 for(int i=0; i < list.count(); i++) |
1232 popup.setSecondaryAction(new HbAction(hbTrId("txt_calendar_button_cancel"), |
1315 { |
1233 &popup)); |
1316 popup->removeAction(list[i]); |
1234 HbAction *selected = popup.exec(); |
1317 } |
1235 if (selected == popup.primaryAction()) { |
1318 HbAction *deleteAction = new HbAction(hbTrId("txt_calendar_button_delete"), |
1236 retStatus = 1; |
1319 popup); |
1237 } |
1320 popup->addAction(deleteAction); |
1238 |
1321 connect(deleteAction, SIGNAL(triggered()), this, |
1239 return retStatus; |
1322 SLOT(handleDeleteAction())); |
|
1323 HbAction *cancelAction = new HbAction(hbTrId("txt_calendar_button_cancel"), |
|
1324 popup); |
|
1325 // Editor should not be closed for all the cases when cancel is pressed |
|
1326 if(closeEditor) { |
|
1327 connect(cancelAction, SIGNAL(triggered()), this, |
|
1328 SLOT(closeEditor())); |
|
1329 } |
|
1330 popup->addAction(cancelAction); |
|
1331 popup->open(); |
1240 } |
1332 } |
1241 |
1333 |
1242 /*! |
1334 /*! |
1243 Returns true if the entry is a child ,else false. |
1335 Returns true if the entry is a child ,else false. |
1244 \return true if the entry is a child, false otherwise. |
1336 \return true if the entry is a child, false otherwise. |
1339 Delete the entry |
1431 Delete the entry |
1340 @param closeEditor set true to close editor else default value is false |
1432 @param closeEditor set true to close editor else default value is false |
1341 */ |
1433 */ |
1342 void CalenEditorPrivate::deleteEntry(bool close) |
1434 void CalenEditorPrivate::deleteEntry(bool close) |
1343 { |
1435 { |
1344 |
|
1345 // if editor is launched from Notes then don't delete entry |
1436 // if editor is launched from Notes then don't delete entry |
1346 // Just exit from calendar editor |
1437 // Just exit from calendar editor |
1347 if (mOriginalEntry->id() > 0) { |
1438 if (mOriginalEntry->id() > 0) { |
1348 |
|
1349 // If user is editing single instanc then delete single instance |
1439 // If user is editing single instanc then delete single instance |
1350 // else delete entry |
1440 // else delete entry |
1351 if (showDeleteConfirmationQuery()) { |
1441 if (mEditRange == ThisOnly) { |
1352 if (mEditRange == ThisOnly) { |
1442 // User wants to delete only this occurence |
1353 // User wants to delete only this occurence |
1443 mAgendaUtil->deleteRepeatedEntry(*mOriginalEntry, |
1354 mAgendaUtil->deleteRepeatedEntry(*mOriginalEntry, |
1444 AgendaUtil::ThisOnly); |
1355 AgendaUtil::ThisOnly); |
1445 } else { |
1356 } else { |
1446 // Delete the entry. |
1357 // Delete the entry. |
1447 mAgendaUtil->deleteEntry(mOriginalEntry->id()); |
1358 mAgendaUtil->deleteEntry(mOriginalEntry->id()); |
1448 } |
1359 } |
1449 |
1360 |
1450 if (close) { |
1361 if (close) { |
1451 closeEditor(); |
1362 closeEditor(); |
|
1363 } |
|
1364 } |
1452 } |
1365 } |
1453 } |
1366 } |
1454 } |
1367 |
1455 |
1368 /*! |
1456 /*! |
1460 */ |
1548 */ |
1461 HbDataFormModelItem* CalenEditorPrivate::allDayCheckBoxItem() |
1549 HbDataFormModelItem* CalenEditorPrivate::allDayCheckBoxItem() |
1462 { |
1550 { |
1463 return mAllDayCheckBoxItem; |
1551 return mAllDayCheckBoxItem; |
1464 } |
1552 } |
|
1553 |
|
1554 /*! |
|
1555 Checks if all day item is added and if selected implies reminder time is added. |
|
1556 When editing single occurence irrespective of type of the event |
|
1557 the all day item is not shown. |
|
1558 Used to calculate the index of other items which are dependant on this. |
|
1559 */ |
|
1560 bool CalenEditorPrivate::isReminderTimeForAllDayAdded() |
|
1561 { |
|
1562 return mReminderField->isReminderTimeForAllDayAdded(); |
|
1563 } |
|
1564 |
|
1565 /*! |
|
1566 Checks if it is an all day event or not. |
|
1567 */ |
|
1568 bool CalenEditorPrivate::isAllDayEvent() |
|
1569 { |
|
1570 if (mAllDayCheckBoxItem) { |
|
1571 return (mAllDayCheckBoxItem->contentWidgetData("checkState") |
|
1572 == Qt::Checked)? true:false; |
|
1573 } else if (!mNewEntry && mEditedEntry->type() == AgendaEntry::TypeEvent) { |
|
1574 // If editing single occurence then all day item not shown but still it |
|
1575 // is an all day event.. |
|
1576 return true;; |
|
1577 } else { |
|
1578 return false; |
|
1579 } |
|
1580 } |
|
1581 |
|
1582 /*! |
|
1583 Returns the current index of the reminder field. |
|
1584 */ |
|
1585 int CalenEditorPrivate::currentIndexOfReminderField() |
|
1586 { |
|
1587 return mReminderField->currentReminderIndex(); |
|
1588 } |
|
1589 |
|
1590 /*! |
|
1591 Sets the index. |
|
1592 /param index indicates the index value to be set. |
|
1593 */ |
|
1594 void CalenEditorPrivate::setCurrentIndexOfReminderField(int index) |
|
1595 { |
|
1596 mReminderField->setCurrentIndex(index); |
|
1597 } |
|
1598 |
|
1599 /*! |
|
1600 Sets the reminder choices for a non all day event. |
|
1601 */ |
|
1602 void CalenEditorPrivate::setReminderChoices() |
|
1603 { |
|
1604 mReminderField->setReminderChoices(); |
|
1605 } |
|
1606 |
|
1607 /*! |
|
1608 Checks if editing all occurences or a single occurence. |
|
1609 */ |
|
1610 bool CalenEditorPrivate::isEditRangeThisOnly() |
|
1611 { |
|
1612 return (mEditRange == ThisOnly); |
|
1613 } |
|
1614 |
|
1615 /*! |
|
1616 Checks if all day field is added. |
|
1617 */ |
|
1618 bool CalenEditorPrivate::isAllDayFieldAdded() |
|
1619 { |
|
1620 return mIsAllDayItemAdded; |
|
1621 } |
|
1622 |
1465 // End of file --Don't remove this. |
1623 // End of file --Don't remove this. |