14 * Description: Calendar controller |
14 * Description: Calendar controller |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <e32std.h> |
19 #include <aknnotewrappers.h> // CAknInformationNote |
20 #include <hbmainwindow.h> |
20 #include <aknViewAppUi.h> // CAknViewAppUi |
21 #include <hbwidget.h> |
21 #include <StringLoader.h> // Loads strings from resource |
22 #include <hbinstance.h> |
22 #include <aknappui.h> |
23 #include <hbapplication.h> //Activity Manager |
23 #include <bautils.h> |
24 #include <xqserviceutil.h> // service utils |
24 #include <data_caging_path_literals.hrh> |
25 |
25 #include <pathinfo.h> |
26 // User includes |
26 #include <avkon.hrh> |
|
27 #include "calenviewinfo.h" // View information |
|
28 #include <Calendar.rsg> // Calendar resourcess |
|
29 #include <missedalarmstore.h> // missed alarm store |
|
30 #include <calsession.h> |
|
31 #include <calencommandhandler.h> |
|
32 #include <calencontext.h> |
|
33 #include <calenconstants.h> // KCalenLostAlarms etc |
|
34 #include <calcalendarinfo.h> |
|
35 |
|
36 #include "calendarui_debug.h" // Debug macros |
27 #include "calencontroller.h" // CCalenController |
37 #include "calencontroller.h" // CCalenController |
28 #include "calenviewmanager.h" // Responsible for all view activations |
38 #include "calenactionui.h" // Default command handling |
|
39 #include "calennotifier.h" // Broadcasts system events |
|
40 #include "calenviewmanager.h" // Responsible for all view activations |
|
41 #include "calenalarmmanager.h" // Alarm Manager |
29 #include "calenservicesimpl.h" // MCalenServices implementation |
42 #include "calenservicesimpl.h" // MCalenServices implementation |
30 #include "calenactionui.h" // Default command handling |
43 #include "calensetting.h" |
|
44 #include "calencmdlinelauncher.h" // Command line launcher |
31 #include "calencustomisationmanager.h" // Customisation Manager |
45 #include "calencustomisationmanager.h" // Customisation Manager |
32 #include "calennotificationhandler.h" |
|
33 #include "calennotifier.h" |
|
34 #include "hb_calencommands.hrh" |
|
35 #include "calendarui_debug.h" // Debug macros |
|
36 #include "calenstatemachine.h" |
46 #include "calenstatemachine.h" |
37 #include "calenservicesimpl.h" // Calendar service implementation |
47 #include "calenicons.h" |
38 #include "CalenUid.h" |
48 #include "calentoolbarimpl.h" |
39 #include "calencontextimpl.h" |
49 #include "calenmultipledbmanager.h" |
40 #include "OstTraceDefinitions.h" |
50 #include "calenattachmentmodel.h" |
41 #ifdef OST_TRACE_COMPILER_IN_USE |
51 |
42 #include "calencontrollerTraces.h" |
|
43 #endif |
|
44 |
|
45 |
|
46 // Constants |
|
47 const TInt KCustomCommandRangeStart = ECalenLastCommand; |
52 const TInt KCustomCommandRangeStart = ECalenLastCommand; |
48 const TInt KNumberOfCommandsPerServices = 100; |
53 const TInt KNumberOfCommandsPerServices = 100; |
49 |
54 _LIT( KResourceFile, "calencommonui.rsc" ); |
50 // ---------------------------------------------------------------------------- |
55 |
51 // CCalenController::CCalenController |
56 // ---------------------------------------------------------------------------- |
52 // Constructor |
57 // CCalenController::NewL |
53 // (other items were commented in a header). |
58 // First stage construction. This will leave if an instance of the controller |
54 // ---------------------------------------------------------------------------- |
59 // already exists. All access to an instance of the controller should be |
55 // |
60 // through the InstanceL function, except for the initial construction |
56 CCalenController::CCalenController() |
61 // which should be handled by the appui. |
57 { |
62 // This is to prevent usage of this API through the services dll when Calendar |
58 OstTraceFunctionEntry0( CCALENCONTROLLER_CCALENCONTROLLER_ENTRY ); |
63 // application is not running. |
59 |
64 // (other items were commented in a header). |
60 // Check the Application Startup reason, set iIsFromServiceFrmWrk if application |
65 // ---------------------------------------------------------------------------- |
61 // is started by service framework, false otherwise |
66 // |
62 /*Hb::ActivationReasonService == qobject_cast<HbApplication*>(qApp)->activateReason() ? |
67 EXPORT_C CCalenController* CCalenController::NewL( CAknViewAppUi& aAppUi ) |
63 iIsFromServiceFrmWrk = true: |
68 { |
64 iIsFromServiceFrmWrk = false; */ |
69 TRACE_ENTRY_POINT; |
65 |
70 |
66 // Check if calendar is launched thru XQService framework |
71 CCalenController* self = NULL; |
67 iIsFromServiceFrmWrk = XQServiceUtil::isService(); // Since activateReason |
72 TAny* tlsPtr = Dll::Tls(); |
68 //of hbapplication is not returning right value if the activity is started |
73 |
69 //as services so using the above line temporarily untill a fix is available in |
74 // Check Thread local storage |
70 // hbappliacation. Need to remove this line after the fix is available for hbapplcation |
75 if( !tlsPtr ) |
71 |
76 { |
72 iNextServicesCommandBase = KCustomCommandRangeStart; |
77 // TLS is NULL, so no CCalenController has been created yet. |
73 iRefCount = 0; |
78 self = new( ELeave ) CCalenController( aAppUi ); |
74 mAgendaUtil = 0; |
79 CleanupStack::PushL( self ); |
75 |
80 // Store a self pointer in TLS |
76 OstTraceFunctionExit0( CCALENCONTROLLER_CCALENCONTROLLER_EXIT ); |
81 User::LeaveIfError( Dll::SetTls( static_cast<TAny*>( self ) ) ); |
77 } |
82 // Increment ref count right away. If we don't do it here, and someone |
78 |
83 // calls Controller::InstanceL in ConstructL and then ConstructL |
79 // ---------------------------------------------------------------------------- |
84 // leaves, we will double delete the controller. |
80 // CCalenController::constuctController |
85 ++self->iRefCount; |
81 // Construct the controller completely |
86 self->ConstructL(); |
82 // (other items were commented in a header). |
87 CleanupStack::Pop( self ); |
83 // ---------------------------------------------------------------------------- |
88 } |
84 // |
89 else |
85 void CCalenController::constructController() |
90 { |
86 { |
91 // An instance of the controller exists already. |
87 OstTraceFunctionEntry0( CCALENCONTROLLER_CONSTRUCTCONTROLLER_ENTRY ); |
92 // This function should only have been called once, by CCalenAppUi |
88 // Store the pointer in tls, also avoid multiple creations |
93 User::Leave( KErrAlreadyExists ); |
89 checkMultipleCreation(); |
94 } |
90 |
95 |
91 // Get an instance of AgendaUtil interface class |
96 TRACE_EXIT_POINT; |
92 // This will take care of |
97 return self; |
93 mAgendaUtil = new AgendaUtil(); |
98 } |
94 |
|
95 iStateMachine = CCalenStateMachine::NewL( *this ); |
|
96 |
|
97 // Create the notifier. |
|
98 iNotifier = new( ELeave )CalenNotifier( *iStateMachine ); |
|
99 |
|
100 // Construct the context |
|
101 mContext = new CalenContextImpl(iNotifier); |
|
102 |
|
103 // Set the default context.Once will start use of calencmdlinelauncher, |
|
104 // Then need to remove this function |
|
105 SetDefaultContext(); |
|
106 |
|
107 RArray<TCalenNotification> notificationArray; |
|
108 // Complete construction of the notifier and register the |
|
109 // global data for notifications |
|
110 iNotifier->ConstructL(); |
|
111 |
|
112 // Create the services |
|
113 iServices = CalenServicesImpl::NewL(); |
|
114 // Create the customisation manager, and register for |
|
115 // notifications |
|
116 iCustomisationManager = CCalenCustomisationManager::NewL( *this, |
|
117 *iServices ); |
|
118 // Create the view manager, and register for notifications |
|
119 iViewManager = new CalenViewManager(*this); |
|
120 |
|
121 iViewManager->SecondPhaseConstruction(); |
|
122 |
|
123 hbInstance->allMainWindows().first()->show(); |
|
124 |
|
125 // Create the action uis. |
|
126 iActionUi = CCalenActionUi::NewL( *this ); |
|
127 |
|
128 notificationArray.Append(ECalenNotifySettingsChanged); |
|
129 notificationArray.Append(ECalenNotifyCheckPluginUnloading); |
|
130 notificationArray.Append(ECalenNotifyEComRegistryChanged); |
|
131 notificationArray.Append(ECalenNotifySystemLanguageChanged); |
|
132 |
|
133 RegisterForNotificationsL( iCustomisationManager,notificationArray); |
|
134 notificationArray.Reset(); |
|
135 |
|
136 notificationArray.Append(ECalenNotifyViewPopulationComplete); |
|
137 notificationArray.Append(ECalenNotifyExternalDatabaseChanged); |
|
138 notificationArray.Append(ECalenNotifyMultipleEntriesDeleted); |
|
139 notificationArray.Append(ECalenNotifyDialogClosed); |
|
140 notificationArray.Append(ECalenNotifyEntrySaved); |
|
141 notificationArray.Append(ECalenNotifyEntryDeleted); |
|
142 notificationArray.Append(ECalenNotifyInstanceDeleted); |
|
143 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
|
144 notificationArray.Append(ECalenNotifySystemLanguageChanged); |
|
145 notificationArray.Append(ECalenNotifySystemTimeChanged); |
|
146 notificationArray.Append(ECalenNotifyEntryClosed); |
|
147 notificationArray.Append(ECalenNotifySettingsClosed); |
|
148 |
|
149 RegisterForNotificationsL( iViewManager, notificationArray ); |
|
150 notificationArray.Reset(); |
|
151 notificationArray.Close(); |
|
152 |
|
153 OstTraceFunctionExit0( CCALENCONTROLLER_CONSTRUCTCONTROLLER_EXIT ); |
|
154 } |
|
155 |
|
156 void CCalenController::checkMultipleCreation() |
|
157 { |
|
158 OstTraceFunctionEntry0( CCALENCONTROLLER_CHECKMULTIPLECREATION_ENTRY ); |
|
159 TAny* tlsPtr = Dll::Tls(); |
|
160 |
|
161 // Check Thread local storage |
|
162 if( !tlsPtr ) |
|
163 { |
|
164 // Store a self pointer in TLS |
|
165 User::LeaveIfError( Dll::SetTls( static_cast<TAny*>( this ) ) ); |
|
166 // Increment ref count right away. If we don't do it here, and someone |
|
167 // calls Controller::InstanceL in ConstructL and then ConstructL |
|
168 // leaves, we will double delete the controller. |
|
169 ++this->iRefCount; |
|
170 } |
|
171 else |
|
172 { |
|
173 // An instance of the controller exists already. |
|
174 // This function should only have been called once, by CCalenAppUi |
|
175 User::Leave( KErrAlreadyExists ); |
|
176 } |
|
177 OstTraceFunctionExit0( CCALENCONTROLLER_CHECKMULTIPLECREATION_EXIT ); |
|
178 } |
|
179 |
99 |
180 // ---------------------------------------------------------------------------- |
100 // ---------------------------------------------------------------------------- |
181 // CCalenController::InstanceL |
101 // CCalenController::InstanceL |
182 // Returns a pointer to the single instance of the Calendar Controller. |
102 // Returns a pointer to the single instance of the Calendar Controller. |
183 // Leaves with KErrNotReady if the controller has not already been created |
103 // Leaves with KErrNotReady if the controller has not already been created |
184 // using NewL. A leave here means that the Calendar application is not running |
104 // using NewL. A leave here means that the Calendar application is not running |
185 // but someone is trying to use the services API. |
105 // but someone is trying to use the services API. |
186 // (other items were commented in a header). |
106 // (other items were commented in a header). |
187 // ---------------------------------------------------------------------------- |
107 // ---------------------------------------------------------------------------- |
188 // |
108 // |
189 CCalenController* CCalenController::InstanceL() |
109 EXPORT_C CCalenController* CCalenController::InstanceL() |
190 { |
110 { |
191 OstTraceFunctionEntry0( CCALENCONTROLLER_INSTANCEL_ENTRY ); |
111 TRACE_ENTRY_POINT; |
192 |
112 |
193 CCalenController* self = NULL; |
113 CCalenController* self = NULL; |
194 TAny* tlsPtr = Dll::Tls(); |
114 TAny* tlsPtr = Dll::Tls(); |
195 |
115 |
196 // Check Thread local storage |
116 // Check Thread local storage |
197 if( !tlsPtr ) |
117 if( !tlsPtr ) |
206 self = static_cast<CCalenController*>( tlsPtr ); |
126 self = static_cast<CCalenController*>( tlsPtr ); |
207 } |
127 } |
208 |
128 |
209 ++self->iRefCount; |
129 ++self->iRefCount; |
210 |
130 |
211 |
131 TRACE_EXIT_POINT; |
212 OstTraceFunctionExit0( CCALENCONTROLLER_INSTANCEL_EXIT ); |
132 return self; |
213 return self; |
133 } |
214 } |
134 |
215 |
135 // ---------------------------------------------------------------------------- |
216 // ---------------------------------------------------------------------------- |
136 // CCalenController::ConstructL |
217 // CCalenController::ReleaseCustomisations |
137 // 2nd phase of construction |
218 // Releases any plugins by deleting the customisation manager |
138 // (other items were commented in a header). |
219 // should only be called on exiting by the application. |
139 // ---------------------------------------------------------------------------- |
220 // (other items were commented in a header). |
140 // |
221 // ---------------------------------------------------------------------------- |
141 void CCalenController::ConstructL() |
222 // |
142 { |
223 void CCalenController::ReleaseCustomisations() |
143 TRACE_ENTRY_POINT; |
224 { |
144 |
225 OstTraceFunctionEntry0( CCALENCONTROLLER_RELEASECUSTOMISATIONS_ENTRY ); |
145 TFileName fileName; |
226 |
146 // Get the complate path of the DLL from where it is currently loaded |
227 delete iCustomisationManager; |
147 Dll::FileName( fileName ); |
228 iCustomisationManager = NULL; |
148 |
229 |
149 TFileName resFile; |
230 OstTraceFunctionExit0( CCALENCONTROLLER_RELEASECUSTOMISATIONS_EXIT ); |
150 |
|
151 // Append the Drive letters ex., Z: or C: |
|
152 resFile.Append(fileName.Mid(0,2)); |
|
153 resFile.Append(KDC_RESOURCE_FILES_DIR); |
|
154 resFile.Append(KResourceFile); |
|
155 |
|
156 BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resFile ); |
|
157 |
|
158 iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL( resFile ); |
|
159 |
|
160 |
|
161 iStateMachine = CCalenStateMachine::NewL( *this ); |
|
162 // Create the notifier. |
|
163 iNotifier = new( ELeave )CCalenNotifier( *this ); |
|
164 |
|
165 // Get an instance of the global data |
|
166 iGlobalData = CCalenGlobalData::NewL( *iNotifier, iNotifier, iNotifier ); |
|
167 iGlobalData->InitializeGlobalDataL(); |
|
168 |
|
169 RArray<TCalenNotification> notificationArray; |
|
170 // Complete construction of the notifier and register the |
|
171 // global data for notifications |
|
172 iNotifier->ConstructL(); |
|
173 |
|
174 notificationArray.Append(ECalenNotifyEntryInstanceViewCreated); |
|
175 notificationArray.Append(ECalenNotifyEntryInstanceViewCreationFailed); |
|
176 notificationArray.Append(ECalenNotifyDeleteInstanceView); |
|
177 notificationArray.Append(ECalenNotifyRealExit); |
|
178 notificationArray.Append(ECalenNotifyCalendarInfoCreated); |
|
179 notificationArray.Append(ECalenNotifyCalendarInfoUpdated); |
|
180 |
|
181 |
|
182 RegisterForNotificationsL( iGlobalData,notificationArray); |
|
183 notificationArray.Reset(); |
|
184 |
|
185 // Create the cmd line handler |
|
186 iCmdLineLauncher = CCalenCmdLineLauncher::NewL( *this, iAppUi ); |
|
187 |
|
188 // Create the services |
|
189 iServices = CCalenServicesImpl::NewL(); |
|
190 |
|
191 // Create the action uis. |
|
192 iActionUi = CCalenActionUi::NewL( *this ); |
|
193 |
|
194 // Create the settings |
|
195 iSetting = CCalenSetting::InstanceL(); |
|
196 |
|
197 // Create the view manager, and register for notifications |
|
198 iViewManager = CCalenViewManager::NewL( iAppUi, *this ); |
|
199 |
|
200 notificationArray.Append(ECalenNotifySettingsChanged); |
|
201 notificationArray.Append(ECalenNotifySettingsClosed); |
|
202 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
|
203 notificationArray.Append(ECalenNotifyPluginEnabledDisabled); |
|
204 notificationArray.Append(ECalenNotifyEntrySaved); |
|
205 notificationArray.Append(ECalenNotifyEntryDeleted); |
|
206 notificationArray.Append(ECalenNotifyInstanceDeleted); |
|
207 notificationArray.Append(ECalenNotifyMultipleEntriesDeleted); |
|
208 notificationArray.Append(ECalenNotifyExternalDatabaseChanged); |
|
209 notificationArray.Append(ECalenNotifyDeleteFailed); |
|
210 notificationArray.Append(ECalenNotifyEntryClosed); |
|
211 notificationArray.Append(ECalenNotifyCancelDelete); |
|
212 notificationArray.Append(ECalenNotifySystemTimeChanged); |
|
213 notificationArray.Append(ECalenNotifyAppForegrounded); |
|
214 notificationArray.Append(ECalenNotifyDayViewClosed); |
|
215 notificationArray.Append(ECalenNotifyWeekViewClosed); |
|
216 notificationArray.Append(ECalenNotifyAppBackgrounded); |
|
217 notificationArray.Append(ECalenNotifyViewPopulationComplete); |
|
218 notificationArray.Append(ECalenNotifyCalendarFieldChanged); |
|
219 notificationArray.Append(ECalenNotifyCancelStatusUpdation); |
|
220 notificationArray.Append(ECalenNotifyMarkedEntryCompleted); |
|
221 notificationArray.Append(ECalenNotifyAttachmentAdded); |
|
222 notificationArray.Append(ECalenNotifyAttachmentViewerClosed); |
|
223 notificationArray.Append(ECalenNotifyAttachmentRemoved); |
|
224 notificationArray.Append(ECalenNotifyCalendarInfoCreated); |
|
225 notificationArray.Append(ECalenNotifyCalendarInfoUpdated); |
|
226 notificationArray.Append(ECalenNotifyCalendarFileDeleted); |
|
227 |
|
228 RegisterForNotificationsL( iViewManager, notificationArray ); |
|
229 notificationArray.Reset(); |
|
230 |
|
231 // Create the customisation manager, and register for |
|
232 // notifications |
|
233 iCustomisationManager = CCalenCustomisationManager::NewL( *this, |
|
234 iSetting->PluginAvailability(), |
|
235 *iServices, |
|
236 iViewManager->ViewInfoArray() ); |
|
237 |
|
238 notificationArray.Append(ECalenNotifySettingsChanged); |
|
239 notificationArray.Append(ECalenNotifyCheckPluginUnloading); |
|
240 notificationArray.Append(ECalenNotifyEComRegistryChanged); |
|
241 |
|
242 RegisterForNotificationsL( iCustomisationManager,notificationArray); |
|
243 notificationArray.Reset(); |
|
244 |
|
245 // Some plugins may have been added or removed - update the settings. |
|
246 iSetting->UpdatePluginListL( *iCustomisationManager ); |
|
247 |
|
248 // View manager constructs the custom views using the |
|
249 // customisation manager |
|
250 iViewManager->ConstructCustomViewsL( *iCustomisationManager ); |
|
251 |
|
252 // for handling missed alarms/msk improvements for alarm |
|
253 iAlarmManager = CCalenAlarmManager::NewL(*this); |
|
254 |
|
255 notificationArray.Append(ECalenNotifyLostAlarms); |
|
256 notificationArray.Append(ECalenNotifyMissedAlarmViewClosed); |
|
257 notificationArray.Append(ECalenNotifyClearMissedAlarms); |
|
258 notificationArray.Append(ECalenNotifyMissedEventViewClosed); |
|
259 notificationArray.Append(ECalenNotifyEntryDeleted); |
|
260 notificationArray.Append(ECalenNotifyInstanceDeleted); |
|
261 notificationArray.Append(ECalenNotifyEntrySaved); |
|
262 notificationArray.Append(ECalenNotifyMultipleEntriesDeleted); |
|
263 notificationArray.Append(ECalenNotifySystemTimeChanged); |
|
264 notificationArray.Append(ECalenNotifyAlarmStopped); |
|
265 notificationArray.Append(ECalenNotifyAlarmSnoozed); |
|
266 notificationArray.Append(ECalenNotifyEntryClosed); |
|
267 notificationArray.Append(ECalenNotifyAppForegrounded); |
|
268 |
|
269 RegisterForNotificationsL( iAlarmManager, notificationArray ); |
|
270 notificationArray.Reset(); |
|
271 |
|
272 //iMultipleDbmanager = CCalenMultipleDbManager::NewL(); |
|
273 |
|
274 iAttachmentData = CCalenAttachmentModel::NewL(); |
|
275 |
|
276 notificationArray.Close(); |
|
277 |
|
278 TRACE_EXIT_POINT; |
|
279 } |
|
280 |
|
281 // ---------------------------------------------------------------------------- |
|
282 // CCalenController::CCalenController |
|
283 // C++ default constructor. |
|
284 // (other items were commented in a header). |
|
285 // ---------------------------------------------------------------------------- |
|
286 // |
|
287 CCalenController::CCalenController( CAknViewAppUi& aAppUi ) |
|
288 : iAppUi( aAppUi ), |
|
289 iNextServicesCommandBase( KCustomCommandRangeStart ), |
|
290 iFasterApp( EFalse ) |
|
291 { |
|
292 TRACE_ENTRY_POINT; |
|
293 TRACE_EXIT_POINT; |
|
294 } |
|
295 |
|
296 // ---------------------------------------------------------------------------- |
|
297 // CCalenController::~CCalenController |
|
298 // Private destructor, called from Release() when reference count is 0. |
|
299 // Frees all resources. |
|
300 // (other items were commented in a header). |
|
301 // ---------------------------------------------------------------------------- |
|
302 // |
|
303 CCalenController::~CCalenController() |
|
304 { |
|
305 TRACE_ENTRY_POINT; |
|
306 |
|
307 if(iSystemTimeChangedMsgDelayer) |
|
308 { |
|
309 iSystemTimeChangedMsgDelayer->Cancel(); |
|
310 delete iSystemTimeChangedMsgDelayer; |
|
311 iSystemTimeChangedMsgDelayer = NULL; |
|
312 } |
|
313 |
|
314 if(iAttachmentData) |
|
315 { |
|
316 delete iAttachmentData; |
|
317 iAttachmentData = NULL; |
|
318 } |
|
319 |
|
320 if( iAlarmManager ) |
|
321 { |
|
322 delete iAlarmManager; |
|
323 } |
|
324 |
|
325 if( iCustomisationManager ) |
|
326 { |
|
327 delete iCustomisationManager; |
|
328 } |
|
329 |
|
330 if( iViewManager ) |
|
331 { |
|
332 delete iViewManager; |
|
333 } |
|
334 |
|
335 if ( iSetting ) |
|
336 { |
|
337 iSetting->Release(); |
|
338 } |
|
339 |
|
340 if( iActionUi ) |
|
341 { |
|
342 delete iActionUi; |
|
343 } |
|
344 |
|
345 if ( iServices ) |
|
346 { |
|
347 iServices->Release(); |
|
348 } |
|
349 |
|
350 if( iCmdLineLauncher ) |
|
351 { |
|
352 delete iCmdLineLauncher; |
|
353 } |
|
354 |
|
355 if( iGlobalData ) |
|
356 { |
|
357 iGlobalData->Release(); |
|
358 } |
|
359 |
|
360 if( iNotifier ) |
|
361 { |
|
362 delete iNotifier; |
|
363 } |
|
364 |
|
365 if( iStateMachine ) |
|
366 { |
|
367 delete iStateMachine; |
|
368 } |
|
369 |
|
370 if( iResourceFileOffset ) |
|
371 { |
|
372 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
373 } |
|
374 Dll::SetTls( NULL ); |
|
375 |
|
376 TRACE_EXIT_POINT; |
231 } |
377 } |
232 |
378 |
233 // ---------------------------------------------------------------------------- |
379 // ---------------------------------------------------------------------------- |
234 // CCalenController::Release |
380 // CCalenController::Release |
235 // Decrement the reference count of this singleton. |
381 // Decrement the reference count of this singleton. |
236 // When the reference count is 0, the controller will self delete and free |
382 // When the reference count is 0, the controller will self delete and free |
237 // all resources |
383 // all resources |
238 // (other items were commented in a header). |
384 // (other items were commented in a header). |
239 // ---------------------------------------------------------------------------- |
385 // ---------------------------------------------------------------------------- |
240 // |
386 // |
241 void CCalenController::Release() |
387 EXPORT_C void CCalenController::Release() |
242 { |
388 { |
243 OstTraceFunctionEntry0( CCALENCONTROLLER_RELEASE_ENTRY ); |
389 TRACE_ENTRY_POINT; |
244 |
390 |
245 --iRefCount; |
391 --iRefCount; |
246 |
392 |
247 // The controller owns its own instance of the services, therefore the |
393 // The controller owns its own instance of the services, therefore the |
248 // reference count will be one, immediatley before deletion. |
394 // reference count will be one, immediatley before deletion. |
249 if (iRefCount == 1) |
395 if (iRefCount == 1) |
250 { |
396 { |
251 delete this; |
397 delete this; |
252 } |
398 } |
253 |
399 |
254 OstTraceFunctionExit0( CCALENCONTROLLER_RELEASE_EXIT ); |
400 TRACE_EXIT_POINT; |
255 } |
401 } |
256 |
402 |
257 // ---------------------------------------------------------------------------- |
403 // ---------------------------------------------------------------------------- |
258 // CCalenController::~CCalenController |
404 // CCalenController::ReleaseCustomisations |
259 // Private destructor, called from Release() when reference count is 0. |
405 // Releases any plugins by deleting the customisation manager |
260 // Frees all resources. |
406 // should only be called on exiting by the document. |
261 // (other items were commented in a header). |
407 // (other items were commented in a header). |
262 // ---------------------------------------------------------------------------- |
408 // ---------------------------------------------------------------------------- |
263 // |
409 // |
264 CCalenController::~CCalenController() |
410 EXPORT_C void CCalenController::ReleaseCustomisations() |
265 { |
411 { |
266 OstTraceFunctionEntry0( DUP1_CCALENCONTROLLER_CCALENCONTROLLER_ENTRY ); |
412 TRACE_ENTRY_POINT; |
267 |
413 |
268 if(iStateMachine) { |
414 delete iCustomisationManager; |
269 delete iStateMachine; |
415 iCustomisationManager = NULL; |
270 iStateMachine = NULL; |
416 |
271 } |
417 TRACE_EXIT_POINT; |
272 |
418 } |
273 if ( iServices ) |
|
274 { |
|
275 iServices->Release(); |
|
276 } |
|
277 |
|
278 if( mContext ) |
|
279 { |
|
280 delete mContext; |
|
281 mContext = NULL; |
|
282 } |
|
283 // iActionUi has to be deleted before iNotifier |
|
284 // as the unregistering of the notifications has to be done |
|
285 if( iActionUi ) |
|
286 { |
|
287 delete iActionUi; |
|
288 iActionUi = NULL; |
|
289 } |
|
290 |
|
291 if( iNotifier ) |
|
292 { |
|
293 delete iNotifier; |
|
294 iNotifier = NULL; |
|
295 } |
|
296 |
|
297 if( iViewManager ) |
|
298 { |
|
299 delete iViewManager; |
|
300 iViewManager = NULL; |
|
301 } |
|
302 |
|
303 if( iCustomisationManager ) |
|
304 { |
|
305 delete iCustomisationManager; |
|
306 iCustomisationManager = NULL; |
|
307 } |
|
308 |
|
309 if (mAgendaUtil) { |
|
310 delete mAgendaUtil; |
|
311 mAgendaUtil = 0; |
|
312 } |
|
313 |
|
314 Dll::SetTls( NULL ); |
|
315 |
|
316 OstTraceFunctionExit0( DUP1_CCALENCONTROLLER_CCALENCONTROLLER_EXIT ); |
|
317 } |
|
318 |
|
319 |
419 |
320 // ---------------------------------------------------------------------------- |
420 // ---------------------------------------------------------------------------- |
321 // CCalenController::IssueCommmandL |
421 // CCalenController::IssueCommmandL |
322 // Adds the passed command to the comand queue. Commands are handled |
422 // Adds the passed command to the comand queue. Commands are handled |
323 // asynchronously in HandleCommandL |
423 // asynchronously in HandleCommandL |
324 // Returns EFalse if the passed command is not in the issuers command range |
424 // Returns EFalse if the passed command is not in the issuers command range |
325 // (other items were commented in a header). |
425 // (other items were commented in a header). |
326 // ---------------------------------------------------------------------------- |
426 // ---------------------------------------------------------------------------- |
327 // |
427 // |
328 TBool CCalenController::IssueCommandL( TInt aCommand ) |
428 EXPORT_C TBool CCalenController::IssueCommandL( TInt aCommand ) |
329 { |
429 { |
330 OstTraceFunctionEntry0( CCALENCONTROLLER_ISSUECOMMANDL_ENTRY ); |
430 TRACE_ENTRY_POINT; |
331 |
|
332 TCalenCommand cmd; |
431 TCalenCommand cmd; |
333 cmd.SetCommandAndContextL( aCommand ,context()); |
432 |
|
433 if( aCommand == EAknCmdHideInBackground || |
|
434 ( aCommand == EAknSoftkeyExit && iAppUi.ExitHidesInBackground() ) ) |
|
435 { |
|
436 SetFasterAppFlag( ETrue ); |
|
437 aCommand = ECalenFasterAppExit; |
|
438 if( iViewManager->CalenToolbar() ) |
|
439 { |
|
440 iViewManager->CalenToolbar()->SetToolbarVisibilityL(ETrue); |
|
441 } |
|
442 } |
|
443 else if( aCommand == EAknCmdExit || aCommand == EEikCmdExit |
|
444 || aCommand == EAknSoftkeyExit ) |
|
445 { |
|
446 if( iViewManager->CalenToolbar() ) |
|
447 { |
|
448 iViewManager->CalenToolbar()->ResetCalendarToolbar(); |
|
449 } |
|
450 } |
|
451 else |
|
452 { |
|
453 if((aCommand < ECalenViewCommandBase ) || (aCommand > iNextServicesCommandBase)) |
|
454 { |
|
455 return EFalse; |
|
456 } |
|
457 } |
|
458 |
|
459 cmd.SetCommandAndContextL( aCommand, iGlobalData->Context() ); |
334 |
460 |
335 TBool ret = iStateMachine->HandleCommandL( cmd ); |
461 TBool ret = iStateMachine->HandleCommandL( cmd ); |
336 |
462 |
337 OstTraceFunctionExit0( CCALENCONTROLLER_ISSUECOMMANDL_EXIT ); |
463 TRACE_EXIT_POINT; |
338 return ret; |
464 return ret; |
339 } |
465 } |
340 |
466 |
341 // ---------------------------------------------------------------------------- |
467 |
342 // CCalenController::Services |
468 // ---------------------------------------------------------------------------- |
343 // Returns the services |
469 // CCalenController::RequestActivationL |
344 // (other items were commented in a header). |
470 // Request activation of a specific view |
345 // ---------------------------------------------------------------------------- |
471 // (other items were commented in a header). |
346 // |
472 // ---------------------------------------------------------------------------- |
347 MCalenServices& CCalenController::Services() |
473 // |
348 { |
474 void CCalenController::RequestActivationL( const TVwsViewId& aViewId ) |
349 OstTraceFunctionEntry0( CCALENCONTROLLER_SERVICES_ENTRY ); |
475 { |
350 |
476 TRACE_ENTRY_POINT; |
351 OstTraceFunctionExit0( CCALENCONTROLLER_SERVICES_EXIT ); |
477 |
352 return *iServices; |
478 iViewManager->RequestActivationL( aViewId ); |
353 } |
479 |
354 |
480 TRACE_EXIT_POINT; |
355 // ---------------------------------------------------------------------------- |
481 } |
356 // CCalenController::ViewManager |
482 |
357 // Returns a reference to the view manager |
483 // ---------------------------------------------------------------------------- |
358 // (other items were commented in a header). |
484 // CCalenController::BroadcastNotification |
359 // ---------------------------------------------------------------------------- |
|
360 CalenViewManager& CCalenController::ViewManager() |
|
361 { |
|
362 OstTraceFunctionEntry0( CCALENCONTROLLER_VIEWMANAGER_ENTRY ); |
|
363 |
|
364 OstTraceFunctionExit0( CCALENCONTROLLER_VIEWMANAGER_EXIT ); |
|
365 return *iViewManager; |
|
366 } |
|
367 |
|
368 // ---------------------------------------------------------------------------- |
|
369 // CCalenController::MainWindow |
|
370 // Returns a reference to the MainWindow |
|
371 // (other items were commented in a header). |
|
372 // ---------------------------------------------------------------------------- |
|
373 HbMainWindow& CCalenController::MainWindow() |
|
374 { |
|
375 |
|
376 OstTraceFunctionEntry0( DUP1_CCALENCONTROLLER_MAINWINDOW_ENTRY ); |
|
377 |
|
378 OstTraceFunctionExit0( DUP1_CCALENCONTROLLER_MAINWINDOW_EXIT ); |
|
379 |
|
380 return *(hbInstance->allMainWindows().first()); |
|
381 |
|
382 |
|
383 } |
|
384 |
|
385 // ---------------------------------------------------------------------------- |
|
386 // CCCalenController::BroadcastNotification |
|
387 // Passes the notification to the Calendar Notifier. The notification will |
485 // Passes the notification to the Calendar Notifier. The notification will |
388 // then be broadcast to all observers |
486 // then be broadcast to all observers |
389 // (other items were commented in a header). |
487 // (other items were commented in a header). |
390 // ---------------------------------------------------------------------------- |
488 // ---------------------------------------------------------------------------- |
391 // |
489 // |
392 void CCalenController::BroadcastNotification( TCalenNotification aNotification ) |
490 EXPORT_C void CCalenController::BroadcastNotification( TCalenNotification aNotification ) |
393 { |
491 { |
394 OstTraceFunctionEntry0( CCALENCONTROLLER_BROADCASTNOTIFICATION_ENTRY ); |
492 TRACE_ENTRY_POINT; |
395 |
493 |
396 iNotifier->BroadcastNotification( aNotification ); |
494 iNotifier->BroadcastNotification( aNotification ); |
397 |
495 |
398 OstTraceFunctionExit0( CCALENCONTROLLER_BROADCASTNOTIFICATION_EXIT ); |
496 TRACE_EXIT_POINT; |
399 } |
497 } |
400 |
498 |
401 // ---------------------------------------------------------------------------- |
499 // ---------------------------------------------------------------------------- |
402 // CCCalenController::RegisterForNotificationsL |
500 // CCalenController::RegisterForNotificationsL |
403 // Registers the passed notification handler with the Calendar Notifier |
501 // Registers the passed notification handler with the Calendar Notifier |
404 // (other items were commented in a header). |
502 // (other items were commented in a header). |
405 // ---------------------------------------------------------------------------- |
503 // ---------------------------------------------------------------------------- |
406 // |
504 // |
407 void CCalenController::RegisterForNotificationsL( MCalenNotificationHandler* aHandler, |
505 EXPORT_C void CCalenController::RegisterForNotificationsL( MCalenNotificationHandler* aHandler, |
408 TCalenNotification aNotification ) |
506 TCalenNotification aNotification ) |
409 { |
507 { |
410 OstTraceFunctionEntry0( CCALENCONTROLLER_REGISTERFORNOTIFICATIONSL_ENTRY ); |
508 TRACE_ENTRY_POINT; |
411 |
509 |
412 iNotifier->RegisterForNotificationsL( aHandler, aNotification ); |
510 iNotifier->RegisterForNotificationsL( aHandler, aNotification ); |
413 |
511 |
414 OstTraceFunctionExit0( CCALENCONTROLLER_REGISTERFORNOTIFICATIONSL_EXIT ); |
512 TRACE_EXIT_POINT; |
415 } |
513 } |
416 |
514 |
417 // ---------------------------------------------------------------------------- |
515 // ---------------------------------------------------------------------------- |
418 // CCCalenController::RegisterForNotificationsL |
516 // CCalenController::RegisterForNotificationsL |
419 // Registers the passed notification handler with the Calendar Notifier |
517 // Registers the passed notification handler with the Calendar Notifier |
420 // (other items were commented in a header). |
518 // (other items were commented in a header). |
421 // ---------------------------------------------------------------------------- |
519 // ---------------------------------------------------------------------------- |
422 // |
520 // |
423 void CCalenController::RegisterForNotificationsL( MCalenNotificationHandler* aHandler, |
521 EXPORT_C void CCalenController::RegisterForNotificationsL( MCalenNotificationHandler* aHandler, |
424 RArray<TCalenNotification>& aNotifications ) |
522 RArray<TCalenNotification>& aNotifications ) |
425 { |
523 { |
426 OstTraceFunctionEntry0( DUP1_CCALENCONTROLLER_REGISTERFORNOTIFICATIONSL_ENTRY ); |
524 TRACE_ENTRY_POINT; |
427 |
525 |
428 iNotifier->RegisterForNotificationsL( aHandler, aNotifications ); |
526 iNotifier->RegisterForNotificationsL( aHandler, aNotifications ); |
429 |
527 |
430 OstTraceFunctionExit0( DUP1_CCALENCONTROLLER_REGISTERFORNOTIFICATIONSL_EXIT ); |
528 TRACE_EXIT_POINT; |
431 } |
529 } |
432 |
530 |
433 // ---------------------------------------------------------------------------- |
531 // ---------------------------------------------------------------------------- |
434 // CCCalenController::CancelNotifications |
532 // CCalenController::CancelNotifications |
435 // Removes the passed handler from the notifier. |
533 // Removes the passed handler from the notifier. |
436 // (other items were commented in a header). |
534 // (other items were commented in a header). |
437 // ---------------------------------------------------------------------------- |
535 // ---------------------------------------------------------------------------- |
438 // |
536 // |
439 void CCalenController::CancelNotifications( MCalenNotificationHandler* aHandler ) |
537 EXPORT_C void CCalenController::CancelNotifications( MCalenNotificationHandler* aHandler ) |
440 { |
538 { |
441 OstTraceFunctionEntry0( CCALENCONTROLLER_CANCELNOTIFICATIONS_ENTRY ); |
539 TRACE_ENTRY_POINT; |
442 |
540 |
443 iNotifier->CancelNotifications( aHandler ); |
541 iNotifier->CancelNotifications( aHandler ); |
444 |
542 |
445 OstTraceFunctionExit0( CCALENCONTROLLER_CANCELNOTIFICATIONS_EXIT ); |
543 TRACE_EXIT_POINT; |
446 } |
544 } |
447 |
545 |
448 // ---------------------------------------------------------------------------- |
546 // ---------------------------------------------------------------------------- |
449 // CCCalenController::GetCommandHandlerL |
547 // CCalenController::GetCommandHandlerL |
450 // Searches for a command handler for a particular command. Customisations |
548 // Searches for a command handler for a particular command. Customisations |
451 // are searched first. If no customisation wants to handle the command it is |
549 // are searched first. If no customisation wants to handle the command it is |
452 // handled by the view manager or the action uis |
550 // handled by the view manager or the action uis |
453 // ---------------------------------------------------------------------------- |
551 // ---------------------------------------------------------------------------- |
454 MCalenCommandHandler* CCalenController::GetCommandHandlerL( TInt aCommand ) |
552 MCalenCommandHandler* CCalenController::GetCommandHandlerL( TInt aCommand ) |
455 { |
553 { |
456 OstTraceFunctionEntry0( CCALENCONTROLLER_GETCOMMANDHANDLERL_ENTRY ); |
554 TRACE_ENTRY_POINT; |
457 |
555 |
458 MCalenCommandHandler* handler( NULL ); |
556 MCalenCommandHandler* handler( NULL ); |
459 |
557 |
460 // Stop non-published commands from being customised |
558 // Stop non-published commands from being customised |
461 if ( aCommand != ECalenShowSettings |
559 if ( aCommand != ECalenShowSettings |
464 // See if a plugin wants the command |
562 // See if a plugin wants the command |
465 handler = iCustomisationManager->GetCommandHandlerL( aCommand ); |
563 handler = iCustomisationManager->GetCommandHandlerL( aCommand ); |
466 } |
564 } |
467 |
565 |
468 // See if the view manager wants the command |
566 // See if the view manager wants the command |
469 if ( !handler ) |
567 if(!handler) |
470 { |
568 { |
471 if ( aCommand >= ECalenViewCommandBase |
569 if( aCommand >= ECalenViewCommandBase |
472 && aCommand < ECalenEditCommandBase ) |
570 && aCommand < ECalenEditCommandBase ) |
473 { |
571 { |
474 handler = iViewManager; |
572 handler = iViewManager; |
475 } |
573 } |
476 else if( aCommand >= ECalenMissedAlarmCommandBase |
574 else if(aCommand >= ECalenMissedAlarmCommandBase |
477 && aCommand < ECalenLastCommand ) |
575 && aCommand < ECalenAttachmentCommandBase ) |
478 { |
576 { |
479 //handler = iAlarmManager; |
577 handler = iAlarmManager; |
480 } |
578 } |
481 else |
579 else |
482 { |
580 { |
483 handler = iActionUi->GetCommandHandlerL( aCommand ); |
581 handler = iActionUi->GetCommandHandlerL(aCommand); |
484 } |
582 } |
485 } |
583 } |
486 |
584 |
487 // No command handler is an error |
585 // No command handler is an error |
488 |
586 |
489 OstTraceFunctionExit0( CCALENCONTROLLER_GETCOMMANDHANDLERL_EXIT ); |
|
490 |
|
491 // return the handler |
587 // return the handler |
|
588 TRACE_EXIT_POINT; |
492 return handler; |
589 return handler; |
493 } |
590 } |
494 |
591 |
495 // ---------------------------------------------------------------------------- |
592 // ---------------------------------------------------- |
496 // CCCalenController::NewServicesL |
593 // CCalenController::CheckSystemTimeAtStartUpL |
|
594 // Check the system time change at the startup |
|
595 // ---------------------------------------------------- |
|
596 // |
|
597 void CCalenController::CheckSystemTimeAtStartUpL() |
|
598 { |
|
599 TRACE_ENTRY_POINT; |
|
600 |
|
601 if(iSystemTimeChangedMsgDelayer) |
|
602 { |
|
603 iSystemTimeChangedMsgDelayer->Cancel(); |
|
604 delete iSystemTimeChangedMsgDelayer; |
|
605 iSystemTimeChangedMsgDelayer = NULL; |
|
606 } |
|
607 |
|
608 // Introduce delay (CPeriodic) before showing the note |
|
609 // to allow time for the active view to display before |
|
610 // note. |
|
611 |
|
612 TCallBack callback; |
|
613 callback = TCallBack( SystemTimeChangeCallback, this ); |
|
614 |
|
615 iSystemTimeChangedMsgDelayer = new (ELeave) CAsyncCallBack( |
|
616 callback, CActive::EPriorityStandard); |
|
617 iSystemTimeChangedMsgDelayer->CallBack(); |
|
618 |
|
619 TRACE_EXIT_POINT; |
|
620 } |
|
621 |
|
622 // ---------------------------------------------------- |
|
623 // CCalenController::SystemTimeChangeCallback |
|
624 // This function is called when the System time is changed. |
|
625 // ---------------------------------------------------- |
|
626 // |
|
627 TInt CCalenController::SystemTimeChangeCallback(TAny* aThisPtr) |
|
628 { |
|
629 TRACE_ENTRY_POINT; |
|
630 |
|
631 PIM_TRAPD_HANDLE( |
|
632 static_cast<CCalenController*>(aThisPtr)->HandleSystemTimeChangeL()); |
|
633 |
|
634 TRACE_EXIT_POINT; |
|
635 return 0; |
|
636 } |
|
637 |
|
638 // ---------------------------------------------------------------------------- |
|
639 // CCalenController::HandleSystemTimeChangeL |
|
640 // Checks to see if the system time was changed while Calendar was |
|
641 // not running or in the background, potentially causing alarms to be missed |
|
642 // (other items were commented in a header). |
|
643 // ---------------------------------------------------------------------------- |
|
644 // |
|
645 void CCalenController::HandleSystemTimeChangeL() |
|
646 { |
|
647 TRACE_ENTRY_POINT; |
|
648 |
|
649 // get the system time change info |
|
650 TInt timeChanged = iNotifier->SystemTimeChangedL(); |
|
651 |
|
652 switch( timeChanged ) |
|
653 { |
|
654 case KCalenTimeZoneChanged: |
|
655 { |
|
656 ShowSystemChangeInfoNoteL( R_QTN_CALE_NOTE_SYSTEM_TIME_CHANGED ); |
|
657 } |
|
658 break; |
|
659 case KCalenLostAlarms: |
|
660 { |
|
661 // Not displayed since missed alarms are handled in missed alarms view. |
|
662 // No need to show the info note the user. |
|
663 // Part of alarm improvement REQ for calendar. |
|
664 //ShowSystemChangeInfoNoteL( R_QTN_CALE_NOTE_MISSED_ALARMS ); |
|
665 } |
|
666 break; |
|
667 case KNoUserInfoNoteDisplay: |
|
668 default: |
|
669 break; |
|
670 } |
|
671 |
|
672 // update system time change info to the cenrep |
|
673 iNotifier->UpdateSytemTimeChangeInfoL(); |
|
674 |
|
675 TRACE_EXIT_POINT; |
|
676 } |
|
677 |
|
678 // ---------------------------------------------------------------------------- |
|
679 // CCalenController::ShowSystemChangeInfoNoteL |
|
680 // Displays an information note if the system time changed while Calendar |
|
681 // was inactive |
|
682 // (other items were commented in a header). |
|
683 // ---------------------------------------------------------------------------- |
|
684 // |
|
685 void CCalenController::ShowSystemChangeInfoNoteL( TInt aResourceId ) |
|
686 { |
|
687 TRACE_ENTRY_POINT; |
|
688 |
|
689 HBufC* buf = StringLoader::LoadLC( aResourceId, CEikonEnv::Static() ); |
|
690 CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(); |
|
691 |
|
692 dialog->ExecuteLD( *buf ); |
|
693 |
|
694 CleanupStack::PopAndDestroy( buf ); |
|
695 |
|
696 TRACE_EXIT_POINT; |
|
697 } |
|
698 |
|
699 // ---------------------------------------------------------------------------- |
|
700 // CCalenController::NewServicesL |
497 // Factory function for creating new MCalenServices objects |
701 // Factory function for creating new MCalenServices objects |
498 // (other items were commented in a header). |
702 // (other items were commented in a header). |
499 // ---------------------------------------------------------------------------- |
703 // ---------------------------------------------------------------------------- |
500 // |
704 // |
501 MCalenServices* CCalenController::NewServicesL() |
705 EXPORT_C MCalenServices* CCalenController::NewServicesL() |
502 { |
706 { |
503 OstTraceFunctionEntry0( CCALENCONTROLLER_NEWSERVICESL_ENTRY ); |
707 TRACE_ENTRY_POINT; |
504 |
708 |
505 TInt commandRangeStart = iNextServicesCommandBase; |
709 TInt commandRangeStart = iNextServicesCommandBase; |
506 TInt commandRangeEnd = commandRangeStart + KNumberOfCommandsPerServices; |
710 TInt commandRangeEnd = commandRangeStart + KNumberOfCommandsPerServices; |
507 iNextServicesCommandBase = commandRangeEnd + 1; |
711 iNextServicesCommandBase = commandRangeEnd + 1; |
508 |
712 |
509 CalenServicesImpl* svc = CalenServicesImpl::NewL( commandRangeStart,commandRangeEnd ); |
713 CCalenServicesImpl* svc = CCalenServicesImpl::NewL( commandRangeStart, |
510 |
714 commandRangeEnd ); |
511 OstTraceFunctionExit0( CCALENCONTROLLER_NEWSERVICESL_EXIT ); |
715 TRACE_EXIT_POINT; |
512 return svc; |
716 return svc; |
|
717 } |
|
718 |
|
719 // ---------------------------------------------------------------------------- |
|
720 // CCalenController::ProcessCommandParametersL |
|
721 // Takes care of commandline parameters. |
|
722 // (other items were commented in a header). |
|
723 // ---------------------------------------------------------------------------- |
|
724 // |
|
725 EXPORT_C void CCalenController::ProcessCommandParametersL( TApaCommand aCommand, |
|
726 TFileName& aDocumentName, |
|
727 const TDesC8& aTail ) |
|
728 { |
|
729 TRACE_ENTRY_POINT; |
|
730 |
|
731 iCmdLineLauncher->ProcessCommandParametersL( aCommand, aDocumentName, aTail ); |
|
732 |
|
733 TRACE_EXIT_POINT; |
513 } |
734 } |
514 |
735 |
515 // ---------------------------------------------------------------------------- |
736 // ---------------------------------------------------------------------------- |
516 // CCalenController::Notifier |
737 // CCalenController::Notifier |
517 // Returns the notifier. |
738 // Returns the notifier. |
518 // (other items were commented in a header). |
739 // (other items were commented in a header). |
519 // ---------------------------------------------------------------------------- |
740 // ---------------------------------------------------------------------------- |
520 // |
741 // |
521 CalenNotifier& CCalenController::Notifier() |
742 CCalenNotifier& CCalenController::Notifier() |
522 { |
743 { |
523 OstTraceFunctionEntry0( CCALENCONTROLLER_NOTIFIER_ENTRY ); |
744 TRACE_ENTRY_POINT; |
524 |
745 TRACE_EXIT_POINT; |
525 OstTraceFunctionExit0( CCALENCONTROLLER_NOTIFIER_EXIT ); |
|
526 return *iNotifier; |
746 return *iNotifier; |
527 } |
747 } |
528 |
748 |
|
749 // ---------------------------------------------------------------------------- |
|
750 // CCalenController::SetExitOnDialogFlag |
|
751 // (other items were commented in a header). |
|
752 // ---------------------------------------------------------------------------- |
|
753 // |
|
754 void CCalenController::SetExitOnDialogFlag( TBool aFlag ) |
|
755 { |
|
756 TRACE_ENTRY_POINT; |
|
757 |
|
758 iCmdLineLauncher->SetExitOnDialogclose( aFlag ); |
|
759 |
|
760 TRACE_EXIT_POINT; |
|
761 } |
|
762 |
|
763 // ---------------------------------------------------------------------------- |
|
764 // CCalenController::GetExitOnDialogFlag |
|
765 // (other items were commented in a header). |
|
766 // ---------------------------------------------------------------------------- |
|
767 // |
|
768 TBool CCalenController::GetExitOnDialogFlag() |
|
769 { |
|
770 TRACE_ENTRY_POINT; |
|
771 |
|
772 TBool tempVal; |
|
773 tempVal = iCmdLineLauncher->GetExitOnDialogStatus(); |
|
774 return tempVal; |
|
775 |
|
776 TRACE_EXIT_POINT; |
|
777 } |
|
778 |
|
779 // ---------------------------------------------------------------------------- |
|
780 // CCalenController::Services |
|
781 // Returns the services |
|
782 // (other items were commented in a header). |
|
783 // ---------------------------------------------------------------------------- |
|
784 // |
|
785 MCalenServices& CCalenController::Services() |
|
786 { |
|
787 TRACE_ENTRY_POINT; |
|
788 TRACE_EXIT_POINT; |
|
789 return *iServices; |
|
790 } |
|
791 |
|
792 // ---------------------------------------------------------------------------- |
|
793 // CCalenController::OfferMenuPaneL |
|
794 // Offers the menu pane to plugins for customisation. |
|
795 // Acts as a conduit between the services and the customisation manager. |
|
796 // (other items were commented in a header). |
|
797 // ---------------------------------------------------------------------------- |
|
798 // |
|
799 EXPORT_C void CCalenController::OfferMenuPaneL( TInt aResourceId, |
|
800 CEikMenuPane* aMenuPane ) |
|
801 { |
|
802 TRACE_ENTRY_POINT; |
|
803 |
|
804 iCustomisationManager->OfferMenuPaneL( aResourceId, aMenuPane ); |
|
805 |
|
806 if( aResourceId == R_CALENDAR_CHANGE_VIEW_MENUPANE ) |
|
807 { |
|
808 // The cascading view switch menu is being displayed |
|
809 // therefore the view manager needs to be asked to remove |
|
810 // the current view |
|
811 iViewManager->RemoveCurrentViewFromMenu( aMenuPane ); |
|
812 } |
|
813 |
|
814 TUint32 missedAlarmsCount(0); |
|
815 // get the count from missed alarm store |
|
816 iAlarmManager->MissedAlarmStore()->CountL(missedAlarmsCount); |
|
817 |
|
818 //For adding "Missed Alarms" menu item for native views menu pane |
|
819 if(!missedAlarmsCount) |
|
820 { |
|
821 TInt dummy; |
|
822 if( aMenuPane->MenuItemExists( ECalenMissedAlarmsView, dummy )) |
|
823 { |
|
824 aMenuPane->DeleteMenuItem(ECalenMissedAlarmsView); |
|
825 } |
|
826 } |
|
827 |
|
828 TRACE_EXIT_POINT; |
|
829 } |
|
830 |
529 // ---------------------------------------------------------------------------- |
831 // ---------------------------------------------------------------------------- |
530 // CCalenController::Infobar |
832 // CCalenController::Infobar |
531 // Descriptor passed to plugins to get customised info bar text. |
833 // Descriptor passed to plugins to get customised info bar text. |
532 // Acts as a conduit between the services and the customisation manager. |
834 // Acts as a conduit between the services and the customisation manager. |
533 // (other items were commented in a header). |
835 // (other items were commented in a header). |
534 // ---------------------------------------------------------------------------- |
836 // ---------------------------------------------------------------------------- |
535 // |
837 // |
536 HbWidget* CCalenController::Infobar() |
838 EXPORT_C CCoeControl* CCalenController::Infobar( const TRect& aRect ) |
537 { |
839 { |
538 OstTraceFunctionEntry0( DUP1_CCALENCONTROLLER_INFOBAR_ENTRY ); |
840 TRACE_ENTRY_POINT; |
539 |
841 TRACE_EXIT_POINT; |
540 OstTraceFunctionExit0( DUP1_CCALENCONTROLLER_INFOBAR_EXIT ); |
842 return iCustomisationManager->Infobar( aRect ); |
|
843 } |
|
844 |
|
845 // ---------------------------------------------------------------------------- |
|
846 // CCalenController::Infobar |
|
847 // Descriptor passed to plugins to get customised info bar text. |
|
848 // Acts as a conduit between the services and the customisation manager. |
|
849 // (other items were commented in a header). |
|
850 // ---------------------------------------------------------------------------- |
|
851 // |
|
852 EXPORT_C const TDesC& CCalenController::Infobar() |
|
853 { |
|
854 TRACE_ENTRY_POINT; |
|
855 TRACE_EXIT_POINT; |
541 return iCustomisationManager->Infobar(); |
856 return iCustomisationManager->Infobar(); |
542 } |
857 } |
543 // ---------------------------------------------------------------------------- |
858 |
544 // CCalenController::InfobarTextL |
859 // ---------------------------------------------------------------------------- |
545 // @returns info bar text |
860 // CCalenController::PreviewPane |
546 // (other items were commented in a header). |
861 // Descriptor passed to plugins to get customised preview pane text. |
547 // ---------------------------------------------------------------------------- |
862 // Acts as a conduit between the services and the customisation manager. |
548 // |
863 // (other items were commented in a header). |
549 QString* CCalenController::InfobarTextL() |
864 // ---------------------------------------------------------------------------- |
550 { |
865 // |
551 OstTraceFunctionEntry0( CCALENCONTROLLER_INFOBARTEXTL_ENTRY ); |
866 EXPORT_C CCoeControl* CCalenController::PreviewPane( TRect& aRect ) |
552 |
867 { |
553 OstTraceFunctionExit0( CCALENCONTROLLER_INFOBARTEXTL_EXIT ); |
868 TRACE_ENTRY_POINT; |
554 return iCustomisationManager->InfobarTextL(); |
869 TRACE_EXIT_POINT; |
555 } |
870 return iCustomisationManager->PreviewPane( aRect ); |
|
871 } |
|
872 |
|
873 // ---------------------------------------------------------------------------- |
|
874 // CCalenController::CustomPreviewPaneL |
|
875 // Return custom preview pane |
|
876 // (other items were commented in a header). |
|
877 // ---------------------------------------------------------------------------- |
|
878 // |
|
879 EXPORT_C MCalenPreview* CCalenController::CustomPreviewPaneL( TRect& aRect ) |
|
880 { |
|
881 TRACE_ENTRY_POINT; |
|
882 TRACE_EXIT_POINT; |
|
883 return iCustomisationManager->CustomPreviewPaneL(aRect); |
|
884 } |
|
885 |
556 // ---------------------------------------------------------------------------- |
886 // ---------------------------------------------------------------------------- |
557 // CCalenController::CustomisationManager |
887 // CCalenController::CustomisationManager |
558 // Returns a reference to the customisation manager |
888 // Returns a reference to the customisation manager |
559 // (other items were commented in a header). |
889 // (other items were commented in a header). |
560 // ---------------------------------------------------------------------------- |
890 // ---------------------------------------------------------------------------- |
561 // |
891 // |
562 CCalenCustomisationManager& CCalenController::CustomisationManager() |
892 CCalenCustomisationManager& CCalenController::CustomisationManager() |
563 { |
893 { |
564 OstTraceFunctionEntry0( CCALENCONTROLLER_CUSTOMISATIONMANAGER_ENTRY ); |
894 TRACE_ENTRY_POINT; |
565 |
895 TRACE_EXIT_POINT; |
566 OstTraceFunctionExit0( CCALENCONTROLLER_CUSTOMISATIONMANAGER_EXIT ); |
|
567 return *iCustomisationManager; |
896 return *iCustomisationManager; |
568 } |
897 } |
569 |
898 |
570 // ---------------------------------------------------------------------------- |
899 // ---------------------------------------------------------------------------- |
571 // CCalenController::SetDefaultContext |
900 // CCalenController::ViewManager |
572 // Sets the default context for today |
901 // Returns a reference to the view manager |
573 // (other items were commented in a header). |
902 // (other items were commented in a header). |
574 // ---------------------------------------------------------------------------- |
903 // ---------------------------------------------------------------------------- |
575 // |
904 CCalenViewManager& CCalenController::ViewManager() |
576 void CCalenController::SetDefaultContext() |
905 { |
577 { |
906 TRACE_ENTRY_POINT; |
578 OstTraceFunctionEntry0( CCALENCONTROLLER_SETDEFAULTCONTEXT_ENTRY ); |
907 TRACE_EXIT_POINT; |
579 |
908 return *iViewManager; |
580 QDateTime focusTime = mContext->defaultCalTimeForViewsL(); |
909 } |
581 mContext->setFocusDateAndTime(focusTime); |
910 |
582 |
911 // ---------------------------------------------------------------------------- |
583 OstTraceFunctionExit0( CCALENCONTROLLER_SETDEFAULTCONTEXT_EXIT ); |
912 // CCalenController::MissedAlarmStore |
584 } |
913 // Returns a reference to the Missed Alarm Store |
585 |
914 // ---------------------------------------------------------------------------- |
586 // ---------------------------------------------------------------------------- |
915 CMissedAlarmStore* CCalenController::MissedAlarmStore() |
587 // CCalenController::OfferMenu |
916 { |
588 // Offers the menu to plugins for customisation. |
917 TRACE_ENTRY_POINT; |
589 // Acts as a conduit between the services and the customisation manager. |
918 TRACE_EXIT_POINT; |
590 // (other items were commented in a header). |
919 |
591 // ---------------------------------------------------------------------------- |
920 return iAlarmManager->MissedAlarmStore(); |
592 |
921 } |
593 void CCalenController::OfferMenu(HbMenu* aHbMenu) |
922 |
594 { |
923 // ---------------------------------------------------------------------------- |
595 OstTraceFunctionEntry0( CCALENCONTROLLER_OFFERMENU_ENTRY ); |
924 // CCalenController::IsFasterAppFlagEnabled |
596 |
925 // Returns ETrue if the application is fake exited |
597 iCustomisationManager->OfferMenu(aHbMenu); |
926 // else return EFalse. |
598 |
927 // (other items were commented in a header). |
599 OstTraceFunctionExit0( CCALENCONTROLLER_OFFERMENU_EXIT ); |
928 // ---------------------------------------------------------------------------- |
600 } |
929 TBool CCalenController::IsFasterAppFlagEnabled() |
601 |
930 { |
602 // ---------------------------------------------------------------------------- |
931 TRACE_ENTRY_POINT; |
603 // CCalenController::agendaInterface |
932 TRACE_EXIT_POINT; |
604 // returns the interface to the agenda database |
933 return iFasterApp; |
605 // (other items were commented in a header). |
934 } |
606 // --------------------------------------------------------------------------- |
935 |
607 // |
936 // ---------------------------------------------------------------------------- |
608 AgendaUtil* CCalenController::agendaInterface() |
937 // CCalenController::SetFasterAppFlag |
609 { |
938 // Set the flag 'iFasterApp' to ETrue if application is fake exited |
610 OstTraceFunctionEntry0( CCALENCONTROLLER_AGENDAINTERFACE_ENTRY ); |
939 // and to EFalse once the application comes to foreground. |
611 |
940 // (other items were commented in a header). |
612 |
941 // ---------------------------------------------------------------------------- |
613 OstTraceFunctionExit0( CCALENCONTROLLER_AGENDAINTERFACE_EXIT ); |
942 void CCalenController::SetFasterAppFlag( TBool aFlag ) |
614 return mAgendaUtil; |
943 { |
615 } |
944 TRACE_ENTRY_POINT; |
616 |
945 TRACE_EXIT_POINT; |
617 // ---------------------------------------------------------------------------- |
946 iFasterApp = aFlag; |
618 // CCalenController::context |
947 } |
619 // returns the calendar context |
948 |
620 // (other items were commented in a header). |
949 // ---------------------------------------------------------------------------- |
621 // --------------------------------------------------------------------------- |
950 // CCalenController::AppUi |
622 // |
951 // Returns a reference to the appui |
623 MCalenContext& CCalenController::context() |
952 // (other items were commented in a header). |
624 { |
953 // ---------------------------------------------------------------------------- |
625 OstTraceFunctionEntry0( CCALENCONTROLLER_CONTEXT_ENTRY ); |
954 // |
|
955 CAknViewAppUi& CCalenController::AppUi() |
|
956 { |
|
957 TRACE_ENTRY_POINT; |
|
958 TRACE_EXIT_POINT; |
|
959 return iAppUi; |
|
960 } |
|
961 |
|
962 // ---------------------------------------------------------------------------- |
|
963 // CCalenController::GetMissedAlarmsList |
|
964 // Returns the missed alarms list |
|
965 // ---------------------------------------------------------------------------- |
|
966 void CCalenController::GetMissedAlarmsList(RArray<TCalenInstanceId>& aMissedAlarmsList) |
|
967 { |
|
968 TRACE_ENTRY_POINT; |
|
969 iAlarmManager->GetMissedAlarmsList(aMissedAlarmsList); |
|
970 TRACE_EXIT_POINT; |
|
971 } |
|
972 |
|
973 // ---------------------------------------------------------------------------- |
|
974 // CCalenController::Settings |
|
975 // Returns a reference to the calendar settings |
|
976 // ---------------------------------------------------------------------------- |
|
977 CCalenSetting& CCalenController::Settings() |
|
978 { |
|
979 TRACE_ENTRY_POINT; |
|
980 TRACE_EXIT_POINT; |
|
981 return *iSetting; |
|
982 } |
|
983 |
|
984 // ---------------------------------------------------------------------------- |
|
985 // CCalenController::GetIconL |
|
986 // Get icon of specific type |
|
987 // ---------------------------------------------------------------------------- |
|
988 // |
|
989 CGulIcon* CCalenController::GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId ) |
|
990 { |
|
991 TRACE_ENTRY_POINT; |
|
992 |
|
993 // if view requests next view icon |
|
994 if(aIndex == MCalenServices::ECalenNextViewIcon) |
|
995 { |
|
996 return (iViewManager->GetNextViewIconL()); |
|
997 } |
|
998 |
|
999 TRACE_EXIT_POINT; |
|
1000 return iViewManager->IconsL().GetIconL(aIndex,aViewId); |
|
1001 } |
|
1002 |
|
1003 // ---------------------------------------------------------------------------- |
|
1004 // CCalenController::MultipleDbManager |
|
1005 // Returns a reference to the CCalenMultipleDbManager |
|
1006 // (other items were commented in a header). |
|
1007 // ---------------------------------------------------------------------------- |
|
1008 // |
|
1009 CCalenMultipleDbManager& CCalenController::MultipleDbManager() |
|
1010 { |
|
1011 TRACE_ENTRY_POINT |
|
1012 CCalenMultipleDbManager* tmp = NULL; |
|
1013 TRACE_EXIT_POINT |
|
1014 return *tmp; |
|
1015 } |
|
1016 |
|
1017 // ---------------------------------------------------------------------------- |
|
1018 // CCalenController::StateMachine |
|
1019 // Returns a reference to the CCalenStateMachine |
|
1020 // (other items were commented in a header). |
|
1021 // ---------------------------------------------------------------------------- |
|
1022 // |
|
1023 CCalenStateMachine& CCalenController::StateMachine() |
|
1024 { |
|
1025 TRACE_ENTRY_POINT |
|
1026 TRACE_EXIT_POINT |
|
1027 return *iStateMachine; |
|
1028 } |
|
1029 |
|
1030 |
|
1031 // ----------------------------------------------------------------------------- |
|
1032 // CCalenController::GetActiveCollectionidsL |
|
1033 // ----------------------------------------------------------------------------- |
|
1034 // |
|
1035 void CCalenController::GetActiveCollectionidsL( |
|
1036 RArray<TInt>& aCollectionIds) |
|
1037 { |
|
1038 TRACE_ENTRY_POINT |
|
1039 RPointerArray<CCalCalendarInfo> calendarInfoList; |
|
1040 CleanupClosePushL(calendarInfoList); |
|
1041 iGlobalData->GetAllCalendarInfoL(calendarInfoList); |
|
1042 |
|
1043 for(TInt index=0;index<calendarInfoList.Count();index++) |
|
1044 { |
|
1045 if(calendarInfoList[index]->Enabled()) |
|
1046 { |
|
1047 HBufC* calendarFileName = |
|
1048 calendarInfoList[index]->FileNameL().AllocLC(); |
|
1049 aCollectionIds.Append( |
|
1050 iGlobalData->CalSessionL(*calendarFileName).CollectionIdL()); |
|
1051 CleanupStack::PopAndDestroy(calendarFileName); |
|
1052 } |
|
1053 } |
|
1054 |
|
1055 CleanupStack::PopAndDestroy(&calendarInfoList); |
|
1056 TRACE_EXIT_POINT |
|
1057 } |
|
1058 |
|
1059 // ----------------------------------------------------------------------------- |
|
1060 // CCalenController::AttachmentData |
|
1061 // Returns a reference to the CCalenAttachmentModel |
|
1062 // ---------------------------------------------------------------------------- |
|
1063 // |
|
1064 CCalenAttachmentModel& CCalenController::AttachmentData() |
|
1065 { |
|
1066 TRACE_ENTRY_POINT; |
|
1067 TRACE_EXIT_POINT; |
|
1068 return *iAttachmentData; |
|
1069 } |
626 |
1070 |
627 OstTraceFunctionExit0( CCALENCONTROLLER_CONTEXT_EXIT ); |
1071 // ----------------------------------------------------------------------------- |
628 return *mContext; |
1072 // CCalenController::IsEditorActive |
629 } |
1073 // Tells framework whether editor is active or not |
630 |
1074 // ----------------------------------------------------------------------------- |
631 // ---------------------------------------------------------------------------- |
1075 // |
632 // CCalenController::handleServiceManagerSlot |
1076 TBool CCalenController::IsEditorActive() |
633 // Launches the requested view |
1077 { |
634 // (other items were commented in a header). |
1078 return (iActionUi->IsEditorActive()); |
635 // --------------------------------------------------------------------------- |
1079 } |
636 // |
1080 |
637 void CCalenController::handleServiceManagerSlot(int view, const QDateTime& dateTime) |
1081 // ----------------------------------------------------------------------------- |
638 { |
1082 // CCalenController::AddCalendarL |
639 OstTraceFunctionEntry0( CCALENCONTROLLER_HANDLESERVICEMANAGERSLOT_ENTRY ); |
1083 // Adds a new calendar file with metadata set |
640 |
1084 // ----------------------------------------------------------------------------- |
641 // Broadcast the notification ECalenNotifyCloseDialogs |
1085 // |
642 // to close the opened dialogs if any |
1086 void CCalenController::AddCalendarL(CCalCalendarInfo* aCalendarInfo) |
643 BroadcastNotification(ECalenNotifyCloseDialogs); |
1087 { |
644 |
1088 TRACE_ENTRY_POINT; |
645 if (iIsFromServiceFrmWrk) { |
1089 iGlobalData->AddCalendarL(aCalendarInfo); |
646 // Set the context properly |
1090 TRACE_EXIT_POINT; |
647 mContext->setFocusDateAndTime(dateTime); |
1091 } |
648 // launch the appropriate view |
1092 |
649 iViewManager->constructAndActivateView(view); |
1093 // ----------------------------------------------------------------------------- |
650 |
1094 // CCalenController::UpdateCalendarL |
651 iIsFromServiceFrmWrk = false; |
1095 // Updates calendar file with new calendar info |
652 |
1096 // ----------------------------------------------------------------------------- |
653 } else { |
1097 // |
654 // Calendar was in backgroung but now its being brought to foreground |
1098 void CCalenController::UpdateCalendarL(CCalCalendarInfo* aCalendarInfo) |
655 |
1099 { |
656 // Remove the previous view to avoid flicker |
1100 TRACE_ENTRY_POINT; |
657 iViewManager->removePreviousView(); |
1101 iGlobalData->UpdateCalendarL(aCalendarInfo); |
658 |
1102 TRACE_EXIT_POINT; |
659 // If current state is editing state or printing state |
1103 } |
660 // or deleting state or sending state, then dont do anything as |
1104 |
661 // user might loose the data |
1105 // ----------------------------------------------------------------------------- |
662 |
1106 // CCalenController::RemoveCalendarL |
663 CCalenStateMachine::TCalenStateIndex currentState = |
1107 // Removes calendar file based on calendar file name |
664 iStateMachine->CurrentState(); |
1108 // ----------------------------------------------------------------------------- |
665 |
1109 // |
666 if ((currentState == CCalenStateMachine::ECalenDeletingState) || |
1110 void CCalenController::RemoveCalendarL(const TDesC& aCalendarFileName) |
667 (currentState == CCalenStateMachine::ECalenPrintingState) || |
1111 { |
668 (currentState == CCalenStateMachine::ECalenSendingState)) { |
1112 TRACE_ENTRY_POINT; |
669 // simply return - we dont have anything to do |
1113 iGlobalData->RemoveCalendarL(aCalendarFileName); |
670 } else if (currentState == CCalenStateMachine::ECalenViewingState) { |
1114 TRACE_EXIT_POINT; |
671 if(iViewManager->isEventViewerActive()) { |
1115 } |
672 iViewManager->closeAgendaEventView(); |
1116 |
673 } |
1117 // ----------------------------------------------------------------------------- |
674 } else if (currentState == CCalenStateMachine::ECalenEditingState) { |
1118 // CCalenController::RemoveCalendarL |
675 // close the editor and save the entry if application is |
1119 // Removes all dead calendar files from the file system |
676 // in background and launch the desired view |
1120 // ----------------------------------------------------------------------------- |
677 if(iViewManager->isEventViewerActive()) { |
1121 // |
678 // First close editor and then viewer |
1122 void CCalenController::RemoveDeadCalendarsL() |
679 iViewManager->saveAndCloseEditor(); |
1123 { |
680 iViewManager->closeAgendaEventView(); |
1124 TRACE_ENTRY_POINT; |
681 } else { |
1125 iGlobalData->RemoveDeadCalendarsL(); |
682 // If viewer is not active, just close the editor |
1126 TRACE_EXIT_POINT; |
683 iActionUi->saveAndCloseEditor(); |
1127 } |
684 } |
1128 // ----------------------------------------------------------------------------- |
685 } else if (currentState == CCalenStateMachine::ECalenSettingsState) { |
1129 // CCalenController::GetAllCalendarInfoL |
686 iViewManager->removeSettingsView(); |
1130 // Get all available calendar info |
687 } |
1131 // ----------------------------------------------------------------------------- |
688 |
1132 // |
689 // Set the context properly |
1133 void CCalenController::GetAllCalendarInfoL( |
690 mContext->setFocusDateAndTime(dateTime); |
1134 RPointerArray<CCalCalendarInfo>& aCalendarInfoList) |
691 IssueCommandL(view); |
1135 { |
692 |
1136 TRACE_ENTRY_POINT; |
693 // connect to raise the window to foreground once the view is ready |
1137 iGlobalData->GetAllCalendarInfoL(aCalendarInfoList); |
694 connect(&MainWindow(), SIGNAL(viewReady()), this, SLOT(raiseWindow())); |
1138 TRACE_EXIT_POINT; |
695 |
1139 } |
696 // Dispatches all posted events of type DeferredDelete, |
1140 |
697 // i.e. empties the event queue in case any deletion is pending |
1141 // ----------------------------------------------------------------------------- |
698 qApp->sendPostedEvents(0, QEvent::DeferredDelete); |
1142 // CCalenController::SetLaunchFromExternalApp |
699 } |
1143 // |
700 |
1144 // (other items were commented in a header). |
701 OstTraceFunctionExit0( CCALENCONTROLLER_HANDLESERVICEMANAGERSLOT_EXIT ); |
1145 // ----------------------------------------------------------------------------- |
702 } |
1146 // |
703 |
1147 void CCalenController::SetLaunchFromExternalApp( TBool aFlag ) |
704 void CCalenController::raiseWindow() |
1148 { |
705 { |
1149 TRACE_ENTRY_POINT; |
706 MainWindow().raise(); |
1150 |
707 disconnect(&MainWindow(), SIGNAL(viewReady()), |
1151 iLaunchFromExternalApp = aFlag; |
708 this, SLOT(raiseWindow())); |
1152 TRACE_EXIT_POINT; |
709 } |
1153 } |
710 // ---------------------------------------------------------------------------- |
1154 |
711 // CCalenController::getFirstView |
1155 // ----------------------------------------------------------------------------- |
712 // returns the first view with which calendar has been launched |
1156 // CCalenController::SetLaunchFromExternalApp |
713 // (other items were commented in a header). |
1157 // |
714 // --------------------------------------------------------------------------- |
1158 // (other items were commented in a header). |
715 // |
1159 // ----------------------------------------------------------------------------- |
716 int CCalenController::getFirstView() |
1160 // |
717 { |
1161 TBool CCalenController::IsLaunchFromExternalApp() |
718 OstTraceFunctionEntry0( CCALENCONTROLLER_GETFIRSTVIEW_ENTRY ); |
1162 { |
719 |
1163 TRACE_ENTRY_POINT; |
720 OstTraceFunctionExit0( CCALENCONTROLLER_GETFIRSTVIEW_EXIT ); |
1164 TRACE_EXIT_POINT; |
721 |
1165 |
722 return iViewManager->getFirstView(); |
1166 return iLaunchFromExternalApp; |
723 |
1167 } |
724 } |
1168 // End of file |
725 |
1169 |
726 // ---------------------------------------------------------------------------- |
|
727 // CCalenController::eventFilter |
|
728 // Filters and handles the changes in events |
|
729 // (other items were commented in a header). |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 bool CCalenController::eventFilter(QObject *object, QEvent *event) |
|
733 { |
|
734 OstTraceFunctionEntry0( CCALENCONTROLLER_EVENTFILTER_ENTRY ); |
|
735 |
|
736 switch (event->type()) |
|
737 { |
|
738 case QEvent::LanguageChange: |
|
739 //TODO: Unload the translator and install the locale specific translator |
|
740 iNotifier->BroadcastNotification( ECalenNotifySystemLanguageChanged ); |
|
741 break; |
|
742 case QEvent::LocaleChange: |
|
743 // TODO: handle the locale changes |
|
744 break; |
|
745 default: |
|
746 break; |
|
747 } |
|
748 OstTraceFunctionExit0( CCALENCONTROLLER_EVENTFILTER_EXIT ); |
|
749 |
|
750 return QObject::eventFilter(object, event); |
|
751 } |
|
752 |
|
753 /* |
|
754 * Emits the appReady signal. |
|
755 */ |
|
756 void CCalenController::emitAppReady() |
|
757 { |
|
758 emit appReady(); |
|
759 } |
|
760 |
|
761 // End of file --Don't remove this. |
|