18 |
18 |
19 #include <e32std.h> |
19 #include <e32std.h> |
20 #include <hbmainwindow.h> |
20 #include <hbmainwindow.h> |
21 #include <hbwidget.h> |
21 #include <hbwidget.h> |
22 #include <hbinstance.h> |
22 #include <hbinstance.h> |
|
23 #include <hbapplication.h> //Activity Manager |
|
24 #include <xqserviceutil.h> // service utils |
23 |
25 |
24 // User includes |
26 // User includes |
25 #include "calencontroller.h" // CCalenController |
27 #include "calencontroller.h" // CCalenController |
26 #include "calenviewmanager.h" // Responsible for all view activations |
28 #include "calenviewmanager.h" // Responsible for all view activations |
27 #include "calenservicesimpl.h" // MCalenServices implementation |
29 #include "calenservicesimpl.h" // MCalenServices implementation |
44 // CCalenController::CCalenController |
46 // CCalenController::CCalenController |
45 // Constructor |
47 // Constructor |
46 // (other items were commented in a header). |
48 // (other items were commented in a header). |
47 // ---------------------------------------------------------------------------- |
49 // ---------------------------------------------------------------------------- |
48 // |
50 // |
49 CCalenController::CCalenController(bool isFromServiceFrmwrk) |
51 CCalenController::CCalenController() |
50 { |
52 { |
51 TRACE_ENTRY_POINT; |
53 TRACE_ENTRY_POINT; |
52 iIsFromServiceFrmWrk = isFromServiceFrmwrk; |
54 // Check the Application Startup reason, set iIsFromServiceFrmWrk if application |
|
55 // is started by service framework, false otherwise |
|
56 /*Hb::ActivationReasonService == qobject_cast<HbApplication*>(qApp)->activateReason() ? |
|
57 iIsFromServiceFrmWrk = true: |
|
58 iIsFromServiceFrmWrk = false; */ |
|
59 |
|
60 // Check if calendar is launched thru XQService framework |
|
61 iIsFromServiceFrmWrk = XQServiceUtil::isService(); // Since activateReason |
|
62 //of hbapplication is not returning right value if the activity is started |
|
63 //as services so using the above line temporarily untill a fix is available in |
|
64 // hbappliacation. Need to remove this line after the fix is available for hbapplcation |
|
65 |
53 iNextServicesCommandBase = KCustomCommandRangeStart; |
66 iNextServicesCommandBase = KCustomCommandRangeStart; |
54 iRefCount = 0; |
67 iRefCount = 0; |
55 |
68 |
56 // Store the pointer in tls, also avoid multiple creations |
69 // Store the pointer in tls, also avoid multiple creations |
57 checkMultipleCreation(); |
70 checkMultipleCreation(); |
58 |
71 |
59 // Get an instance of AgendaUtil interface class |
72 // Get an instance of AgendaUtil interface class |
60 // This will take care of |
73 // This will take care of |
61 mAgendaUtil = new AgendaUtil(this); |
74 mAgendaUtil = new AgendaUtil(); |
62 |
75 |
63 iStateMachine = CCalenStateMachine::NewL( *this ); |
76 iStateMachine = CCalenStateMachine::NewL( *this ); |
64 |
77 |
65 // Create the notifier. |
78 // Create the notifier. |
66 iNotifier = new( ELeave )CalenNotifier( *iStateMachine ); |
79 iNotifier = new( ELeave )CalenNotifier( *iStateMachine ); |
67 |
80 |
82 // Create the customisation manager, and register for |
95 // Create the customisation manager, and register for |
83 // notifications |
96 // notifications |
84 iCustomisationManager = CCalenCustomisationManager::NewL( *this, |
97 iCustomisationManager = CCalenCustomisationManager::NewL( *this, |
85 *iServices ); |
98 *iServices ); |
86 // Create the view manager, and register for notifications |
99 // Create the view manager, and register for notifications |
87 iViewManager = new CalenViewManager(*this, isFromServiceFrmwrk ); |
100 iViewManager = new CalenViewManager(*this); |
|
101 |
|
102 iViewManager->SecondPhaseConstruction(); |
88 |
103 |
89 hbInstance->allMainWindows().first()->show(); |
104 hbInstance->allMainWindows().first()->show(); |
90 |
105 |
91 // Create the action uis. |
106 // Create the action uis. |
92 iActionUi = CCalenActionUi::NewL( *this ); |
107 iActionUi = CCalenActionUi::NewL( *this ); |
93 |
108 |
94 notificationArray.Append(ECalenNotifySettingsChanged); |
109 notificationArray.Append(ECalenNotifySettingsChanged); |
95 notificationArray.Append(ECalenNotifyCheckPluginUnloading); |
110 notificationArray.Append(ECalenNotifyCheckPluginUnloading); |
96 notificationArray.Append(ECalenNotifyEComRegistryChanged); |
111 notificationArray.Append(ECalenNotifyEComRegistryChanged); |
|
112 notificationArray.Append(ECalenNotifySystemLanguageChanged); |
97 |
113 |
98 RegisterForNotificationsL( iCustomisationManager,notificationArray); |
114 RegisterForNotificationsL( iCustomisationManager,notificationArray); |
99 notificationArray.Reset(); |
115 notificationArray.Reset(); |
100 |
116 |
101 notificationArray.Append(ECalenNotifyViewPopulationComplete); |
117 notificationArray.Append(ECalenNotifyViewPopulationComplete); |
104 notificationArray.Append(ECalenNotifyDialogClosed); |
120 notificationArray.Append(ECalenNotifyDialogClosed); |
105 notificationArray.Append(ECalenNotifyEntrySaved); |
121 notificationArray.Append(ECalenNotifyEntrySaved); |
106 notificationArray.Append(ECalenNotifyEntryDeleted); |
122 notificationArray.Append(ECalenNotifyEntryDeleted); |
107 notificationArray.Append(ECalenNotifyInstanceDeleted); |
123 notificationArray.Append(ECalenNotifyInstanceDeleted); |
108 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
124 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
|
125 notificationArray.Append(ECalenNotifySystemLanguageChanged); |
109 notificationArray.Append(ECalenNotifySystemTimeChanged); |
126 notificationArray.Append(ECalenNotifySystemTimeChanged); |
110 notificationArray.Append(ECalenNotifyEntryClosed); |
127 notificationArray.Append(ECalenNotifyEntryClosed); |
111 notificationArray.Append(ECalenNotifySettingsClosed); |
128 notificationArray.Append(ECalenNotifySettingsClosed); |
112 |
129 |
113 RegisterForNotificationsL( iViewManager, notificationArray ); |
130 RegisterForNotificationsL( iViewManager, notificationArray ); |
609 |
626 |
610 return iViewManager->getFirstView(); |
627 return iViewManager->getFirstView(); |
611 |
628 |
612 } |
629 } |
613 |
630 |
|
631 // ---------------------------------------------------------------------------- |
|
632 // CCalenController::eventFilter |
|
633 // Filters and handles the changes in events |
|
634 // (other items were commented in a header). |
|
635 // --------------------------------------------------------------------------- |
|
636 // |
|
637 bool CCalenController::eventFilter(QObject *object, QEvent *event) |
|
638 { |
|
639 switch (event->type()) |
|
640 { |
|
641 case QEvent::LanguageChange: |
|
642 //TODO: Unload the translator and install the locale specific translator |
|
643 iNotifier->BroadcastNotification( ECalenNotifySystemLanguageChanged ); |
|
644 break; |
|
645 case QEvent::LocaleChange: |
|
646 // TODO: handle the locale changes |
|
647 break; |
|
648 default: |
|
649 break; |
|
650 } |
|
651 return QObject::eventFilter(object, event); |
|
652 } |
614 // End of file |
653 // End of file |