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 |
67 iRefCount = 0; |
55 // Store the pointer in tls, also avoid multiple creations |
68 |
56 checkMultipleCreation(); |
69 TRACE_EXIT_POINT; |
57 |
70 } |
58 // Get an instance of AgendaUtil interface class |
71 |
59 // This will take care of |
72 // ---------------------------------------------------------------------------- |
60 mAgendaUtil = new AgendaUtil(); |
73 // CCalenController::constuctController |
61 |
74 // Construct the controller completely |
62 iStateMachine = CCalenStateMachine::NewL( *this ); |
75 // (other items were commented in a header). |
63 |
76 // ---------------------------------------------------------------------------- |
64 // Create the notifier. |
77 // |
65 iNotifier = new( ELeave )CalenNotifier( *iStateMachine ); |
78 void CCalenController::constructController() |
66 |
79 { |
67 // Construct the context |
80 // Store the pointer in tls, also avoid multiple creations |
68 mContext = new CalenContextImpl(iNotifier); |
81 checkMultipleCreation(); |
69 |
82 |
70 // Set the default context.Once will start use of calencmdlinelauncher, |
83 // Get an instance of AgendaUtil interface class |
71 // Then need to remove this function |
84 // This will take care of |
72 SetDefaultContext(); |
85 mAgendaUtil = new AgendaUtil(); |
73 |
86 |
74 RArray<TCalenNotification> notificationArray; |
87 iStateMachine = CCalenStateMachine::NewL( *this ); |
75 // Complete construction of the notifier and register the |
88 |
76 // global data for notifications |
89 // Create the notifier. |
77 iNotifier->ConstructL(); |
90 iNotifier = new( ELeave )CalenNotifier( *iStateMachine ); |
78 |
91 |
79 // Create the services |
92 // Construct the context |
80 iServices = CalenServicesImpl::NewL(); |
93 mContext = new CalenContextImpl(iNotifier); |
81 // Create the customisation manager, and register for |
94 |
82 // notifications |
95 // Set the default context.Once will start use of calencmdlinelauncher, |
83 iCustomisationManager = CCalenCustomisationManager::NewL( *this, |
96 // Then need to remove this function |
84 *iServices ); |
97 SetDefaultContext(); |
85 // Create the view manager, and register for notifications |
98 |
86 iViewManager = new CalenViewManager(*this, isFromServiceFrmwrk ); |
99 RArray<TCalenNotification> notificationArray; |
87 |
100 // Complete construction of the notifier and register the |
|
101 // global data for notifications |
|
102 iNotifier->ConstructL(); |
|
103 |
|
104 // Create the services |
|
105 iServices = CalenServicesImpl::NewL(); |
|
106 // Create the customisation manager, and register for |
|
107 // notifications |
|
108 iCustomisationManager = CCalenCustomisationManager::NewL( *this, |
|
109 *iServices ); |
|
110 // Create the view manager, and register for notifications |
|
111 iViewManager = new CalenViewManager(*this); |
|
112 |
|
113 iViewManager->SecondPhaseConstruction(); |
|
114 |
88 hbInstance->allMainWindows().first()->show(); |
115 hbInstance->allMainWindows().first()->show(); |
89 |
116 |
90 // Create the action uis. |
117 // Create the action uis. |
91 iActionUi = CCalenActionUi::NewL( *this ); |
118 iActionUi = CCalenActionUi::NewL( *this ); |
92 |
119 |
93 notificationArray.Append(ECalenNotifySettingsChanged); |
120 notificationArray.Append(ECalenNotifySettingsChanged); |
94 notificationArray.Append(ECalenNotifyCheckPluginUnloading); |
121 notificationArray.Append(ECalenNotifyCheckPluginUnloading); |
95 notificationArray.Append(ECalenNotifyEComRegistryChanged); |
122 notificationArray.Append(ECalenNotifyEComRegistryChanged); |
96 |
123 notificationArray.Append(ECalenNotifySystemLanguageChanged); |
97 RegisterForNotificationsL( iCustomisationManager,notificationArray); |
124 |
98 notificationArray.Reset(); |
125 RegisterForNotificationsL( iCustomisationManager,notificationArray); |
99 |
126 notificationArray.Reset(); |
100 notificationArray.Append(ECalenNotifyViewPopulationComplete); |
127 |
101 notificationArray.Append(ECalenNotifyExternalDatabaseChanged); |
128 notificationArray.Append(ECalenNotifyViewPopulationComplete); |
102 notificationArray.Append(ECalenNotifyMultipleEntriesDeleted); |
129 notificationArray.Append(ECalenNotifyExternalDatabaseChanged); |
103 notificationArray.Append(ECalenNotifyDialogClosed); |
130 notificationArray.Append(ECalenNotifyMultipleEntriesDeleted); |
104 notificationArray.Append(ECalenNotifyEntrySaved); |
131 notificationArray.Append(ECalenNotifyDialogClosed); |
105 notificationArray.Append(ECalenNotifyEntryDeleted); |
132 notificationArray.Append(ECalenNotifyEntrySaved); |
106 notificationArray.Append(ECalenNotifyInstanceDeleted); |
133 notificationArray.Append(ECalenNotifyEntryDeleted); |
107 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
134 notificationArray.Append(ECalenNotifyInstanceDeleted); |
108 notificationArray.Append(ECalenNotifySystemTimeChanged); |
135 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
109 notificationArray.Append(ECalenNotifyEntryClosed); |
136 notificationArray.Append(ECalenNotifySystemLanguageChanged); |
110 notificationArray.Append(ECalenNotifySettingsClosed); |
137 notificationArray.Append(ECalenNotifySystemTimeChanged); |
111 |
138 notificationArray.Append(ECalenNotifyEntryClosed); |
112 RegisterForNotificationsL( iViewManager, notificationArray ); |
139 notificationArray.Append(ECalenNotifySettingsClosed); |
113 notificationArray.Reset(); |
140 |
114 notificationArray.Close(); |
141 RegisterForNotificationsL( iViewManager, notificationArray ); |
115 TRACE_EXIT_POINT; |
142 notificationArray.Reset(); |
|
143 notificationArray.Close(); |
116 } |
144 } |
117 |
145 |
118 void CCalenController::checkMultipleCreation() |
146 void CCalenController::checkMultipleCreation() |
119 { |
147 { |
120 TAny* tlsPtr = Dll::Tls(); |
148 TAny* tlsPtr = Dll::Tls(); |
517 void CCalenController::handleServiceManagerSlot(int view, const QDateTime& dateTime) |
596 void CCalenController::handleServiceManagerSlot(int view, const QDateTime& dateTime) |
518 { |
597 { |
519 |
598 |
520 if (iIsFromServiceFrmWrk) { |
599 if (iIsFromServiceFrmWrk) { |
521 // Set the context properly |
600 // Set the context properly |
522 mContext->setFocusDateAndTimeL(dateTime,KCalenMonthViewUidValue); |
601 mContext->setFocusDateAndTime(dateTime); |
523 // launch the appropriate view |
602 // launch the appropriate view |
524 iViewManager->constructAndActivateView(view); |
603 iViewManager->constructAndActivateView(view); |
525 |
604 |
526 // Construct other views |
|
527 iViewManager->constructOtherViews(); |
|
528 |
|
529 } else { // Calendar was in backgroung but now its being brought to foreground |
605 } else { // Calendar was in backgroung but now its being brought to foreground |
530 // If current state is editing state or printing state |
606 // If current state is editing state or printing state |
531 // or deleting state or sending state, then dont do anything as |
607 // or deleting state or sending state, then dont do anything as |
532 // user might loose the data |
608 // user might loose the data |
533 CCalenStateMachine::TCalenStateIndex currentState = iStateMachine->CurrentState(); |
609 CCalenStateMachine::TCalenStateIndex currentState = iStateMachine->CurrentState(); |