369 */ |
390 */ |
370 void CalenMonthView::addBackgroundFrame() |
391 void CalenMonthView::addBackgroundFrame() |
371 { |
392 { |
372 // Set the background items for all the widgets |
393 // Set the background items for all the widgets |
373 HbFrameItem* frame = NULL; |
394 HbFrameItem* frame = NULL; |
374 if (mMonthGrid) { |
395 HbWidget* monthViewExceptPreviewPane = qobject_cast<HbWidget *> ( |
|
396 mDocLoader->findWidget(CALEN_MONTHVIEW_EXCEPT_PANE)); |
|
397 if (monthViewExceptPreviewPane) { |
375 // The grid background |
398 // The grid background |
376 frame = new HbFrameItem(this); |
399 frame = new HbFrameItem(this); |
377 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
400 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
378 |
401 |
379 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_monthgrid_bg"); |
402 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_monthgrid_bg"); |
380 mMonthGrid->setBackgroundItem(frame->graphicsItem(), -2); |
403 monthViewExceptPreviewPane->setBackgroundItem(frame->graphicsItem(), -2); |
381 } |
404 } |
382 if (mTitleLabel) { |
405 if (mTitleLabel) { |
383 // The month title |
406 // The month title |
384 frame = new HbFrameItem(this); |
407 frame = new HbFrameItem(this); |
385 frame->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
408 frame->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
386 |
409 |
387 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_monthgrid_title_bg"); |
410 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_monthgrid_title_bg"); |
388 mTitleLabel->setBackgroundItem(frame->graphicsItem(), -2); |
411 mTitleLabel->setBackgroundItem(frame->graphicsItem(), -2); |
389 } |
412 } |
390 |
413 |
|
414 // Set the frame to the preview pane |
|
415 frame = new HbFrameItem(this); |
|
416 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
417 |
|
418 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_bg"); |
|
419 mPrevPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5); |
|
420 |
|
421 // Set the frame to the preview pane |
|
422 frame = new HbFrameItem(this); |
|
423 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
424 |
|
425 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_bg"); |
|
426 mCurrPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5); |
|
427 |
|
428 // Set the frame to the preview pane |
|
429 frame = new HbFrameItem(this); |
|
430 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
431 |
|
432 frame->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_bg"); |
|
433 mNextPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5); |
|
434 } |
|
435 |
|
436 void CalenMonthView::showHideRegionalInformation() |
|
437 { |
|
438 XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, |
|
439 KCRUidCalendar.iUid, KShowRegionalInformation); |
|
440 |
|
441 int showRegionalInfo = mSettingsManager->readItemValue(regionalInfo).toUInt(); |
|
442 if (showRegionalInfo) { |
|
443 |
|
444 // Add the regional information to the preview panes |
|
445 if (!mPrevRegionalInfo) { |
|
446 mPrevRegionalInfo = new CalenPluginLabel(mServices, this); |
|
447 mPrevPaneLayout->insertItem(0, mPrevRegionalInfo); |
|
448 |
|
449 HbFrameItem *frameCurr = new HbFrameItem(this); |
|
450 frameCurr->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
451 frameCurr->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_title_bg"); |
|
452 mPrevRegionalInfo->setBackgroundItem(frameCurr->graphicsItem(), -2); |
|
453 } |
|
454 if (!mCurrRegionalInfo) { |
|
455 mCurrRegionalInfo = new CalenPluginLabel(mServices, this); |
|
456 mCurrPaneLayout->insertItem(0, mCurrRegionalInfo); |
|
457 |
|
458 HbFrameItem *frameCurr = new HbFrameItem(this); |
|
459 frameCurr->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
460 frameCurr->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_title_bg"); |
|
461 mCurrRegionalInfo->setBackgroundItem(frameCurr->graphicsItem(), -2); |
|
462 } |
|
463 if (!mNextRegionalInfo) { |
|
464 mNextRegionalInfo = new CalenPluginLabel(mServices, this); |
|
465 mNextPaneLayout->insertItem(0, mNextRegionalInfo); |
|
466 |
|
467 HbFrameItem *frameCurr = new HbFrameItem(this); |
|
468 frameCurr->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
469 frameCurr->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_title_bg"); |
|
470 mNextRegionalInfo->setBackgroundItem(frameCurr->graphicsItem(), -2); |
|
471 } |
|
472 |
|
473 if (pluginEnabled()) { |
|
474 QString *pluginString = pluginText(); |
|
475 mPrevRegionalInfo->setPlainText(*pluginString); |
|
476 mCurrRegionalInfo->setPlainText(*pluginString); |
|
477 mNextRegionalInfo->setPlainText(*pluginString); |
|
478 } |
|
479 } else { |
|
480 if (mPrevRegionalInfo) { |
|
481 mPrevPaneLayout->removeItem(mPrevRegionalInfo); |
|
482 delete mPrevRegionalInfo; |
|
483 mPrevRegionalInfo = NULL; |
|
484 } |
|
485 if (mCurrRegionalInfo) { |
|
486 mPrevPaneLayout->removeItem(mCurrRegionalInfo); |
|
487 delete mCurrRegionalInfo; |
|
488 mCurrRegionalInfo = NULL; |
|
489 } |
|
490 if (mNextRegionalInfo) { |
|
491 mPrevPaneLayout->removeItem(mNextRegionalInfo); |
|
492 delete mNextRegionalInfo; |
|
493 mNextRegionalInfo = NULL; |
|
494 } |
|
495 } |
|
496 } |
|
497 |
|
498 /*! |
|
499 Handles the context changed notification |
|
500 */ |
|
501 void CalenMonthView::onContextChanged() |
|
502 { |
|
503 //Update plugin label after setting context |
|
504 if (mCurrRegionalInfo && mPrevRegionalInfo && mNextPaneLayout |
|
505 && pluginEnabled()) { |
|
506 QString *pluginString = pluginText(); |
|
507 mPrevRegionalInfo->setPlainText(*pluginString); |
|
508 mCurrRegionalInfo->setPlainText(*pluginString); |
|
509 mNextRegionalInfo->setPlainText(*pluginString); |
|
510 } |
391 } |
511 } |
392 |
512 |
393 /*! |
513 /*! |
394 Calculates the week numbers and sets them to the week labels |
514 Calculates the week numbers and sets them to the week labels |
395 */ |
515 */ |
438 Populates the month view with today as focussed item |
558 Populates the month view with today as focussed item |
439 */ |
559 */ |
440 void CalenMonthView::goToToday() |
560 void CalenMonthView::goToToday() |
441 { |
561 { |
442 QDateTime today = CalenDateUtils::today(); |
562 QDateTime today = CalenDateUtils::today(); |
443 // First check if we are not already |
563 // First check if we are not alread |
444 // showing today's month view |
564 // showing today's month view |
445 if (mDate == today) { |
565 if (mDate == today) { |
446 return; |
566 return; |
|
567 } else if (mActiveMonth.date().year() == today.date().year() && |
|
568 mActiveMonth.date().month() == today.date().month()) { |
|
569 // User is in current month only, so just set the focus to current |
|
570 // date grid item and refresh the preview pane |
|
571 int currIndex = mFirstDayOfGrid.daysTo(today); |
|
572 setCurrGridIndex(currIndex); |
|
573 return; |
447 } |
574 } |
448 |
575 |
449 // Set the context and repopulate the view |
576 // Set the context and repopulate the view |
450 MCalenContext &context = mServices.Context(); |
577 MCalenContext &context = mServices.Context(); |
451 context.setFocusDateAndTimeL(today, KCalenMonthViewUidValue); |
578 context.setFocusDateAndTimeL(today, KCalenMonthViewUidValue); |
452 |
579 |
453 mServices.IssueCommandL(ECalenStartActiveStep); |
580 refreshViewOnGoToDate(); |
|
581 } |
|
582 |
|
583 /* |
|
584 Slot to handle adding / removing actions frm the menu when menu is about to |
|
585 shown to the user |
|
586 */ |
|
587 void CalenMonthView::addRemoveActionsInMenu() |
|
588 { |
|
589 HbAction* menuAction = mDeleteSubMenu->menuAction(); |
|
590 // Check if there are no entries in the database |
|
591 if (mAgendaUtil->areNoEntriesInCalendar() && menuAction) { |
|
592 // hide the delete entries option |
|
593 menuAction->setVisible(false); |
|
594 } else if (menuAction) { |
|
595 // Show the option to delete |
|
596 menuAction->setVisible(true); |
|
597 } |
|
598 |
|
599 // Check if we are population for current day, if yes then disable the |
|
600 // gototoday action |
|
601 if ((CalenDateUtils::today().date() == mDate.date()) && mGoToTodayAction) { |
|
602 mGoToTodayAction->setVisible(false); |
|
603 } else if (mGoToTodayAction){ |
|
604 mGoToTodayAction->setVisible(true); |
|
605 } |
454 } |
606 } |
455 |
607 |
456 /*! |
608 /*! |
457 Populates the view |
609 Populates the view |
458 */ |
610 */ |
877 const int todayIndex(gridStart.daysTo(today)); |
1040 const int todayIndex(gridStart.daysTo(today)); |
878 |
1041 |
879 QDateTime gridEnd(mLastDayOfGrid.date(), QTime(23, 59, 59, 0)); |
1042 QDateTime gridEnd(mLastDayOfGrid.date(), QTime(23, 59, 59, 0)); |
880 QList<AgendaEntry> list; |
1043 QList<AgendaEntry> list; |
881 |
1044 |
882 getInstanceList(list, gridStart, gridEnd); |
1045 AgendaUtil::FilterFlags filter = |
883 |
1046 AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries |
884 //Parse fetched items |
1047 | AgendaUtil::IncludeAppointments |
885 if (list.count()) { |
1048 | AgendaUtil::IncludeEvents |
886 for (int i(0); i < list.count(); i++) { |
1049 | AgendaUtil::IncludeReminders |
887 AgendaEntry entry = list[i]; |
1050 | AgendaUtil::IncludeIncompletedTodos); |
888 |
1051 |
889 // Parse Day Notes, Appointments and Remainders |
1052 // Get the list of dates which have events |
890 // Start and end time of Event/Appointment/Remainders has to be |
1053 QList<QDate> datesWithEvents; |
891 // indentified before marking the tags |
1054 mAgendaUtil->markDatesWithEvents(gridStart,gridEnd,filter,datesWithEvents); |
892 // EEvents/Appointments can span multiple days, |
1055 |
893 // while Anniversaries cannot. |
1056 // Parse thru the list of dates and set the required flags |
894 if ((entry.type() == AgendaEntry::TypeEvent) || (entry.type() |
1057 for(int i(0); i < datesWithEvents.count(); i++) { |
895 == AgendaEntry::TypeAppoinment) || (entry.type() |
1058 int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i)); |
896 == AgendaEntry::TypeReminder)) { |
1059 mMonthDataArray[offset].SetHasEvents(true); |
897 // The start time of the instance |
1060 } |
898 QDateTime startTime = entry.startTime(); |
1061 |
899 // The instance's start index from the grid start |
1062 datesWithEvents.clear(); |
900 int startIndex(gridStart.daysTo(startTime)); |
|
901 // The end time of the instance |
|
902 QDateTime endTime = entry.endTime(); |
|
903 |
|
904 if (CalenAgendaUtils::endsAtStartOfDayL(entry, endTime)) { |
|
905 // prevent problems with items ending tomorrow at 00:00 |
|
906 QTime time = endTime.time(); |
|
907 time.setHMS(time.hour(), time.minute() - 1, time.second(), |
|
908 time.msec()); |
|
909 endTime.setTime(time); |
|
910 |
|
911 if (endTime <= gridStart) { |
|
912 // ends at the start of the grid -> not visible |
|
913 continue; // skip |
|
914 } |
|
915 } |
|
916 // The instance's end index from the grid start |
|
917 int endIndex(gridStart.daysTo(endTime)); |
|
918 |
|
919 // Mark the days from start index to end index |
|
920 for (; startIndex <= endIndex; startIndex++) { |
|
921 if (startIndex >= 0 && |
|
922 startIndex < mMonthDataArray.count()) { |
|
923 mMonthDataArray[startIndex].SetHasEvents(true); |
|
924 } |
|
925 } // Parse Anniversaries |
|
926 } else if (entry.type() == AgendaEntry::TypeAnniversary) { |
|
927 QDateTime startTime = entry.startTime(); |
|
928 // The instance's start index from the grid start |
|
929 int index(gridStart.daysTo(startTime)); |
|
930 // Mark the particular day |
|
931 if (index >= 0 && index < mMonthDataArray.count()) { |
|
932 mMonthDataArray[index].SetHasEvents(true); |
|
933 } // Parse To DOs |
|
934 } else if (entry.type() == AgendaEntry::TypeTodo) { |
|
935 QDateTime startTime = entry.startTime(); |
|
936 ; |
|
937 int index; |
|
938 // Mark the particular day if the instance's start |
|
939 // time is not in the past |
|
940 if (startTime >= today) { |
|
941 index = gridStart.daysTo(startTime); |
|
942 } else {// Mark for today if the instance's |
|
943 // start time is in the past |
|
944 index = todayIndex; |
|
945 } |
|
946 if (index >= 0 && index < mMonthDataArray.count()) { |
|
947 mMonthDataArray[index].SetHasEvents(true); |
|
948 } |
|
949 } |
|
950 } |
|
951 } |
|
952 list.clear(); |
|
953 } |
1063 } |
954 |
1064 |
955 /*! |
1065 /*! |
956 Parses the fetched entries for previous month and |
1066 Parses the fetched entries for previous month and |
957 sets hasEvent attribute for necessary days |
1067 sets hasEvent attribute for necessary days |
964 |
1074 |
965 const int todayIndex(gridStart.daysTo(today)); // grid index for "today" |
1075 const int todayIndex(gridStart.daysTo(today)); // grid index for "today" |
966 QDateTime end = gridStart.addDays(mNumOfRowsInPrevMonth * KCalenDaysInWeek); |
1076 QDateTime end = gridStart.addDays(mNumOfRowsInPrevMonth * KCalenDaysInWeek); |
967 QDateTime gridEnd(end.date(), QTime(23, 59, 59, 0)); |
1077 QDateTime gridEnd(end.date(), QTime(23, 59, 59, 0)); |
968 |
1078 |
969 getInstanceList(list, gridStart, gridEnd); |
1079 |
970 |
1080 AgendaUtil::FilterFlags filter = |
971 //Parse fetched items |
1081 AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries |
972 if (list.count()) { |
1082 | AgendaUtil::IncludeAppointments |
973 for (int i(0); i < list.count(); i++) { |
1083 | AgendaUtil::IncludeEvents |
974 AgendaEntry entry = list[i]; |
1084 | AgendaUtil::IncludeReminders |
975 |
1085 | AgendaUtil::IncludeIncompletedTodos); |
976 // Parse Day Notes, Appointments and Remainders |
1086 |
977 // Start and end time of Event/Appointment/Remainders |
1087 // Get the list of dates which have events |
978 // has to be indentified before marking the tags |
1088 QList<QDate> datesWithEvents; |
979 // EEvents/Appointments can span multiple days, |
1089 mAgendaUtil->markDatesWithEvents(gridStart,gridEnd,filter,datesWithEvents); |
980 // while Anniversaries cannot. |
1090 |
981 if ((entry.type() == AgendaEntry::TypeEvent) || (entry.type() |
1091 // Parse thru the list of dates and set the required flags |
982 == AgendaEntry::TypeAppoinment) || (entry.type() |
1092 for(int i(0); i < datesWithEvents.count(); i++) { |
983 == AgendaEntry::TypeReminder)) { |
1093 int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i)); |
984 // The start time of the instance |
1094 mMonthDataArray[offset].SetHasEvents(true); |
985 QDateTime startTime = entry.startTime(); |
1095 } |
986 // The instance's start index from the grid start |
1096 |
987 int startIndex(gridStart.daysTo(startTime)); |
1097 datesWithEvents.clear(); |
988 // The end time of the instance |
|
989 QDateTime endTime = entry.endTime(); |
|
990 |
|
991 if (CalenAgendaUtils::endsAtStartOfDayL(entry, endTime)) { |
|
992 // prevent problems with items ending tomorrow at 00:00 |
|
993 QTime time = endTime.time(); |
|
994 time.setHMS(time.hour(), time.minute() - 1, time.second(), |
|
995 time.msec()); |
|
996 endTime.setTime(time); |
|
997 |
|
998 if (endTime <= gridStart) { |
|
999 // ends at the start of the grid -> not visible |
|
1000 continue; // skip |
|
1001 } |
|
1002 } |
|
1003 // The instance's end index from the grid start |
|
1004 int endIndex(gridStart.daysTo(endTime)); |
|
1005 |
|
1006 // Mark the days from start index to end index |
|
1007 for (; startIndex <= endIndex; startIndex++) { |
|
1008 if (startIndex >= 0 && |
|
1009 startIndex < mMonthDataArray.count()) { |
|
1010 mMonthDataArray[startIndex].SetHasEvents(true); |
|
1011 } |
|
1012 } // Parse Anniversaries |
|
1013 } else if (entry.type() == AgendaEntry::TypeAnniversary) { |
|
1014 QDateTime startTime = entry.startTime(); |
|
1015 // The instance's start index from the grid start |
|
1016 int index(gridStart.daysTo(startTime)); |
|
1017 // Mark the particular day |
|
1018 if (index >= 0 && index < mMonthDataArray.count()) { |
|
1019 mMonthDataArray[index].SetHasEvents(true); |
|
1020 } // Parse To DOs |
|
1021 } else if (entry.type() == AgendaEntry::TypeTodo) { |
|
1022 QDateTime startTime = entry.startTime(); |
|
1023 ; |
|
1024 int index; |
|
1025 // Mark the particular day if the instance's |
|
1026 // start time is not in the past |
|
1027 if (startTime >= today) { |
|
1028 index = gridStart.daysTo(startTime); |
|
1029 } else {// Mark for today if the instance's |
|
1030 //start time is in the past |
|
1031 index = todayIndex; |
|
1032 } |
|
1033 if (index >= 0 && index < mMonthDataArray.count()) { |
|
1034 mMonthDataArray[index].SetHasEvents(true); |
|
1035 } |
|
1036 } |
|
1037 } |
|
1038 } |
|
1039 list.clear(); |
|
1040 } |
1098 } |
1041 |
1099 |
1042 /*! |
1100 /*! |
1043 Parses the fetched entries for future month and |
1101 Parses the fetched entries for future month and |
1044 sets hasEvent attribute for necessary days |
1102 sets hasEvent attribute for necessary days |
1052 |
1110 |
1053 const QDateTime today(CalenDateUtils::today()); |
1111 const QDateTime today(CalenDateUtils::today()); |
1054 const int todayIndex(gridStart.daysTo(today)); // grid index for "today" |
1112 const int todayIndex(gridStart.daysTo(today)); // grid index for "today" |
1055 QDateTime gridEnd(mLastDayOfGrid.date(), QTime(23, 59, 59, 0)); |
1113 QDateTime gridEnd(mLastDayOfGrid.date(), QTime(23, 59, 59, 0)); |
1056 |
1114 |
1057 getInstanceList(list, gridStart, gridEnd); |
1115 |
1058 |
1116 AgendaUtil::FilterFlags filter = |
1059 //Parse fetched items |
1117 AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries |
1060 if (list.count()) { |
1118 | AgendaUtil::IncludeAppointments |
1061 for (int i(0); i < list.count(); i++) { |
1119 | AgendaUtil::IncludeEvents |
1062 AgendaEntry entry = list[i]; |
1120 | AgendaUtil::IncludeReminders |
1063 |
1121 | AgendaUtil::IncludeIncompletedTodos); |
1064 // Parse Day Notes, Appointments and Remainders |
1122 |
1065 // Start and end time of Event/Appointment/Remainders |
1123 // Get the list of dates which have events |
1066 // has to be indentified before marking the tags |
1124 QList<QDate> datesWithEvents; |
1067 // EEvents/Appointments can span multiple days, |
1125 mAgendaUtil->markDatesWithEvents(gridStart,gridEnd,filter,datesWithEvents); |
1068 // while Anniversaries cannot. |
1126 |
1069 if ((entry.type() == AgendaEntry::TypeEvent) || (entry.type() |
1127 // Parse thru the list of dates and set the required flags |
1070 == AgendaEntry::TypeAppoinment) || (entry.type() |
1128 for(int i(0); i < datesWithEvents.count(); i++) { |
1071 == AgendaEntry::TypeReminder)) { |
1129 int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i)); |
1072 // The start time of the instance |
1130 mMonthDataArray[offset].SetHasEvents(true); |
1073 QDateTime startTime = entry.startTime(); |
1131 } |
1074 // The instance's start index from the grid start |
1132 |
1075 int startIndex(gridStart.daysTo(startTime)); |
1133 |
1076 // The end time of the instance |
1134 |
1077 QDateTime endTime = entry.endTime(); |
1135 datesWithEvents.clear(); |
1078 |
|
1079 if (CalenAgendaUtils::endsAtStartOfDayL(entry, endTime)) { |
|
1080 // prevent problems with items ending tomorrow at 00:00 |
|
1081 QTime time = endTime.time(); |
|
1082 time.setHMS(time.hour(), time.minute() - 1, time.second(), |
|
1083 time.msec()); |
|
1084 endTime.setTime(time); |
|
1085 |
|
1086 if (endTime <= gridStart) { |
|
1087 // ends at the start of the grid -> not visible |
|
1088 continue; // skip |
|
1089 } |
|
1090 } |
|
1091 // The instance's end index from the grid start |
|
1092 int endIndex(gridStart.daysTo(endTime)); |
|
1093 |
|
1094 // Mark the days from start index to end index |
|
1095 for (; startIndex <= endIndex; startIndex++) { |
|
1096 if (startIndex >= 0 && |
|
1097 startIndex < mMonthDataArray.count()) { |
|
1098 mMonthDataArray[actualIndex + startIndex].SetHasEvents(true); |
|
1099 } |
|
1100 } // Parse Anniversaries |
|
1101 } else if (entry.type() == AgendaEntry::TypeAnniversary) { |
|
1102 QDateTime startTime = entry.startTime(); |
|
1103 // The instance's start index from the grid start |
|
1104 int index(gridStart.daysTo(startTime)); |
|
1105 // Mark the particular day |
|
1106 if (actualIndex +index >= 0 && (actualIndex + index) < mMonthDataArray.count()) { |
|
1107 mMonthDataArray[actualIndex + index].SetHasEvents(true); |
|
1108 } // Parse To DOs |
|
1109 } else if (entry.type() == AgendaEntry::TypeTodo) { |
|
1110 QDateTime startTime = entry.startTime(); |
|
1111 ; |
|
1112 int index; |
|
1113 // Mark the particular day if the instance's |
|
1114 // start time is not in the past |
|
1115 if (startTime >= today) { |
|
1116 index = gridStart.daysTo(startTime); |
|
1117 } else {// Mark for today if the instance's |
|
1118 // start time is in the past |
|
1119 index = todayIndex; |
|
1120 } |
|
1121 if (actualIndex + index >= 0 && (actualIndex + index) < mMonthDataArray.count()) { |
|
1122 mMonthDataArray[actualIndex + index].SetHasEvents(true); |
|
1123 } |
|
1124 } |
|
1125 } |
|
1126 } |
|
1127 list.clear(); |
|
1128 } |
1136 } |
1129 |
1137 |
1130 /*! |
1138 /*! |
1131 Populates the preview pane |
1139 Populates the preview pane |
1132 */ |
1140 */ |
1303 if(rightGesture) { |
1297 if(rightGesture) { |
1304 // Need to bring up the previous day preview pane |
1298 // Need to bring up the previous day preview pane |
1305 // Create the effect on mCurrPreviewPane to slide to right side |
1299 // Create the effect on mCurrPreviewPane to slide to right side |
1306 mPrevPaneParent->setVisible(true); |
1300 mPrevPaneParent->setVisible(true); |
1307 if (mOrientation == Qt::Vertical) { |
1301 if (mOrientation == Qt::Vertical) { |
1308 HbEffect::add(mCurrPreviewPane, |
1302 HbEffect::add(mCurrPaneLayoutWidget, |
1309 ":/fxml/portrait_preview_pane_hide_on_right_gesture", |
1303 ":/fxml/portrait_preview_pane_hide_on_right_gesture", |
1310 "hide"); |
1304 "hide"); |
1311 HbEffect::add(mPrevPreviewPane, |
1305 HbEffect::add(mPrevPaneLayoutWidget, |
1312 ":/fxml/portrait_preview_pane_show_on_right_gesture", |
1306 ":/fxml/portrait_preview_pane_show_on_right_gesture", |
1313 "show"); |
1307 "show"); |
1314 } else { |
1308 } else { |
1315 HbEffect::add(mCurrPreviewPane, |
1309 HbEffect::add(mCurrPaneLayoutWidget, |
1316 ":/fxml/landscape_preview_pane_hide_on_right_gesture", |
1310 ":/fxml/landscape_preview_pane_hide_on_right_gesture", |
1317 "hide"); |
1311 "hide"); |
1318 HbEffect::add(mPrevPreviewPane, |
1312 HbEffect::add(mPrevPaneLayoutWidget, |
1319 ":/fxml/landscape_preview_pane_show_on_right_gesture", |
1313 ":/fxml/landscape_preview_pane_show_on_right_gesture", |
1320 "show"); |
1314 "show"); |
1321 } |
1315 } |
1322 // Start the effects |
1316 // Start the effects |
1323 HbEffect::start(mCurrPreviewPane, "hide"); |
1317 HbEffect::start(mCurrPaneLayoutWidget, "hide"); |
1324 HbEffect::start(mPrevPreviewPane, "show", |
1318 HbEffect::start(mPrevPaneLayoutWidget, "show", |
1325 this, "handleRightEffectCompleted"); |
1319 this, "handleRightEffectCompleted"); |
1326 |
1320 |
1327 //Remove the mCurrPreviewPane from the layout and add mPrevPreviewPane |
1321 //Remove the mCurrPreviewPane from the layout and add mPrevPreviewPane |
1328 // to the layout |
1322 // to the layout |
1329 viewLayout->removeAt(1); |
1323 viewLayout->removeAt(1); |
1331 } else { |
1325 } else { |
1332 // Need to bring up the previous day preview pane |
1326 // Need to bring up the previous day preview pane |
1333 // Create the effect on mCurrPreviewPane to slide to left side |
1327 // Create the effect on mCurrPreviewPane to slide to left side |
1334 mNextPaneParent->setVisible(true); |
1328 mNextPaneParent->setVisible(true); |
1335 if (mOrientation == Qt::Vertical) { |
1329 if (mOrientation == Qt::Vertical) { |
1336 HbEffect::add(mCurrPreviewPane, |
1330 HbEffect::add(mCurrPaneLayoutWidget, |
1337 ":/fxml/portrait_preview_pane_hide_on_left_gesture", |
1331 ":/fxml/portrait_preview_pane_hide_on_left_gesture", |
1338 "hide"); |
1332 "hide"); |
1339 HbEffect::add(mNextPreviewPane, |
1333 HbEffect::add(mNextPaneLayoutWidget, |
1340 ":/fxml/portrait_preview_pane_show_on_left_gesture", |
1334 ":/fxml/portrait_preview_pane_show_on_left_gesture", |
1341 "show"); |
1335 "show"); |
1342 } else { |
1336 } else { |
1343 HbEffect::add(mCurrPreviewPane, |
1337 HbEffect::add(mCurrPaneLayoutWidget, |
1344 ":/fxml/landscape_preview_pane_hide_on_left_gesture", |
1338 ":/fxml/landscape_preview_pane_hide_on_left_gesture", |
1345 "hide"); |
1339 "hide"); |
1346 HbEffect::add(mNextPreviewPane, |
1340 HbEffect::add(mNextPaneLayoutWidget, |
1347 ":/fxml/landscape_preview_pane_show_on_left_gesture", |
1341 ":/fxml/landscape_preview_pane_show_on_left_gesture", |
1348 "show"); |
1342 "show"); |
1349 } |
1343 } |
1350 |
1344 |
1351 // Start the effects |
1345 // Start the effects |
1352 HbEffect::start(mCurrPreviewPane, "hide"); |
1346 HbEffect::start(mCurrPaneLayoutWidget, "hide"); |
1353 HbEffect::start(mNextPreviewPane, "show", |
1347 HbEffect::start(mNextPaneLayoutWidget, "show", |
1354 this, "handleLeftEffectCompleted"); |
1348 this, "handleLeftEffectCompleted"); |
1355 |
1349 |
1356 //Remove the mCurrPreviewPane from the layout and add mNextPreviewPane |
1350 //Remove the mCurrPreviewPane from the layout and add mNextPreviewPane |
1357 // to the layout |
1351 // to the layout |
1358 viewLayout->removeAt(1); |
1352 viewLayout->removeAt(1); |
1359 viewLayout->addItem(mNextPaneParent); |
1353 viewLayout->addItem(mNextPaneParent); |
1360 } |
1354 } |
1361 } |
1355 } |
1362 |
1356 |
1363 /*! |
1357 /*! |
|
1358 Returns the first date in the month grid |
|
1359 */ |
|
1360 QDateTime CalenMonthView::firstDayOfGrid() |
|
1361 { |
|
1362 return mFirstDayOfGrid; |
|
1363 } |
|
1364 |
|
1365 /*! |
1364 Function to handle any locale related changes |
1366 Function to handle any locale related changes |
1365 */ |
1367 */ |
1366 void CalenMonthView::onLocaleChanged(int reason) |
1368 void CalenMonthView::onLocaleChanged(int reason) |
1367 { |
1369 { |
1368 Q_UNUSED(reason); |
1370 Q_UNUSED(reason); |
1383 mCurrPreviewPane->stopScrolling(); |
1385 mCurrPreviewPane->stopScrolling(); |
1384 |
1386 |
1385 // Swap the preview panes properly |
1387 // Swap the preview panes properly |
1386 CalenPreviewPane* pane = mCurrPreviewPane; |
1388 CalenPreviewPane* pane = mCurrPreviewPane; |
1387 HbWidget* paneParent = mCurrPaneParent; |
1389 HbWidget* paneParent = mCurrPaneParent; |
|
1390 HbWidget* paneLayoutWidget = mCurrPaneLayoutWidget; |
1388 mCurrPreviewPane = mNextPreviewPane; |
1391 mCurrPreviewPane = mNextPreviewPane; |
1389 mCurrPaneParent = mNextPaneParent; |
1392 mCurrPaneParent = mNextPaneParent; |
|
1393 mCurrPaneLayoutWidget = mNextPaneLayoutWidget; |
1390 mNextPreviewPane = mPrevPreviewPane; |
1394 mNextPreviewPane = mPrevPreviewPane; |
1391 mNextPaneParent = mPrevPaneParent; |
1395 mNextPaneParent = mPrevPaneParent; |
|
1396 mNextPaneLayoutWidget = mPrevPaneLayoutWidget; |
1392 mPrevPreviewPane = pane; |
1397 mPrevPreviewPane = pane; |
1393 mPrevPaneParent = paneParent; |
1398 mPrevPaneParent = paneParent; |
|
1399 mPrevPaneLayoutWidget = paneLayoutWidget; |
1394 |
1400 |
1395 // Set the focus to proper date |
1401 // Set the focus to proper date |
1396 setCurrGridIndex(index); |
1402 setCurrGridIndex(index); |
1397 // Start the auto scroll on current preview pane |
1403 // Start the auto scroll on current preview pane |
1398 mCurrPreviewPane->startAutoScroll(); |
1404 mCurrPreviewPane->startAutoScroll(); |
1414 mCurrPreviewPane->stopScrolling(); |
1420 mCurrPreviewPane->stopScrolling(); |
1415 |
1421 |
1416 // Swap the preview panes properly |
1422 // Swap the preview panes properly |
1417 CalenPreviewPane* pane = mCurrPreviewPane; |
1423 CalenPreviewPane* pane = mCurrPreviewPane; |
1418 HbWidget* paneParent = mCurrPaneParent; |
1424 HbWidget* paneParent = mCurrPaneParent; |
|
1425 HbWidget* paneLayoutWidget = mCurrPaneLayoutWidget; |
1419 mCurrPreviewPane = mPrevPreviewPane; |
1426 mCurrPreviewPane = mPrevPreviewPane; |
1420 mCurrPaneParent = mPrevPaneParent; |
1427 mCurrPaneParent = mPrevPaneParent; |
|
1428 mCurrPaneLayoutWidget = mPrevPaneLayoutWidget; |
1421 mPrevPreviewPane = mNextPreviewPane; |
1429 mPrevPreviewPane = mNextPreviewPane; |
1422 mPrevPaneParent = mNextPaneParent; |
1430 mPrevPaneParent = mNextPaneParent; |
|
1431 mPrevPaneLayoutWidget = mNextPaneLayoutWidget; |
1423 mNextPreviewPane = pane; |
1432 mNextPreviewPane = pane; |
1424 mNextPaneParent = paneParent; |
1433 mNextPaneParent = paneParent; |
|
1434 mNextPaneLayoutWidget = paneLayoutWidget; |
1425 |
1435 |
1426 // Set the focus to proper date |
1436 // Set the focus to proper date |
1427 setCurrGridIndex(index); |
1437 setCurrGridIndex(index); |
1428 // Start the auto scroll on current preview pane |
1438 // Start the auto scroll on current preview pane |
1429 mCurrPreviewPane->startAutoScroll(); |
1439 mCurrPreviewPane->startAutoScroll(); |