37 #include "calensettingsview.h" |
37 #include "calensettingsview.h" |
38 #include "calendocloader.h" |
38 #include "calendocloader.h" |
39 #include "calendarui_debug.h" |
39 #include "calendarui_debug.h" |
40 #include "calencommon.h" |
40 #include "calencommon.h" |
41 #include "calendayview.h" |
41 #include "calendayview.h" |
|
42 #include "agendautil.h" |
|
43 #include "OstTraceDefinitions.h" |
|
44 #ifdef OST_TRACE_COMPILER_IN_USE |
|
45 #include "calenviewmanagerTraces.h" |
|
46 #endif |
42 |
47 |
43 // ---------------------------------------------------------------------------- |
48 // ---------------------------------------------------------------------------- |
44 // CalenViewManager::CalenViewManager |
49 // CalenViewManager::CalenViewManager |
45 // 2nd phase of construction. |
50 // 2nd phase of construction. |
46 // (other items were commented in a header). |
51 // (other items were commented in a header). |
47 // ---------------------------------------------------------------------------- |
52 // ---------------------------------------------------------------------------- |
48 // |
53 // |
49 CalenViewManager::CalenViewManager( CCalenController& aController) |
54 CalenViewManager::CalenViewManager( CCalenController& aController) |
50 : mController(aController) |
55 : mController(aController) |
51 { |
56 { |
52 TRACE_ENTRY_POINT; |
57 OstTraceFunctionEntry0( CALENVIEWMANAGER_CALENVIEWMANAGER_ENTRY ); |
53 |
58 |
54 // Following block intializes member variables |
59 // Following block intializes member variables |
55 mCalenEventViewer = NULL; |
60 mCalenEventViewer = NULL; |
56 mMonthViewDocLoader = NULL; |
61 mMonthViewDocLoader = NULL; |
57 mAgendaViewDocLoader = NULL; |
62 mAgendaViewDocLoader = NULL; |
66 // interface |
71 // interface |
67 connect(mController.agendaInterface(), SIGNAL(instanceViewCreationCompleted(int)), |
72 connect(mController.agendaInterface(), SIGNAL(instanceViewCreationCompleted(int)), |
68 this, SLOT(handleInstanceViewCreation(int))); |
73 this, SLOT(handleInstanceViewCreation(int))); |
69 connect(mController.agendaInterface(), SIGNAL(entryViewCreationCompleted(int)), |
74 connect(mController.agendaInterface(), SIGNAL(entryViewCreationCompleted(int)), |
70 this, SLOT(handleEntryViewCreation(int))); |
75 this, SLOT(handleEntryViewCreation(int))); |
71 |
76 connect(mController.agendaInterface(), SIGNAL(entriesChanged(QList<ulong>)), |
72 TRACE_EXIT_POINT; |
77 this, SLOT(handleEntriesChanged(QList<ulong>))); |
|
78 OstTraceFunctionExit0( CALENVIEWMANAGER_CALENVIEWMANAGER_EXIT ); |
73 } |
79 } |
74 |
80 |
75 void CalenViewManager::SecondPhaseConstruction() |
81 void CalenViewManager::SecondPhaseConstruction() |
76 { |
82 { |
77 |
83 OstTraceFunctionEntry0( CALENVIEWMANAGER_SECONDPHASECONSTRUCTION_ENTRY ); |
78 TRACE_ENTRY_POINT; |
|
79 |
84 |
80 // Check the Application Startup reason from Activity Manager |
85 // Check the Application Startup reason from Activity Manager |
81 int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason(); |
86 int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason(); |
82 |
87 |
83 // Check if calendar is launched thru XQService framework |
88 // Check if calendar is launched thru XQService framework |
172 } |
177 } |
173 if (mMonthViewDocLoader) { |
178 if (mMonthViewDocLoader) { |
174 delete mMonthViewDocLoader; |
179 delete mMonthViewDocLoader; |
175 mMonthViewDocLoader = 0; |
180 mMonthViewDocLoader = 0; |
176 } |
181 } |
177 TRACE_EXIT_POINT; |
182 |
|
183 OstTraceFunctionExit0( DUP1_CALENVIEWMANAGER_CALENVIEWMANAGER_EXIT ); |
178 } |
184 } |
179 |
185 |
180 // ---------------------------------------------------------------------------- |
186 // ---------------------------------------------------------------------------- |
181 // CalenViewManager::constructAndActivateView |
187 // CalenViewManager::constructAndActivateView |
182 // Constructs and activates the requested view |
188 // Constructs and activates the requested view |
183 // (other items were commented in a header). |
189 // (other items were commented in a header). |
184 // ---------------------------------------------------------------------------- |
190 // ---------------------------------------------------------------------------- |
185 // |
191 // |
186 void CalenViewManager::constructAndActivateView(int view) |
192 void CalenViewManager::constructAndActivateView(int view) |
187 { |
193 { |
188 TRACE_ENTRY_POINT; |
194 OstTraceFunctionEntry0( CALENVIEWMANAGER_CONSTRUCTANDACTIVATEVIEW_ENTRY ); |
189 // We are here because, some other application is launching calendar with |
195 |
|
196 // We are here because, some other application is launching calendar with |
190 // the view, hence connect to viewReady() signal to do any lazy loading |
197 // the view, hence connect to viewReady() signal to do any lazy loading |
191 // in the slot |
198 // in the slot |
192 |
199 |
193 // Connect to the view ready signal so that we construct other view |
200 // Connect to the view ready signal so that we construct other view |
194 // once this view is shown |
201 // once this view is shown |
207 ActivateDefaultViewL(ECalenAgendaView); |
214 ActivateDefaultViewL(ECalenAgendaView); |
208 // Add agenda view to mainwindow. |
215 // Add agenda view to mainwindow. |
209 mController.MainWindow().addView(mCalenAgendaView); |
216 mController.MainWindow().addView(mCalenAgendaView); |
210 mController.MainWindow().setCurrentView(mCalenAgendaView); |
217 mController.MainWindow().setCurrentView(mCalenAgendaView); |
211 } |
218 } |
212 TRACE_EXIT_POINT; |
219 OstTraceFunctionExit0( CALENVIEWMANAGER_CONSTRUCTANDACTIVATEVIEW_EXIT ); |
213 } |
220 } |
214 |
221 |
215 // ---------------------------------------------------------------------------- |
222 // ---------------------------------------------------------------------------- |
216 // CalenViewManager::loadMonthView |
223 // CalenViewManager::loadMonthView |
217 // Loads month view frm the docml |
224 // Loads month view frm the docml |
218 // (other items were commented in a header). |
225 // (other items were commented in a header). |
219 // ---------------------------------------------------------------------------- |
226 // ---------------------------------------------------------------------------- |
220 // |
227 // |
221 void CalenViewManager::loadMonthView() |
228 void CalenViewManager::loadMonthView() |
222 { |
229 { |
|
230 OstTraceFunctionEntry0( CALENVIEWMANAGER_LOADMONTHVIEW_ENTRY ); |
|
231 |
223 bool loadSuccess = false; |
232 bool loadSuccess = false; |
224 Qt::Orientation currentOrienation = mController.MainWindow().orientation(); |
233 Qt::Orientation currentOrienation = mController.MainWindow().orientation(); |
225 // Create the month view docloader object. |
234 // Create the month view docloader object. |
226 mMonthViewDocLoader = new CalenDocLoader(mController); |
235 mMonthViewDocLoader = new CalenDocLoader(mController); |
227 mMonthViewDocLoader->load(CALEN_MONTHVIEW_XML_FILE, &loadSuccess); |
236 mMonthViewDocLoader->load(CALEN_MONTHVIEW_XML_FILE, &loadSuccess); |
243 Q_ASSERT_X(mCalenMonthView, "calenviewmanager.cpp", |
252 Q_ASSERT_X(mCalenMonthView, "calenviewmanager.cpp", |
244 "Unable to load calenMonth view"); |
253 "Unable to load calenMonth view"); |
245 |
254 |
246 // Setup the month view. |
255 // Setup the month view. |
247 mCalenMonthView->setupView(mMonthViewDocLoader); |
256 mCalenMonthView->setupView(mMonthViewDocLoader); |
|
257 |
|
258 OstTraceFunctionExit0( CALENVIEWMANAGER_LOADMONTHVIEW_EXIT ); |
248 } |
259 } |
249 |
260 |
250 // ---------------------------------------------------------------------------- |
261 // ---------------------------------------------------------------------------- |
251 // CalenViewManager::loadAgendaView |
262 // CalenViewManager::loadAgendaView |
252 // Loads the agenda view frm the docml |
263 // Loads the agenda view frm the docml |
253 // (other items were commented in a header). |
264 // (other items were commented in a header). |
254 // ---------------------------------------------------------------------------- |
265 // ---------------------------------------------------------------------------- |
255 // |
266 // |
256 void CalenViewManager::loadAgendaView() |
267 void CalenViewManager::loadAgendaView() |
257 { |
268 { |
|
269 OstTraceFunctionEntry0( CALENVIEWMANAGER_LOADAGENDAVIEW_ENTRY ); |
|
270 |
258 bool loadSuccess = false; |
271 bool loadSuccess = false; |
259 // Create the agenda view docloader object. |
272 // Create the agenda view docloader object. |
260 mAgendaViewDocLoader = new CalenDocLoader(mController); |
273 mAgendaViewDocLoader = new CalenDocLoader(mController); |
261 |
274 |
262 // Load default section |
275 // Load default section |
278 // in agenda view. Idea is to create two views and keep |
291 // in agenda view. Idea is to create two views and keep |
279 // switiching between these two using view switch effects |
292 // switiching between these two using view switch effects |
280 // to provide an illusion of flow to the user |
293 // to provide an illusion of flow to the user |
281 loadAlternateAgendaView(); |
294 loadAlternateAgendaView(); |
282 |
295 |
|
296 OstTraceFunctionExit0( CALENVIEWMANAGER_LOADAGENDAVIEW_EXIT ); |
283 } |
297 } |
284 |
298 |
285 // ---------------------------------------------------------------------------- |
299 // ---------------------------------------------------------------------------- |
286 // CalenViewManager::handleMainViewReady |
300 // CalenViewManager::handleMainViewReady |
287 // Slot to handle viewReady() signal from mainwindow |
301 // Slot to handle viewReady() signal from mainwindow |
288 // (other items were commented in a header). |
302 // (other items were commented in a header). |
289 // ---------------------------------------------------------------------------- |
303 // ---------------------------------------------------------------------------- |
290 // |
304 // |
291 void CalenViewManager::handleMainViewReady() |
305 void CalenViewManager::handleMainViewReady() |
292 { |
306 { |
|
307 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEMAINVIEWREADY_ENTRY ); |
|
308 |
293 // Construct the month view part that is kept for lazy loading |
309 // Construct the month view part that is kept for lazy loading |
294 if (mCalenMonthView) { |
310 if (mCalenMonthView) { |
295 mCalenMonthView->doLazyLoading(); |
311 mCalenMonthView->doLazyLoading(); |
296 } |
312 } |
297 |
313 |
303 //hbInstance->allMainWindows().first()->installEventFilter(&mController); |
319 //hbInstance->allMainWindows().first()->installEventFilter(&mController); |
304 |
320 |
305 // disconnect the view ready signal as we dont need it anymore |
321 // disconnect the view ready signal as we dont need it anymore |
306 disconnect(&mController.MainWindow(), SIGNAL(viewReady()), |
322 disconnect(&mController.MainWindow(), SIGNAL(viewReady()), |
307 this, SLOT(handleMainViewReady())); |
323 this, SLOT(handleMainViewReady())); |
|
324 |
|
325 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEMAINVIEWREADY_EXIT ); |
308 } |
326 } |
309 |
327 |
310 // ---------------------------------------------------------------------------- |
328 // ---------------------------------------------------------------------------- |
311 // CalenViewManager::constructOtherViews |
329 // CalenViewManager::constructOtherViews |
312 // Constructs the other views apart frm firstview and adds them to main window |
330 // Constructs the other views apart frm firstview and adds them to main window |
313 // (other items were commented in a header). |
331 // (other items were commented in a header). |
314 // ---------------------------------------------------------------------------- |
332 // ---------------------------------------------------------------------------- |
315 // |
333 // |
316 void CalenViewManager::constructOtherViews() |
334 void CalenViewManager::constructOtherViews() |
317 { |
335 { |
|
336 OstTraceFunctionEntry0( CALENVIEWMANAGER_CONSTRUCTOTHERVIEWS_ENTRY ); |
|
337 |
318 // Load all other views except mFirstView |
338 // Load all other views except mFirstView |
319 |
339 |
320 // NOTE: Right now, since Calendar has only two views, month view |
340 // NOTE: Right now, since Calendar has only two views, month view |
321 // and agenda view, when client launches agenda view, then there is no need |
341 // and agenda view, when client launches agenda view, then there is no need |
322 // to construct the month view as per UI REQ., but tomorrow if new views |
342 // to construct the month view as per UI REQ., but tomorrow if new views |
342 // mCalenMonthView->doLazyLoading(); |
362 // mCalenMonthView->doLazyLoading(); |
343 } |
363 } |
344 |
364 |
345 // Setup the settings view |
365 // Setup the settings view |
346 mSettingsView = new CalenSettingsView(mController.Services()); |
366 mSettingsView = new CalenSettingsView(mController.Services()); |
|
367 |
|
368 OstTraceFunctionExit0( CALENVIEWMANAGER_CONSTRUCTOTHERVIEWS_EXIT ); |
347 } |
369 } |
348 |
370 |
349 // ---------------------------------------------------------------------------- |
371 // ---------------------------------------------------------------------------- |
350 // CalenViewManager::getFirstView |
372 // CalenViewManager::getFirstView |
351 // Returns the first view |
373 // Returns the first view |
352 // (other items were commented in a header). |
374 // (other items were commented in a header). |
353 // ---------------------------------------------------------------------------- |
375 // ---------------------------------------------------------------------------- |
354 // |
376 // |
355 int CalenViewManager::getFirstView() |
377 int CalenViewManager::getFirstView() |
356 { |
378 { |
|
379 OstTraceFunctionEntry0( CALENVIEWMANAGER_GETFIRSTVIEW_ENTRY ); |
|
380 |
|
381 OstTraceFunctionExit0( CALENVIEWMANAGER_GETFIRSTVIEW_EXIT ); |
357 return mFirstView; |
382 return mFirstView; |
358 } |
383 } |
359 |
384 |
360 // ---------------------------------------------------------------------------- |
385 // ---------------------------------------------------------------------------- |
361 // CalenViewManager::showNextDay |
386 // CalenViewManager::showNextDay |
362 // other items were commented in a header |
387 // other items were commented in a header |
363 // ---------------------------------------------------------------------------- |
388 // ---------------------------------------------------------------------------- |
364 // |
389 // |
365 void CalenViewManager::showNextDay() |
390 void CalenViewManager::showNextDay() |
366 { |
391 { |
|
392 OstTraceFunctionEntry0( CALENVIEWMANAGER_SHOWNEXTDAY_ENTRY ); |
|
393 |
367 // Set the context for the next day |
394 // Set the context for the next day |
368 QDateTime currentDay = mController.Services().Context().focusDateAndTime(); |
395 QDateTime currentDay = mController.Services().Context().focusDateAndTime(); |
369 currentDay = currentDay.addDays(1); |
396 currentDay = currentDay.addDays(1); |
370 mController.Services().Context().setFocusDate(currentDay); |
397 mController.Services().Context().setFocusDate(currentDay); |
371 mCurrentViewId = ECalenAgendaView; |
398 mCurrentViewId = ECalenAgendaView; |
393 "show"); |
420 "show"); |
394 // It would also connect for aboutToQuit events |
421 // It would also connect for aboutToQuit events |
395 mCalenAgendaView->doPopulation(); |
422 mCalenAgendaView->doPopulation(); |
396 mController.MainWindow().setCurrentView(mCalenAgendaView, true, Hb::ViewSwitchUseNormalAnim); |
423 mController.MainWindow().setCurrentView(mCalenAgendaView, true, Hb::ViewSwitchUseNormalAnim); |
397 } |
424 } |
|
425 OstTraceFunctionExit0( CALENVIEWMANAGER_SHOWNEXTDAY_EXIT ); |
398 } |
426 } |
399 |
427 |
400 // ---------------------------------------------------------------------------- |
428 // ---------------------------------------------------------------------------- |
401 // CalenViewManager::showPrevDay |
429 // CalenViewManager::showPrevDay |
402 // other items were commented in a header |
430 // other items were commented in a header |
403 // ---------------------------------------------------------------------------- |
431 // ---------------------------------------------------------------------------- |
404 // |
432 // |
405 void CalenViewManager::showPrevDay() |
433 void CalenViewManager::showPrevDay() |
406 { |
434 { |
|
435 OstTraceFunctionEntry0( CALENVIEWMANAGER_SHOWPREVDAY_ENTRY ); |
|
436 |
407 QDateTime currentDay = mController.Services().Context().focusDateAndTime(); |
437 QDateTime currentDay = mController.Services().Context().focusDateAndTime(); |
408 currentDay = currentDay.addDays(-1); |
438 currentDay = currentDay.addDays(-1); |
409 mController.Services().Context().setFocusDate(currentDay); |
439 mController.Services().Context().setFocusDate(currentDay); |
410 mCurrentViewId = ECalenAgendaView; |
440 mCurrentViewId = ECalenAgendaView; |
411 if (mController.MainWindow().currentView() == mCalenAgendaView) { |
441 if (mController.MainWindow().currentView() == mCalenAgendaView) { |
429 "show"); |
459 "show"); |
430 // It would also connect for aboutToQuit events |
460 // It would also connect for aboutToQuit events |
431 mCalenAgendaView->doPopulation(); |
461 mCalenAgendaView->doPopulation(); |
432 mController.MainWindow().setCurrentView(mCalenAgendaView, true, Hb::ViewSwitchUseNormalAnim); |
462 mController.MainWindow().setCurrentView(mCalenAgendaView, true, Hb::ViewSwitchUseNormalAnim); |
433 } |
463 } |
|
464 |
|
465 OstTraceFunctionExit0( CALENVIEWMANAGER_SHOWPREVDAY_EXIT ); |
434 } |
466 } |
435 |
467 |
436 // ---------------------------------------------------------------------------- |
468 // ---------------------------------------------------------------------------- |
437 // CalenViewManager::removePreviousView |
469 // CalenViewManager::removePreviousView |
438 // Remove the previous view from main window |
470 // Remove the previous view from main window |
439 // ---------------------------------------------------------------------------- |
471 // ---------------------------------------------------------------------------- |
440 // |
472 // |
441 void CalenViewManager::removePreviousView() |
473 void CalenViewManager::removePreviousView() |
442 { |
474 { |
|
475 OstTraceFunctionEntry0( CALENVIEWMANAGER_REMOVEPREVIOUSVIEW_ENTRY ); |
|
476 |
443 if (ECalenAgendaView == mCurrentViewId) { |
477 if (ECalenAgendaView == mCurrentViewId) { |
444 mCalenAgendaView->clearListModel(); |
478 mCalenAgendaView->clearListModel(); |
445 mCalenAgendaViewAlt->clearListModel(); |
479 mCalenAgendaViewAlt->clearListModel(); |
446 mController.MainWindow().removeView(mCalenAgendaView); |
480 mController.MainWindow().removeView(mCalenAgendaView); |
447 mController.MainWindow().removeView(mCalenAgendaViewAlt); |
481 mController.MainWindow().removeView(mCalenAgendaViewAlt); |
451 if (ECalenMonthView == mCurrentViewId) { |
485 if (ECalenMonthView == mCurrentViewId) { |
452 mController.MainWindow().removeView(mCalenMonthView); |
486 mController.MainWindow().removeView(mCalenMonthView); |
453 } |
487 } |
454 } |
488 } |
455 |
489 |
|
490 OstTraceFunctionExit0( CALENVIEWMANAGER_REMOVEPREVIOUSVIEW_EXIT ); |
456 } |
491 } |
457 |
492 |
458 // ---------------------------------------------------------------------------- |
493 // ---------------------------------------------------------------------------- |
459 // CalenViewManager::~ActivateDefaultViewL |
494 // CalenViewManager::~ActivateDefaultViewL |
460 // Activates the default view, as retrieved from settings. |
495 // Activates the default view, as retrieved from settings. |
461 // (other items were commented in a header). |
496 // (other items were commented in a header). |
462 // ---------------------------------------------------------------------------- |
497 // ---------------------------------------------------------------------------- |
463 // |
498 // |
464 void CalenViewManager::ActivateDefaultViewL(int defaultView) |
499 void CalenViewManager::ActivateDefaultViewL(int defaultView) |
465 { |
500 { |
466 TRACE_ENTRY_POINT; |
501 OstTraceFunctionEntry0( CALENVIEWMANAGER_ACTIVATEDEFAULTVIEWL_ENTRY ); |
|
502 |
467 mCurrentViewId = defaultView; |
503 mCurrentViewId = defaultView; |
468 if (ECalenMonthView == defaultView) { |
504 if (ECalenMonthView == defaultView) { |
469 mCalenMonthView->doPopulation(); |
505 mCalenMonthView->doPopulation(); |
470 } else if (ECalenAgendaView == defaultView) { |
506 } else if (ECalenAgendaView == defaultView) { |
471 mCalenAgendaView->doPopulation(); |
507 mCalenAgendaView->doPopulation(); |
472 } |
508 } |
473 TRACE_EXIT_POINT; |
509 OstTraceFunctionExit0( CALENVIEWMANAGER_ACTIVATEDEFAULTVIEWL_EXIT ); |
474 } |
510 } |
475 |
511 |
476 // ---------------------------------------------------------------------------- |
512 // ---------------------------------------------------------------------------- |
477 // Refresh current view. |
513 // Refresh current view. |
478 // (other items were commented in a header). |
514 // (other items were commented in a header). |
479 // ---------------------------------------------------------------------------- |
515 // ---------------------------------------------------------------------------- |
480 void CalenViewManager::refreshCurrentViewL() |
516 void CalenViewManager::refreshCurrentViewL() |
481 { |
517 { |
482 TRACE_ENTRY_POINT; |
518 OstTraceFunctionEntry0( CALENVIEWMANAGER_REFRESHCURRENTVIEWL_ENTRY ); |
|
519 |
483 activateCurrentView(); |
520 activateCurrentView(); |
484 TRACE_EXIT_POINT; |
521 |
|
522 OstTraceFunctionExit0( CALENVIEWMANAGER_REFRESHCURRENTVIEWL_EXIT ); |
485 } |
523 } |
486 |
524 |
487 // ---------------------------------------------------------------------------- |
525 // ---------------------------------------------------------------------------- |
488 // Activate current view. |
526 // Activate current view. |
489 // (other items were commented in a header). |
527 // (other items were commented in a header). |
490 // ---------------------------------------------------------------------------- |
528 // ---------------------------------------------------------------------------- |
491 void CalenViewManager::activateCurrentView() |
529 void CalenViewManager::activateCurrentView() |
492 { |
530 { |
493 TRACE_ENTRY_POINT; |
531 OstTraceFunctionEntry0( CALENVIEWMANAGER_ACTIVATECURRENTVIEW_ENTRY ); |
|
532 |
494 switch (mCurrentViewId) { |
533 switch (mCurrentViewId) { |
495 case ECalenMonthView: |
534 case ECalenMonthView: |
496 mCalenMonthView->doPopulation(); |
535 mCalenMonthView->doPopulation(); |
497 mController.MainWindow().setCurrentView(mCalenMonthView); |
536 mController.MainWindow().setCurrentView(mCalenMonthView); |
498 break; |
537 break; |
530 case ECalenDayView: |
569 case ECalenDayView: |
531 mCalenDayView->doPopulation(); |
570 mCalenDayView->doPopulation(); |
532 mController.MainWindow().setCurrentView(mCalenDayView); |
571 mController.MainWindow().setCurrentView(mCalenDayView); |
533 break; |
572 break; |
534 } |
573 } |
535 TRACE_EXIT_POINT; |
574 |
|
575 OstTraceFunctionExit0( CALENVIEWMANAGER_ACTIVATECURRENTVIEW_EXIT ); |
536 } |
576 } |
537 |
577 |
538 // ---------------------------------------------------------------------------- |
578 // ---------------------------------------------------------------------------- |
539 // CalenViewManager::launchEventView |
579 // CalenViewManager::launchEventView |
540 // Launch event view. |
580 // Launch event view. |
541 // (other items were commented in a header). |
581 // (other items were commented in a header). |
542 // ---------------------------------------------------------------------------- |
582 // ---------------------------------------------------------------------------- |
543 // |
583 // |
544 void CalenViewManager::launchEventView() |
584 void CalenViewManager::launchEventView() |
545 { |
585 { |
|
586 OstTraceFunctionEntry0( CALENVIEWMANAGER_LAUNCHEVENTVIEW_ENTRY ); |
|
587 |
546 // capture cureent view in case app closed/quits from AgendaEventViewer |
588 // capture cureent view in case app closed/quits from AgendaEventViewer |
547 if (mCalenMonthView) { |
589 if (mCalenMonthView) { |
548 mCalenMonthView->captureScreenshot(true); |
590 mCalenMonthView->captureScreenshot(true); |
549 } |
591 } |
550 else if (mCalenAgendaView) { |
592 else if (mCalenAgendaView) { |
573 this, SLOT(handleDeletingCompleted())); |
615 this, SLOT(handleDeletingCompleted())); |
574 |
616 |
575 |
617 |
576 // Launch agenda event viewer |
618 // Launch agenda event viewer |
577 mCalenEventViewer->view(viewEntry, AgendaEventViewer::ActionEditDelete); |
619 mCalenEventViewer->view(viewEntry, AgendaEventViewer::ActionEditDelete); |
|
620 OstTraceFunctionExit0( CALENVIEWMANAGER_LAUNCHEVENTVIEW_EXIT ); |
578 } |
621 } |
579 |
622 |
580 // ---------------------------------------------------------------------------- |
623 // ---------------------------------------------------------------------------- |
581 // CalenViewManager::loadAlternateAgendaView |
624 // CalenViewManager::loadAlternateAgendaView |
582 // other items were commented in a header |
625 // other items were commented in a header |
583 // ---------------------------------------------------------------------------- |
626 // ---------------------------------------------------------------------------- |
584 // |
627 // |
585 void CalenViewManager::loadAlternateAgendaView() |
628 void CalenViewManager::loadAlternateAgendaView() |
586 { |
629 { |
|
630 OstTraceFunctionEntry0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_ENTRY ); |
|
631 |
587 bool loadSuccess = false; |
632 bool loadSuccess = false; |
588 // Create the agenda view docloader object. |
633 // Create the agenda view docloader object. |
589 mAgendaViewAltDocLoader = new CalenDocLoader(mController); |
634 mAgendaViewAltDocLoader = new CalenDocLoader(mController); |
590 |
635 |
591 // Load default section |
636 // Load default section |
600 qFatal("calenviewmanager.cpp : Unable to find alternate agenda view"); |
645 qFatal("calenviewmanager.cpp : Unable to find alternate agenda view"); |
601 } |
646 } |
602 |
647 |
603 // Setup the agenda view |
648 // Setup the agenda view |
604 mCalenAgendaViewAlt->setupView(mAgendaViewAltDocLoader); |
649 mCalenAgendaViewAlt->setupView(mAgendaViewAltDocLoader); |
|
650 OstTraceFunctionExit0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_EXIT ); |
605 } |
651 } |
606 |
652 |
607 // ---------------------------------------------------------------------------- |
653 // ---------------------------------------------------------------------------- |
608 // CalenViewManager::HandleCommandL |
654 // CalenViewManager::HandleCommandL |
609 // Handles view manager commands. |
655 // Handles view manager commands. |
610 // @return ETrue if command is handled, EFalse otherwise |
656 // @return ETrue if command is handled, EFalse otherwise |
611 // ---------------------------------------------------------------------------- |
657 // ---------------------------------------------------------------------------- |
612 // |
658 // |
613 TBool CalenViewManager::HandleCommandL(const TCalenCommand& command) |
659 TBool CalenViewManager::HandleCommandL(const TCalenCommand& command) |
614 { |
660 { |
615 TRACE_ENTRY_POINT; |
661 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLECOMMANDL_ENTRY ); |
|
662 |
616 TBool commandUsed(EFalse); |
663 TBool commandUsed(EFalse); |
617 |
664 |
618 switch (command.Command()) { |
665 switch (command.Command()) { |
619 case ECalenMonthView: |
666 case ECalenMonthView: |
620 // First remove the previous native view before |
667 // First remove the previous native view before |
665 // ---------------------------------------------------------------------------- |
712 // ---------------------------------------------------------------------------- |
666 // |
713 // |
667 void CalenViewManager::HandleNotification( |
714 void CalenViewManager::HandleNotification( |
668 const TCalenNotification notification) |
715 const TCalenNotification notification) |
669 { |
716 { |
670 TRACE_ENTRY_POINT; |
717 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLENOTIFICATION_ENTRY ); |
|
718 |
671 switch (notification) { |
719 switch (notification) { |
672 case ECalenNotifyExternalDatabaseChanged: |
720 case ECalenNotifyExternalDatabaseChanged: |
673 case ECalenNotifyDialogClosed: |
721 case ECalenNotifyDialogClosed: |
674 case ECalenNotifyMultipleEntriesDeleted: |
722 case ECalenNotifyMultipleEntriesDeleted: |
675 case ECalenNotifyEntrySaved: |
723 case ECalenNotifyEntrySaved: |
676 case ECalenNotifyEntryDeleted: |
724 case ECalenNotifyEntryDeleted: |
677 case ECalenNotifyInstanceDeleted: |
725 case ECalenNotifyInstanceDeleted: |
678 case ECalenNotifyEntryClosed: |
726 case ECalenNotifyEntryClosed: |
679 case ECalenNotifySystemLocaleChanged: |
727 case ECalenNotifySystemLocaleChanged: |
680 case ECalenNotifySystemLanguageChanged: |
728 case ECalenNotifySystemLanguageChanged: { |
681 { |
729 activateCurrentView(); |
682 activateCurrentView(); |
730 if (mCalenMonthView) { |
683 } |
731 mCalenMonthView->captureScreenshot(); |
|
732 } else if (mCalenAgendaView) { |
|
733 mCalenAgendaView->captureScreenshot(); |
|
734 } |
|
735 } |
684 break; |
736 break; |
685 case ECalenNotifySettingsClosed: |
737 case ECalenNotifySettingsClosed: { |
686 { |
|
687 //when setting view closed , switch to the previous view |
738 //when setting view closed , switch to the previous view |
688 mCurrentViewId = mPreviousViewsId ; |
739 mCurrentViewId = mPreviousViewsId ; |
689 mController.Services().IssueCommandL(ECalenStartActiveStep); |
740 mController.Services().IssueCommandL(ECalenStartActiveStep); |
690 |
741 |
691 // invalidate captured screenshots as either agenda view is activated now |
742 // invalidate captured screenshots as either agenda view is activated now |
720 // (other items were commented in a header). |
774 // (other items were commented in a header). |
721 // ---------------------------------------------------------------------------- |
775 // ---------------------------------------------------------------------------- |
722 // |
776 // |
723 void CalenViewManager::handleViewingCompleted(const QDate date) |
777 void CalenViewManager::handleViewingCompleted(const QDate date) |
724 { |
778 { |
|
779 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEVIEWINGCOMPLETED_ENTRY ); |
725 |
780 |
726 // Cleanup. |
781 // Cleanup. |
727 mCalenEventViewer->deleteLater(); |
782 mCalenEventViewer->deleteLater(); |
728 if (!date.isNull() && date.isValid()) { |
|
729 mController.Services().Context().setFocusDate(QDateTime(date)); |
|
730 } |
|
731 mController.Services().IssueNotificationL(ECalenNotifyEntryClosed); |
783 mController.Services().IssueNotificationL(ECalenNotifyEntryClosed); |
732 |
784 |
733 // invalidate captured screenshots as either agenda view is activated now |
785 // invalidate captured screenshots as either agenda view is activated now |
734 if (mCalenMonthView) { |
786 if (mCalenMonthView) { |
735 mCalenMonthView->captureScreenshot(); |
787 mCalenMonthView->captureScreenshot(); |
736 } else if (mCalenAgendaView) { |
788 } else if (mCalenAgendaView) { |
737 mCalenAgendaView->captureScreenshot(); |
789 mCalenAgendaView->captureScreenshot(); |
738 } |
790 } |
|
791 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEVIEWINGCOMPLETED_EXIT ); |
739 } |
792 } |
740 |
793 |
741 // ---------------------------------------------------------------------------- |
794 // ---------------------------------------------------------------------------- |
742 // CalenViewManager::handleEditingStarted |
795 // CalenViewManager::handleEditingStarted |
743 // Slot to handle signal editingStarted by the agenda event viewer |
796 // Slot to handle signal editingStarted by the agenda event viewer |
744 // (other items were commented in a header). |
797 // (other items were commented in a header). |
745 // ---------------------------------------------------------------------------- |
798 // ---------------------------------------------------------------------------- |
746 // |
799 // |
747 void CalenViewManager::handleEditingStarted() |
800 void CalenViewManager::handleEditingStarted() |
748 { |
801 { |
|
802 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEEDITINGSTARTED_ENTRY ); |
749 |
803 |
750 mController.IssueCommandL(ECalenEditEntryFromViewer); |
804 mController.IssueCommandL(ECalenEditEntryFromViewer); |
751 |
805 |
|
806 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEEDITINGSTARTED_EXIT ); |
752 } |
807 } |
753 |
808 |
754 // ---------------------------------------------------------------------------- |
809 // ---------------------------------------------------------------------------- |
755 // CalenViewManager::handleEditingCompleted |
810 // CalenViewManager::handleEditingCompleted |
756 // Slot to handle signal editingCompleted by the agenda event viewer |
811 // Slot to handle signal editingCompleted by the agenda event viewer |
757 // (other items were commented in a header). |
812 // (other items were commented in a header). |
758 // ---------------------------------------------------------------------------- |
813 // ---------------------------------------------------------------------------- |
759 // |
814 // |
760 void CalenViewManager::handleEditingCompleted() |
815 void CalenViewManager::handleEditingCompleted() |
761 { |
816 { |
|
817 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEEDITINGCOMPLETED_ENTRY ); |
762 |
818 |
763 mController.Services().IssueNotificationL(ECalenNotifyEditorClosedFromViewer); |
819 mController.Services().IssueNotificationL(ECalenNotifyEditorClosedFromViewer); |
764 |
820 |
|
821 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEEDITINGCOMPLETED_EXIT ); |
765 } |
822 } |
766 |
823 |
767 // ---------------------------------------------------------------------------- |
824 // ---------------------------------------------------------------------------- |
768 // CalenViewManager::handleDeletingStarted |
825 // CalenViewManager::handleDeletingStarted |
769 // Slot to handle signal deletingStarted by the agenda event viewer |
826 // Slot to handle signal deletingStarted by the agenda event viewer |
770 // (other items were commented in a header). |
827 // (other items were commented in a header). |
771 // ---------------------------------------------------------------------------- |
828 // ---------------------------------------------------------------------------- |
772 // |
829 // |
773 void CalenViewManager::handleDeletingStarted() |
830 void CalenViewManager::handleDeletingStarted() |
774 { |
831 { |
|
832 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEDELETINGSTARTED_ENTRY ); |
775 |
833 |
776 mController.IssueCommandL(ECalenDeleteEntryFromViewer); |
834 mController.IssueCommandL(ECalenDeleteEntryFromViewer); |
777 |
835 |
|
836 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEDELETINGSTARTED_EXIT ); |
778 } |
837 } |
779 |
838 |
780 // ---------------------------------------------------------------------------- |
839 // ---------------------------------------------------------------------------- |
781 // CalenViewManager::handleDeletingCompleted |
840 // CalenViewManager::handleDeletingCompleted |
782 // Slot to handle signal deletingCompleted by the agenda event viewer |
841 // Slot to handle signal deletingCompleted by the agenda event viewer |
783 // (other items were commented in a header). |
842 // (other items were commented in a header). |
784 // ---------------------------------------------------------------------------- |
843 // ---------------------------------------------------------------------------- |
785 // |
844 // |
786 void CalenViewManager::handleDeletingCompleted() |
845 void CalenViewManager::handleDeletingCompleted() |
787 { |
846 { |
|
847 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEDELETINGCOMPLETED_ENTRY ); |
788 |
848 |
789 mController.Services().IssueNotificationL(ECalenNotifyEntryDeleted); |
849 mController.Services().IssueNotificationL(ECalenNotifyEntryDeleted); |
790 |
850 |
791 // invalidate captured screenshots as either month view or agenda view is activated now |
851 // invalidate captured screenshots as either month view or agenda view is activated now |
792 if (mCalenMonthView) { |
852 if (mCalenMonthView) { |
793 mCalenMonthView->captureScreenshot(); |
853 mCalenMonthView->captureScreenshot(); |
794 } else if (mCalenAgendaView) { |
854 } else if (mCalenAgendaView) { |
795 mCalenAgendaView->captureScreenshot(); |
855 mCalenAgendaView->captureScreenshot(); |
796 } |
856 } |
797 |
857 |
798 |
858 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEDELETINGCOMPLETED_EXIT ); |
799 } |
859 } |
800 |
860 |
801 // ---------------------------------------------------------------------------- |
861 // ---------------------------------------------------------------------------- |
802 // CalenViewManager::handleInstanceViewCreation |
862 // CalenViewManager::handleInstanceViewCreation |
803 // Slot to handle completion of instance view creation |
863 // Slot to handle completion of instance view creation |
804 // (other items were commented in a header). |
864 // (other items were commented in a header). |
805 // ---------------------------------------------------------------------------- |
865 // ---------------------------------------------------------------------------- |
806 // |
866 // |
807 void CalenViewManager::handleInstanceViewCreation(int status) |
867 void CalenViewManager::handleInstanceViewCreation(int status) |
808 { |
868 { |
|
869 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEINSTANCEVIEWCREATION_ENTRY ); |
|
870 |
809 Q_UNUSED(status); |
871 Q_UNUSED(status); |
810 // handleInstanceViewCreation function is called only once. Now that the instance |
872 // handleInstanceViewCreation function is called only once. Now that the instance |
811 // view creation is successfull. Events need to be populated on screen |
873 // view creation is successfull. Events need to be populated on screen |
812 // Ideal colution should be to call a uniform function, e.g. PopulateEvents |
874 // Ideal colution should be to call a uniform function, e.g. PopulateEvents |
813 // where PopulateEvents should be implemeted by all views. Since the current |
875 // where PopulateEvents should be implemeted by all views. Since the current |
818 mCalenMonthView->fetchEntriesAndUpdateModel(); |
880 mCalenMonthView->fetchEntriesAndUpdateModel(); |
819 } |
881 } |
820 else if (mCalenAgendaView) { |
882 else if (mCalenAgendaView) { |
821 mCalenAgendaView->doPopulation(); |
883 mCalenAgendaView->doPopulation(); |
822 } |
884 } |
|
885 |
|
886 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEINSTANCEVIEWCREATION_EXIT ); |
823 } |
887 } |
824 |
888 |
825 // ---------------------------------------------------------------------------- |
889 // ---------------------------------------------------------------------------- |
826 // CalenViewManager::handleDeletingCompleted |
890 // CalenViewManager::handleDeletingCompleted |
827 // Slot to handle completion of entry view creation |
891 // Slot to handle completion of entry view creation |
828 // (other items were commented in a header). |
892 // (other items were commented in a header). |
829 // ---------------------------------------------------------------------------- |
893 // ---------------------------------------------------------------------------- |
830 // |
894 // |
831 void CalenViewManager::handleEntryViewCreation(int status) |
895 void CalenViewManager::handleEntryViewCreation(int status) |
832 { |
896 { |
|
897 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEENTRYVIEWCREATION_ENTRY ); |
|
898 |
833 // Nothing Yet |
899 // Nothing Yet |
834 Q_UNUSED(status); |
900 Q_UNUSED(status); |
|
901 |
|
902 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEENTRYVIEWCREATION_EXIT ); |
835 } |
903 } |
836 |
904 |
837 // ---------------------------------------------------------------------------- |
905 // ---------------------------------------------------------------------------- |
838 // CalenViewManager::handleDayViewReady |
906 // CalenViewManager::handleDayViewReady |
839 // Launches day view when it is added to MainWindow and ready to be displayed |
907 // Launches day view when it is added to MainWindow and ready to be displayed |
840 // ---------------------------------------------------------------------------- |
908 // ---------------------------------------------------------------------------- |
841 // |
909 // |
842 void CalenViewManager::handleDayViewReady() |
910 void CalenViewManager::handleDayViewReady() |
843 { |
911 { |
|
912 OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEDAYVIEWREADY_ENTRY ); |
|
913 |
844 // Removes current view |
914 // Removes current view |
845 // Notice: removing view should be done after new view is set as current to |
915 // Notice: removing view should be done after new view is set as current to |
846 // avoid situation that there is no current view in application |
916 // avoid situation that there is no current view in application |
847 removePreviousView(); |
917 removePreviousView(); |
848 |
918 |
849 // Sets and activates day view |
919 // Sets and activates day view |
850 mCurrentViewId = ECalenDayView; |
920 mCurrentViewId = ECalenDayView; |
851 activateCurrentView(); |
921 activateCurrentView(); |
|
922 OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEDAYVIEWREADY_EXIT ); |
|
923 } |
|
924 |
|
925 // ---------------------------------------------------------------------------- |
|
926 // CalenViewManager::handleEntriesChanged |
|
927 // this function will be called when someone else has changed the database |
|
928 // ---------------------------------------------------------------------------- |
|
929 // |
|
930 void CalenViewManager::handleEntriesChanged(QList<ulong> ids) |
|
931 { |
|
932 // Update and refresh the view. |
|
933 activateCurrentView(); |
852 } |
934 } |
853 |
935 |
854 // ---------------------------------------------------------------------------- |
936 // ---------------------------------------------------------------------------- |
855 // CalenViewManager::launchSettingsView |
937 // CalenViewManager::launchSettingsView |
856 // Launches settings view |
938 // Launches settings view |
857 // (other items were commented in a header). |
939 // (other items were commented in a header). |
858 // ---------------------------------------------------------------------------- |
940 // ---------------------------------------------------------------------------- |
859 // |
941 // |
860 void CalenViewManager::launchSettingsView() |
942 void CalenViewManager::launchSettingsView() |
861 { |
943 { |
|
944 OstTraceFunctionEntry0( CALENVIEWMANAGER_LAUNCHSETTINGSVIEW_ENTRY ); |
|
945 |
862 mPreviousViewsId = mCurrentViewId ; |
946 mPreviousViewsId = mCurrentViewId ; |
863 mCurrentViewId = ECalenShowSettings; |
947 mCurrentViewId = ECalenShowSettings; |
864 mSettingsView->initializeForm(); |
948 mSettingsView->initializeForm(); |
865 mController.Services().MainWindow().setCurrentView(mSettingsView); |
949 mController.Services().MainWindow().setCurrentView(mSettingsView); |
866 |
950 |