380 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX)); |
382 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX)); |
381 |
383 |
382 AgendaEntry::Type entryType = mAgendaEntry.type(); |
384 AgendaEntry::Type entryType = mAgendaEntry.type(); |
383 if (entryType == AgendaEntry::TypeTodo) { |
385 if (entryType == AgendaEntry::TypeTodo) { |
384 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")); |
385 } else if (entryType == AgendaEntry::TypeAppoinment) { |
389 } else if (entryType == AgendaEntry::TypeAppoinment) { |
386 groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting")); |
390 groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting")); |
387 }else if (entryType == AgendaEntry::TypeEvent) { |
391 } |
388 groupBox->setHeading(hbTrId("txt_calendar_subhead_all_day_event")); |
|
389 } |
|
390 |
392 |
391 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDGROUPBOXDATA_EXIT ); |
393 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDGROUPBOXDATA_EXIT ); |
392 } |
394 } |
393 |
395 |
394 /*! |
396 /*! |
450 QString startDateText; |
452 QString startDateText; |
451 QString dateTimeText; |
453 QString dateTimeText; |
452 QString data; |
454 QString data; |
453 |
455 |
454 // Add agenda entry specific fields to the viewer |
456 // Add agenda entry specific fields to the viewer |
|
457 |
455 switch (mAgendaEntry.type()) { |
458 switch (mAgendaEntry.type()) { |
456 case AgendaEntry::TypeAppoinment: |
459 case AgendaEntry::TypeAppoinment: |
457 |
460 case AgendaEntry::TypeEvent: |
458 startTimeText.append(systemLocale.format( |
461 // Check if entry is an all-day |
459 startDateTime.time(), r_qtn_time_usual_with_zero)); |
462 if (CalenAgendaUtils::isAlldayEvent(mAgendaEntry)) { |
460 |
463 dateTimeText.append(systemLocale.format(startDateTime.date(), |
461 endTimeText.append(systemLocale.format(endDateTime.time(), |
464 r_qtn_date_usual_with_zero)); |
462 r_qtn_time_usual_with_zero)); |
465 if (CalenDateUtils::onSameDay(startDateTime, endDateTime.addSecs(-60))) { |
463 startDateText.append( |
466 data.append(dateTimeText); |
464 systemLocale.format(startDateTime.date(), |
467 } else { |
465 r_qtn_date_usual_with_zero)); |
468 QString endDate; |
466 if (CalenDateUtils::onSameDay(startDateTime, endDateTime)) { |
469 endDate.append( |
467 data.append(startTimeText); |
470 systemLocale.format(endDateTime.addSecs(-60).date(), |
468 data.append(CHARACTER_HYPHEN); |
471 r_qtn_date_usual_with_zero)); |
469 data.append(endTimeText); |
472 data.append(dateTimeText); |
470 data.append(CHARACTER_SPACE); |
473 data.append(" - "); |
471 data.append(startDateText); |
474 data.append(endDate); |
472 } else { |
475 } |
473 // If both start and end time of a meeting are on different dates |
476 } else { |
474 data.append(startTimeText); |
477 startTimeText.append(systemLocale.format( |
475 data.append(CHARACTER_SPACE); |
478 startDateTime.time(), r_qtn_time_usual_with_zero)); |
476 data.append(startDateText); |
479 |
477 QString endDateText; |
480 endTimeText.append(systemLocale.format(endDateTime.time(), |
478 endDateText.append( |
481 r_qtn_time_usual_with_zero)); |
479 systemLocale.format(endDateTime.date(), |
482 startDateText.append( |
480 r_qtn_date_usual_with_zero)); |
483 systemLocale.format(startDateTime.date(), |
481 data.append(CHARACTER_HYPHEN); |
484 r_qtn_date_usual_with_zero)); |
482 data.append(endTimeText); |
485 if (CalenDateUtils::onSameDay(startDateTime, endDateTime)) { |
483 data.append(CHARACTER_SPACE); |
486 data.append(startTimeText); |
484 data.append(endDateText); |
487 data.append(CHARACTER_HYPHEN); |
485 } |
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 } |
486 break; |
506 break; |
487 case AgendaEntry::TypeAnniversary: |
507 case AgendaEntry::TypeAnniversary: |
488 case AgendaEntry::TypeTodo: |
508 case AgendaEntry::TypeTodo: |
489 dateTimeText.append(systemLocale.format(endDateTime.date(), |
509 dateTimeText.append(systemLocale.format(endDateTime.date(), |
490 r_qtn_date_usual_with_zero)); |
510 r_qtn_date_usual_with_zero)); |
491 data.append(dateTimeText); |
511 data.append(dateTimeText); |
492 break; |
512 break; |
493 case AgendaEntry::TypeEvent: |
|
494 |
|
495 dateTimeText.append(systemLocale.format(startDateTime.date(), |
|
496 r_qtn_date_usual_with_zero)); |
|
497 if (CalenDateUtils::onSameDay(startDateTime, endDateTime.addSecs(-60))) { |
|
498 data.append(dateTimeText); |
|
499 } else { |
|
500 QString endDate; |
|
501 endDate.append( |
|
502 systemLocale.format(endDateTime.addSecs(-60).date(), |
|
503 r_qtn_date_usual_with_zero)); |
|
504 data.append(dateTimeText); |
|
505 data.append(" - "); |
|
506 data.append(endDate); |
|
507 } |
|
508 break; |
|
509 default: |
513 default: |
510 break; |
514 break; |
511 } |
515 } |
512 itemData.append(data); |
516 itemData.append(data); |
513 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
517 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
578 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
582 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
579 itemData.clear(); |
583 itemData.clear(); |
580 itemData.append(QString::null); |
584 itemData.append(QString::null); |
581 itemData.append(alarmTimeText()); |
585 itemData.append(alarmTimeText()); |
582 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
586 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
583 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDREMINDERDATA_EXIT ); |
587 mReminderWidgetAdded = true; |
584 } |
588 OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDREMINDERDATA_EXIT ); |
|
589 } |
585 |
590 |
586 /*! |
591 /*! |
587 Add completed to-do data to Event viewer |
592 Add completed to-do data to Event viewer |
588 */ |
593 */ |
589 void AgendaEventView::addCompletedTodoData() |
594 void AgendaEventView::addCompletedTodoData() |
590 { |
595 { |
591 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDCOMPLETEDTODODATA_ENTRY ); |
596 OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDCOMPLETEDTODODATA_ENTRY ); |
592 QStringList itemData; |
597 QStringList itemData; |
593 QString completedText; |
598 QString completedText; |
594 HbExtendedLocale systemLocale = HbExtendedLocale::system();; |
599 HbExtendedLocale systemLocale = HbExtendedLocale::system();; |
595 itemData.append(QString::null); |
|
596 itemData.append(QString::null); |
600 itemData.append(QString::null); |
597 itemData.append(QString::null); |
601 itemData.append(QString::null); |
598 mReminderWidget->setProperty(primaryLeftIconItem, true); |
602 itemData.append(QString::null); |
|
603 mReminderWidget->setProperty(primaryLeftIconItem, true); |
599 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
604 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
600 itemData.clear(); |
605 itemData.clear(); |
601 completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(), |
606 completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(), |
602 r_qtn_date_usual_with_zero); |
607 r_qtn_date_usual_with_zero); |
603 itemData.append(hbTrId("txt_calendar_dblist_completed_date")); |
608 itemData.append(hbTrId("txt_calendar_dblist_completed_date")); |
801 mLinearLayout->removeItem(mReminderWidget); |
806 mLinearLayout->removeItem(mReminderWidget); |
802 mReminderWidgetAdded = false; |
807 mReminderWidgetAdded = false; |
803 } |
808 } |
804 } |
809 } |
805 |
810 |
|
811 // Check whether the entry is a completed To-do. if so then remove the |
|
812 // time and date widget. |
|
813 if (mAgendaEntry.type() == AgendaEntry::TypeTodo && |
|
814 AgendaEntry::TodoCompleted == mAgendaEntry.status()) { |
|
815 mDateTimeWidget->hide(); |
|
816 mLinearLayout->removeItem(mDateTimeWidget); |
|
817 } |
|
818 |
806 if ((mAgendaEntry.repeatRule().type() == AgendaRepeatRule::InvalidRule) && |
819 if ((mAgendaEntry.repeatRule().type() == AgendaRepeatRule::InvalidRule) && |
807 (mAgendaEntry.recurrenceId().isNull())) { |
820 (mAgendaEntry.recurrenceId().isNull())) { |
808 mRepeatWidget->hide(); |
821 mRepeatWidget->hide(); |
809 mLinearLayout->removeItem(mRepeatWidget); |
822 mLinearLayout->removeItem(mRepeatWidget); |
810 } |
823 } |
811 |
824 |
812 if (mAgendaEntry.description().isEmpty()) { |
825 if (mAgendaEntry.description().isEmpty()) { |
819 |
832 |
820 OstTraceFunctionExit0( AGENDAEVENTVIEW_REMOVEWIDGET_EXIT ); |
833 OstTraceFunctionExit0( AGENDAEVENTVIEW_REMOVEWIDGET_EXIT ); |
821 } |
834 } |
822 |
835 |
823 /*! |
836 /*! |
824 Update the completed to-do or reminder data to event viewer. |
837 Update all the fields according to to-do status change.. |
825 */ |
838 */ |
826 void AgendaEventView::updateCompletedReminderData() |
839 void AgendaEventView::updateFieldsforTodoStatus() |
827 { |
840 { |
828 OstTraceFunctionEntry0( AGENDAEVENTVIEW_UPDATECOMPLETEDREMINDERDATA_ENTRY ); |
841 OstTraceFunctionEntry0( AGENDAEVENTVIEW_UPDATEFIELDSFORTODOSTATUS_ENTRY ); |
829 |
842 |
830 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. |
831 addCompletedTodoData(); |
850 addCompletedTodoData(); |
|
851 |
|
852 // Add the completed date to thte viewer. |
832 if (!mReminderWidgetAdded) { |
853 if (!mReminderWidgetAdded) { |
833 mReminderWidget->show(); |
854 mReminderWidget->show(); |
834 mLinearLayout->insertItem(2, mReminderWidget); |
855 mLinearLayout->insertItem(2, mReminderWidget); |
835 mReminderWidgetAdded = true; |
856 mReminderWidgetAdded = true; |
836 } |
857 } |
837 |
858 |
838 } else { |
859 } else { |
|
860 // Add the date and time widget to the viewer. |
|
861 mDateTimeWidget->show(); |
|
862 mLinearLayout->insertItem(1, mDateTimeWidget); |
|
863 |
839 if (!mAgendaEntry.alarm().isNull()) { |
864 if (!mAgendaEntry.alarm().isNull()) { |
840 addReminderData(); |
865 addReminderData(); |
841 if (!mReminderWidgetAdded) { |
866 if (!mReminderWidgetAdded) { |
842 mReminderWidget->show(); |
867 mReminderWidget->show(); |
843 mLinearLayout->insertItem(2, mReminderWidget); |
868 mLinearLayout->insertItem(2, mReminderWidget); |
844 mReminderWidgetAdded = true; |
869 mReminderWidgetAdded = true; |
845 } |
870 } |
846 } else { |
871 } else { |
|
872 // Remove the completed date from the viewer. |
847 if (mReminderWidgetAdded) { |
873 if (mReminderWidgetAdded) { |
848 mReminderWidget->hide(); |
874 mReminderWidget->hide(); |
849 mLinearLayout->removeItem(mReminderWidget); |
875 mLinearLayout->removeItem(mReminderWidget); |
850 mReminderWidgetAdded = false; |
876 mReminderWidgetAdded = false; |
851 } |
877 } |
852 } |
878 } |
853 |
879 |
854 } |
880 } |
|
881 // The To-do icon changes according to the To-do status change. |
|
882 updateSubjectandPriorityData(); |
855 |
883 |
856 mLinearLayout->invalidate(); |
884 mLinearLayout->invalidate(); |
857 mLinearLayout->activate(); |
885 mLinearLayout->activate(); |
858 OstTraceFunctionExit0( AGENDAEVENTVIEW_UPDATECOMPLETEDREMINDERDATA_EXIT ); |
886 OstTraceFunctionExit0( AGENDAEVENTVIEW_UPDATEFIELDSFORTODOSTATUS_EXIT ); |
859 } |
887 } |
860 |
888 |
861 /*! |
889 /*! |
862 Remove all widgets from layout. |
890 Remove all widgets from layout. |
863 */ |
891 */ |
1282 void AgendaEventView::getSubjectIcon(AgendaEntry::Type type, QString &subjectIcon) |
1316 void AgendaEventView::getSubjectIcon(AgendaEntry::Type type, QString &subjectIcon) |
1283 { |
1317 { |
1284 OstTraceFunctionEntry0( AGENDAEVENTVIEW_GETSUBJECTICON_ENTRY ); |
1318 OstTraceFunctionEntry0( AGENDAEVENTVIEW_GETSUBJECTICON_ENTRY ); |
1285 switch(type) { |
1319 switch(type) { |
1286 case AgendaEntry::TypeAppoinment: |
1320 case AgendaEntry::TypeAppoinment: |
|
1321 case AgendaEntry::TypeEvent: |
1287 { |
1322 { |
1288 subjectIcon.append("qtg_small_meeting"); |
1323 // Check for all-day |
|
1324 if (CalenAgendaUtils::isAlldayEvent(mAgendaEntry)) { |
|
1325 subjectIcon.append("qtg_small_day"); |
|
1326 } else { |
|
1327 subjectIcon.append("qtg_small_meeting"); |
|
1328 } |
1289 } |
1329 } |
1290 break; |
1330 break; |
1291 case AgendaEntry::TypeTodo: |
1331 case AgendaEntry::TypeTodo: |
1292 { |
1332 { |
1293 if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) { |
1333 if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) { |
1294 subjectIcon.append("qtg_small_todo_done"); |
1334 subjectIcon.append("qtg_small_todo_done"); |
1295 } else { |
1335 } else { |
1296 subjectIcon.append("qtg_small_todo"); |
1336 subjectIcon.append("qtg_small_todo"); |
1297 } |
1337 } |
1298 } |
|
1299 break; |
|
1300 case AgendaEntry::TypeEvent: |
|
1301 { |
|
1302 subjectIcon.append("qtg_small_day"); |
|
1303 } |
1338 } |
1304 break; |
1339 break; |
1305 case AgendaEntry::TypeAnniversary: |
1340 case AgendaEntry::TypeAnniversary: |
1306 { |
1341 { |
1307 subjectIcon.append("qtg_small_anniversary"); |
1342 subjectIcon.append("qtg_small_anniversary"); |
1422 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
1457 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
1423 progressIcon.append(QString::null); |
1458 progressIcon.append(QString::null); |
1424 } |
1459 } |
1425 OstTraceFunctionExit0( AGENDAEVENTVIEW_GETPROGRESSINDICATORSTATUS_EXIT ); |
1460 OstTraceFunctionExit0( AGENDAEVENTVIEW_GETPROGRESSINDICATORSTATUS_EXIT ); |
1426 } |
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 |
1427 /*! |
1482 /*! |
1428 Reload the maptile image on system orientation change. |
1483 Reload the maptile image on system orientation change. |
1429 */ |
1484 */ |
1430 void AgendaEventView::changedOrientation(Qt::Orientation orientation) |
1485 void AgendaEventView::changedOrientation(Qt::Orientation orientation) |
1431 { |
1486 { |