131 = qobject_cast<HbLabel *> ( |
135 = qobject_cast<HbLabel *> ( |
132 mDocLoader->findWidget(CALEN_MONTVIEW_SIXTH_DAY_LABEL)); |
136 mDocLoader->findWidget(CALEN_MONTVIEW_SIXTH_DAY_LABEL)); |
133 mSeventhDayLabel |
137 mSeventhDayLabel |
134 = qobject_cast<HbLabel *> ( |
138 = qobject_cast<HbLabel *> ( |
135 mDocLoader->findWidget(CALEN_MONTVIEW_SEVENTH_DAY_LABEL)); |
139 mDocLoader->findWidget(CALEN_MONTVIEW_SEVENTH_DAY_LABEL)); |
136 |
|
137 // Set the short day names to these labels |
|
138 // TODO: Need to read start of the week from the locale |
|
139 // and update the labels accortdingly |
|
140 int startOfDay = mLocale.startOfWeek(); |
|
141 mFirstDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_mo")); |
|
142 mSecondDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_tu")); |
|
143 mThirdDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_we")); |
|
144 mFourthDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_th")); |
|
145 mFifthDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_fr")); |
|
146 mSixthDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_sa")); |
|
147 mSeventhDayLabel->setPlainText(hbTrId("txt_calendar_grid_day_su")); |
|
148 |
140 |
149 // Get the weeknumber widget |
141 // Get the weeknumber widget |
150 mWeekNumberWidget |
142 mWeekNumberWidget |
151 = qobject_cast<CalenThickLinesDrawer *> ( |
143 = qobject_cast<CalenThickLinesDrawer *> ( |
152 mDocLoader->findWidget(CALEN_WEEKNUMBERS_WIDGET)); |
144 mDocLoader->findWidget(CALEN_WEEKNUMBERS_WIDGET)); |
451 mNextPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5); |
450 mNextPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5); |
452 } |
451 } |
453 |
452 |
454 void CalenMonthView::showHideRegionalInformation() |
453 void CalenMonthView::showHideRegionalInformation() |
455 { |
454 { |
456 XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, |
455 if (pluginEnabled()) { |
457 KCRUidCalendar, KCalendarShowRegionalInfo); |
456 XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, |
458 |
457 KCRUidCalendar, KCalendarShowRegionalInfo); |
459 int showRegionalInfo = mSettingsManager->readItemValue(regionalInfo).toUInt(); |
458 |
460 if (showRegionalInfo) { |
459 int showRegionalInfo = |
461 |
460 mSettingsManager->readItemValue(regionalInfo).toUInt(); |
462 // Add the regional information to the preview panes |
461 if (showRegionalInfo) { |
463 if (!mPrevRegionalInfo) { |
462 |
464 mPrevRegionalInfo = qobject_cast<CalenPluginLabel *> |
463 // Add the regional information to the preview panes |
465 (mDocLoader->findWidget(CALEN_PREVREGIONALINFO)); |
464 if (!mPrevRegionalInfo) { |
466 mPrevRegionalInfo->show(); |
465 mPrevRegionalInfo = qobject_cast<CalenPluginLabel *> |
467 mPrevPaneLayout->insertItem(0, mPrevRegionalInfo); |
466 (mDocLoader->findWidget(CALEN_PREVREGIONALINFO)); |
468 |
467 mPrevRegionalInfo->show(); |
469 HbFrameItem *frameCurr = new HbFrameItem(this); |
468 mPrevPaneLayout->insertItem(0, mPrevRegionalInfo); |
470 frameCurr->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
469 |
471 frameCurr->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_title_bg"); |
470 HbFrameItem *frameCurr = new HbFrameItem(this); |
472 mPrevRegionalInfo->setBackgroundItem(frameCurr->graphicsItem(), -2); |
471 frameCurr->frameDrawer().setFrameType( |
473 } |
472 HbFrameDrawer::ThreePiecesHorizontal); |
474 if (!mCurrRegionalInfo) { |
473 frameCurr->frameDrawer().setFrameGraphicsName( |
475 mCurrRegionalInfo = qobject_cast<CalenPluginLabel *> |
474 "qtg_fr_cal_preview_title_bg"); |
476 (mDocLoader->findWidget(CALEN_CURRREGIONALINFO)); |
475 mPrevRegionalInfo->setBackgroundItem( |
477 mCurrRegionalInfo->show(); |
476 frameCurr->graphicsItem(), -2); |
478 mCurrPaneLayout->insertItem(0, mCurrRegionalInfo); |
477 } |
479 |
478 if (!mCurrRegionalInfo) { |
480 HbFrameItem *frameCurr = new HbFrameItem(this); |
479 mCurrRegionalInfo = qobject_cast<CalenPluginLabel *> |
481 frameCurr->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
480 (mDocLoader->findWidget(CALEN_CURRREGIONALINFO)); |
482 frameCurr->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_title_bg"); |
481 mCurrRegionalInfo->show(); |
483 mCurrRegionalInfo->setBackgroundItem(frameCurr->graphicsItem(), -2); |
482 mCurrPaneLayout->insertItem(0, mCurrRegionalInfo); |
484 } |
483 |
485 if (!mNextRegionalInfo) { |
484 HbFrameItem *frameCurr = new HbFrameItem(this); |
486 mNextRegionalInfo = qobject_cast<CalenPluginLabel *> |
485 frameCurr->frameDrawer().setFrameType( |
487 (mDocLoader->findWidget(CALEN_NEXTREGIONALINFO)); |
486 HbFrameDrawer::ThreePiecesHorizontal); |
488 mNextRegionalInfo->show(); |
487 frameCurr->frameDrawer().setFrameGraphicsName( |
489 mNextPaneLayout->insertItem(0, mNextRegionalInfo); |
488 "qtg_fr_cal_preview_title_bg"); |
490 |
489 mCurrRegionalInfo->setBackgroundItem( |
491 HbFrameItem *frameCurr = new HbFrameItem(this); |
490 frameCurr->graphicsItem(), -2); |
492 frameCurr->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
491 } |
493 frameCurr->frameDrawer().setFrameGraphicsName("qtg_fr_cal_preview_title_bg"); |
492 if (!mNextRegionalInfo) { |
494 mNextRegionalInfo->setBackgroundItem(frameCurr->graphicsItem(), -2); |
493 mNextRegionalInfo = qobject_cast<CalenPluginLabel *> |
495 } |
494 (mDocLoader->findWidget(CALEN_NEXTREGIONALINFO)); |
496 |
495 mNextRegionalInfo->show(); |
497 if (pluginEnabled()) { |
496 mNextPaneLayout->insertItem(0, mNextRegionalInfo); |
|
497 |
|
498 HbFrameItem *frameCurr = new HbFrameItem(this); |
|
499 frameCurr->frameDrawer().setFrameType( |
|
500 HbFrameDrawer::ThreePiecesHorizontal); |
|
501 frameCurr->frameDrawer().setFrameGraphicsName( |
|
502 "qtg_fr_cal_preview_title_bg"); |
|
503 mNextRegionalInfo->setBackgroundItem( |
|
504 frameCurr->graphicsItem(), -2); |
|
505 } |
498 QString *pluginString = pluginText(); |
506 QString *pluginString = pluginText(); |
499 mPrevRegionalInfo->setPlainText(*pluginString); |
507 mPrevRegionalInfo->setPlainText(*pluginString); |
500 mCurrRegionalInfo->setPlainText(*pluginString); |
508 mCurrRegionalInfo->setPlainText(*pluginString); |
501 mNextRegionalInfo->setPlainText(*pluginString); |
509 mNextRegionalInfo->setPlainText(*pluginString); |
|
510 } else { |
|
511 if (mPrevRegionalInfo) { |
|
512 mPrevPaneLayout->removeItem(mPrevRegionalInfo); |
|
513 mPrevRegionalInfo->hide(); |
|
514 mPrevRegionalInfo = NULL; |
|
515 } |
|
516 if (mCurrRegionalInfo) { |
|
517 mPrevPaneLayout->removeItem(mCurrRegionalInfo); |
|
518 mCurrRegionalInfo->hide(); |
|
519 mCurrRegionalInfo = NULL; |
|
520 } |
|
521 if (mNextRegionalInfo) { |
|
522 mPrevPaneLayout->removeItem(mNextRegionalInfo); |
|
523 mNextRegionalInfo->hide(); |
|
524 mNextRegionalInfo = NULL; |
|
525 } |
502 } |
526 } |
503 } else { |
527 } |
504 if (mPrevRegionalInfo) { |
|
505 mPrevPaneLayout->removeItem(mPrevRegionalInfo); |
|
506 mPrevRegionalInfo->hide(); |
|
507 mPrevRegionalInfo = NULL; |
|
508 } |
|
509 if (mCurrRegionalInfo) { |
|
510 mPrevPaneLayout->removeItem(mCurrRegionalInfo); |
|
511 mCurrRegionalInfo->hide(); |
|
512 mCurrRegionalInfo = NULL; |
|
513 } |
|
514 if (mNextRegionalInfo) { |
|
515 mPrevPaneLayout->removeItem(mNextRegionalInfo); |
|
516 mNextRegionalInfo->hide(); |
|
517 mNextRegionalInfo = NULL; |
|
518 } |
|
519 } |
|
520 } |
528 } |
521 |
529 |
522 /*! |
530 /*! |
523 Handles the context changed notification |
531 Handles the context changed notification |
524 */ |
532 */ |
644 populateWithInstanceView(); |
653 populateWithInstanceView(); |
645 // Populate the preview panes |
654 // Populate the preview panes |
646 populatePreviewPane(mDate); |
655 populatePreviewPane(mDate); |
647 } |
656 } |
648 |
657 |
649 // Create the grid items with proper dates |
658 |
|
659 //update the day label |
|
660 //if changes in locale setting |
|
661 updateDayLabel(); |
|
662 |
|
663 // Create the grid items with proper dates |
650 createGrid(); |
664 createGrid(); |
651 |
665 |
652 |
666 |
653 // Complete the population |
667 // Complete the population |
654 completePopulation(); |
668 completePopulation(); |
655 |
669 |
|
670 //set Currect Activity to month view |
|
671 mActivityId = ECalenMonthView; |
|
672 |
|
673 // connect to receive a call back on Month View exit. Call back would result in saveActivity |
|
674 // to be called in Native View. |
|
675 if (!mIsAboutToQuitEventConnected) // check if not already connected |
|
676 { |
|
677 connect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
|
678 mIsAboutToQuitEventConnected = true; |
|
679 } |
|
680 |
|
681 |
656 // Population is complete, inform it |
682 // Population is complete, inform it |
657 populationComplete(); |
683 populationComplete(); |
658 |
684 |
659 // Handle regional data here if we are not populating the month view for |
685 // Handle regional data here if we are not populating the month view for |
660 // the first time |
686 // the first time |
829 void CalenMonthView::createGrid() |
855 void CalenMonthView::createGrid() |
830 { |
856 { |
831 // Update the month grid |
857 // Update the month grid |
832 mMonthGrid->updateMonthGridModel(mMonthDataArray, mIndexToBeScrolled, |
858 mMonthGrid->updateMonthGridModel(mMonthDataArray, mIndexToBeScrolled, |
833 mIsFirstTimeLoad); |
859 mIsFirstTimeLoad); |
834 |
860 // Get start of week from the locale. |
835 // Read the week number setting from cenrep |
861 HbExtendedLocale locale = HbExtendedLocale::system(); |
836 QVariant value = mSettingsManager->readItemValue(*mWeekNumberCenrepKey); |
862 int startOfWeek = locale.startOfWeek(); |
837 mIsWeekNumbersShown = value.toUInt(); |
863 if(startOfWeek != HbExtendedLocale::Monday) |
|
864 { |
|
865 //if the start of week is other than Monday, don't show the week number |
|
866 mIsWeekNumbersShown = 0; |
|
867 } |
|
868 else |
|
869 { |
|
870 // Read the week number setting from cenrep |
|
871 QVariant value = mSettingsManager->readItemValue(*mWeekNumberCenrepKey); |
|
872 mIsWeekNumbersShown = value.toUInt(); |
|
873 } |
838 if (mIsWeekNumbersShown) { |
874 if (mIsWeekNumbersShown) { |
839 // Add week numbers to week grid |
875 // Add week numbers to week grid |
840 addWeekNumbers(); |
876 addWeekNumbers(); |
841 } else { |
877 } else { |
842 // remove the weeknumbergrid from the layout |
878 // remove the weeknumbergrid from the layout |
1420 setCurrGridIndex(index); |
1463 setCurrGridIndex(index); |
1421 // Start the auto scroll on current preview pane |
1464 // Start the auto scroll on current preview pane |
1422 mCurrPreviewPane->startAutoScroll(); |
1465 mCurrPreviewPane->startAutoScroll(); |
1423 mPrevPreviewPane->populateLabel(mDate.addDays(-1)); |
1466 mPrevPreviewPane->populateLabel(mDate.addDays(-1)); |
1424 } |
1467 } |
|
1468 /*! |
|
1469 update the Day labels |
|
1470 */ |
|
1471 void CalenMonthView::updateDayLabel() |
|
1472 { |
|
1473 // Set the short day names to these labels |
|
1474 int startOfWeek = mLocale.startOfWeek(); |
|
1475 int weekDayIndex = startOfWeek; |
|
1476 QStringList weekDayArray ; |
|
1477 weekDayArray <<hbTrId("txt_calendar_grid_day_mo") |
|
1478 <<hbTrId("txt_calendar_grid_day_tu") |
|
1479 <<hbTrId("txt_calendar_grid_day_we") |
|
1480 <<hbTrId("txt_calendar_grid_day_th") |
|
1481 <<hbTrId("txt_calendar_grid_day_fr") |
|
1482 <<hbTrId("txt_calendar_grid_day_sa") |
|
1483 <<hbTrId("txt_calendar_grid_day_su"); |
|
1484 |
|
1485 QList<HbLabel*> labels; |
|
1486 // append seven day labels |
|
1487 labels.append(mFirstDayLabel); |
|
1488 labels.append(mSecondDayLabel); |
|
1489 labels.append(mThirdDayLabel); |
|
1490 labels.append(mFourthDayLabel); |
|
1491 labels.append(mFifthDayLabel); |
|
1492 labels.append(mSixthDayLabel); |
|
1493 labels.append(mSeventhDayLabel); |
|
1494 for(int i=0;i < KCalenDaysInWeek; i++ ) |
|
1495 { |
|
1496 labels.at(i)->setPlainText(weekDayArray[weekDayIndex]); |
|
1497 if(weekDayIndex == KCalenDaysInWeek - 1 )//Sunday |
|
1498 { |
|
1499 weekDayIndex = 0;//reset to monday |
|
1500 continue; |
|
1501 } |
|
1502 weekDayIndex++;//increase the index for next value |
|
1503 } |
|
1504 labels.clear(); |
|
1505 weekDayArray.clear(); |
|
1506 } |
1425 // End of file --Don't remove this. |
1507 // End of file --Don't remove this. |