348 saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar")); |
366 saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar")); |
349 connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry())); |
367 connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry())); |
350 toolBar->addAction(saveAction); |
368 toolBar->addAction(saveAction); |
351 } |
369 } |
352 |
370 |
|
371 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDTOOLBARITEM_EXIT ); |
353 } |
372 } |
354 |
373 |
355 /*! |
374 /*! |
356 Add the groupbox data depends up on entry type |
375 Add the groupbox data depends up on entry type |
357 */ |
376 */ |
358 void AgendaEventView::addGroupBoxData() |
377 void AgendaEventView::addGroupBoxData() |
359 { |
378 { |
|
379 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDGROUPBOXDATA_ENTRY ); |
360 |
380 |
361 HbGroupBox *groupBox = qobject_cast<HbGroupBox *> ( |
381 HbGroupBox *groupBox = qobject_cast<HbGroupBox *> ( |
362 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX)); |
382 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX)); |
363 |
383 |
364 AgendaEntry::Type entryType = mAgendaEntry.type(); |
384 AgendaEntry::Type entryType = mAgendaEntry.type(); |
365 if (entryType == AgendaEntry::TypeTodo) { |
385 if (entryType == AgendaEntry::TypeTodo) { |
366 groupBox->setHeading(hbTrId("txt_calendar_subhead_to_do")); |
386 groupBox->setHeading(hbTrId("txt_calendar_subhead_to_do")); |
|
387 } else if (CalenAgendaUtils::isAlldayEvent(mAgendaEntry)) { |
|
388 groupBox->setHeading(hbTrId("txt_calendar_subhead_all_day_event")); |
367 } else if (entryType == AgendaEntry::TypeAppoinment) { |
389 } else if (entryType == AgendaEntry::TypeAppoinment) { |
368 groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting")); |
390 groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting")); |
369 }else if (entryType == AgendaEntry::TypeEvent) { |
391 } |
370 //TODO: Add text id once available |
|
371 groupBox->setHeading(hbTrId("All day event")); |
|
372 } |
|
373 |
392 |
|
393 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDGROUPBOXDATA_EXIT ); |
374 } |
394 } |
375 |
395 |
376 /*! |
396 /*! |
377 Add subject and priority data to Event viewer |
397 Add subject and priority data to Event viewer |
378 */ |
398 */ |
379 void AgendaEventView::addSubjectAndPriorityData() |
399 void AgendaEventView::addSubjectAndPriorityData() |
380 { |
400 { |
|
401 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDSUBJECTANDPRIORITYDATA_ENTRY ); |
381 |
402 |
382 QStringList itemList; |
403 QStringList itemList; |
383 itemList.append(hbTrId("txt_calendar_dblist_subject")); |
404 itemList.append(hbTrId("txt_calendar_dblist_subject")); |
384 if (mAgendaEntry.summary().isEmpty()) { |
405 if (mAgendaEntry.summary().isEmpty()) { |
385 itemList.append(hbTrId("txt_calendar_dblist_val_unnamed")); |
406 itemList.append(hbTrId("txt_calendar_dblist_val_unnamed")); |
429 QString startDateText; |
452 QString startDateText; |
430 QString dateTimeText; |
453 QString dateTimeText; |
431 QString data; |
454 QString data; |
432 |
455 |
433 // Add agenda entry specific fields to the viewer |
456 // Add agenda entry specific fields to the viewer |
|
457 |
434 switch (mAgendaEntry.type()) { |
458 switch (mAgendaEntry.type()) { |
435 case AgendaEntry::TypeAppoinment: |
459 case AgendaEntry::TypeAppoinment: |
436 |
460 case AgendaEntry::TypeEvent: |
437 startTimeText.append(systemLocale.format( |
461 // Check if entry is an all-day |
438 startDateTime.time(), r_qtn_time_usual_with_zero)); |
462 if (CalenAgendaUtils::isAlldayEvent(mAgendaEntry)) { |
439 |
463 dateTimeText.append(systemLocale.format(startDateTime.date(), |
440 endTimeText.append(systemLocale.format(endDateTime.time(), |
464 r_qtn_date_usual_with_zero)); |
441 r_qtn_time_usual_with_zero)); |
465 if (CalenDateUtils::onSameDay(startDateTime, endDateTime.addSecs(-60))) { |
442 startDateText.append( |
466 data.append(dateTimeText); |
443 systemLocale.format(startDateTime.date(), |
467 } else { |
444 r_qtn_date_usual_with_zero)); |
468 QString endDate; |
445 if (CalenDateUtils::onSameDay(startDateTime, endDateTime)) { |
469 endDate.append( |
446 data.append(hbTrId("txt_calendar_dblist_start_end_time").arg( |
470 systemLocale.format(endDateTime.addSecs(-60).date(), |
447 startTimeText).arg(endTimeText)); |
471 r_qtn_date_usual_with_zero)); |
448 data.append(CHARACTER_SPACE); |
472 data.append(dateTimeText); |
449 data.append(hbTrId("txt_calendar_dblist_meeting_date").arg( |
473 data.append(" - "); |
450 startDateText)); |
474 data.append(endDate); |
451 } else { |
475 } |
452 data.append(hbTrId("txt_calendar_dblist_start_time_date").arg( |
476 } else { |
453 startTimeText).arg(startDateText)); |
477 startTimeText.append(systemLocale.format( |
454 QString endDateText; |
478 startDateTime.time(), r_qtn_time_usual_with_zero)); |
455 endDateText.append( |
479 |
456 systemLocale.format(endDateTime.date(), |
480 endTimeText.append(systemLocale.format(endDateTime.time(), |
457 r_qtn_date_usual_with_zero)); |
481 r_qtn_time_usual_with_zero)); |
458 data.append(hbTrId("txt_calendar_dblist_end_time_date").arg( |
482 startDateText.append( |
459 endTimeText).arg(endDateText)); |
483 systemLocale.format(startDateTime.date(), |
460 } |
484 r_qtn_date_usual_with_zero)); |
|
485 if (CalenDateUtils::onSameDay(startDateTime, endDateTime)) { |
|
486 data.append(startTimeText); |
|
487 data.append(CHARACTER_HYPHEN); |
|
488 data.append(endTimeText); |
|
489 data.append(CHARACTER_SPACE); |
|
490 data.append(startDateText); |
|
491 } else { |
|
492 // If both start and end time of a meeting are on different dates |
|
493 data.append(startTimeText); |
|
494 data.append(CHARACTER_SPACE); |
|
495 data.append(startDateText); |
|
496 QString endDateText; |
|
497 endDateText.append( |
|
498 systemLocale.format(endDateTime.date(), |
|
499 r_qtn_date_usual_with_zero)); |
|
500 data.append(CHARACTER_HYPHEN); |
|
501 data.append(endTimeText); |
|
502 data.append(CHARACTER_SPACE); |
|
503 data.append(endDateText); |
|
504 } |
|
505 } |
461 break; |
506 break; |
462 case AgendaEntry::TypeAnniversary: |
507 case AgendaEntry::TypeAnniversary: |
463 case AgendaEntry::TypeTodo: |
508 case AgendaEntry::TypeTodo: |
464 dateTimeText.append(systemLocale.format(endDateTime.date(), |
509 dateTimeText.append(systemLocale.format(endDateTime.date(), |
465 r_qtn_date_usual_with_zero)); |
510 r_qtn_date_usual_with_zero)); |
466 data.append(hbTrId( |
511 data.append(dateTimeText); |
467 "txt_calendar_dblist_meeting_date").arg(dateTimeText)); |
|
468 break; |
|
469 case AgendaEntry::TypeEvent: |
|
470 |
|
471 dateTimeText.append(systemLocale.format(startDateTime.date(), |
|
472 r_qtn_date_usual_with_zero)); |
|
473 if (CalenDateUtils::onSameDay(startDateTime, endDateTime.addSecs(-60))) { |
|
474 data.append(hbTrId("txt_calendar_dblist_meeting_date").arg( |
|
475 dateTimeText)); |
|
476 } else { |
|
477 QString endDate; |
|
478 endDate.append( |
|
479 systemLocale.format(endDateTime.addSecs(-60).date(), |
|
480 r_qtn_date_usual_with_zero)); |
|
481 data.append(hbTrId("txt_calendar_dblist_start_end_time").arg( |
|
482 dateTimeText).arg(endDate)); |
|
483 } |
|
484 break; |
512 break; |
485 default: |
513 default: |
486 break; |
514 break; |
487 } |
515 } |
488 itemData.append(data); |
516 itemData.append(data); |
489 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
517 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
490 |
518 |
|
519 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDDATETIMEDATA_EXIT ); |
491 } |
520 } |
492 |
521 |
493 /*! |
522 /*! |
494 Add location data to Event viewer |
523 Add location data to Event viewer |
495 */ |
524 */ |
496 void AgendaEventView::addLocationData() |
525 void AgendaEventView::addLocationData() |
497 { |
526 { |
|
527 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDLOCATIONDATA_ENTRY ); |
498 QStringList itemData; |
528 QStringList itemData; |
499 QString progressIcon(QString::null); |
529 QString progressIcon(QString::null); |
500 if ( mLocationFeatureEnabled ) { |
530 if ( mLocationFeatureEnabled ) { |
501 getProgressIndicatorstatus(progressIcon); |
531 getProgressIndicatorstatus(progressIcon); |
502 } |
532 } |
503 if( progressIcon.isNull() ) { |
533 if( progressIcon.isNull() ) { |
504 itemData.append(QString::null); |
534 itemData.append(QString::null); |
505 itemData.append(QString::null); |
535 itemData.append(QString::null); |
506 itemData.append("qtg_small_location"); |
536 itemData.append("qtg_small_location"); |
515 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
545 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
516 itemData.clear(); |
546 itemData.clear(); |
517 itemData.append(QString::null); |
547 itemData.append(QString::null); |
518 itemData.append(mAgendaEntry.location()); |
548 itemData.append(mAgendaEntry.location()); |
519 mLocationWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
549 mLocationWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
|
550 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDLOCATIONDATA_EXIT ); |
520 } |
551 } |
521 |
552 |
522 /*! |
553 /*! |
523 Add maptile image to Event viewer |
554 Add maptile image to Event viewer |
524 */ |
555 */ |
525 void AgendaEventView::addMapTileImage() |
556 void AgendaEventView::addMapTileImage() |
526 { |
557 { |
|
558 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDMAPTILEIMAGE_ENTRY ); |
527 if (mLocationFeatureEnabled && !mAgendaEntry.location().isEmpty() && !mMaptilePath.isEmpty()) { |
559 if (mLocationFeatureEnabled && !mAgendaEntry.location().isEmpty() && !mMaptilePath.isEmpty()) { |
528 |
560 |
529 HbIcon maptile(mMaptilePath); |
561 HbIcon maptile(mMaptilePath); |
530 mMaptileLabel->setIcon(maptile); |
562 mMaptileLabel->setIcon(maptile); |
531 mMaptileLabel->setPreferredSize(QSizeF(maptile.width(), maptile.height())); |
563 //get the margin size |
532 } |
564 qreal left, bottom; |
|
565 mMaptileLabel->getContentsMargins( &left, 0, 0, &bottom ); |
|
566 mMaptileLabel->setPreferredSize( |
|
567 QSizeF( maptile.width() + left, maptile.height() + bottom ) ); |
|
568 } |
|
569 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDMAPTILEIMAGE_EXIT ); |
533 } |
570 } |
534 /*! |
571 /*! |
535 Add reminder data to Event viewer |
572 Add reminder data to Event viewer |
536 */ |
573 */ |
537 void AgendaEventView::addReminderData() |
574 void AgendaEventView::addReminderData() |
538 { |
575 { |
|
576 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDREMINDERDATA_ENTRY ); |
539 QStringList itemData; |
577 QStringList itemData; |
540 itemData.append(QString::null); |
578 itemData.append(QString::null); |
541 itemData.append(QString::null); |
579 itemData.append(QString::null); |
542 itemData.append("qtg_small_reminder"); |
580 itemData.append("qtg_small_reminder"); |
543 mReminderWidget->setProperty(primaryLeftIconItem, false); |
581 mReminderWidget->setProperty(primaryLeftIconItem, false); |
544 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
582 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
545 itemData.clear(); |
583 itemData.clear(); |
546 itemData.append(QString::null); |
584 itemData.append(QString::null); |
547 itemData.append(alarmTimeText()); |
585 itemData.append(alarmTimeText()); |
548 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
586 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
549 } |
587 mReminderWidgetAdded = true; |
|
588 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDREMINDERDATA_EXIT ); |
|
589 } |
550 |
590 |
551 /*! |
591 /*! |
552 Add completed to-do data to Event viewer |
592 Add completed to-do data to Event viewer |
553 */ |
593 */ |
554 void AgendaEventView::addCompletedTodoData() |
594 void AgendaEventView::addCompletedTodoData() |
555 { |
595 { |
|
596 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDCOMPLETEDTODODATA_ENTRY ); |
556 QStringList itemData; |
597 QStringList itemData; |
557 QString completedText; |
598 QString completedText; |
558 HbExtendedLocale systemLocale = HbExtendedLocale::system();; |
599 HbExtendedLocale systemLocale = HbExtendedLocale::system();; |
559 itemData.append(QString::null); |
|
560 itemData.append(QString::null); |
600 itemData.append(QString::null); |
561 itemData.append(QString::null); |
601 itemData.append(QString::null); |
562 mReminderWidget->setProperty(primaryLeftIconItem, false); |
602 itemData.append(QString::null); |
|
603 mReminderWidget->setProperty(primaryLeftIconItem, true); |
563 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
604 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
564 itemData.clear(); |
605 itemData.clear(); |
565 completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(), |
606 completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(), |
566 r_qtn_date_usual_with_zero); |
607 r_qtn_date_usual_with_zero); |
567 itemData.append(hbTrId("txt_calendar_dblist_completed_date")); |
608 itemData.append(hbTrId("txt_calendar_dblist_completed_date")); |
568 itemData.append(completedText); |
609 itemData.append(completedText); |
569 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
610 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
|
611 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDCOMPLETEDTODODATA_EXIT ); |
570 } |
612 } |
571 |
613 |
572 /*! |
614 /*! |
573 Add repeat data to Event viewer |
615 Add repeat data to Event viewer |
574 */ |
616 */ |
575 void AgendaEventView::addRepeatData() |
617 void AgendaEventView::addRepeatData() |
576 { |
618 { |
|
619 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDREPEATDATA_ENTRY ); |
577 QStringList itemData; |
620 QStringList itemData; |
578 itemData.append(QString::null); |
621 itemData.append(QString::null); |
579 itemData.append(QString::null); |
622 itemData.append(QString::null); |
580 itemData.append("qtg_small_repeat"); |
623 if(!mAgendaEntry.recurrenceId().isNull()) { |
|
624 itemData.append("qtg_small_repeat_exception"); |
|
625 }else { |
|
626 itemData.append("qtg_small_repeat"); |
|
627 } |
581 mRepeatWidget->setProperty(primaryLeftIconItem, false); |
628 mRepeatWidget->setProperty(primaryLeftIconItem, false); |
582 mRepeatWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
629 mRepeatWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
583 itemData.clear(); |
630 itemData.clear(); |
584 itemData.append(QString::null); |
631 itemData.append(QString::null); |
585 itemData.append(repeatRule()); |
632 itemData.append(repeatRule()); |
586 mRepeatWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
633 mRepeatWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
|
634 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDREPEATDATA_EXIT ); |
587 } |
635 } |
588 |
636 |
589 /*! |
637 /*! |
590 Add description data to Event viewer |
638 Add description data to Event viewer |
591 */ |
639 */ |
592 void AgendaEventView::addDescriptionData() |
640 void AgendaEventView::addDescriptionData() |
593 { |
641 { |
|
642 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDDESCRIPTIONDATA_ENTRY ); |
594 QStringList itemData; |
643 QStringList itemData; |
595 itemData.append(QString::null); |
644 itemData.append(QString::null); |
596 itemData.append(QString::null); |
645 itemData.append(QString::null); |
597 itemData.append(QString::null); |
646 itemData.append(QString::null); |
598 mDescriptionWidget->setProperty(primaryLeftIconItem, false); |
647 mDescriptionWidget->setProperty(primaryLeftIconItem, true); |
599 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
648 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
600 itemData.clear(); |
649 itemData.clear(); |
601 itemData.append(hbTrId("txt_calendar_dblist_description")); |
650 itemData.append(hbTrId("txt_calendar_dblist_description")); |
602 itemData.append(mAgendaEntry.description()); |
651 itemData.append(mAgendaEntry.description()); |
603 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
652 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
|
653 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDDESCRIPTIONDATA_EXIT ); |
604 } |
654 } |
605 |
655 |
606 /*! |
656 /*! |
607 Returns priority icon |
657 Returns priority icon |
608 */ |
658 */ |
609 void AgendaEventView::getPriorityIcon(int priority, QString &priorityIcon) |
659 void AgendaEventView::getPriorityIcon(int priority, QString &priorityIcon) |
610 { |
660 { |
|
661 OstTraceFunctionEntry0( AGENDAEVENTVIEW_GETPRIORITYICON_ENTRY ); |
611 |
662 |
612 switch(priority) { |
663 switch(priority) { |
613 case 1:priorityIcon.append("qtg_small_priority_high"); |
664 case 1:priorityIcon.append("qtg_small_priority_high"); |
614 break; |
665 break; |
615 case 3:priorityIcon.append("qtg_small_priority_low"); |
666 case 3:priorityIcon.append("qtg_small_priority_low"); |
616 break; |
667 break; |
617 default: |
668 default: |
618 break; |
669 break; |
619 } |
670 } |
620 |
671 |
|
672 OstTraceFunctionExit0( AGENDAEVENTVIEW_GETPRIORITYICON_EXIT ); |
621 } |
673 } |
622 |
674 |
623 /*! |
675 /*! |
624 Returns repeat rule |
676 Returns repeat rule |
625 */ |
677 */ |
626 QString AgendaEventView::repeatRule() const |
678 QString AgendaEventView::repeatRule() |
627 { |
679 { |
|
680 OstTraceFunctionEntry0( AGENDAEVENTVIEW_REPEATRULE_ENTRY ); |
628 |
681 |
629 QString repeatRule; |
682 QString repeatRule; |
630 AgendaRepeatRule agendaRepeatRule = mAgendaEntry.repeatRule(); |
683 AgendaRepeatRule agendaRepeatRule; |
|
684 if (mAgendaEntry.isRepeating()) { |
|
685 agendaRepeatRule = mAgendaEntry.repeatRule(); |
|
686 } else { |
|
687 if (!mAgendaEntry.recurrenceId().isNull()) { |
|
688 AgendaEntry parentEntry= mOwner->mAgendaUtil->parentEntry(mAgendaEntry); |
|
689 agendaRepeatRule = parentEntry.repeatRule(); |
|
690 } |
|
691 } |
|
692 |
631 if (agendaRepeatRule.type() != AgendaRepeatRule::InvalidRule) |
693 if (agendaRepeatRule.type() != AgendaRepeatRule::InvalidRule) |
632 { |
694 { |
633 switch (agendaRepeatRule.type()) { |
695 switch (agendaRepeatRule.type()) { |
634 case AgendaRepeatRule::DailyRule: |
696 case AgendaRepeatRule::DailyRule: |
635 repeatRule.append(hbTrId("txt_calendar_dblist_repeats_daily")); |
697 repeatRule.append(hbTrId("txt_calendar_dblist_repeats_daily")); |
636 break; |
698 break; |
637 case AgendaRepeatRule::WeeklyRule: |
699 case AgendaRepeatRule::WeeklyRule: |
638 if (AgendaUtil::isWorkdaysRepeatingEntry(agendaRepeatRule)) { |
700 if (AgendaUtil::isWorkdaysRepeatingEntry(agendaRepeatRule)) { |
639 repeatRule.append(hbTrId("txt_calendar_dblist_repeats_workdays")); |
701 repeatRule.append( |
|
702 hbTrId("txt_calendar_dblist_repeats_workdays")); |
640 } else { |
703 } else { |
641 if (agendaRepeatRule.interval() == 2) { |
704 if (agendaRepeatRule.interval() == 2) { |
642 repeatRule.append( |
705 repeatRule.append( |
643 hbTrId("txt_calendar_dblist_repeats_fortnightly")); |
706 hbTrId("txt_calendar_dblist_repeats_fortnightly")); |
644 } else { |
707 } else { |
692 |
757 |
693 int alarmTimeOffsetInMinutes = mAgendaEntry.alarm().timeOffset(); |
758 int alarmTimeOffsetInMinutes = mAgendaEntry.alarm().timeOffset(); |
694 alarmDateTime = startTime.addSecs(-alarmTimeOffsetInMinutes * 60); |
759 alarmDateTime = startTime.addSecs(-alarmTimeOffsetInMinutes * 60); |
695 |
760 |
696 HbExtendedLocale systemLocale = HbExtendedLocale::system(); |
761 HbExtendedLocale systemLocale = HbExtendedLocale::system(); |
697 alarmDateTimeText.append( |
762 alarmDateTimeText.append(systemLocale.format(alarmDateTime.time(), |
698 hbTrId("txt_calendar_list_reminder_time_date").arg( |
763 r_qtn_time_usual_with_zero)); |
699 systemLocale.format(alarmDateTime.time(), |
764 // Show the alarm date only if its not on the same day of the entry |
700 r_qtn_time_usual_with_zero)).arg( |
765 if (!CalenDateUtils::onSameDay(alarmDateTime, startTime)) { |
701 systemLocale.format(alarmDateTime.date(), |
766 alarmDateTimeText.append(CHARACTER_SPACE); |
702 r_qtn_date_usual_with_zero))); |
767 alarmDateTimeText.append(systemLocale.format(alarmDateTime.date(), |
703 } |
768 r_qtn_date_usual_with_zero)); |
704 |
769 } |
|
770 } |
|
771 |
|
772 OstTraceFunctionExit0( AGENDAEVENTVIEW_ALARMTIMETEXT_EXIT ); |
705 return alarmDateTimeText; |
773 return alarmDateTimeText; |
706 } |
774 } |
707 |
775 |
708 /*! |
776 /*! |
709 Remove unnecessary widget from layout. |
777 Remove unnecessary widget from layout. |
710 */ |
778 */ |
711 void AgendaEventView::removeWidget() |
779 void AgendaEventView::removeWidget() |
712 { |
780 { |
|
781 OstTraceFunctionEntry0( AGENDAEVENTVIEW_REMOVEWIDGET_ENTRY ); |
713 |
782 |
714 if (mAgendaEntry.location().isEmpty()) { |
783 if (mAgendaEntry.location().isEmpty()) { |
715 mLocationWidget->hide(); |
784 mLocationWidget->hide(); |
716 mLinearLayout->removeItem(mLocationWidget); |
785 mLinearLayout->removeItem(mLocationWidget); |
717 } |
786 } |
718 |
787 |
719 QFile file(mMaptilePath); |
788 QFile file(mMaptilePath); |
720 if ( !mLocationFeatureEnabled || !file.exists() |
789 if (!mLocationFeatureEnabled || !file.exists() |
721 || mAgendaEntry.location().isEmpty()){ |
790 || mAgendaEntry.location().isEmpty()) { |
722 //code added to hide and remove maptile image |
791 //code added to hide and remove maptile image |
723 mMaptileLabel->hide(); |
792 mMaptileLabel->hide(); |
724 mLinearLayout->removeItem(mMaptileLabel); |
793 mLinearLayout->removeItem(mMaptileLabel); |
725 } |
794 } |
726 file.close(); |
795 file.close(); |
727 |
796 |
750 } |
828 } |
751 |
829 |
752 mLinearLayout->invalidate(); |
830 mLinearLayout->invalidate(); |
753 mLinearLayout->activate(); |
831 mLinearLayout->activate(); |
754 |
832 |
755 } |
833 OstTraceFunctionExit0( AGENDAEVENTVIEW_REMOVEWIDGET_EXIT ); |
756 |
834 } |
757 /*! |
835 |
758 Update the completed to-do or reminder data to event viewer. |
836 /*! |
759 */ |
837 Update all the fields according to to-do status change.. |
760 void AgendaEventView::updateCompletedReminderData() |
838 */ |
761 { |
839 void AgendaEventView::updateFieldsforTodoStatus() |
|
840 { |
|
841 OstTraceFunctionEntry0( AGENDAEVENTVIEW_UPDATEFIELDSFORTODOSTATUS_ENTRY ); |
762 |
842 |
763 if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) { |
843 if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) { |
|
844 |
|
845 // For completed to-do due date and time should be removed. |
|
846 mDateTimeWidget->hide(); |
|
847 mLinearLayout->removeItem(mDateTimeWidget); |
|
848 |
|
849 // Fill the completed data information. |
764 addCompletedTodoData(); |
850 addCompletedTodoData(); |
|
851 |
|
852 // Add the completed date to thte viewer. |
765 if (!mReminderWidgetAdded) { |
853 if (!mReminderWidgetAdded) { |
766 mReminderWidget->show(); |
854 mReminderWidget->show(); |
767 mLinearLayout->insertItem(2, mReminderWidget); |
855 mLinearLayout->insertItem(2, mReminderWidget); |
768 mReminderWidgetAdded = true; |
856 mReminderWidgetAdded = true; |
769 } |
857 } |
770 |
858 |
771 } else { |
859 } else { |
|
860 // Add the date and time widget to the viewer. |
|
861 mDateTimeWidget->show(); |
|
862 mLinearLayout->insertItem(1, mDateTimeWidget); |
|
863 |
772 if (!mAgendaEntry.alarm().isNull()) { |
864 if (!mAgendaEntry.alarm().isNull()) { |
773 addReminderData(); |
865 addReminderData(); |
774 if (!mReminderWidgetAdded) { |
866 if (!mReminderWidgetAdded) { |
775 mReminderWidget->show(); |
867 mReminderWidget->show(); |
776 mLinearLayout->insertItem(2, mReminderWidget); |
868 mLinearLayout->insertItem(2, mReminderWidget); |
777 mReminderWidgetAdded = true; |
869 mReminderWidgetAdded = true; |
778 } |
870 } |
779 } else { |
871 } else { |
|
872 // Remove the completed date from the viewer. |
780 if (mReminderWidgetAdded) { |
873 if (mReminderWidgetAdded) { |
781 mReminderWidget->hide(); |
874 mReminderWidget->hide(); |
782 mLinearLayout->removeItem(mReminderWidget); |
875 mLinearLayout->removeItem(mReminderWidget); |
783 mReminderWidgetAdded = false; |
876 mReminderWidgetAdded = false; |
784 } |
877 } |
785 } |
878 } |
786 |
879 |
787 } |
880 } |
|
881 // The To-do icon changes according to the To-do status change. |
|
882 updateSubjectandPriorityData(); |
788 |
883 |
789 mLinearLayout->invalidate(); |
884 mLinearLayout->invalidate(); |
790 mLinearLayout->activate(); |
885 mLinearLayout->activate(); |
|
886 OstTraceFunctionExit0( AGENDAEVENTVIEW_UPDATEFIELDSFORTODOSTATUS_EXIT ); |
791 } |
887 } |
792 |
888 |
793 /*! |
889 /*! |
794 Remove all widgets from layout. |
890 Remove all widgets from layout. |
795 */ |
891 */ |
796 void AgendaEventView::removeAllWidgets() |
892 void AgendaEventView::removeAllWidgets() |
797 { |
893 { |
|
894 OstTraceFunctionEntry0( AGENDAEVENTVIEW_REMOVEALLWIDGETS_ENTRY ); |
798 |
895 |
799 for (int i = 2; i < mLinearLayout->count(); i++) { |
896 for (int i = 2; i < mLinearLayout->count(); i++) { |
800 mLinearLayout->removeAt(i); |
897 mLinearLayout->removeAt(i); |
801 } |
898 } |
802 mLinearLayout->invalidate(); |
899 mLinearLayout->invalidate(); |
803 mLinearLayout->activate(); |
900 mLinearLayout->activate(); |
804 |
901 |
|
902 OstTraceFunctionExit0( AGENDAEVENTVIEW_REMOVEALLWIDGETS_EXIT ); |
805 } |
903 } |
806 |
904 |
807 /*! |
905 /*! |
808 Add all widgets to layout. |
906 Add all widgets to layout. |
809 */ |
907 */ |
810 void AgendaEventView::addAllWidgets() |
908 void AgendaEventView::addAllWidgets() |
811 { |
909 { |
|
910 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDALLWIDGETS_ENTRY ); |
812 |
911 |
813 mLinearLayout->addItem(mLocationWidget); |
912 mLinearLayout->addItem(mLocationWidget); |
814 mLocationWidget->show(); |
913 mLocationWidget->show(); |
815 mLinearLayout->addItem(mMaptileLabel); |
914 mLinearLayout->addItem(mMaptileLabel); |
816 mMaptileLabel->show(); |
915 mMaptileLabel->show(); |
908 HbAction *deleteAction = |
1017 HbAction *deleteAction = |
909 new HbAction(hbTrId("txt_calendar_button_delete"), popup); |
1018 new HbAction(hbTrId("txt_calendar_button_delete"), popup); |
910 popup->addAction(deleteAction); |
1019 popup->addAction(deleteAction); |
911 connect(deleteAction, SIGNAL(triggered()), this , |
1020 connect(deleteAction, SIGNAL(triggered()), this , |
912 SLOT(handleDeleteAction())); |
1021 SLOT(handleDeleteAction())); |
913 popup->addAction(new HbAction(hbTrId("txt_calendar_button_cancel"), popup)); |
1022 popup->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popup)); |
914 popup->open(); |
1023 popup->open(); |
|
1024 OstTraceFunctionExit0( AGENDAEVENTVIEW_SHOWDELETECONFIRMATIONQUERY_EXIT ); |
915 } |
1025 } |
916 |
1026 |
917 /*! |
1027 /*! |
918 Handles the delete action |
1028 Handles the delete action |
919 */ |
1029 */ |
920 void AgendaEventView::handleDeleteAction() |
1030 void AgendaEventView::handleDeleteAction() |
921 { |
1031 { |
|
1032 OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEDELETEACTION_ENTRY ); |
922 // If delete button is pressed delete the entry |
1033 // If delete button is pressed delete the entry |
923 // To notify client that deleting Started |
1034 // To notify client that deleting Started |
924 // Calendar Application changing state from viewing to deleting. |
1035 // Calendar Application changing state from viewing to deleting. |
925 mOwner->deletingStarted(); |
1036 mOwner->deletingStarted(); |
926 |
1037 |
927 // Delete the entry. |
1038 // Delete the entry. |
928 mOwner->mAgendaUtil->deleteEntry(mAgendaEntry.id()); |
1039 mOwner->mAgendaUtil->deleteEntry(mAgendaEntry.id()); |
|
1040 OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEDELETEACTION_EXIT ); |
929 } |
1041 } |
930 |
1042 |
931 /*! |
1043 /*! |
932 Marks to-do entry as done or undone based on the completed value. |
1044 Marks to-do entry as done or undone based on the completed value. |
933 */ |
1045 */ |
934 void AgendaEventView::markTodoStatus() |
1046 void AgendaEventView::markTodoStatus() |
935 { |
1047 { |
|
1048 OstTraceFunctionEntry0( AGENDAEVENTVIEW_MARKTODOSTATUS_ENTRY ); |
936 |
1049 |
937 QDateTime currentDateTime = QDateTime::currentDateTime(); |
1050 QDateTime currentDateTime = QDateTime::currentDateTime(); |
938 |
1051 |
939 // Set the to-do status using the agenda util. |
1052 // Set the to-do status using the agenda util. |
940 if (AgendaEntry::TodoCompleted != mAgendaEntry.status()) { |
1053 if (AgendaEntry::TodoCompleted != mAgendaEntry.status()) { |
1017 showDeleteOccurencePopup(); |
1134 showDeleteOccurencePopup(); |
1018 } else { |
1135 } else { |
1019 showDeleteConfirmationQuery(); |
1136 showDeleteConfirmationQuery(); |
1020 } |
1137 } |
1021 |
1138 |
|
1139 OstTraceFunctionExit0( AGENDAEVENTVIEW_DELETEAGENDAENTRY_EXIT ); |
1022 } |
1140 } |
1023 |
1141 |
1024 /*! |
1142 /*! |
1025 Save the agenda entry to calendar db. |
1143 Save the agenda entry to calendar db. |
1026 */ |
1144 */ |
1027 void AgendaEventView::saveAgendaEntry() |
1145 void AgendaEventView::saveAgendaEntry() |
1028 { |
1146 { |
|
1147 OstTraceFunctionEntry0( AGENDAEVENTVIEW_SAVEAGENDAENTRY_ENTRY ); |
1029 |
1148 |
1030 // Save entry to calendar. |
1149 // Save entry to calendar. |
1031 mOwner->mAgendaUtil->addEntry(mAgendaEntry); |
1150 mOwner->mAgendaUtil->store(mAgendaEntry); |
1032 |
1151 |
1033 // Close the agenda entry viewer |
1152 // Close the agenda entry viewer |
1034 close(); |
1153 close(); |
|
1154 OstTraceFunctionExit0( AGENDAEVENTVIEW_SAVEAGENDAENTRY_EXIT ); |
1035 } |
1155 } |
1036 /*! |
1156 /*! |
1037 Closes the event viewer |
1157 Closes the event viewer |
1038 */ |
1158 */ |
1039 void AgendaEventView::close() |
1159 void AgendaEventView::close() |
1040 { |
1160 { |
|
1161 OstTraceFunctionEntry0( AGENDAEVENTVIEW_CLOSE_ENTRY ); |
1041 |
1162 |
1042 // Remove the view from main window. |
1163 // Remove the view from main window. |
1043 HbMainWindow *window = hbInstance->allMainWindows().first(); |
1164 HbMainWindow *window = hbInstance->allMainWindows().first(); |
1044 |
1165 |
1045 // Cleanup. |
1166 // Cleanup. |
1046 disconnect( |
1167 disconnect( |
1047 mBackAction, SIGNAL(triggered()), |
1168 mBackAction, SIGNAL(triggered()), |
1048 this, SLOT(close())); |
1169 this, SLOT(close())); |
1049 |
1170 |
1050 window->removeView(mViewer); |
1171 window->removeView(mViewer); |
|
1172 if (AgendaEntry::TypeTodo == mAgendaEntry.type()) { |
|
1173 mAgendaEntry.setStartAndEndTime( |
|
1174 CalenDateUtils::today(), CalenDateUtils::today()); |
|
1175 } |
1051 mOwner->viewingCompleted(mAgendaEntry.startTime().date()); |
1176 mOwner->viewingCompleted(mAgendaEntry.startTime().date()); |
1052 |
1177 |
|
1178 OstTraceFunctionExit0( AGENDAEVENTVIEW_CLOSE_EXIT ); |
1053 } |
1179 } |
1054 |
1180 |
1055 /*! |
1181 /*! |
1056 Handles entry updation of the event entry. |
1182 Handles entry updation of the event entry. |
1057 */ |
1183 */ |
1058 void AgendaEventView::handleEntryUpdation(ulong id) |
1184 void AgendaEventView::handleEntryUpdation(ulong id) |
1059 { |
1185 { |
|
1186 OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEENTRYUPDATION_ENTRY ); |
1060 |
1187 |
1061 AgendaEntry updatedEntry = mOwner->mAgendaUtil->fetchById(id); |
1188 AgendaEntry updatedEntry = mOwner->mAgendaUtil->fetchById(id); |
1062 |
1189 |
1063 // Agenda entry is not null then refresh the view else close event viewer |
1190 // Agenda entry is not null then refresh the view else close event viewer |
1064 if (!updatedEntry.isNull()) { |
1191 if (!updatedEntry.isNull()) { |
1065 |
1192 |
1066 mAgendaEntry = updatedEntry; |
1193 mAgendaEntry = updatedEntry; |
1067 |
1194 |
1068 if (updatedEntry.isRepeating() && mAgendaEntry.type() |
1195 // If the updated entry's & original entry's repeat rule mismatches than |
1069 != AgendaEntry::TypeTodo) { |
1196 // show the parent entry. |
|
1197 if (updatedEntry.isRepeating() && |
|
1198 mAgendaEntry.type() != AgendaEntry::TypeTodo && |
|
1199 mOriginalAgendaEntry.repeatRule() == |
|
1200 updatedEntry.repeatRule()) { |
1070 // if start date of original entry is between start date of updated |
1201 // if start date of original entry is between start date of updated |
1071 // entry and until date of updated entry then only update time. |
1202 // entry and until date of updated entry then only update time. |
1072 if (mOriginalAgendaEntry.startTime().date() |
1203 if (mOriginalAgendaEntry.startTime().date() |
1073 >= updatedEntry.startTime().date() |
1204 >= updatedEntry.startTime().date() |
1074 && mOriginalAgendaEntry.startTime().date() |
1205 && mOriginalAgendaEntry.startTime().date() |
1100 } else { |
1231 } else { |
1101 // Close the agenda entry viewer |
1232 // Close the agenda entry viewer |
1102 close(); |
1233 close(); |
1103 } |
1234 } |
1104 |
1235 |
|
1236 OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEENTRYUPDATION_EXIT ); |
1105 } |
1237 } |
1106 |
1238 |
1107 /*! |
1239 /*! |
1108 Handles the entry deletion of the agenda entry |
1240 Handles the entry deletion of the agenda entry |
1109 */ |
1241 */ |
1110 void AgendaEventView::handleEntryDeletion(ulong id) |
1242 void AgendaEventView::handleEntryDeletion(ulong id) |
1111 { |
1243 { |
|
1244 OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEENTRYDELETION_ENTRY ); |
1112 |
1245 |
1113 if (id == mAgendaEntry.id()) { |
1246 if (id == mAgendaEntry.id()) { |
1114 // Close the agenda entry viewer |
1247 // Close the agenda entry viewer |
1115 close(); |
1248 close(); |
1116 mOwner->deletingCompleted(); |
1249 mOwner->deletingCompleted(); |
1117 } |
1250 } |
1118 |
1251 |
|
1252 OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEENTRYDELETION_EXIT ); |
1119 } |
1253 } |
1120 |
1254 |
1121 /*! |
1255 /*! |
1122 Handles the Note Editor editing completion of the agenda entry |
1256 Handles the Note Editor editing completion of the agenda entry |
1123 */ |
1257 */ |
1124 void AgendaEventView::handleNoteEditorClosed(bool status) |
1258 void AgendaEventView::handleNoteEditorClosed(bool status) |
1125 { |
1259 { |
|
1260 OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLENOTEEDITORCLOSED_ENTRY ); |
1126 Q_UNUSED(status); |
1261 Q_UNUSED(status); |
1127 |
1262 |
1128 // To avoid loading the plugin again for editing, |
1263 // To avoid loading the plugin again for editing, |
1129 // Unload the plug-in while destruction. |
1264 // Unload the plug-in while destruction. |
1130 |
1265 |
1131 mOwner->editingCompleted(); |
1266 mOwner->editingCompleted(); |
1132 |
1267 |
|
1268 OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLENOTEEDITORCLOSED_EXIT ); |
1133 } |
1269 } |
1134 |
1270 |
1135 /*! |
1271 /*! |
1136 Handles the Note Editor editing completion of the agenda entry |
1272 Handles the Note Editor editing completion of the agenda entry |
1137 */ |
1273 */ |
1138 void AgendaEventView::handleCalendarEditorClosed() |
1274 void AgendaEventView::handleCalendarEditorClosed() |
1139 { |
1275 { |
|
1276 OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLECALENDAREDITORCLOSED_ENTRY ); |
1140 |
1277 |
1141 // Cleanup. |
1278 // Cleanup. |
1142 mCalenEditor->deleteLater(); |
1279 mCalenEditor->deleteLater(); |
1143 mOwner->editingCompleted(); |
1280 mOwner->editingCompleted(); |
1144 |
1281 |
|
1282 OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLECALENDAREDITORCLOSED_EXIT ); |
1145 } |
1283 } |
1146 |
1284 |
1147 /*! |
1285 /*! |
1148 Slot to handle User selection for series deleting or single occurence popup |
1286 Slot to handle User selection for series deleting or single occurence popup |
1149 */ |
1287 */ |
1150 void AgendaEventView::handleDeleteOccurence(int index) |
1288 void AgendaEventView::handleDeleteOccurence(int index) |
1151 { |
1289 { |
|
1290 OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEDELETEOCCURENCE_ENTRY ); |
1152 |
1291 |
1153 // To notify client that deleting Started |
1292 // To notify client that deleting Started |
1154 // Calendar Application changing state from viewing to deleting. |
1293 // Calendar Application changing state from viewing to deleting. |
1155 mOwner->deletingStarted(); |
1294 mOwner->deletingStarted(); |
1156 |
1295 |
1303 //no further need of this coonnection |
1455 //no further need of this coonnection |
1304 disconnect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int, |
1456 disconnect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int, |
1305 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
1457 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
1306 progressIcon.append(QString::null); |
1458 progressIcon.append(QString::null); |
1307 } |
1459 } |
1308 } |
1460 OstTraceFunctionExit0( AGENDAEVENTVIEW_GETPROGRESSINDICATORSTATUS_EXIT ); |
|
1461 } |
|
1462 |
|
1463 /*! |
|
1464 Updates the To-do icon for the changes in to-do status. |
|
1465 */ |
|
1466 void AgendaEventView::updateSubjectandPriorityData() |
|
1467 { |
|
1468 OstTraceFunctionEntry0( AGENDAEVENTVIEW_UPDATESUBJECTANDPRIORITYDATA_ENTRY ); |
|
1469 QStringList itemList; |
|
1470 QString priorityIcon(QString::null); |
|
1471 QString subjectIcon(QString::null); |
|
1472 getPriorityIcon(mAgendaEntry.priority(), priorityIcon); |
|
1473 getSubjectIcon(mAgendaEntry.type(),subjectIcon); |
|
1474 itemList.append(subjectIcon); |
|
1475 itemList.append(priorityIcon); |
|
1476 itemList.append(QString::null); |
|
1477 |
|
1478 mSubjectWidget->setEventViewerItemData(itemList, Qt::DecorationRole); |
|
1479 OstTraceFunctionExit0( AGENDAEVENTVIEW_UPDATESUBJECTANDPRIORITYDATA_EXIT ); |
|
1480 } |
|
1481 |
1309 /*! |
1482 /*! |
1310 Reload the maptile image on system orientation change. |
1483 Reload the maptile image on system orientation change. |
1311 */ |
1484 */ |
1312 void AgendaEventView::changedOrientation(Qt::Orientation orientation) |
1485 void AgendaEventView::changedOrientation(Qt::Orientation orientation) |
1313 { |
1486 { |
|
1487 OstTraceFunctionEntry0( AGENDAEVENTVIEW_CHANGEDORIENTATION_ENTRY ); |
1314 if (mMaptileStatus == MapTileService::MapTileFetchingCompleted) { |
1488 if (mMaptileStatus == MapTileService::MapTileFetchingCompleted) { |
1315 mMaptilePath.clear(); |
1489 mMaptilePath.clear(); |
1316 mMaptileService->getMapTileImage(mAgendaEntry.id(), MapTileService::AddressPlain, mMaptilePath,orientation); |
1490 mMaptileService->getMapTileImage(mAgendaEntry.id(), MapTileService::AddressPlain, mMaptilePath,orientation); |
1317 addMapTileImage(); |
1491 addMapTileImage(); |
1318 } |
1492 } |
|
1493 OstTraceFunctionExit0( AGENDAEVENTVIEW_CHANGEDORIENTATION_EXIT ); |
1319 } |
1494 } |
1320 |
1495 |
1321 // End of file |
1496 // End of file |