25 #include <hbaction.h> |
25 #include <hbaction.h> |
26 #include <hbview.h> |
26 #include <hbview.h> |
27 #include <hblabel.h> |
27 #include <hblabel.h> |
28 #include <hbframeitem.h> |
28 #include <hbframeitem.h> |
29 #include <hbcolorscheme.h> |
29 #include <hbcolorscheme.h> |
|
30 #include <hbtheme.h> |
30 #include <agendautil.h> |
31 #include <agendautil.h> |
31 #include <agendaentry.h> |
32 #include <agendaentry.h> |
32 #include <hbapplication.h> // hbapplication |
33 #include <hbapplication.h> // hbapplication |
33 #include <hbactivitymanager.h> //Activity Manager |
34 #include <hbactivitymanager.h> //Activity Manager |
34 |
35 |
91 KCRUidCalendar, KCalendarShowWeekNum); |
92 KCRUidCalendar, KCalendarShowWeekNum); |
92 |
93 |
93 mLocale = HbExtendedLocale::system(); |
94 mLocale = HbExtendedLocale::system(); |
94 mFirstWeekLabel = NULL; |
95 mFirstWeekLabel = NULL; |
95 mIsPrevPaneGesture = false; |
96 mIsPrevPaneGesture = false; |
96 // Get the week day color from the theme |
97 // Get the week day and preview heading color from the theme |
97 mWeekDaysColor = HbColorScheme::color("qtc_cal_week_day"); |
98 mWeekDaysColor = HbColorScheme::color("qtc_cal_week_day"); |
98 |
99 |
|
100 mPreviewHeadingColor = HbColorScheme::color("qtc_cal_day_preview_heading"); |
|
101 |
|
102 connect(HbTheme::instance(), SIGNAL(changed()), |
|
103 this, SLOT(handleThemeChange())); |
|
104 |
99 OstTraceFunctionExit0( CALENMONTHVIEW_CALENMONTHVIEW_EXIT ); |
105 OstTraceFunctionExit0( CALENMONTHVIEW_CALENMONTHVIEW_EXIT ); |
100 } |
106 } |
101 |
107 |
102 /*! |
108 /*! |
103 Destructor. |
109 Destructor. |
177 HbLabel* currPaneNoEntriesLabel = static_cast<HbLabel *> ( |
183 HbLabel* currPaneNoEntriesLabel = static_cast<HbLabel *> ( |
178 docLoader->findWidget(CALEN_NOENTRIES_LABEL_CURR)); |
184 docLoader->findWidget(CALEN_NOENTRIES_LABEL_CURR)); |
179 mCurrPreviewPane->setView(this); |
185 mCurrPreviewPane->setView(this); |
180 mCurrPreviewPane->setNoEntriesLabel(currPaneNoEntriesLabel); |
186 mCurrPreviewPane->setNoEntriesLabel(currPaneNoEntriesLabel); |
181 |
187 |
|
188 connect( |
|
189 HbTheme::instance(), SIGNAL(changed()), |
|
190 mCurrPreviewPane, SLOT(handleThemeChange())); |
|
191 |
182 mCurrPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_CURRPANELAYOUT)); |
192 mCurrPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_CURRPANELAYOUT)); |
183 mCurrPaneLayout = static_cast<QGraphicsLinearLayout*>(mCurrPaneLayoutWidget->layout()); |
193 mCurrPaneLayout = static_cast<QGraphicsLinearLayout*>(mCurrPaneLayoutWidget->layout()); |
184 |
194 |
185 mPrevPaneParent = qobject_cast<HbWidget *> ( |
195 mPrevPaneParent = qobject_cast<HbWidget *> ( |
186 mDocLoader->findWidget(CALEN_PREVPREVIEWPARENT)); |
196 mDocLoader->findWidget(CALEN_PREVPREVIEWPARENT)); |
192 mPrevPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); |
202 mPrevPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); |
193 HbLabel* prevPaneNoEntriesLabel = static_cast<HbLabel *> ( |
203 HbLabel* prevPaneNoEntriesLabel = static_cast<HbLabel *> ( |
194 docLoader->findWidget(CALEN_NOENTRIES_LABEL_PREV)); |
204 docLoader->findWidget(CALEN_NOENTRIES_LABEL_PREV)); |
195 mPrevPreviewPane->setView(this); |
205 mPrevPreviewPane->setView(this); |
196 mPrevPreviewPane->setNoEntriesLabel(prevPaneNoEntriesLabel); |
206 mPrevPreviewPane->setNoEntriesLabel(prevPaneNoEntriesLabel); |
|
207 connect( |
|
208 HbTheme::instance(), SIGNAL(changed()), |
|
209 mPrevPreviewPane, SLOT(handleThemeChange())); |
197 mPrevPaneParent->setVisible(false); |
210 mPrevPaneParent->setVisible(false); |
198 |
211 |
199 mPrevPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_PREVPANELAYOUT)); |
212 mPrevPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_PREVPANELAYOUT)); |
200 mPrevPaneLayout = static_cast<QGraphicsLinearLayout*>(mPrevPaneLayoutWidget->layout()); |
213 mPrevPaneLayout = static_cast<QGraphicsLinearLayout*>(mPrevPaneLayoutWidget->layout()); |
201 mNextPaneParent = qobject_cast<HbWidget *> ( |
214 mNextPaneParent = qobject_cast<HbWidget *> ( |
208 mNextPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); |
221 mNextPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); |
209 HbLabel* nextPaneNoEntriesLabel = static_cast<HbLabel *> ( |
222 HbLabel* nextPaneNoEntriesLabel = static_cast<HbLabel *> ( |
210 docLoader->findWidget(CALEN_NOENTRIES_LABEL_NEXT)); |
223 docLoader->findWidget(CALEN_NOENTRIES_LABEL_NEXT)); |
211 mNextPreviewPane->setView(this); |
224 mNextPreviewPane->setView(this); |
212 mNextPreviewPane->setNoEntriesLabel(nextPaneNoEntriesLabel); |
225 mNextPreviewPane->setNoEntriesLabel(nextPaneNoEntriesLabel); |
|
226 connect( |
|
227 HbTheme::instance(), SIGNAL(changed()), |
|
228 mNextPreviewPane, SLOT(handleThemeChange())); |
|
229 |
213 mNextPaneParent->setVisible(false); |
230 mNextPaneParent->setVisible(false); |
214 mNextPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_NEXTPANELAYOUT)); |
231 mNextPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_NEXTPANELAYOUT)); |
215 mNextPaneLayout = static_cast<QGraphicsLinearLayout*>(mNextPaneLayoutWidget->layout()); |
232 mNextPaneLayout = static_cast<QGraphicsLinearLayout*>(mNextPaneLayoutWidget->layout()); |
216 |
233 |
217 mMonthGridPlusWeekNumWidget |
234 mMonthGridPlusWeekNumWidget |
558 mNextRegionalInfo->setBackgroundItem( |
575 mNextRegionalInfo->setBackgroundItem( |
559 frameCurr->graphicsItem(), -2); |
576 frameCurr->graphicsItem(), -2); |
560 } |
577 } |
561 QString *pluginString = pluginText(); |
578 QString *pluginString = pluginText(); |
562 mPrevRegionalInfo->setPlainText(*pluginString); |
579 mPrevRegionalInfo->setPlainText(*pluginString); |
|
580 mPrevRegionalInfo->setTextColor(mPreviewHeadingColor); |
563 mCurrRegionalInfo->setPlainText(*pluginString); |
581 mCurrRegionalInfo->setPlainText(*pluginString); |
|
582 mCurrRegionalInfo->setTextColor(mPreviewHeadingColor); |
564 mNextRegionalInfo->setPlainText(*pluginString); |
583 mNextRegionalInfo->setPlainText(*pluginString); |
|
584 mNextRegionalInfo->setTextColor(mPreviewHeadingColor); |
565 } else { |
585 } else { |
566 if (mPrevRegionalInfo) { |
586 if (mPrevRegionalInfo) { |
567 mPrevPaneLayout->removeItem(mPrevRegionalInfo); |
587 mPrevPaneLayout->removeItem(mPrevRegionalInfo); |
568 mPrevRegionalInfo->hide(); |
588 mPrevRegionalInfo->hide(); |
569 mPrevRegionalInfo = NULL; |
589 mPrevRegionalInfo = NULL; |
570 } |
590 } |
571 if (mCurrRegionalInfo) { |
591 if (mCurrRegionalInfo) { |
572 mPrevPaneLayout->removeItem(mCurrRegionalInfo); |
592 mCurrPaneLayout->removeItem(mCurrRegionalInfo); |
573 mCurrRegionalInfo->hide(); |
593 mCurrRegionalInfo->hide(); |
574 mCurrRegionalInfo = NULL; |
594 mCurrRegionalInfo = NULL; |
575 } |
595 } |
576 if (mNextRegionalInfo) { |
596 if (mNextRegionalInfo) { |
577 mPrevPaneLayout->removeItem(mNextRegionalInfo); |
597 mNextPaneLayout->removeItem(mNextRegionalInfo); |
578 mNextRegionalInfo->hide(); |
598 mNextRegionalInfo->hide(); |
579 mNextRegionalInfo = NULL; |
599 mNextRegionalInfo = NULL; |
580 } |
600 } |
581 } |
601 } |
582 } |
602 } |
1425 OstTraceFunctionEntry0( CALENMONTHVIEW_LAUNCHDAYVIEW_ENTRY ); |
1445 OstTraceFunctionEntry0( CALENMONTHVIEW_LAUNCHDAYVIEW_ENTRY ); |
1426 |
1446 |
1427 mServices.IssueCommandL(ECalenDayView); |
1447 mServices.IssueCommandL(ECalenDayView); |
1428 // day view launched now, disconnect to get the call backs for saveActivity |
1448 // day view launched now, disconnect to get the call backs for saveActivity |
1429 // on aboutToQuit signal |
1449 // on aboutToQuit signal |
1430 if (mIsAboutToQuitEventConnected) |
1450 disconnectAboutToQuitEvent(); |
1431 { |
|
1432 disconnect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
|
1433 mIsAboutToQuitEventConnected = false; |
|
1434 } |
|
1435 |
1451 |
1436 OstTraceFunctionExit0( CALENMONTHVIEW_LAUNCHDAYVIEW_EXIT ); |
1452 OstTraceFunctionExit0( CALENMONTHVIEW_LAUNCHDAYVIEW_EXIT ); |
|
1453 } |
|
1454 |
|
1455 /*! |
|
1456 disconnects for the aboutToQuit events |
|
1457 */ |
|
1458 void CalenMonthView::disconnectAboutToQuitEvent() |
|
1459 { |
|
1460 OstTraceFunctionEntry0( CALENMONTHVIEW_DISCONNECTABOUTTOQUITEVENT_ENTRY ); |
|
1461 |
|
1462 if (mIsAboutToQuitEventConnected) { |
|
1463 disconnect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
|
1464 mIsAboutToQuitEventConnected = false; |
|
1465 } |
|
1466 |
|
1467 OstTraceFunctionExit0( CALENMONTHVIEW_DISCONNECTABOUTTOQUITEVENT_EXIT ); |
1437 } |
1468 } |
1438 |
1469 |
1439 /*! |
1470 /*! |
1440 Slot to handle the change in orientation |
1471 Slot to handle the change in orientation |
1441 */ |
1472 */ |
1448 mOrientation = orientation; |
1479 mOrientation = orientation; |
1449 handleChangeOrientation(); |
1480 handleChangeOrientation(); |
1450 } |
1481 } |
1451 |
1482 |
1452 OstTraceFunctionExit0( CALENMONTHVIEW_CHANGEORIENTATION_EXIT ); |
1483 OstTraceFunctionExit0( CALENMONTHVIEW_CHANGEORIENTATION_EXIT ); |
|
1484 } |
|
1485 |
|
1486 /*! |
|
1487 Slot to handle the change in theme |
|
1488 */ |
|
1489 void CalenMonthView::handleThemeChange() |
|
1490 { |
|
1491 OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLETHEMECHANGE_ENTRY ); |
|
1492 |
|
1493 // Refresh the month view when the theme change happens |
|
1494 mWeekDaysColor = HbColorScheme::color("qtc_cal_week_day"); |
|
1495 QColor monthTitleColor = HbColorScheme::color("qtc_cal_monthgrid_title"); |
|
1496 |
|
1497 if (mTitleLabel && monthTitleColor.isValid()) { |
|
1498 mTitleLabel->setTextColor(monthTitleColor); |
|
1499 } |
|
1500 |
|
1501 mPreviewHeadingColor = HbColorScheme::color("qtc_cal_day_preview_heading"); |
|
1502 |
|
1503 mServices.IssueCommandL(ECalenStartActiveStep); |
|
1504 |
|
1505 OstTraceFunctionExit0( CALENMONTHVIEW_HANDLETHEMECHANGE_EXIT ); |
1453 } |
1506 } |
1454 |
1507 |
1455 /*! |
1508 /*! |
1456 Loads appropriate section from the docml dsepending on the current orientation |
1509 Loads appropriate section from the docml dsepending on the current orientation |
1457 of the device |
1510 of the device |
1719 labels.append(mThirdDayLabel); |
1772 labels.append(mThirdDayLabel); |
1720 labels.append(mFourthDayLabel); |
1773 labels.append(mFourthDayLabel); |
1721 labels.append(mFifthDayLabel); |
1774 labels.append(mFifthDayLabel); |
1722 labels.append(mSixthDayLabel); |
1775 labels.append(mSixthDayLabel); |
1723 labels.append(mSeventhDayLabel); |
1776 labels.append(mSeventhDayLabel); |
|
1777 QGraphicsLinearLayout* layout = static_cast<QGraphicsLinearLayout*> (mDayNameWidget->layout()); |
1724 for(int i=0;i < KCalenDaysInWeek; i++ ) |
1778 for(int i=0;i < KCalenDaysInWeek; i++ ) |
1725 { |
1779 { |
1726 labels.at(i)->setPlainText(weekDayArray[weekDayIndex]); |
1780 labels.at(i)->setPlainText(weekDayArray[weekDayIndex]); |
|
1781 // Set the stretch factor as 1 so that each label occupies equal space |
|
1782 layout->setStretchFactor(labels.at(i), 1); |
1727 if(weekDayIndex == KCalenDaysInWeek - 1 )//Sunday |
1783 if(weekDayIndex == KCalenDaysInWeek - 1 )//Sunday |
1728 { |
1784 { |
1729 weekDayIndex = 0;//reset to monday |
1785 weekDayIndex = 0;//reset to monday |
1730 continue; |
1786 continue; |
1731 } |
1787 } |