appinstaller/AppinstUi/Daemon/Src/DialogWrapper.cpp
changeset 37 6e7b00453237
parent 33 8110bf1194d1
child 42 d17dc5398051
equal deleted inserted replaced
33:8110bf1194d1 37:6e7b00453237
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <hb/hbwidgets/hbdeviceprogressdialogsymbian.h>
    21 #include <hb/hbwidgets/hbdeviceprogressdialogsymbian.h>
    22 #include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
    22 #include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
       
    23 #include <hb/hbcore/hbindicatorsymbian.h>
       
    24 #include <hb/hbcore/hbsymbianvariant.h>
       
    25 //#include <ssm/ssmstateawaresession.h> // For system state
       
    26 //#include <ssm/ssmstate.h>
       
    27 //#include <ssm/ssmdomaindefs.h> // KUIFrameworkDomain
    23 #include "DialogWrapper.h"
    28 #include "DialogWrapper.h"
    24 #include "SWInstDebug.h"
    29 #include "SWInstDebug.h"
    25 
    30 
    26 using namespace Swi;
    31 using namespace Swi;
    27 
    32 
       
    33 // Time interval for progress dialog.
       
    34 const TUint KDialogTimeOut = 5000000;
       
    35 // Indicator type
       
    36 _LIT( KIndicatorTypeSWIDaemon, 
       
    37         "com.nokia.sisxsilentinstall.indicatorplugin/1.0" );
       
    38 
    28 //TODO: remove when HB dialogs do not crash in HW/WINS
    39 //TODO: remove when HB dialogs do not crash in HW/WINS
    29 #define _SWIDAEMON_DISABLE_NOTES_
    40 //#define _SWIDAEMON_DISABLE_NOTES_
    30 
    41 
    31 // ============================ MEMBER FUNCTIONS ===============================
    42 // ============================ MEMBER FUNCTIONS ===============================
    32 
    43 
    33 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    34 // CDialogWrapper::CDialogWrapper
    45 // CDialogWrapper::CDialogWrapper
    50     {
    61     {
    51     iIsProgressDialog = EFalse;
    62     iIsProgressDialog = EFalse;
    52     iHbProgressDialog = NULL;
    63     iHbProgressDialog = NULL;
    53     iIsUninstallerProgressDialog = EFalse;
    64     iIsUninstallerProgressDialog = EFalse;
    54     iHbProgressDialogForUninstaller = NULL;
    65     iHbProgressDialogForUninstaller = NULL;
    55                   
    66     iIsIndicator = EFalse;
       
    67     iHbIndicator = NULL;                        
    56     // By default Daemon will show all notes.
    68     // By default Daemon will show all notes.
    57     iDisableAllNotes = EFalse;
    69     iDisableAllNotes = EFalse;    
    58     
    70     iTimeOffDisableProgress = EFalse;    
    59     // Create watcher AO for PS Key.
    71     // Create watcher AO for PS Key.
    60     iWatcher = CDialogWatcher::NewL( this );   
    72     iWatcher = CDialogWatcher::NewL( this );              
    61     // Get current PS Key 
    73     // Get current PS Key 
    62     TInt err = iWatcher->GetPSKeyForUI( iDisableAllNotes );
    74     TInt err = iWatcher->GetPSKeyForUI( iDisableAllNotes );
    63     if ( err )
    75     if ( err )
    64         {
    76         {
    65         // 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.
    66         iDisableAllNotes = ETrue;
    78         iDisableAllNotes = ETrue;
    67         }
    79         }
    68     // Start AO
    80     // Start AO
    69     iWatcher->StartWatcher();
    81     iWatcher->StartWatcher();    
       
    82     // Create dialog timer for progress dialog.
       
    83     iTimer = CDialogTimer::NewL( this );
    70     }
    84     }
    71 
    85 
    72 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    73 // CDialogWrapper::NewL
    87 // CDialogWrapper::NewL
    74 // Two-phased constructor.
    88 // Two-phased constructor.
    88 // Destructor
   102 // Destructor
    89 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
    90 //    
   104 //    
    91 CDialogWrapper::~CDialogWrapper()
   105 CDialogWrapper::~CDialogWrapper()
    92     {
   106     {
       
   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             }    
    93     delete iHbProgressDialog;
   115     delete iHbProgressDialog;
    94     delete iHbProgressDialogForUninstaller;                          
   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     
    95     if ( iWatcher )
   130     if ( iWatcher )
    96         {
   131         {
    97         iWatcher->StopWatcher();
   132         iWatcher->StopWatcher();        
    98         delete iWatcher;
   133         }       
    99         }
   134     delete iWatcher;
   100     }
   135     }
   101 
   136 
   102 // -----------------------------------------------------------------------------
   137 // -----------------------------------------------------------------------------
   103 // CDialogWrapper::ShowUntrustedResultL
   138 // CDialogWrapper::ShowUntrustedResultL
   104 // Show global result dialog.
   139 // Show global result dialog.
   106 // -----------------------------------------------------------------------------
   141 // -----------------------------------------------------------------------------
   107 // 
   142 // 
   108 void CDialogWrapper::ShowUntrustedResultL()
   143 void CDialogWrapper::ShowUntrustedResultL()
   109     {
   144     {
   110     FLOG( _L("Daemon: CDialogWrapper::ShowUntrustedResultL") );
   145     FLOG( _L("Daemon: CDialogWrapper::ShowUntrustedResultL") );
   111 
   146         
   112 #ifdef _SWIDAEMON_DISABLE_NOTES_
   147 #ifdef _SWIDAEMON_DISABLE_NOTES_
   113     FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") );
   148     FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") );
   114     iDisableAllNotes = ETrue;
   149     iDisableAllNotes = ETrue;
   115 #endif      
   150 #endif                
   116       
   151     
   117     // Let watcher to know that waiting note is canceled.
   152     // Let watcher to know that waiting note is canceled.
   118     iWatcher->CancelNoteRequest();            
   153     iWatcher->CancelNoteRequest();            
   119         
   154         
   120     // Inform watcher that we have request to show note. 
   155     // Inform watcher that we have request to show note. 
   121     iWatcher->CancelNoteRequest();   
   156     iWatcher->CancelNoteRequest(); 
   122     
   157             
   123     if ( iDisableAllNotes == EFalse )
   158     if ( !iDisableAllNotes  )
   124         {    
   159         {    
   125         CHbDeviceNotificationDialogSymbian* notificationDialog = 
   160         CHbDeviceNotificationDialogSymbian* notificationDialog = 
   126                 CHbDeviceNotificationDialogSymbian::NewL( NULL );
   161                 CHbDeviceNotificationDialogSymbian::NewL( NULL );
   127         
   162         
   128         CleanupStack::PushL( notificationDialog );
   163         CleanupStack::PushL( notificationDialog );
   129         
   164         
   130 //TODO get string from log file.  
   165 //TODO get string from log file.  
   131         _LIT( KTempIconText,"note_info");
   166         _LIT( KTempIconText,"note_info");
   132         _LIT( KTempTextTitle,"SW Silent Installer" );
   167         _LIT( KTempTextTitle,"SW Silent Installer" );
   133         _LIT( KTempTextForErrorMessage,"Untrusted software was found." ); 
   168         _LIT( KTempTextForErrorMessage,"Untrusted software was found." ); 
   134                      
   169                                          
   135         //notificationDialog->SetTimeout( KHbLongNotificationDialogTimeout );        
       
   136         
       
   137         notificationDialog->NotificationL( KTempIconText, 
   170         notificationDialog->NotificationL( KTempIconText, 
   138                                            KTempTextTitle , 
   171                                            KTempTextTitle , 
   139                                            KTempTextForErrorMessage );
   172                                            KTempTextForErrorMessage );
   140                     
   173                     
   141         CleanupStack::PopAndDestroy( notificationDialog );        
   174         CleanupStack::PopAndDestroy( notificationDialog );        
   157     iDisableAllNotes = ETrue;
   190     iDisableAllNotes = ETrue;
   158 #endif  
   191 #endif  
   159     
   192     
   160     // Inform watcher that we have request to show note. 
   193     // Inform watcher that we have request to show note. 
   161     iWatcher->CancelNoteRequest();   
   194     iWatcher->CancelNoteRequest();   
   162     
   195             
   163     if ( iDisableAllNotes == EFalse )
   196     if ( !iDisableAllNotes )
   164         {    
   197         {    
   165         CHbDeviceNotificationDialogSymbian* notificationDialog = 
   198         CHbDeviceNotificationDialogSymbian* notificationDialog = 
   166                 CHbDeviceNotificationDialogSymbian::NewL( NULL );
   199                 CHbDeviceNotificationDialogSymbian::NewL( NULL );
   167         
   200         
   168         CleanupStack::PushL( notificationDialog );
   201         CleanupStack::PushL( notificationDialog );
   169         
   202         
   170 //TODO get string from log file.  
   203 //TODO get string from log file.  
   171         _LIT( KTempIconText,"note_info");
   204         _LIT( KTempIconText,"note_info");
   172         _LIT( KTempTextTitle,"SW Silent Installer" );
   205         _LIT( KTempTextTitle,"SW Silent Installer" );
   173         _LIT( KTempTextForErrorMessage,"Installation was not completed." ); 
   206         _LIT( KTempTextForErrorMessage,"Installation was not completed." ); 
   174                    
   207                                         
   175         //notificationDialog->SetTimeout( KHbLongNotificationDialogTimeout );        
       
   176         
       
   177         notificationDialog->NotificationL( KTempIconText, 
   208         notificationDialog->NotificationL( KTempIconText, 
   178                                            KTempTextTitle , 
   209                                            KTempTextTitle , 
   179                                            KTempTextForErrorMessage );
   210                                            KTempTextForErrorMessage );
   180                
   211                
   181         CleanupStack::PopAndDestroy( notificationDialog ); 
   212         CleanupStack::PopAndDestroy( notificationDialog ); 
   189 // -----------------------------------------------------------------------------
   220 // -----------------------------------------------------------------------------
   190 // 
   221 // 
   191 void CDialogWrapper::ShowWaitingNoteL()
   222 void CDialogWrapper::ShowWaitingNoteL()
   192 	{
   223 	{
   193     FLOG( _L("Daemon: CDialogWrapper::ShowWaitingNoteL") );
   224     FLOG( _L("Daemon: CDialogWrapper::ShowWaitingNoteL") );
   194     
   225            
   195 #ifdef _SWIDAEMON_DISABLE_NOTES_
   226 #ifdef _SWIDAEMON_DISABLE_NOTES_
   196     FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") );
   227     FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") );
   197     iDisableAllNotes = ETrue;
   228     iDisableAllNotes = ETrue;
   198 #endif
   229 #endif
   199     
   230     
   200     if ( iDisableAllNotes == EFalse )
   231     FLOG_1( _L("Daemon: iDisableAllNotes: %d"), iDisableAllNotes );
       
   232     FLOG_1( _L("Daemon: iIsProgressDialog: %d"), iIsProgressDialog );
       
   233     FLOG_1( _L("Daemon: iTimeOffDisableProgress: %d"), iTimeOffDisableProgress );
       
   234             
       
   235     if ( !iDisableAllNotes )
   201         {          
   236         {          
   202         if ( !iIsProgressDialog )
   237         if ( !iIsProgressDialog && !iTimeOffDisableProgress )
   203             {    
   238             {    
   204             iHbProgressDialog = CHbDeviceProgressDialogSymbian::NewL( 
   239             iHbProgressDialog = CHbDeviceProgressDialogSymbian::NewL( 
   205                                    CHbDeviceProgressDialogSymbian::EWaitDialog, 
   240                                    CHbDeviceProgressDialogSymbian::EWaitDialog, 
   206                                    NULL );
   241                                    NULL );
   207             iIsProgressDialog = ETrue;
   242             iIsProgressDialog = ETrue;
   208             
   243                        
   209 //TODO get string from log file.            
       
   210             _LIT( KTempTextForProgressDialog,"Installing" );
   244             _LIT( KTempTextForProgressDialog,"Installing" );
   211             
   245             
   212             iHbProgressDialog->SetTextL( KTempTextForProgressDialog );            
   246             iHbProgressDialog->SetTextL( KTempTextForProgressDialog ); 
   213             iHbProgressDialog->ShowL();
   247             FLOG( _L("Daemon: ShowWaitingNoteL: ShowL") );
       
   248             iHbProgressDialog->ShowL();            
       
   249             FLOG( _L("Daemon: ShowWaitingNoteL: StartDialogTimer") );
       
   250             iTimer->StartDialogTimer( KDialogTimeOut );
   214             }
   251             }
   215         }
   252         }
   216     else if ( iDisableAllNotes )
   253     else if ( iDisableAllNotes )
   217         {
   254         {
   218         // Let watcher to know that waiting note should be shown 
   255         // Let watcher to know that waiting note should be shown 
   225 // CDialogWrapper::CancelWaitingNoteL  
   262 // CDialogWrapper::CancelWaitingNoteL  
   226 // Cancel global waiting note after installing.
   263 // Cancel global waiting note after installing.
   227 // (other items were commented in a header).
   264 // (other items were commented in a header).
   228 // -----------------------------------------------------------------------------
   265 // -----------------------------------------------------------------------------
   229 // 
   266 // 
   230 void CDialogWrapper::CancelWaitingNoteL()
   267 void CDialogWrapper::CancelWaitingNote()
   231 	{ 
   268 	{ 
   232     FLOG( _L("Daemon: CDialogWrapper::CancelWaitingNoteL") );
   269     FLOG( _L("Daemon: CDialogWrapper::CancelWaitingNoteL") );
   233     
   270     
   234 	if ( iIsProgressDialog )
   271 	if ( iIsProgressDialog )
   235 		{
   272 		{
   236 		iHbProgressDialog->Close();
   273 		iHbProgressDialog->Close();
   237 		delete iHbProgressDialog;
   274 		delete iHbProgressDialog;
       
   275 		//Make sure not to delete twice in destructor.
   238 		iHbProgressDialog = NULL;
   276 		iHbProgressDialog = NULL;
   239 		iIsProgressDialog = EFalse;
   277 		iIsProgressDialog = EFalse;
       
   278 		
       
   279 		iTimeOffDisableProgress = ETrue;
   240 		}
   280 		}
   241 		
   281 		
   242     // Let watcher to know that waiting note is canceled.
   282     // Let watcher to know that waiting note is canceled.
   243 	iWatcher->CancelNoteRequest();
   283 	iWatcher->CancelNoteRequest();
   244  	}
   284  	}
   277 #ifdef _SWIDAEMON_DISABLE_NOTES_
   317 #ifdef _SWIDAEMON_DISABLE_NOTES_
   278     FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") );
   318     FLOG( _L("Daemon: CDialogWrapper: iDisableAllNotes = ETrue") );
   279     iDisableAllNotes = ETrue;
   319     iDisableAllNotes = ETrue;
   280 #endif
   320 #endif
   281     
   321     
   282     //TODO: All resoureces nees to be rewriten for device dialogs (QT)   
   322     FLOG_1( _L("Daemon: iDisableAllNotes: %d"), iDisableAllNotes );
   283     if ( iDisableAllNotes == EFalse )
   323     FLOG_1( _L("Daemon: iIsProgressDialog: %d"), iIsProgressDialog );
   284         {
   324     FLOG_1( _L("Daemon: iTimeOffDisableProgress: %d"), iTimeOffDisableProgress );
   285         if ( !iIsUninstallerProgressDialog )
   325               
       
   326     if ( !iDisableAllNotes )
       
   327         {
       
   328         if ( !iIsUninstallerProgressDialog && !iTimeOffDisableProgress )
   286             {    
   329             {    
   287             iHbProgressDialogForUninstaller = 
   330             iHbProgressDialogForUninstaller = 
   288                     CHbDeviceProgressDialogSymbian::NewL( 
   331                     CHbDeviceProgressDialogSymbian::NewL( 
   289                                    CHbDeviceProgressDialogSymbian::EWaitDialog, 
   332                                    CHbDeviceProgressDialogSymbian::EWaitDialog, 
   290                                    NULL );
   333                                    NULL );
   291             iIsUninstallerProgressDialog = ETrue;
   334             iIsUninstallerProgressDialog = ETrue;
   292     //TODO get string from log file.            
   335     //TODO get string from log file.            
   293             _LIT( KTempTextForProgressDialog,"Uninstalling" );            
   336             _LIT( KTempTextForProgressDialog,"Uninstalling" );            
   294             iHbProgressDialogForUninstaller->SetTextL( KTempTextForProgressDialog );            
   337             iHbProgressDialogForUninstaller->SetTextL( KTempTextForProgressDialog ); 
       
   338             FLOG( _L("Daemon: ShowWaitingNoteForUninstallerL: ShowL") );
   295             iHbProgressDialogForUninstaller->ShowL();
   339             iHbProgressDialogForUninstaller->ShowL();
       
   340             FLOG( _L("Daemon: ShowWaitingNoteForUninstallerL: StartDialogTimer") );
       
   341             iTimer->StartDialogTimer( KDialogTimeOut );
   296             }
   342             }
   297         }
   343         }
   298     else if ( iDisableAllNotes )
   344     else if ( iDisableAllNotes )
   299         {
   345         {
   300         // Let watcher to know that waiting note should be shown 
   346         // Let watcher to know that waiting note should be shown 
   301         // after dialogs are enabled.
   347         // after dialogs are enabled.
   302         iWatcher->RequestToDisplayNote();
   348         iWatcher->RequestToDisplayNote();
   303         }
   349         }
   304     }
   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     TReal processValue = aProcessValue;
       
   394         
       
   395     CHbSymbianVariant* hbParam = CHbSymbianVariant::NewL( 
       
   396                                                  &processValue,
       
   397                                                  CHbSymbianVariant::EReal );    
       
   398     CleanupStack::PushL( hbParam );
       
   399     
       
   400     FLOG( _L("Daemon: ActivateIndicatorL: Activate") );
       
   401     iHbIndicator->Activate( KIndicatorTypeSWIDaemon, hbParam );
       
   402     
       
   403     CleanupStack::PopAndDestroy( hbParam );         
       
   404     }
       
   405 
       
   406 // -----------------------------------------------------------------------------
       
   407 // CDialogWrapper::SetModeToIndicatorL()  
       
   408 // 
       
   409 // -----------------------------------------------------------------------------
       
   410 // 
       
   411 void CDialogWrapper::SetModeToIndicatorL( TInt aMode )
       
   412     {  
       
   413     FLOG_1( _L("Daemon: CDialogWrapper::SetModeToIndicatorL: aMode: %d"),
       
   414             aMode );
       
   415                   
       
   416     if ( !iIsIndicator )
       
   417         {
       
   418         FLOG( _L("Daemon: CHbIndicatorSymbian::NewL") );
       
   419         iHbIndicator = CHbIndicatorSymbian::NewL();
       
   420         iIsIndicator = ETrue;        
       
   421         }
       
   422     // Set mode.
       
   423     TReal mode = aMode;    
       
   424     CHbSymbianVariant* hbParam = CHbSymbianVariant::NewL( 
       
   425                                                  &mode,
       
   426                                                  CHbSymbianVariant::EReal );    
       
   427     CleanupStack::PushL( hbParam );    
       
   428     FLOG( _L("Daemon: SetModeToIndicatorL: Activate") );
       
   429     iHbIndicator->Activate( KIndicatorTypeSWIDaemon, hbParam );
       
   430     
       
   431     CleanupStack::PopAndDestroy( hbParam );         
       
   432     }
       
   433 
       
   434 
       
   435 // -----------------------------------------------------------------------------
       
   436 // CDialogWrapper::CancelIndicatorL  
       
   437 // 
       
   438 // -----------------------------------------------------------------------------
       
   439 // 
       
   440 void CDialogWrapper::CancelIndicatorL()
       
   441     {
       
   442     FLOG( _L("Daemon: CDialogWrapper::CancelIndicatorL") );
       
   443     
       
   444     if ( iIsIndicator )
       
   445         { 
       
   446         FLOG( _L("Daemon: CancelIndicatorL: Deactivate") );
       
   447         iHbIndicator->Deactivate( KIndicatorTypeSWIDaemon );              
       
   448         delete iHbIndicator;
       
   449         iHbIndicator = NULL; //Make sure not to delete twice in destructor.
       
   450         iIsIndicator = EFalse;
       
   451         }
       
   452     }
       
   453 
       
   454 // -----------------------------------------------------------------------------
       
   455 // CDialogWrapper::CheckSystemState()  
       
   456 // 
       
   457 // -----------------------------------------------------------------------------
       
   458 // 
       
   459 /*
       
   460 void CDialogWrapper::CheckSystemState()
       
   461     {
       
   462     FLOG( _L("Daemon: CDialogWrapper::CheckSystemState TEST") );
       
   463 
       
   464     // We need to check this only if system is not ready to show 
       
   465     // dialogs e.g. UI is not up.
       
   466     if ( !iSystemReadyToShowDialogs )
       
   467         {    
       
   468         RSsmStateAwareSession systemStateSession;
       
   469          
       
   470         TInt err = systemStateSession.Connect( KUIFrameworkDomain3 );
       
   471         FLOG_1( _L("Daemon: systemStateSession.Connect err = %d"), err ); 
       
   472         
       
   473         if ( err == KErrNone )
       
   474             {
       
   475             TSsmState currentState = systemStateSession.State();
       
   476             systemStateSession.Close();
       
   477             
       
   478             FLOG_1( _L("Daemon: System main state = %d"), currentState.MainState() ); 
       
   479             FLOG_1( _L("Daemon: System sub state = %d"), currentState.SubState() ); 
       
   480             
       
   481             
       
   482             if ( currentState.MainState() == ESsmNormal )
       
   483                 {
       
   484                 iSystemReadyToShowDialogs = ETrue;            
       
   485                 }
       
   486             else
       
   487                 {
       
   488                 iSystemReadyToShowDialogs = EFalse;            
       
   489                 }
       
   490             }
       
   491         else
       
   492             {
       
   493             iSystemReadyToShowDialogs = EFalse;
       
   494             }
       
   495         }
       
   496     FLOG_1( _L("Daemon: iSystemReadyToShowDialogs = %d"), 
       
   497             iSystemReadyToShowDialogs );      
       
   498     }
       
   499 */
       
   500 
       
   501 //-------------------------------------------------------------------------------
       
   502 
       
   503 // -----------------------------------------------------------------------------
       
   504 // CDialogTimer::CDialogTimer()
       
   505 //
       
   506 // -----------------------------------------------------------------------------
       
   507 //
       
   508 CDialogTimer::CDialogTimer() : CActive( EPriorityNormal )
       
   509     {
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CDialogTimer::~CDialogTimer()
       
   514 //
       
   515 // -----------------------------------------------------------------------------
       
   516 //
       
   517 CDialogTimer::~CDialogTimer()
       
   518     {
       
   519     FLOG( _L("Daemon: CDialogTimer::~CDialogTimer") );
       
   520     // Cancel the outstanding request. Calls the active object’s
       
   521     // DoCancel function if request is outstanding.
       
   522     Cancel();
       
   523     // Delete RTimer
       
   524     iRTimer.Close();
       
   525     }
       
   526 
       
   527 // -----------------------------------------------------------------------------
       
   528 // CDialogTimer::NewL()
       
   529 //
       
   530 // -----------------------------------------------------------------------------
       
   531 //
       
   532 CDialogTimer* CDialogTimer::NewL( CDialogWrapper* aDialog )
       
   533     {
       
   534     CDialogTimer* activeTimer = new (ELeave) CDialogTimer();
       
   535     CleanupStack::PushL( activeTimer );
       
   536     activeTimer->ConstructL( aDialog );
       
   537     CleanupStack::Pop();
       
   538     return activeTimer;
       
   539     }
       
   540 
       
   541 // -----------------------------------------------------------------------------
       
   542 // CDialogTimer::ConstructL()
       
   543 //
       
   544 // -----------------------------------------------------------------------------
       
   545 //
       
   546 void CDialogTimer::ConstructL( CDialogWrapper* aDialog )
       
   547     {  
       
   548     if ( aDialog == NULL )
       
   549         {
       
   550         User::Leave( KErrArgument );
       
   551         }  
       
   552     iDialog = aDialog;
       
   553     CActiveScheduler::Add( this );                 
       
   554     iRTimer.CreateLocal();                                     
       
   555     }
       
   556 
       
   557 // -----------------------------------------------------------------------------
       
   558 // CDialogTimer::StartDialogTimer()
       
   559 //
       
   560 // -----------------------------------------------------------------------------
       
   561 //
       
   562 void CDialogTimer::StartDialogTimer( TUint32 aRefreshTime )
       
   563     {
       
   564     FLOG( _L("Daemon: CDialogTimer::StartDialogTimer") );
       
   565     // Check first that we do not have request outstanding.
       
   566     if ( !IsActive() )
       
   567         {
       
   568         // Set time interval for dialog.
       
   569         TimerSet( aRefreshTime );     
       
   570         }
       
   571     }
       
   572 
       
   573 // -----------------------------------------------------------------------------
       
   574 // CDialogTimer::TimerSet()
       
   575 //
       
   576 // -----------------------------------------------------------------------------
       
   577 //
       
   578 void CDialogTimer::TimerSet( TUint32 aRefreshTime )
       
   579     {  
       
   580     FLOG_1( _L("Daemon: CDialogTimer::TimerSet time: %d"), aRefreshTime );
       
   581     // Set timer interval.    
       
   582     iRTimer.After( iStatus, aRefreshTime );               
       
   583     // Set active. Start wait for timer.
       
   584     SetActive();
       
   585     }
       
   586 
       
   587 // -----------------------------------------------------------------------------
       
   588 // CDialogTimer::RunL()
       
   589 //
       
   590 // -----------------------------------------------------------------------------
       
   591 //
       
   592 void CDialogTimer::RunL()
       
   593     {
       
   594     FLOG( _L("Daemon: CDialogTimer::RunL: Cancel waiting note") );
       
   595     iDialog->CancelWaitingNote();
       
   596     iDialog->CancelWaitingNoteForUninstaller();
       
   597     }
       
   598 
       
   599 // -----------------------------------------------------------------------------
       
   600 // CDialogTimer::DoCancel()
       
   601 //
       
   602 // -----------------------------------------------------------------------------
       
   603 //
       
   604 void CDialogTimer::DoCancel()
       
   605     {
       
   606     // Cancel outstanding request for a timer event.
       
   607     iRTimer.Cancel();
       
   608     }
       
   609 
       
   610 // -----------------------------------------------------------------------------
       
   611 // CDialogTimer::RunError()
       
   612 //
       
   613 // -----------------------------------------------------------------------------
       
   614 //
       
   615 TInt CDialogTimer::RunError( TInt aError )
       
   616     {                        
       
   617     return aError;       
       
   618     }
       
   619 
       
   620 
   305 //  End of File  
   621 //  End of File