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