49 // Symbian 2nd phase constructor can leave. |
57 // Symbian 2nd phase constructor can leave. |
50 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
51 // |
59 // |
52 void CDialogWrapper::ConstructL() |
60 void CDialogWrapper::ConstructL() |
53 { |
61 { |
54 // Get resource file path |
62 iIsProgressDialog = EFalse; |
55 TFileName fileName; |
63 iHbProgressDialog = NULL; |
56 fileName.Copy( TParsePtrC( RProcess().FileName() ).Drive() ); |
64 iIsUninstallerProgressDialog = EFalse; |
57 fileName.Append( KDC_RESOURCE_FILES_DIR ); |
65 iHbProgressDialogForUninstaller = NULL; |
58 fileName.Append( KDaemonResourceFile ); |
66 iIsIndicator = EFalse; |
59 |
67 iHbIndicator = NULL; |
60 // Get language of resource file |
|
61 BaflUtils::NearestLanguageFile( iFs, fileName ); |
|
62 |
|
63 // Open resource file |
|
64 iResourceFile.OpenL( iFs, fileName ); |
|
65 iResourceFile.ConfirmSignatureL(); |
|
66 |
|
67 // By default Daemon will show all notes. |
68 // By default Daemon will show all notes. |
68 iDisableAllNotes = EFalse; |
69 iDisableAllNotes = EFalse; |
|
70 iTimeOffDisableProgress = EFalse; |
69 // Create watcher AO for PS Key. |
71 // Create watcher AO for PS Key. |
70 iWatcher = CDialogWatcher::NewL( this ); |
72 iWatcher = CDialogWatcher::NewL( this ); |
71 // Get current PS Key |
73 // Get current PS Key |
72 TInt err = iWatcher->GetPSKeyForUI( iDisableAllNotes ); |
74 TInt err = iWatcher->GetPSKeyForUI( iDisableAllNotes ); |
73 if ( err ) |
75 if ( err ) |
74 { |
76 { |
75 // If we can not get PS key, let's disable all notes. |
77 // If we can not get PS key, let's disable all notes. |
76 iDisableAllNotes = ETrue; |
78 iDisableAllNotes = ETrue; |
77 } |
79 } |
78 // Start AO |
80 // Start AO |
79 iWatcher->StartWatcher(); |
81 iWatcher->StartWatcher(); |
|
82 // Create dialog timer for progress dialog. |
|
83 iTimer = CDialogTimer::NewL( this ); |
80 } |
84 } |
81 |
85 |
82 // ----------------------------------------------------------------------------- |
86 // ----------------------------------------------------------------------------- |
83 // CDialogWrapper::NewL |
87 // CDialogWrapper::NewL |
84 // Two-phased constructor. |
88 // Two-phased constructor. |
90 CleanupStack::PushL( self ); |
94 CleanupStack::PushL( self ); |
91 self->ConstructL(); |
95 self->ConstructL(); |
92 CleanupStack::Pop( self ); |
96 CleanupStack::Pop( self ); |
93 return self; |
97 return self; |
94 } |
98 } |
95 |
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CDialogWrapper::~CDialogWrapper |
96 // Destructor |
102 // Destructor |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
97 CDialogWrapper::~CDialogWrapper() |
105 CDialogWrapper::~CDialogWrapper() |
98 { |
106 { |
99 iResourceFile.Close(); |
107 FLOG( _L("Daemon: CDialogWrapper::~CDialogWrapper") ); |
|
108 delete iTimer; |
|
109 |
|
110 // If installer's RunL leaves make sure that dialogs are closed. |
|
111 if ( iIsProgressDialog && iHbProgressDialog ) |
|
112 { |
|
113 iHbProgressDialog->Close(); |
|
114 } |
|
115 delete iHbProgressDialog; |
|
116 |
|
117 // If uninstaller's RunL leaves make sure that dialogs are closed. |
|
118 if ( iIsUninstallerProgressDialog && iHbProgressDialogForUninstaller ) |
|
119 { |
|
120 iHbProgressDialogForUninstaller->Close(); |
|
121 } |
|
122 delete iHbProgressDialogForUninstaller; |
|
123 |
|
124 if ( iIsIndicator && iHbIndicator ) |
|
125 { |
|
126 iHbIndicator->Deactivate( KIndicatorTypeSWIDaemon ); |
|
127 } |
|
128 delete iHbIndicator; |
|
129 |
100 if ( iWatcher ) |
130 if ( iWatcher ) |
101 { |
131 { |
102 iWatcher->StopWatcher(); |
132 iWatcher->StopWatcher(); |
103 delete iWatcher; |
133 } |
104 } |
134 delete iWatcher; |
105 } |
135 } |
106 |
136 |
107 // ----------------------------------------------------------------------------- |
137 // ----------------------------------------------------------------------------- |
108 // CDialogWrapper::ShowUntrustedResultL |
138 // CDialogWrapper::ShowUntrustedResultL |
109 // Show global result dialog. |
139 // Show global result dialog. |
110 // (other items were commented in a header). |
140 // (other items were commented in a header). |
111 // ----------------------------------------------------------------------------- |
141 // ----------------------------------------------------------------------------- |
112 // |
142 // |
113 void CDialogWrapper::ShowUntrustedResultL() |
143 void CDialogWrapper::ShowUntrustedResultL() |
114 { |
144 { |
|
145 FLOG( _L("Daemon: CDialogWrapper::ShowUntrustedResultL") ); |
|
146 |
|
147 #ifdef _SWIDAEMON_DISABLE_NOTES_ |
|
148 FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") ); |
|
149 iDisableAllNotes = ETrue; |
|
150 #endif |
|
151 |
115 // Let watcher to know that waiting note is canceled. |
152 // Let watcher to know that waiting note is canceled. |
116 iWatcher->CancelNoteRequest(); |
153 iWatcher->CancelNoteRequest(); |
117 |
154 |
118 if ( iDisableAllNotes == EFalse ) |
155 // Inform watcher that we have request to show note. |
|
156 iWatcher->CancelNoteRequest(); |
|
157 |
|
158 if ( !iDisableAllNotes ) |
119 { |
159 { |
120 HBufC* string = ReadResourceLC( R_DAEMON_UNTRUSTED_FOUND ); |
160 CHbDeviceNotificationDialogSymbian* notificationDialog = |
121 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
161 CHbDeviceNotificationDialogSymbian::NewL( NULL ); |
122 note->ShowNoteL( EAknGlobalInformationNote, *string ); |
162 |
123 CleanupStack::PopAndDestroy( 2, string ); |
163 CleanupStack::PushL( notificationDialog ); |
124 } |
164 |
|
165 //TODO get string from log file. |
|
166 _LIT( KTempIconText,"note_info"); |
|
167 _LIT( KTempTextTitle,"SW Silent Installer" ); |
|
168 _LIT( KTempTextForErrorMessage,"Untrusted software was found." ); |
|
169 |
|
170 notificationDialog->NotificationL( KTempIconText, |
|
171 KTempTextTitle , |
|
172 KTempTextForErrorMessage ); |
|
173 |
|
174 CleanupStack::PopAndDestroy( notificationDialog ); |
|
175 } |
125 } |
176 } |
126 |
177 |
127 // ----------------------------------------------------------------------------- |
178 // ----------------------------------------------------------------------------- |
128 // CDialogWrapper::ShowErrorResultL |
179 // CDialogWrapper::ShowErrorResultL |
129 // Show global result dialog. |
180 // Show global result dialog. |
130 // (other items were commented in a header). |
181 // (other items were commented in a header). |
131 // ----------------------------------------------------------------------------- |
182 // ----------------------------------------------------------------------------- |
132 // |
183 // |
133 void CDialogWrapper::ShowErrorResultL() |
184 void CDialogWrapper::ShowErrorResultL() |
134 { |
185 { |
135 // Let watcher to know that waiting note is canceled. |
186 FLOG( _L("Daemon: CDialogWrapper::ShowErrorResultL") ); |
|
187 |
|
188 #ifdef _SWIDAEMON_DISABLE_NOTES_ |
|
189 FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") ); |
|
190 iDisableAllNotes = ETrue; |
|
191 #endif |
|
192 |
|
193 // Inform watcher that we have request to show note. |
136 iWatcher->CancelNoteRequest(); |
194 iWatcher->CancelNoteRequest(); |
137 |
195 |
138 if ( iDisableAllNotes == EFalse ) |
196 if ( !iDisableAllNotes ) |
139 { |
197 { |
140 HBufC* string = ReadResourceLC( R_DAEMON_INSTALLATION_ERROR ); |
198 CHbDeviceNotificationDialogSymbian* notificationDialog = |
141 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
199 CHbDeviceNotificationDialogSymbian::NewL( NULL ); |
142 note->ShowNoteL( EAknGlobalInformationNote, *string ); |
200 |
143 CleanupStack::PopAndDestroy( 2, string ); |
201 CleanupStack::PushL( notificationDialog ); |
|
202 |
|
203 //TODO get string from log file. |
|
204 _LIT( KTempIconText,"note_info"); |
|
205 _LIT( KTempTextTitle,"SW Silent Installer" ); |
|
206 _LIT( KTempTextForErrorMessage,"Installation was not completed." ); |
|
207 |
|
208 notificationDialog->NotificationL( KTempIconText, |
|
209 KTempTextTitle , |
|
210 KTempTextForErrorMessage ); |
|
211 |
|
212 CleanupStack::PopAndDestroy( notificationDialog ); |
144 } |
213 } |
145 } |
214 } |
146 |
215 |
147 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
148 // CDialogWrapper::ShowWaitingNoteL |
217 // CDialogWrapper::ShowWaitingNoteL |
150 // (other items were commented in a header). |
219 // (other items were commented in a header). |
151 // ----------------------------------------------------------------------------- |
220 // ----------------------------------------------------------------------------- |
152 // |
221 // |
153 void CDialogWrapper::ShowWaitingNoteL() |
222 void CDialogWrapper::ShowWaitingNoteL() |
154 { |
223 { |
155 if ( iDisableAllNotes == EFalse ) |
224 FLOG( _L("Daemon: CDialogWrapper::ShowWaitingNoteL") ); |
156 { |
225 |
157 if ( iNoteId == 0 ) |
226 #ifdef _SWIDAEMON_DISABLE_NOTES_ |
158 { |
227 FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") ); |
159 HBufC* string = ReadResourceLC( R_DAEMON_INSTALLING ); |
228 iDisableAllNotes = ETrue; |
160 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
229 #endif |
161 note->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY ); |
230 |
162 iNoteId = note->ShowNoteL( EAknGlobalWaitNote, *string ); |
231 FLOG_1( _L("Daemon: iDisableAllNotes: %d"), iDisableAllNotes ); |
163 CleanupStack::PopAndDestroy( 2, string ); |
232 FLOG_1( _L("Daemon: iIsProgressDialog: %d"), iIsProgressDialog ); |
|
233 FLOG_1( _L("Daemon: iTimeOffDisableProgress: %d"), iTimeOffDisableProgress ); |
|
234 |
|
235 if ( !iDisableAllNotes ) |
|
236 { |
|
237 if ( !iIsProgressDialog && !iTimeOffDisableProgress ) |
|
238 { |
|
239 iHbProgressDialog = CHbDeviceProgressDialogSymbian::NewL( |
|
240 CHbDeviceProgressDialogSymbian::EWaitDialog, |
|
241 NULL ); |
|
242 iIsProgressDialog = ETrue; |
|
243 |
|
244 _LIT( KTempTextForProgressDialog,"Installing" ); |
|
245 |
|
246 iHbProgressDialog->SetTextL( KTempTextForProgressDialog ); |
|
247 FLOG( _L("Daemon: ShowWaitingNoteL: ShowL") ); |
|
248 iHbProgressDialog->ShowL(); |
|
249 FLOG( _L("Daemon: ShowWaitingNoteL: StartDialogTimer") ); |
|
250 iTimer->StartDialogTimer( KDialogTimeOut ); |
164 } |
251 } |
165 } |
252 } |
166 else if ( iDisableAllNotes ) |
253 else if ( iDisableAllNotes ) |
167 { |
254 { |
168 // Let watcher to know that waiting note should be shown |
255 // Let watcher to know that waiting note should be shown |
175 // CDialogWrapper::CancelWaitingNoteL |
262 // CDialogWrapper::CancelWaitingNoteL |
176 // Cancel global waiting note after installing. |
263 // Cancel global waiting note after installing. |
177 // (other items were commented in a header). |
264 // (other items were commented in a header). |
178 // ----------------------------------------------------------------------------- |
265 // ----------------------------------------------------------------------------- |
179 // |
266 // |
180 void CDialogWrapper::CancelWaitingNoteL() |
267 void CDialogWrapper::CancelWaitingNote() |
181 { |
268 { |
182 if ( iNoteId ) |
269 FLOG( _L("Daemon: CDialogWrapper::CancelWaitingNoteL") ); |
|
270 |
|
271 if ( iIsProgressDialog ) |
183 { |
272 { |
184 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
273 iHbProgressDialog->Close(); |
185 note->CancelNoteL( iNoteId ); |
274 delete iHbProgressDialog; |
186 iNoteId = 0; |
275 //Make sure not to delete twice in destructor. |
187 CleanupStack::PopAndDestroy(); |
276 iHbProgressDialog = NULL; |
|
277 iIsProgressDialog = EFalse; |
|
278 |
|
279 iTimeOffDisableProgress = ETrue; |
188 } |
280 } |
|
281 |
189 // Let watcher to know that waiting note is canceled. |
282 // Let watcher to know that waiting note is canceled. |
190 iWatcher->CancelNoteRequest(); |
283 iWatcher->CancelNoteRequest(); |
191 } |
284 } |
192 // CDialogWrapper::LoadResourceLC |
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CDialogWrapper::LoadResourceLC |
193 // Read resource string. |
288 // Read resource string. |
194 // (other items were commented in a header). |
289 // (other items were commented in a header). |
195 // ----------------------------------------------------------------------------- |
290 // ----------------------------------------------------------------------------- |
196 // |
291 // |
197 HBufC* CDialogWrapper::ReadResourceLC( TInt aResourceId ) |
292 HBufC* CDialogWrapper::ReadResourceLC( TInt /*aResourceId*/ ) |
198 { |
293 { |
199 TResourceReader reader; |
294 //TODO: All resoureces nees to be rewriten for device dialogs (QT) |
200 HBufC8* buff = iResourceFile.AllocReadLC( aResourceId ); |
295 return NULL; |
201 reader.SetBuffer( buff ); |
|
202 HBufC* text = reader.ReadHBufCL(); |
|
203 CleanupStack::PopAndDestroy( buff ); |
|
204 CleanupStack::PushL( text ); |
|
205 return text; |
|
206 } |
296 } |
207 |
297 |
208 // ----------------------------------------------------------------------------- |
298 // ----------------------------------------------------------------------------- |
209 // CDialogWrapper::SetUIFlag |
299 // CDialogWrapper::SetUIFlag |
210 // Sets UI flag for dialog wrapper. If flag is ture, dialogs are disabled. |
300 // Sets UI flag for dialog wrapper. If flag is ture, dialogs are disabled. |
220 // Show global waiting note during uninstall. |
310 // Show global waiting note during uninstall. |
221 // ----------------------------------------------------------------------------- |
311 // ----------------------------------------------------------------------------- |
222 // |
312 // |
223 void CDialogWrapper::ShowWaitingNoteForUninstallerL() |
313 void CDialogWrapper::ShowWaitingNoteForUninstallerL() |
224 { |
314 { |
225 if ( iDisableAllNotes == EFalse ) |
315 FLOG( _L("Daemon: CDialogWrapper::ShowWaitingNoteForUninstallerL") ); |
226 { |
316 |
227 if ( iNoteId == 0 ) |
317 #ifdef _SWIDAEMON_DISABLE_NOTES_ |
228 { |
318 FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") ); |
229 HBufC* string = ReadResourceLC( R_UNINSTALLER_INSTALL ); |
319 iDisableAllNotes = ETrue; |
230 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
320 #endif |
231 note->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY ); |
321 |
232 iNoteId = note->ShowNoteL( EAknGlobalWaitNote, *string ); |
322 FLOG_1( _L("Daemon: iDisableAllNotes: %d"), iDisableAllNotes ); |
233 CleanupStack::PopAndDestroy( 2, string ); |
323 FLOG_1( _L("Daemon: iIsProgressDialog: %d"), iIsProgressDialog ); |
|
324 FLOG_1( _L("Daemon: iTimeOffDisableProgress: %d"), iTimeOffDisableProgress ); |
|
325 |
|
326 if ( !iDisableAllNotes ) |
|
327 { |
|
328 if ( !iIsUninstallerProgressDialog && !iTimeOffDisableProgress ) |
|
329 { |
|
330 iHbProgressDialogForUninstaller = |
|
331 CHbDeviceProgressDialogSymbian::NewL( |
|
332 CHbDeviceProgressDialogSymbian::EWaitDialog, |
|
333 NULL ); |
|
334 iIsUninstallerProgressDialog = ETrue; |
|
335 //TODO get string from log file. |
|
336 _LIT( KTempTextForProgressDialog,"Uninstalling" ); |
|
337 iHbProgressDialogForUninstaller->SetTextL( KTempTextForProgressDialog ); |
|
338 FLOG( _L("Daemon: ShowWaitingNoteForUninstallerL: ShowL") ); |
|
339 iHbProgressDialogForUninstaller->ShowL(); |
|
340 FLOG( _L("Daemon: ShowWaitingNoteForUninstallerL: StartDialogTimer") ); |
|
341 iTimer->StartDialogTimer( KDialogTimeOut ); |
234 } |
342 } |
235 } |
343 } |
236 else if ( iDisableAllNotes ) |
344 else if ( iDisableAllNotes ) |
237 { |
345 { |
238 // Let watcher to know that waiting note should be shown |
346 // Let watcher to know that waiting note should be shown |
239 // after dialogs are enabled. |
347 // after dialogs are enabled. |
240 iWatcher->RequestToDisplayNote(); |
348 iWatcher->RequestToDisplayNote(); |
241 } |
349 } |
242 } |
350 } |
|
351 |
|
352 // ----------------------------------------------------------------------------- |
|
353 // CDialogWrapper::CancelWaitingNoteL |
|
354 // Cancel global waiting note after installing. |
|
355 // (other items were commented in a header). |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CDialogWrapper::CancelWaitingNoteForUninstaller() |
|
359 { |
|
360 FLOG( _L("Daemon: CDialogWrapper::CancelWaitingNoteForUninstallerL") ); |
|
361 |
|
362 if ( iIsUninstallerProgressDialog ) |
|
363 { |
|
364 iHbProgressDialogForUninstaller->Close(); |
|
365 delete iHbProgressDialogForUninstaller; |
|
366 //Make sure not to delete twice in destructor. |
|
367 iHbProgressDialogForUninstaller = NULL; |
|
368 iIsUninstallerProgressDialog = EFalse; |
|
369 |
|
370 iTimeOffDisableProgress = ETrue; |
|
371 } |
|
372 |
|
373 // Let watcher to know that waiting note is canceled. |
|
374 iWatcher->CancelNoteRequest(); |
|
375 } |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // CDialogWrapper::ActivateIndicatorL() |
|
379 // |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 void CDialogWrapper::ActivateIndicatorL( TReal aProcessValue ) |
|
383 { |
|
384 FLOG( _L("Daemon: CDialogWrapper::ActivateIndicatorL") ); |
|
385 |
|
386 if ( !iIsIndicator ) |
|
387 { |
|
388 FLOG( _L("Daemon: CHbIndicatorSymbian::NewL") ); |
|
389 iHbIndicator = CHbIndicatorSymbian::NewL(); |
|
390 iIsIndicator = ETrue; |
|
391 } |
|
392 |
|
393 TInt value = static_cast<TInt>( aProcessValue ); |
|
394 FLOG_1( _L("Daemon: ActivateIndicatorL: precent value: %d"), value ); |
|
395 |
|
396 CHbSymbianVariant* hbParam = CHbSymbianVariant::NewL( |
|
397 &value, |
|
398 CHbSymbianVariant::EInt ); |
|
399 CleanupStack::PushL( hbParam ); |
|
400 |
|
401 FLOG( _L("Daemon: ActivateIndicatorL: Activate") ); |
|
402 iHbIndicator->Activate( KIndicatorTypeSWIDaemon, hbParam ); |
|
403 |
|
404 CleanupStack::PopAndDestroy( hbParam ); |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CDialogWrapper::SetModeToIndicatorL() |
|
409 // |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 void CDialogWrapper::SetModeToIndicatorL( TInt aMode ) |
|
413 { |
|
414 FLOG_1( _L("Daemon: CDialogWrapper::SetModeToIndicatorL: aMode: %d"), |
|
415 aMode ); |
|
416 |
|
417 if ( !iIsIndicator ) |
|
418 { |
|
419 FLOG( _L("Daemon: CHbIndicatorSymbian::NewL") ); |
|
420 iHbIndicator = CHbIndicatorSymbian::NewL(); |
|
421 iIsIndicator = ETrue; |
|
422 } |
|
423 // Set mode. |
|
424 TReal mode = aMode; |
|
425 CHbSymbianVariant* hbParam = CHbSymbianVariant::NewL( |
|
426 &mode, |
|
427 CHbSymbianVariant::EReal ); |
|
428 CleanupStack::PushL( hbParam ); |
|
429 FLOG( _L("Daemon: SetModeToIndicatorL: Activate") ); |
|
430 iHbIndicator->Activate( KIndicatorTypeSWIDaemon, hbParam ); |
|
431 |
|
432 CleanupStack::PopAndDestroy( hbParam ); |
|
433 } |
|
434 |
|
435 |
|
436 // ----------------------------------------------------------------------------- |
|
437 // CDialogWrapper::CancelIndicatorL |
|
438 // |
|
439 // ----------------------------------------------------------------------------- |
|
440 // |
|
441 void CDialogWrapper::CancelIndicatorL() |
|
442 { |
|
443 FLOG( _L("Daemon: CDialogWrapper::CancelIndicatorL") ); |
|
444 |
|
445 if ( iIsIndicator ) |
|
446 { |
|
447 FLOG( _L("Daemon: CancelIndicatorL: Deactivate") ); |
|
448 iHbIndicator->Deactivate( KIndicatorTypeSWIDaemon ); |
|
449 delete iHbIndicator; |
|
450 iHbIndicator = NULL; //Make sure not to delete twice in destructor. |
|
451 iIsIndicator = EFalse; |
|
452 } |
|
453 } |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CDialogWrapper::CheckSystemState() |
|
457 // |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 /* |
|
461 void CDialogWrapper::CheckSystemState() |
|
462 { |
|
463 FLOG( _L("Daemon: CDialogWrapper::CheckSystemState TEST") ); |
|
464 |
|
465 // We need to check this only if system is not ready to show |
|
466 // dialogs e.g. UI is not up. |
|
467 if ( !iSystemReadyToShowDialogs ) |
|
468 { |
|
469 RSsmStateAwareSession systemStateSession; |
|
470 |
|
471 TInt err = systemStateSession.Connect( KUIFrameworkDomain3 ); |
|
472 FLOG_1( _L("Daemon: systemStateSession.Connect err = %d"), err ); |
|
473 |
|
474 if ( err == KErrNone ) |
|
475 { |
|
476 TSsmState currentState = systemStateSession.State(); |
|
477 systemStateSession.Close(); |
|
478 |
|
479 FLOG_1( _L("Daemon: System main state = %d"), currentState.MainState() ); |
|
480 FLOG_1( _L("Daemon: System sub state = %d"), currentState.SubState() ); |
|
481 |
|
482 |
|
483 if ( currentState.MainState() == ESsmNormal ) |
|
484 { |
|
485 iSystemReadyToShowDialogs = ETrue; |
|
486 } |
|
487 else |
|
488 { |
|
489 iSystemReadyToShowDialogs = EFalse; |
|
490 } |
|
491 } |
|
492 else |
|
493 { |
|
494 iSystemReadyToShowDialogs = EFalse; |
|
495 } |
|
496 } |
|
497 FLOG_1( _L("Daemon: iSystemReadyToShowDialogs = %d"), |
|
498 iSystemReadyToShowDialogs ); |
|
499 } |
|
500 */ |
|
501 |
|
502 //------------------------------------------------------------------------------- |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CDialogTimer::CDialogTimer() |
|
506 // |
|
507 // ----------------------------------------------------------------------------- |
|
508 // |
|
509 CDialogTimer::CDialogTimer() : CActive( EPriorityNormal ) |
|
510 { |
|
511 } |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // CDialogTimer::~CDialogTimer() |
|
515 // |
|
516 // ----------------------------------------------------------------------------- |
|
517 // |
|
518 CDialogTimer::~CDialogTimer() |
|
519 { |
|
520 FLOG( _L("Daemon: CDialogTimer::~CDialogTimer") ); |
|
521 // Cancel the outstanding request. Calls the active object’s |
|
522 // DoCancel function if request is outstanding. |
|
523 Cancel(); |
|
524 // Delete RTimer |
|
525 iRTimer.Close(); |
|
526 } |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // CDialogTimer::NewL() |
|
530 // |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 CDialogTimer* CDialogTimer::NewL( CDialogWrapper* aDialog ) |
|
534 { |
|
535 CDialogTimer* activeTimer = new (ELeave) CDialogTimer(); |
|
536 CleanupStack::PushL( activeTimer ); |
|
537 activeTimer->ConstructL( aDialog ); |
|
538 CleanupStack::Pop(); |
|
539 return activeTimer; |
|
540 } |
|
541 |
|
542 // ----------------------------------------------------------------------------- |
|
543 // CDialogTimer::ConstructL() |
|
544 // |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 void CDialogTimer::ConstructL( CDialogWrapper* aDialog ) |
|
548 { |
|
549 if ( aDialog == NULL ) |
|
550 { |
|
551 User::Leave( KErrArgument ); |
|
552 } |
|
553 iDialog = aDialog; |
|
554 CActiveScheduler::Add( this ); |
|
555 iRTimer.CreateLocal(); |
|
556 } |
|
557 |
|
558 // ----------------------------------------------------------------------------- |
|
559 // CDialogTimer::StartDialogTimer() |
|
560 // |
|
561 // ----------------------------------------------------------------------------- |
|
562 // |
|
563 void CDialogTimer::StartDialogTimer( TUint32 aRefreshTime ) |
|
564 { |
|
565 FLOG( _L("Daemon: CDialogTimer::StartDialogTimer") ); |
|
566 // Check first that we do not have request outstanding. |
|
567 if ( !IsActive() ) |
|
568 { |
|
569 // Set time interval for dialog. |
|
570 TimerSet( aRefreshTime ); |
|
571 } |
|
572 } |
|
573 |
|
574 // ----------------------------------------------------------------------------- |
|
575 // CDialogTimer::TimerSet() |
|
576 // |
|
577 // ----------------------------------------------------------------------------- |
|
578 // |
|
579 void CDialogTimer::TimerSet( TUint32 aRefreshTime ) |
|
580 { |
|
581 FLOG_1( _L("Daemon: CDialogTimer::TimerSet time: %d"), aRefreshTime ); |
|
582 // Set timer interval. |
|
583 iRTimer.After( iStatus, aRefreshTime ); |
|
584 // Set active. Start wait for timer. |
|
585 SetActive(); |
|
586 } |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // CDialogTimer::RunL() |
|
590 // |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 void CDialogTimer::RunL() |
|
594 { |
|
595 FLOG( _L("Daemon: CDialogTimer::RunL: Cancel waiting note") ); |
|
596 iDialog->CancelWaitingNote(); |
|
597 iDialog->CancelWaitingNoteForUninstaller(); |
|
598 } |
|
599 |
|
600 // ----------------------------------------------------------------------------- |
|
601 // CDialogTimer::DoCancel() |
|
602 // |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 void CDialogTimer::DoCancel() |
|
606 { |
|
607 // Cancel outstanding request for a timer event. |
|
608 iRTimer.Cancel(); |
|
609 } |
|
610 |
|
611 // ----------------------------------------------------------------------------- |
|
612 // CDialogTimer::RunError() |
|
613 // |
|
614 // ----------------------------------------------------------------------------- |
|
615 // |
|
616 TInt CDialogTimer::RunError( TInt aError ) |
|
617 { |
|
618 return aError; |
|
619 } |
|
620 |
|
621 |
243 // End of File |
622 // End of File |