45
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: CalenDayView class definition.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
55
|
18 |
// System includes
|
45
|
19 |
#include <QDateTime>
|
|
20 |
#include <QGraphicsLinearLayout>
|
|
21 |
#include <xqsettingsmanager.h>
|
55
|
22 |
#include <HbWidget>
|
45
|
23 |
#include <hbaction.h>
|
|
24 |
#include <hbmenu.h>
|
|
25 |
#include <hbmainwindow.h>
|
|
26 |
#include <hbmodeliterator.h>
|
|
27 |
#include <hbstyleloader.h>
|
|
28 |
#include <hbgroupbox.h>
|
|
29 |
#include <hbextendedlocale.h>
|
|
30 |
#include <agendautil.h>
|
55
|
31 |
|
|
32 |
// User includes
|
45
|
33 |
#include "calendayview.h"
|
55
|
34 |
#include "calencommon.h"
|
45
|
35 |
#include "calencontext.h"
|
|
36 |
#include "calenservices.h"
|
|
37 |
#include "calendocloader.h"
|
|
38 |
#include "calendateutils.h" //useful date/time utils
|
|
39 |
#include "calendaycontentscrollarea.h"
|
|
40 |
#include "calendaycontentwidget.h"
|
|
41 |
#include "calendayhourscrollarea.h"
|
|
42 |
#include "calendaymodelmanager.h"
|
|
43 |
#include "CalenUid.h"
|
|
44 |
#include "CalendarPrivateCRKeys.h"
|
|
45 |
#include "calenpluginlabel.h"
|
|
46 |
#include "calendaymodel.h"
|
|
47 |
|
|
48 |
//constants
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
// CalenDayView()
|
|
52 |
// Constructor.
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
CalenDayView::CalenDayView(MCalenServices &services) :
|
|
56 |
CalenNativeView(services), mContentScrollArea(NULL), mContentWidget(NULL),
|
55
|
57 |
mHourScrollArea(NULL), mVLayout(NULL), mDocLoader(NULL), mIsLaunching(
|
|
58 |
true), mSettingsManager(NULL), mRegionalInfo(
|
|
59 |
XQSettingsKey::TargetCentralRepository, KCRUidCalendar,
|
|
60 |
KCalendarShowRegionalInfo), mServices(services),
|
|
61 |
mRegionalInfoGroupBox(NULL), mGoToTodayMenuAction(NULL)
|
45
|
62 |
{
|
|
63 |
setupMenu();
|
55
|
64 |
|
45
|
65 |
// Create model manager
|
55
|
66 |
mModelManager = new CalenDayModelManager(mServices, true, this);
|
45
|
67 |
mSettingsManager = new XQSettingsManager(this);
|
|
68 |
mSettingsManager->startMonitoring(mRegionalInfo);
|
|
69 |
|
|
70 |
//setup Back functionality
|
|
71 |
if (ECalenDayView != mServices.getFirstView()) {
|
|
72 |
HbAction* action = new HbAction(Hb::BackNaviAction, this);
|
|
73 |
setNavigationAction(action);
|
|
74 |
// Connect to the signal triggered by clicking on back button.
|
|
75 |
connect(action, SIGNAL(triggered()), this, SLOT(onBack()));
|
|
76 |
}
|
|
77 |
|
|
78 |
HbStyleLoader::registerFilePath(":/calendayhourelement.css");
|
|
79 |
HbStyleLoader::registerFilePath(":/calendayhourelement.widgetml");
|
|
80 |
HbStyleLoader::registerFilePath(":/calendayitem.css");
|
|
81 |
HbStyleLoader::registerFilePath(":/calendayitem.widgetml");
|
55
|
82 |
HbStyleLoader::registerFilePath(":/calendayeventspane.css");
|
45
|
83 |
}
|
|
84 |
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
// ~CalenDayView()
|
|
87 |
// Destructor.
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
CalenDayView::~CalenDayView()
|
|
91 |
{
|
55
|
92 |
mSettingsManager->stopMonitoring(mRegionalInfo);
|
|
93 |
if (mDocLoader) {
|
|
94 |
delete mDocLoader;
|
|
95 |
mDocLoader = NULL;
|
|
96 |
}
|
45
|
97 |
}
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// onLocaleChanged()
|
|
101 |
// Handles locale change.
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
void CalenDayView::onLocaleChanged(int reason)
|
|
105 |
{
|
|
106 |
Q_UNUSED( reason )
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
// From CalenView
|
|
111 |
// doPopulation()
|
|
112 |
// Handles view (re)population.
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CalenDayView::doPopulation()
|
|
116 |
{
|
|
117 |
// Triggers fading effect for heading label
|
|
118 |
getCurrentDate();
|
|
119 |
HbEffect::start(mHeadingLabel, "fadeOut", this, "setHeadingText");
|
|
120 |
|
|
121 |
mModelManager->refreshAllModels();
|
|
122 |
//Set date and time for hour scroll area.
|
|
123 |
//It's later used by hour element to display timeline
|
|
124 |
mHourScrollArea->setDateTime(mDate);
|
|
125 |
|
|
126 |
//set in menu go to today visible
|
|
127 |
QDateTime currentDateTime = QDateTime::currentDateTime();
|
|
128 |
if (mGoToTodayMenuAction and currentDateTime.date() == mDate.date()) {
|
|
129 |
mGoToTodayMenuAction->setVisible(false);
|
|
130 |
}
|
|
131 |
else if(mGoToTodayMenuAction) {
|
|
132 |
mGoToTodayMenuAction->setVisible(true);
|
|
133 |
}
|
|
134 |
|
55
|
135 |
// Call async. if the view is loaded first time (fix to ou1cimx1#482516)
|
|
136 |
if (mIsLaunching) {
|
|
137 |
mIsLaunching = false;
|
|
138 |
QMetaObject::invokeMethod(this, "setupViewport", Qt::QueuedConnection);
|
|
139 |
} else {
|
|
140 |
setupViewport();
|
|
141 |
}
|
45
|
142 |
|
|
143 |
populationComplete();
|
|
144 |
}
|
|
145 |
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
// From CalenView
|
|
148 |
// populationComplete()
|
|
149 |
// Informs the organizer that the view's population is complete.
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
void CalenDayView::populationComplete()
|
|
153 |
{
|
|
154 |
CalenNativeView::populationComplete();
|
|
155 |
}
|
|
156 |
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
// From MCalenNotificationHandler
|
|
159 |
// HandleNotification()
|
|
160 |
// The function handles calendar notifications.
|
|
161 |
// -----------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
void CalenDayView::HandleNotification(const TCalenNotification notification)
|
|
164 |
{
|
|
165 |
Q_UNUSED( notification )
|
|
166 |
}
|
|
167 |
|
|
168 |
// -----------------------------------------------------------------------------
|
|
169 |
// setupView()
|
|
170 |
// Sets up the view accroding to the 'xml'
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
void CalenDayView::setupView(CalenDocLoader* docLoader)
|
|
174 |
{
|
55
|
175 |
// Store document loader for further use
|
|
176 |
mDocLoader = docLoader;
|
|
177 |
|
|
178 |
// Get vertical layout from day view
|
|
179 |
mVLayout = static_cast<QGraphicsLinearLayout *> (this->layout());
|
|
180 |
|
|
181 |
// Set up day info
|
|
182 |
mHeadingLabel = qobject_cast<HbGroupBox *> (mDocLoader->findWidget(
|
|
183 |
CALEN_DAYVIEW_DAYINFO));
|
|
184 |
HbEffect::add(mHeadingLabel, ":/fade_out.fxml", "fadeOut");
|
|
185 |
HbEffect::add(mHeadingLabel, ":/fade_in.fxml", "fadeIn");
|
|
186 |
|
|
187 |
// Set up hour scroll area
|
|
188 |
mHourScrollArea
|
|
189 |
= static_cast<CalenDayHourScrollArea *> (mDocLoader->findWidget(
|
|
190 |
CALEN_DAYVIEW_HOURSCROLLAREA));
|
|
191 |
|
|
192 |
// Set up content scroll area
|
|
193 |
mContentScrollArea
|
|
194 |
= static_cast<CalenDayContentScrollArea *> (mDocLoader->findWidget(
|
|
195 |
CALEN_DAYVIEW_CONTENTSCROLLAREA));
|
|
196 |
mContentWidget = new CalenDayContentWidget(*mModelManager, NULL);
|
|
197 |
mContentScrollArea->setContentWidget(mContentWidget);
|
|
198 |
|
|
199 |
// Set up regional info if variant is correct
|
|
200 |
showRegionalInformationFadeIn();
|
|
201 |
|
|
202 |
setupSlots();
|
45
|
203 |
}
|
|
204 |
|
|
205 |
//private slots
|
|
206 |
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
// onBack()
|
|
209 |
// Handles 'back' functionality;
|
|
210 |
// -----------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CalenDayView::onBack()
|
|
213 |
{
|
|
214 |
TRAP_IGNORE(mServices.IssueCommandL(ECalenMonthView));
|
|
215 |
}
|
|
216 |
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
// dayChange()
|
|
219 |
// -----------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
void CalenDayView::dayChangeStarted(CalenScrollDirection direction)
|
|
222 |
{
|
|
223 |
if (direction == ECalenScrollToNext) {
|
|
224 |
mDate = mDate.addDays(1);
|
|
225 |
}
|
|
226 |
else {
|
|
227 |
mDate = mDate.addDays(-1);
|
|
228 |
}
|
|
229 |
|
|
230 |
//set in menu go to today visible
|
|
231 |
QDateTime currentDateTime = QDateTime::currentDateTime();
|
|
232 |
if (mGoToTodayMenuAction and currentDateTime.date() == mDate.date()) {
|
|
233 |
mGoToTodayMenuAction->setVisible(false);
|
|
234 |
}
|
|
235 |
else if(mGoToTodayMenuAction) {
|
|
236 |
mGoToTodayMenuAction->setVisible(true);
|
|
237 |
}
|
|
238 |
|
|
239 |
// Triggers fading effect for heading label.
|
|
240 |
HbEffect::start(mHeadingLabel, "fadeOut", this, "setHeadingText");
|
|
241 |
HbEffect::start(mRegionalInfoGroupBox, "fadeOut", this, "showRegionalInformation");
|
|
242 |
|
|
243 |
mServices.Context().setFocusDate(mDate);
|
|
244 |
}
|
|
245 |
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
// dayChanged()
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
void CalenDayView::dayChanged(CalenScrollDirection direction)
|
|
251 |
{
|
|
252 |
mModelManager->viewsScrollingFinished(direction);
|
|
253 |
mHourScrollArea->setDateTime(mDate);
|
|
254 |
}
|
|
255 |
|
|
256 |
// -----------------------------------------------------------------------------
|
|
257 |
// getCurrentDate()
|
|
258 |
// -----------------------------------------------------------------------------
|
|
259 |
//
|
|
260 |
void CalenDayView::getCurrentDate()
|
|
261 |
{
|
|
262 |
mDate = CalenNativeView::mServices.Context().focusDateAndTime();
|
|
263 |
}
|
|
264 |
|
|
265 |
// -----------------------------------------------------------------------------
|
|
266 |
// setupMenu()
|
|
267 |
// -----------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CalenDayView::setupMenu()
|
|
270 |
{
|
|
271 |
menu()->addAction(hbTrId("txt_calendar_opt_new_event"), this, SLOT(runNewMeeting()));
|
|
272 |
//get pointer to this position, because need to change visibility
|
|
273 |
mGoToTodayMenuAction = menu()->addAction(hbTrId("txt_calendar_opt_go_to_today"), this, SLOT(runGoToToday()));
|
|
274 |
menu()->addAction(hbTrId("txt_calendar_opt_go_to_date"), this, SLOT(goToDate()));
|
|
275 |
//TODO: Add id for this text
|
|
276 |
//"Switch to Agenda view"
|
|
277 |
menu()->addAction(hbTrId("txt_calendar_opt_switch_to_agenda_view"), this, SLOT(runChangeToAgendaView()));
|
|
278 |
//TODO: Add id for this text (lunar data)
|
|
279 |
//"Show lunar data"
|
|
280 |
if (pluginEnabled())
|
|
281 |
{
|
|
282 |
menu()->addAction(hbTrId("txt_calendar_opt_show_lunar_data"), this, SLOT(runLunarData()));
|
|
283 |
}
|
|
284 |
menu()->addAction(hbTrId("txt_calendar_opt_settings"), this, SLOT(launchSettingsView()));
|
|
285 |
}
|
|
286 |
|
|
287 |
/*!
|
|
288 |
\brief Ot change Day view to Agenda View
|
|
289 |
*/
|
|
290 |
void CalenDayView::runChangeToAgendaView()
|
|
291 |
{
|
|
292 |
changeView(ECalenAgendaView);
|
|
293 |
}
|
|
294 |
|
|
295 |
/*!
|
|
296 |
\brief Shows lunar data in popup box
|
|
297 |
*/
|
|
298 |
void CalenDayView::runLunarData()
|
|
299 |
{
|
|
300 |
TRAP_IGNORE(mServices.IssueCommandL(ECalenRegionalPluginTapEvent));
|
|
301 |
}
|
|
302 |
|
|
303 |
// -----------------------------------------------------------------------------
|
|
304 |
// setupSlots()
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
void CalenDayView::setupSlots()
|
|
308 |
{
|
|
309 |
// Connecting other view-related signals/slots
|
|
310 |
connect(mContentScrollArea,
|
|
311 |
SIGNAL(scrollAreaMoveStarted(CalenScrollDirection)), this,
|
|
312 |
SLOT(dayChangeStarted(CalenScrollDirection)));
|
|
313 |
|
|
314 |
connect(mContentScrollArea,
|
|
315 |
SIGNAL(scrollAreaMoveFinished(CalenScrollDirection)), mContentWidget,
|
|
316 |
SLOT(relayoutWidgets(CalenScrollDirection)));
|
|
317 |
|
|
318 |
connect(mContentWidget, SIGNAL(
|
|
319 |
widgetsRelayoutFinished(CalenScrollDirection)), mContentScrollArea,
|
|
320 |
SLOT(scrollToMiddleWidget()));
|
|
321 |
|
|
322 |
connect(mContentWidget,
|
|
323 |
SIGNAL(widgetsRelayoutFinished(CalenScrollDirection)), this,
|
|
324 |
SLOT(dayChanged(CalenScrollDirection)));
|
|
325 |
|
|
326 |
connect(mContentWidget, SIGNAL(scrollPositionChanged(const QPointF &)),
|
|
327 |
mHourScrollArea, SLOT(scrollVertically(const QPointF &)));
|
|
328 |
|
|
329 |
connect(mHourScrollArea, SIGNAL(scrollPositionChanged(const QPointF &)),
|
|
330 |
mContentWidget, SLOT(widgetScrolled(const QPointF &)));
|
|
331 |
|
|
332 |
connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
|
|
333 |
this, SLOT(showHideRegionalInformationChanged(XQSettingsKey, QVariant)));
|
|
334 |
}
|
|
335 |
|
|
336 |
// -----------------------------------------------------------------------------
|
|
337 |
// runNewMeeting()
|
|
338 |
// -----------------------------------------------------------------------------
|
|
339 |
//
|
|
340 |
void CalenDayView::runNewMeeting()
|
|
341 |
{
|
|
342 |
QDateTime dateTime(mDate);
|
|
343 |
TRAP_IGNORE(
|
|
344 |
dateTime.setTime(mServices.Context().defaultCalTimeForViewsL().time());
|
|
345 |
mServices.Context().setFocusDateAndTime(dateTime);
|
|
346 |
mServices.IssueCommandL(ECalenNewMeeting)
|
55
|
347 |
);
|
45
|
348 |
}
|
|
349 |
|
|
350 |
// -----------------------------------------------------------------------------
|
|
351 |
// runGoToToday()
|
|
352 |
// -----------------------------------------------------------------------------
|
|
353 |
//
|
|
354 |
void CalenDayView::runGoToToday()
|
|
355 |
{
|
|
356 |
mServices.Context().setFocusDateAndTime(CalenDateUtils::today());
|
|
357 |
TRAP_IGNORE(mServices.IssueCommandL(ECalenGotoToday));
|
|
358 |
refreshViewOnGoToDate();
|
|
359 |
}
|
|
360 |
|
|
361 |
|
|
362 |
// -----------------------------------------------------------------------------
|
|
363 |
// changeView()
|
|
364 |
// -----------------------------------------------------------------------------
|
|
365 |
//
|
|
366 |
void CalenDayView::changeView(TCalenCommandId viewId)
|
|
367 |
{
|
|
368 |
TRAP_IGNORE(mServices.IssueCommandL(viewId));
|
|
369 |
}
|
|
370 |
|
|
371 |
// ----------------------------------------------------------------------------
|
|
372 |
// CalenDayView::setHeadingText
|
|
373 |
// Sets heading text according to date from model and locale.
|
|
374 |
// It's connected to modelReset signal
|
|
375 |
// ----------------------------------------------------------------------------
|
|
376 |
//
|
|
377 |
void CalenDayView::setHeadingText(const HbEffect::EffectStatus &status)
|
|
378 |
{
|
|
379 |
Q_UNUSED(status)
|
|
380 |
|
|
381 |
// Format the date as per the device locale settings
|
|
382 |
HbExtendedLocale systemLocale = HbExtendedLocale::system();
|
|
383 |
|
|
384 |
// Get localised name of the day from locale
|
|
385 |
QString dayString = systemLocale.dayName(mDate.date().dayOfWeek());
|
|
386 |
// Append a single space
|
|
387 |
dayString.append(" ");
|
|
388 |
// Set the heading
|
|
389 |
|
|
390 |
// Append the date which is formatted as per the locale
|
|
391 |
mHeadingLabel->setHeading(hbTrId("txt_calendar_subhead_1_2").arg(dayString).arg(
|
|
392 |
systemLocale.format(mDate.date(), r_qtn_date_usual_with_zero)));
|
|
393 |
|
|
394 |
HbEffect::start(mHeadingLabel, "fadeIn");
|
|
395 |
}
|
|
396 |
|
|
397 |
// ----------------------------------------------------------------------------
|
|
398 |
// CalenDayView::showHideRegionalInformation
|
|
399 |
// To run effect on lunar data label
|
|
400 |
// ----------------------------------------------------------------------------
|
|
401 |
//
|
|
402 |
void CalenDayView::showRegionalInformation(const HbEffect::EffectStatus &status)
|
|
403 |
{
|
|
404 |
Q_UNUSED(status);
|
|
405 |
showRegionalInformationFadeIn();
|
|
406 |
}
|
|
407 |
|
|
408 |
// ----------------------------------------------------------------------------
|
|
409 |
// CalenDayView::showRegionalInformationFadeIn
|
|
410 |
// To run effect on lunar data label and change text according to date change
|
|
411 |
// ----------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
void CalenDayView::showRegionalInformationFadeIn()
|
|
414 |
{
|
|
415 |
showHideRegionalInformationChanged(mRegionalInfo, 3);
|
|
416 |
HbEffect::start(mRegionalInfoGroupBox, "fadeIn");
|
|
417 |
}
|
|
418 |
|
|
419 |
// ----------------------------------------------------------------------------
|
|
420 |
// CalenDayView::showHideRegionalInformationChanged
|
|
421 |
// To Show and hide regional plugin label depends upon settings
|
|
422 |
// ----------------------------------------------------------------------------
|
|
423 |
//
|
55
|
424 |
void CalenDayView::showHideRegionalInformationChanged(
|
|
425 |
const XQSettingsKey& key,
|
|
426 |
const QVariant&)
|
|
427 |
{
|
|
428 |
if (key.key() == mRegionalInfo.key()) {
|
|
429 |
int showRegionalInfo =
|
|
430 |
mSettingsManager->readItemValue(mRegionalInfo).toUInt();
|
45
|
431 |
|
55
|
432 |
if (showRegionalInfo) {
|
|
433 |
QString *pluginString = pluginText();
|
|
434 |
if (pluginString) {
|
|
435 |
if (!mRegionalInfoGroupBox) {
|
|
436 |
mRegionalInfoGroupBox = qobject_cast<HbGroupBox *> (
|
|
437 |
mDocLoader->findWidget(CALEN_DAYVIEW_REGIONALINFO));
|
|
438 |
CalenPluginLabel *regionalInfo = new CalenPluginLabel(
|
|
439 |
mServices, this);
|
|
440 |
HbEffect::add(mRegionalInfoGroupBox, ":/fade_out.fxml",
|
|
441 |
"fadeOut");
|
|
442 |
HbEffect::add(mRegionalInfoGroupBox, ":/fade_in.fxml",
|
|
443 |
"fadeIn");
|
|
444 |
regionalInfo->setContentsMargins(1, 1, 1, 1);
|
|
445 |
mRegionalInfoGroupBox->setContentWidget(regionalInfo);
|
|
446 |
}
|
45
|
447 |
|
55
|
448 |
if (pluginEnabled()) {
|
|
449 |
HbLabel *pluginInfoLabel = qobject_cast<HbLabel *> (
|
|
450 |
mRegionalInfoGroupBox->contentWidget());
|
45
|
451 |
|
55
|
452 |
pluginInfoLabel->setPlainText(*pluginString);
|
|
453 |
mVLayout->insertItem(1, mRegionalInfoGroupBox);
|
|
454 |
}
|
|
455 |
}
|
|
456 |
}
|
|
457 |
else {
|
|
458 |
if (mRegionalInfoGroupBox) {
|
|
459 |
mVLayout->removeItem(mRegionalInfoGroupBox);
|
|
460 |
delete mRegionalInfoGroupBox;
|
|
461 |
mRegionalInfoGroupBox = NULL;
|
|
462 |
}
|
|
463 |
}
|
|
464 |
}
|
|
465 |
}
|
45
|
466 |
|
|
467 |
// ----------------------------------------------------------------------------
|
|
468 |
// CalenDayView::setupViewport
|
|
469 |
// Scrolls view according to current day and events
|
|
470 |
// ----------------------------------------------------------------------------
|
|
471 |
//
|
|
472 |
void CalenDayView::setupViewport()
|
|
473 |
{
|
|
474 |
QDateTime currentTime = QDateTime::currentDateTime();
|
55
|
475 |
|
45
|
476 |
// If we have event in current day and hour, scroll to this event
|
55
|
477 |
if (mDate.date() == currentTime.date()){
|
|
478 |
|
|
479 |
QDateTime midnight = currentTime;
|
|
480 |
midnight.setTime(QTime(23, 59));
|
|
481 |
|
|
482 |
//Filter flags (only timed events)
|
|
483 |
AgendaUtil::FilterFlags filter = AgendaUtil::FilterFlags(AgendaUtil::IncludeAppointments);
|
|
484 |
QList<AgendaEntry> list;
|
|
485 |
// Fetch the instance list from the agenda interface
|
|
486 |
list = mServices.agendaInterface()->fetchEntriesInRange(currentTime, midnight, filter);
|
|
487 |
|
|
488 |
if(!list.isEmpty()){
|
|
489 |
int hourToScrollTo(list.first().startTime().time().hour());
|
|
490 |
mHourScrollArea->scrollToHour(hourToScrollTo);
|
|
491 |
}
|
|
492 |
else{
|
|
493 |
mHourScrollArea->scrollToHour(currentTime.time().hour());
|
|
494 |
}
|
45
|
495 |
}
|
55
|
496 |
else {
|
45
|
497 |
//Scroll view to 7am
|
|
498 |
mHourScrollArea->scrollToHour(7);
|
|
499 |
}
|
|
500 |
}
|
|
501 |
|
|
502 |
//End of File
|