113 \param reason the reason of a change |
113 \param reason the reason of a change |
114 */ |
114 */ |
115 void CalenDayView::onLocaleChanged(int reason) |
115 void CalenDayView::onLocaleChanged(int reason) |
116 { |
116 { |
117 Q_UNUSED( reason ) |
117 Q_UNUSED( reason ) |
|
118 if ((reason & EChangesSystemTime) || (reason & EChangesMidnightCrossover)) { |
|
119 mDate = CalenDateUtils::today(); |
|
120 } |
|
121 |
|
122 if ((reason & EChangesLocale)) { |
|
123 mHourScrollArea->localeChanged(); |
|
124 } |
118 } |
125 } |
119 |
126 |
120 /*! |
127 /*! |
121 \brief Reimplemented from CalenView. Handles view (re)population |
128 \brief Reimplemented from CalenView. Handles view (re)population |
122 */ |
129 */ |
128 |
135 |
129 mModelManager->refreshAllModels(); |
136 mModelManager->refreshAllModels(); |
130 //Set date and time for hour scroll area. |
137 //Set date and time for hour scroll area. |
131 //It's later used by hour element to display timeline |
138 //It's later used by hour element to display timeline |
132 mHourScrollArea->setDateTime(mDate); |
139 mHourScrollArea->setDateTime(mDate); |
|
140 |
|
141 isDateValid(); |
133 |
142 |
134 //set in menu go to today visible |
143 //set in menu go to today visible |
135 QDateTime currentDateTime = QDateTime::currentDateTime(); |
144 QDateTime currentDateTime = QDateTime::currentDateTime(); |
136 if (mGoToTodayMenuAction and currentDateTime.date() == mDate.date()) { |
145 if (mGoToTodayMenuAction and currentDateTime.date() == mDate.date()) { |
137 mGoToTodayMenuAction->setVisible(false); |
146 mGoToTodayMenuAction->setVisible(false); |
236 |
245 |
237 \param direction indicates to which day view needs to be scrolled (previous or next day) |
246 \param direction indicates to which day view needs to be scrolled (previous or next day) |
238 */ |
247 */ |
239 void CalenDayView::dayChangeStarted(CalenScrollDirection direction) |
248 void CalenDayView::dayChangeStarted(CalenScrollDirection direction) |
240 { |
249 { |
241 if (direction == ECalenScrollToNext) { |
250 switch (direction) { |
242 mDate = mDate.addDays(1); |
251 case ECalenScrollToNext: |
243 } |
252 mDate = mDate.addDays(1); |
244 else { |
253 break; |
245 mDate = mDate.addDays(-1); |
254 case ECalenScrollToPrev: |
246 } |
255 mDate = mDate.addDays(-1); |
247 |
256 break; |
248 //set in menu go to today visible |
257 default: |
249 QDateTime currentDateTime = QDateTime::currentDateTime(); |
258 break; |
|
259 } |
|
260 |
|
261 // Update the visibility of 'Go to today' option in menu |
|
262 QDateTime currentDateTime = QDateTime::currentDateTime(); |
250 if (mGoToTodayMenuAction and currentDateTime.date() == mDate.date()) { |
263 if (mGoToTodayMenuAction and currentDateTime.date() == mDate.date()) { |
251 mGoToTodayMenuAction->setVisible(false); |
264 mGoToTodayMenuAction->setVisible(false); |
252 } |
265 } |
253 else if(mGoToTodayMenuAction) { |
266 else if(mGoToTodayMenuAction) { |
254 mGoToTodayMenuAction->setVisible(true); |
267 mGoToTodayMenuAction->setVisible(true); |
409 mContentWidget->add(currItemView); |
424 mContentWidget->add(currItemView); |
410 mContentWidget->add(nextItemView); |
425 mContentWidget->add(nextItemView); |
411 } |
426 } |
412 |
427 |
413 /*! |
428 /*! |
|
429 \brief Checks current date and if previous/next days are valid. |
|
430 |
|
431 Checks if previous/next day is in range of supported dates: 1900-01-01 - 2100-12-30 |
|
432 */ |
|
433 void CalenDayView::isDateValid() |
|
434 { |
|
435 // Fix to ou1cimx1#583805: user shouldnot be able to scroll |
|
436 // before 01/01/1900 and after 30/12/2100 |
|
437 mContentScrollArea->setDisallowedScrollDirection(ECalenScrollNoDayChange); |
|
438 if (!CalenDateUtils::isValidDay(mDate.addDays(-1))) { |
|
439 mContentScrollArea->setDisallowedScrollDirection(ECalenScrollToPrev); |
|
440 } |
|
441 else |
|
442 if (!CalenDateUtils::isValidDay(mDate.addDays(1))) { |
|
443 mContentScrollArea->setDisallowedScrollDirection(ECalenScrollToNext); |
|
444 } |
|
445 } |
|
446 |
|
447 /*! |
414 \brief This slot triggers new meeting creation view |
448 \brief This slot triggers new meeting creation view |
415 */ |
449 */ |
416 void CalenDayView::runNewMeeting() |
450 void CalenDayView::runNewMeeting() |
417 { |
451 { |
418 QDateTime dateTime(mDate); |
452 QDateTime dateTime(mDate); |
508 if (!mRegionalInfoGroupBox) { |
542 if (!mRegionalInfoGroupBox) { |
509 mRegionalInfoGroupBox = new HbGroupBox(); |
543 mRegionalInfoGroupBox = new HbGroupBox(); |
510 CalenPluginLabel *regionalInfo = new CalenPluginLabel( |
544 CalenPluginLabel *regionalInfo = new CalenPluginLabel( |
511 mServices, this); |
545 mServices, this); |
512 regionalInfo->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
546 regionalInfo->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
513 |
|
514 // Set margins in groupbox according to UI spec |
|
515 HbStyle style; |
|
516 HbDeviceProfile deviceProfile; |
|
517 qreal leftMargin = 0.0; |
|
518 qreal rightMargin = 0.0; |
|
519 qreal topMargin = 0.0; |
|
520 qreal bottomMargin = 0.0; |
|
521 style.parameter(QString("hb-param-margin-gene-left"), |
|
522 leftMargin, deviceProfile); |
|
523 style.parameter(QString("hb-param-margin-gene-right"), |
|
524 rightMargin, deviceProfile); |
|
525 style.parameter(QString("hb-param-margin-gene-top"), topMargin, |
|
526 deviceProfile); |
|
527 style.parameter(QString("hb-param-margin-gene-bottom"), |
|
528 bottomMargin, deviceProfile); |
|
529 regionalInfo->setContentsMargins(leftMargin, topMargin, |
|
530 rightMargin, bottomMargin); |
|
531 mRegionalInfoGroupBox->setContentWidget(regionalInfo); |
547 mRegionalInfoGroupBox->setContentWidget(regionalInfo); |
532 |
|
533 mVLayout->insertItem(1, mRegionalInfoGroupBox); |
548 mVLayout->insertItem(1, mRegionalInfoGroupBox); |
534 } |
549 } |
535 QString *pluginString = pluginText(); |
550 QString *pluginString = pluginText(); |
536 HbLabel *pluginInfoLabel = qobject_cast<HbLabel *> ( |
551 HbLabel *pluginInfoLabel = qobject_cast<HbLabel *> ( |
537 mRegionalInfoGroupBox->contentWidget()); |
552 mRegionalInfoGroupBox->contentWidget()); |