iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    23 #include <iaupdateresult.h>
    23 #include <iaupdateresult.h>
    24 #include <w32std.h>
    24 #include <w32std.h>
    25 #include <apgwgnam.h>
    25 #include <apgwgnam.h>
    26 #include <apgcli.h>
    26 #include <apgcli.h>
    27 #include <apacmdln.h>
    27 #include <apacmdln.h>
       
    28 #include <avkon.hrh>
       
    29 #include <StringLoader.h> 
       
    30 #include <iaupdate.rsg>
       
    31 #include <data_caging_path_literals.hrh>
    28 #include <bautils.h>
    32 #include <bautils.h>
    29 #include <apgtask.h>
    33 #include <apgtask.h>
    30 #include <sysversioninfo.h>  //sysversioninfo
    34 #include <sysversioninfo.h>  //sysversioninfo
    31 #include <featurecontrol.h>
    35 #include <featurecontrol.h>
    32 
    36 
    33 #include <hb/hbcore/hbtextresolversymbian.h>
       
    34 #include "iaupdateprivatecrkeys.h"
    37 #include "iaupdateprivatecrkeys.h"
    35 #include "iaupdate.hrh"
    38 #include "iaupdate.hrh"
    36 
    39 
    37 #include "iaupdatebgrefreshtimer.h"
    40 #include "iaupdatebgrefreshtimer.h"
    38 #include "iaupdatebglogger.h"
    41 #include "iaupdatebglogger.h"
    40 #include "iaupdatebginternalfilehandler.h"
    43 #include "iaupdatebginternalfilehandler.h"
    41 #include "iaupdatebgconst.h"
    44 #include "iaupdatebgconst.h"
    42 
    45 
    43 //MACROS
    46 //MACROS
    44 _LIT8( KRefreshFromNetworkDenied, "1" );
    47 _LIT8( KRefreshFromNetworkDenied, "1" );
       
    48 _LIT(KIAUpdateResourceFile, "iaupdate.rsc");
    45 _LIT(KIAUpdateLauncherExe, "iaupdatelauncher.exe" );
    49 _LIT(KIAUpdateLauncherExe, "iaupdatelauncher.exe" );
       
    50 //_LIT(KImageFile, "qgn_note_swupdate_notification.svg");
    46 
    51 
    47 //CONSTANTS
    52 //CONSTANTS
    48 const TUint KIADUpdateLauncherUid( 0x2001FE2F );
    53 const TUint KIADUpdateLauncherUid( 0x2001FE2F );
    49 
    54 
    50 // ----------------------------------------------------------
    55 // ----------------------------------------------------------
    66 void CIAUpdateBGTimer::ConstructL()
    71 void CIAUpdateBGTimer::ConstructL()
    67     {
    72     {
    68     CTimer::ConstructL();
    73     CTimer::ConstructL();
    69     CActiveScheduler::Add( this );
    74     CActiveScheduler::Add( this );
    70   
    75   
       
    76     iReminderTimer = CIAUpdateBGReminderTimer::NewL( this );
    71     iUpdate = NULL;
    77     iUpdate = NULL;
    72     iParameters = NULL;
    78     iParameters = NULL;
    73     
    79     
    74     iIAUpdateCRSession = NULL; 
    80     iIAUpdateCRSession = NULL; 
    75     iNotifyHandler = NULL;
    81     iNotifyHandler = NULL;
    76 
    82 
    77     iControllerFile = CIAUpdateBGControllerFile::NewL();
    83     iControllerFile = CIAUpdateBGControllerFile::NewL();
    78     
    84     
    79     iInternalFile = CIAUpdateBGInternalFileHandler::NewL();
    85     iInternalFile = CIAUpdateBGInternalFileHandler::NewL();
    80     
    86     
    81     iSoftNotification = CIAUpdateBGSoftNotification::NewL( this ); 
    87     iSoftNotification = CIAUpdateBGSoftNotification::NewL( this, iInternalFile );
    82     
    88     iSoftNotification->StartObservingIfNeededL();
    83     iIndicatorNotifyHandler = CIAUpdateBGNotifyHandler::NewL();
    89     
    84     
    90     // Get resource file path
    85     // loc: initialize localisation text loader
    91     TFileName fileName;
    86     /*
    92     fileName.Copy(TParsePtrC(RProcess().FileName()).Drive());
    87     TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
    93     fileName.Append(KDC_APP_RESOURCE_DIR);
    88     if ( res != KErrNone )
    94     fileName.Append(KIAUpdateResourceFile);
    89         {
    95 
    90         // nothing to do
    96     User::LeaveIfError(iFs.Connect());
    91         }
    97 
    92     */
    98     // Get language of resource file        
    93     }
    99     BaflUtils::NearestLanguageFile( iFs, fileName );
       
   100 
       
   101     // Open resource file
       
   102     iResourceFile.OpenL( iFs, fileName );
       
   103     iResourceFile.ConfirmSignatureL();    
       
   104     }
       
   105     
    94     
   106     
    95 // ----------------------------------------------------------
   107 // ----------------------------------------------------------
    96 // CIAUpdateBGTimer::~CIAUpdateBGTimer()
   108 // CIAUpdateBGTimer::~CIAUpdateBGTimer()
    97 // ----------------------------------------------------------
   109 // ----------------------------------------------------------
    98 CIAUpdateBGTimer::~CIAUpdateBGTimer()
   110 CIAUpdateBGTimer::~CIAUpdateBGTimer()
    99     {
   111     {
   100     Cancel();
   112     Cancel();
   101     delete iUpdate; 
   113     delete iUpdate; 
   102     delete iParameters;
   114     delete iParameters;
       
   115     delete iReminderTimer;
   103 
   116 
   104     if ( iNotifyHandler ) 
   117     if ( iNotifyHandler ) 
   105         {
   118         {
   106         iNotifyHandler->StopListening();
   119         iNotifyHandler->StopListening();
   107         delete iNotifyHandler;
   120         delete iNotifyHandler;
   109 
   122 
   110     delete iIAUpdateCRSession; 
   123     delete iIAUpdateCRSession; 
   111     delete iControllerFile;
   124     delete iControllerFile;
   112     delete iInternalFile;
   125     delete iInternalFile;
   113     delete iSoftNotification;
   126     delete iSoftNotification;
   114     delete iIndicatorNotifyHandler;
   127     
   115     
   128     iResourceFile.Close();
   116     }
   129     iFs.Close();
       
   130     }
       
   131 
   117 
   132 
   118 // ----------------------------------------------------------
   133 // ----------------------------------------------------------
   119 // CIAUpdateBGTimer::StartProcessL()
   134 // CIAUpdateBGTimer::StartProcessL()
   120 // ----------------------------------------------------------
   135 // ----------------------------------------------------------
   121 void CIAUpdateBGTimer::StartProcessL()
   136 void CIAUpdateBGTimer::StartProcessL()
   122     {
   137     {
   123     FLOG("[bgchecker] StartProcessL");
   138     FLOG("[bgchecker] StartProcessL");
   124     
   139         
   125     // start listening indicator remove
       
   126     iIndicatorNotifyHandler->StartListeningL( this );
       
   127     
       
   128     
       
   129     iMode = ModeL();
   140     iMode = ModeL();
   130     
   141     
   131     switch ( iMode )
   142     switch ( iMode )
   132         {
   143         {
   133         case EFirstTimeMode:
   144         case EFirstTimeMode:
       
   145         case EFirstTimeRemindMode:    
   134             {
   146             {
   135             // while not released keep in sleep mode
       
   136             int test = 0;
       
   137             if ( test == 0 )
       
   138                 {
       
   139                 ListenAutoUpdateSettingsL();
       
   140                 iMode = ESleepMode;
       
   141                 SetModeL( iMode );
       
   142                 return;
       
   143                 }
       
   144         
       
   145             if ( IsFirstTimeDialogDisabledL() )
   147             if ( IsFirstTimeDialogDisabledL() )
   146                 {
   148                 {
   147                 //this should only happen in testing
   149                 //this should only happen in testing
   148                 FLOG("[bgchecker] StartProcessL Firs time dialog is disabled, this should only happen in testing");
   150                 FLOG("[bgchecker] StartProcessL Firs time dialog is disabled, this should only happen in testing");
   149 
   151 
   167                 }
   169                 }
   168 
   170 
   169                         
   171                         
   170             FLOG("[bgchecker] StartProcessL EFirstTimeMode");
   172             FLOG("[bgchecker] StartProcessL EFirstTimeMode");
   171             
   173             
       
   174             
       
   175 
       
   176 
   172             //Wait for some days before activate the first time mode
   177             //Wait for some days before activate the first time mode
   173             TTimeIntervalMinutes timetowait =
   178             TTimeIntervalMinutes timetowait =
   174                     TimeIntervalFromNextShowOfNewFeatureDialogL();
   179                     TimeIntervalFromNextShowOfNewFeatureDialogL();
   175                 FLOG_NUM( " time to wait = %d", timetowait.Int() );
   180                 FLOG_NUM( " time to wait = %d", timetowait.Int() );
   176             if (timetowait.Int() <= 0)
   181             if (timetowait.Int() <= 0)
   213             break;
   218             break;
   214             }
   219             }
   215 
   220 
   216         case EFirstTimeMode2:
   221         case EFirstTimeMode2:
   217             {
   222             {
   218             FLOG("[bgchecker] StartProcessL EFirstTimeMode 2");
   223             FLOG("[bgchecker] StartProcessL EFirstTimeMode2");
       
   224             RunL();
       
   225             break;
       
   226             }
       
   227 
       
   228         case EFirstTimeMode3:
       
   229             {
       
   230             FLOG("[bgchecker] StartProcessL EFirstTimeMode 3");
   219             //if user accepted the disclaimer already and reboot the phone, 
   231             //if user accepted the disclaimer already and reboot the phone, 
   220             //this mode could go to network immediately after boot
   232             //this mode could go to network immediately after boot
   221             //We put one min delay here to wait for network ready.
   233             //We put one min delay here to wait for network ready.
   222             StartL(StartAfterOneMin);
   234             StartL(StartAfterOneMin);
   223             break;
   235             break;
   236                 {
   248                 {
   237                 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iIAUpdateCRSession ); 
   249                 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iIAUpdateCRSession ); 
   238                 }
   250                 }
   239                     
   251                     
   240             iNotifyHandler->StartListeningL();  
   252             iNotifyHandler->StartListeningL();  
   241             
       
   242 
       
   243             if ( !IsAgreementAcceptedL() )
       
   244                 {
       
   245                 FLOG("[bgchecker] EFirstTimeMode4 ShowIndicator");
       
   246                 // Set number of updates; zero for first case
       
   247                 iSoftNotification->SetNrOfUpdates( 0 );
       
   248                 
       
   249                 // do not show indicator when testing
       
   250                 int test = 0;
       
   251                 if ( test == 1)
       
   252                   iSoftNotification->ShowIndicatorL();
       
   253                 
       
   254                 }
       
   255             
       
   256             
       
   257             break;
   253             break;
   258             }
   254             }
   259 
   255 
   260         case ENormalMode:
   256         case ENormalMode:
   261         case ERetryMode:
   257         case ERetryMode:
   262             {
   258             {
   263             
       
   264             // Should indicator be shown ?
       
   265             TInt entries = NrOfIndicatorEntries();
       
   266             if  ( entries )
       
   267                 {
       
   268                 iSoftNotification->SetNrOfUpdates( entries );
       
   269                 iSoftNotification->ShowIndicatorL();
       
   270                 }
       
   271             
       
   272             StartUpdatesCheckingL();
   259             StartUpdatesCheckingL();
   273             
       
   274             break;
   260             break;
   275             }
   261             }
   276         
   262         
   277         default:
   263         default:
   278             break;
   264             break;
   290     CleanupStack::PushL( fthandler );
   276     CleanupStack::PushL( fthandler );
   291     TBool result = fthandler->AgreementAcceptedL();
   277     TBool result = fthandler->AgreementAcceptedL();
   292     
   278     
   293     CleanupStack::PopAndDestroy( fthandler );
   279     CleanupStack::PopAndDestroy( fthandler );
   294     
   280     
       
   281     return result;
       
   282     }
       
   283 
       
   284 
       
   285 // ----------------------------------------------------------
       
   286 // CIAUpdateBGTimer::IsAskedAlreadyL()
       
   287 // ----------------------------------------------------------
       
   288 TBool CIAUpdateBGTimer::IsAskedAlreadyL()
       
   289     {
       
   290     CIAUpdateBGFirstTimeHandler* fthandler  = CIAUpdateBGFirstTimeHandler::NewL();
       
   291     CleanupStack::PushL( fthandler );
       
   292     TBool result = fthandler->AgreementAskedL();
       
   293     CleanupStack::PopAndDestroy( fthandler );
   295     return result;
   294     return result;
   296     }
   295     }
   297 
   296 
   298 
   297 
   299 // ----------------------------------------------------------
   298 // ----------------------------------------------------------
   330     else
   329     else
   331         {
   330         {
   332             FLOG_NUM( "Start checking update after %d minutes", timetowait.Int());
   331             FLOG_NUM( "Start checking update after %d minutes", timetowait.Int());
   333             StartL( timetowait );
   332             StartL( timetowait );
   334             
   333             
   335          }
   334             //start reminder timer also if user choose later before reboot
       
   335             //check the value from private folder
       
   336              
       
   337               if ( ReminderOnL() )
       
   338                   {
       
   339                   TTime currenttime;
       
   340                   currenttime.UniversalTime();
       
   341                   
       
   342                   FTIME( currenttime );
       
   343                   
       
   344                   TTime nextremindtime = NextRemindTimeL();
       
   345                   
       
   346                   FTIME( nextremindtime );
       
   347                   
       
   348                   TTimeIntervalMinutes timetogo;
       
   349                   nextremindtime.MinutesFrom( currenttime, timetogo );
       
   350                   
       
   351                   FLOG_NUM("time to go = %d", timetogo.Int() );
       
   352                   
       
   353                   if ( timetogo.Int() <= 0 )
       
   354                       {
       
   355                       //pop up the reminder directly
       
   356                       ReminderTimerCallBack();
       
   357                       }
       
   358                   else
       
   359                       {
       
   360                       iReminderTimer->StartReminderTimerL( timetogo );
       
   361                       }
       
   362                   }
       
   363             }
   336     }
   364     }
   337 
   365 
   338 
   366 
   339 // ----------------------------------------------------------
   367 // ----------------------------------------------------------
   340 // CIAUpdateBGTimer::DoHandleNotifyGeneric()
   368 // CIAUpdateBGTimer::DoHandleNotifyGeneric()
   455     iInternalFile->SetLastTimeShowNewFeatureDialog( aTime );
   483     iInternalFile->SetLastTimeShowNewFeatureDialog( aTime );
   456     TRAPD( err,iInternalFile->WriteControllerDataL() );
   484     TRAPD( err,iInternalFile->WriteControllerDataL() );
   457     return err;
   485     return err;
   458     }
   486     }
   459 
   487 
       
   488 
       
   489 // ----------------------------------------------------------
       
   490 // CIAUpdateBGTimer::NextRemindTimeL()
       
   491 // ----------------------------------------------------------
       
   492 TTime CIAUpdateBGTimer::NextRemindTimeL()
       
   493     {
       
   494     iInternalFile->ReadControllerDataL();
       
   495     return iInternalFile->NextRemindTime();
       
   496     }
       
   497 
       
   498 
       
   499 // ----------------------------------------------------------
       
   500 // CIAUpdateBGTimer::SetNextRemindTimeL()
       
   501 // ----------------------------------------------------------
       
   502 TInt CIAUpdateBGTimer::SetNextRemindTimeL( TTime aTime )
       
   503     {
       
   504     iInternalFile->SetNextRemindTime( aTime );
       
   505     TRAPD( err,iInternalFile->WriteControllerDataL() );
       
   506     return err;
       
   507     }
       
   508 
       
   509 
       
   510 // ----------------------------------------------------------
       
   511 // CIAUpdateBGTimer::ReminderOnL()
       
   512 // ----------------------------------------------------------
       
   513 TBool CIAUpdateBGTimer::ReminderOnL()
       
   514     {
       
   515     iInternalFile->ReadControllerDataL(); 
       
   516     return iInternalFile->ReminderOn();
       
   517     }
       
   518 
       
   519 
       
   520 // ----------------------------------------------------------
       
   521 // CIAUpdateBGTimer::SetReminderL()
       
   522 // ----------------------------------------------------------
       
   523 TInt CIAUpdateBGTimer::SetReminderL( TBool aOn )
       
   524     {
       
   525     iInternalFile->SetReminder( aOn );
       
   526     TRAPD( err,iInternalFile->WriteControllerDataL() );
       
   527     return err;
       
   528     }
       
   529 
       
   530 
   460 // ----------------------------------------------------------
   531 // ----------------------------------------------------------
   461 // CIAUpdateBGTimer::ModeL()
   532 // CIAUpdateBGTimer::ModeL()
   462 // ----------------------------------------------------------
   533 // ----------------------------------------------------------
   463 TIAUpdateBGMode CIAUpdateBGTimer::ModeL()
   534 TIAUpdateBGMode CIAUpdateBGTimer::ModeL()
   464     {
   535     {
   475     iInternalFile->SetMode( aMode  );
   546     iInternalFile->SetMode( aMode  );
   476     TRAPD( err,iInternalFile->WriteControllerDataL() );
   547     TRAPD( err,iInternalFile->WriteControllerDataL() );
   477     return err;
   548     return err;
   478     }
   549     }
   479 
   550 
   480 // ----------------------------------------------------------
       
   481 // CIAUpdateBGTimer::NrOfIndicatorEntries()
       
   482 // ----------------------------------------------------------
       
   483 TInt CIAUpdateBGTimer::NrOfIndicatorEntries()
       
   484     {
       
   485     iInternalFile->ReadControllerDataL();
       
   486     return iInternalFile->NrOfIndicatorEntries();
       
   487     }
       
   488 
       
   489 
       
   490 // ----------------------------------------------------------
       
   491 // CIAUpdateBGTimer::SetNrOfIndicatorEntriesL()
       
   492 // ----------------------------------------------------------
       
   493 TInt CIAUpdateBGTimer::SetNrOfIndicatorEntriesL( TInt aEntries )
       
   494     {
       
   495     iInternalFile->SetNrOfIndicatorEntries( aEntries );
       
   496     TRAPD( err,iInternalFile->WriteControllerDataL() );
       
   497     return err;
       
   498     }
       
   499 
   551 
   500 // ----------------------------------------------------------
   552 // ----------------------------------------------------------
   501 // CIAUpdateBGTimer::RetryTimesL()
   553 // CIAUpdateBGTimer::RetryTimesL()
   502 // ----------------------------------------------------------
   554 // ----------------------------------------------------------
   503 TInt CIAUpdateBGTimer::RetryTimesL()
   555 TInt CIAUpdateBGTimer::RetryTimesL()
   531 // CIAUpdateBGTimer::DoUpdatesCheckingL()
   583 // CIAUpdateBGTimer::DoUpdatesCheckingL()
   532 // ----------------------------------------------------------
   584 // ----------------------------------------------------------
   533 void CIAUpdateBGTimer::DoUpdatesCheckingL( const TBool& aUpdateFromServer )
   585 void CIAUpdateBGTimer::DoUpdatesCheckingL( const TBool& aUpdateFromServer )
   534     {   
   586     {   
   535     FLOG( "DoUpdatesCheckingL update");
   587     FLOG( "DoUpdatesCheckingL update");
       
   588     //turn off the reminder, user will decide whether to turn if on or off
       
   589     //The user's decision will be checked in soft notification callback function
       
   590     
       
   591     if ( ReminderOnL())
       
   592         {
       
   593         FLOG( "Do CheckUpdates 3");
       
   594         iReminderTimer->CancelReminderTimerL();
       
   595         SetReminderL( EFalse );
       
   596         }
   536     
   597     
   537     if( !iUpdate )
   598     if( !iUpdate )
   538         {
   599         {
   539         iUpdate = CIAUpdate::NewL( *this );
   600         iUpdate = CIAUpdate::NewL( *this );
   540         }
   601         }
   581 // ----------------------------------------------------------
   642 // ----------------------------------------------------------
   582 void CIAUpdateBGTimer::DoCheckUpdatesCompleteL( TInt aErrorCode, TInt aAvailableUpdates )
   643 void CIAUpdateBGTimer::DoCheckUpdatesCompleteL( TInt aErrorCode, TInt aAvailableUpdates )
   583     {
   644     {
   584     FLOG_NUM( "CheckUpdatesComplete aErrorCode = %d", aErrorCode );
   645     FLOG_NUM( "CheckUpdatesComplete aErrorCode = %d", aErrorCode );
   585     FLOG_NUM( "CheckUpdatesComplete aAvailableUpdates = %d", aAvailableUpdates );
   646     FLOG_NUM( "CheckUpdatesComplete aAvailableUpdates = %d", aAvailableUpdates );
   586     
       
   587     //HLa
       
   588     int test = 0;
       
   589     if ( test == 0 )
       
   590         {
       
   591         aErrorCode = 0;
       
   592         aAvailableUpdates = 0;
       
   593         }
       
   594     
       
   595     if ( !IAUpdateEnabledL() )
   647     if ( !IAUpdateEnabledL() )
   596         {
   648         {
   597         Shutdown();
   649         Shutdown();
   598         return;
   650         return;
   599         }
   651         }
   634         
   686         
   635         if ( aAvailableUpdates > 0 )
   687         if ( aAvailableUpdates > 0 )
   636             {             
   688             {             
   637             FLOG( "CheckUpdatesComplete 4");
   689             FLOG( "CheckUpdatesComplete 4");
   638     
   690     
   639             LaunchNotificationL( aAvailableUpdates );
   691             LaunchSoftNotificationL(R_IAUPDATE_UPDATE_AVAILABLE,
       
   692                         R_TEXT_SOFTKEY_SHOW, R_TEXT_SOFTKEY_LATER );
   640             }
   693             }
   641 
   694 
   642             FLOG( "CheckUpdatesComplete 5");
   695             FLOG( "CheckUpdatesComplete 5");
   643         
   696         
   644         // if update checking is from server, restart the refresh timer 
   697         // if update checking is from server, restart the refresh timer 
   680             if ( checkupdatefromserver )
   733             if ( checkupdatefromserver )
   681                 {
   734                 {
   682                 TTimeIntervalMinutes interval( CheckingFrequencyInMinutesL() );
   735                 TTimeIntervalMinutes interval( CheckingFrequencyInMinutesL() );
   683                 StartL( interval );
   736                 StartL( interval );
   684                 SetLastRefreshTime();
   737                 SetLastRefreshTime();
       
   738                 }
       
   739             else
       
   740                 {
       
   741                 //don't show soft notification and restart the timer.
       
   742                 TTimeIntervalMinutes oneweek( UpdateAvailableReminderIntervalInMinutesL() );   
       
   743                 TTime currenttime;
       
   744                 currenttime.UniversalTime();
       
   745                 TTime nextRemindTime = currenttime + oneweek;
       
   746 
       
   747                 SetReminderL( ETrue );
       
   748                 SetNextRemindTimeL( nextRemindTime );
       
   749                                        
       
   750                 iReminderTimer->StartReminderTimerL( oneweek );
   685                 }
   751                 }
   686             //clear the retry time
   752             //clear the retry time
   687             SetRetryTimesL( 0 ); 
   753             SetRetryTimesL( 0 ); 
   688             }
   754             }
   689         else
   755         else
   825                  }        
   891                  }        
   826             }
   892             }
   827             break;
   893             break;
   828             
   894             
   829         case EFirstTimeMode:
   895         case EFirstTimeMode:
       
   896         case EFirstTimeRemindMode:
   830             {
   897             {
   831             FLOG("[bgchecker] runl EFirstTimeMode");
   898             FLOG("[bgchecker] runl EFirstTimeMode");
   832             
   899             
   833             if ( iRuns == 0 )
   900             if ( iRuns == 0 )
   834                 {
   901                 {
   852             }
   919             }
   853             break;
   920             break;
   854 
   921 
   855         case EFirstTimeMode2:
   922         case EFirstTimeMode2:
   856             {
   923             {
   857             FLOG("[bgchecker] runl EFirstTimeMode2");                 
   924             FLOG("[bgchecker] runl EFirstTimeMode2");
       
   925             LaunchSoftNotificationL(R_IAUPDATE_REMIND_LATER, R_TEXT_SOFTKEY_YES, R_TEXT_SOFTKEY_NO );
       
   926             }
       
   927             break;
       
   928 
       
   929         case EFirstTimeMode3:
       
   930             {
       
   931             FLOG("[bgchecker] runl EFirstTimeMode3");                 
   858             //disclaimer is not accepted  
   932             //disclaimer is not accepted  
   859            
   933            
   860             if ( !IsAgreementAcceptedL()  )
   934             if ( !IsAgreementAcceptedL()  )
   861                 {
   935                 {
   862                 FLOG("[bgchecker] runl EFirstTimeMode reject disclaimer");
   936                 FLOG("[bgchecker] runl EFirstTimeMode reject disclaimer");
   908         }
   982         }
   909     else
   983     else
   910         {
   984         {
   911         //this is first time mode
   985         //this is first time mode
   912         FLOG("[bgchecker]HandlerFirstTimeL 3 ");
   986         FLOG("[bgchecker]HandlerFirstTimeL 3 ");
   913         LaunchNotificationL( 0 );
   987         LaunchSoftNotificationL( R_IAUPDATE_FEATURES_AVAILABLE,
       
   988                     R_TEXT_SOFTKEY_OK, R_TEXT_SOFTKEY_CANCEL );
   914         }
   989         }
   915     }
   990     }
   916 
   991 
   917 
   992 
   918 // ----------------------------------------------------------
   993 // ----------------------------------------------------------
  1175     if ( ModeL() == EFirstTimeMode )
  1250     if ( ModeL() == EFirstTimeMode )
  1176         {
  1251         {
  1177         FLOG(" current mode is FirstTimeMode ");
  1252         FLOG(" current mode is FirstTimeMode ");
  1178         interval = FirstTimeDialogDelayInMinutesL();
  1253         interval = FirstTimeDialogDelayInMinutesL();
  1179         }
  1254         }
       
  1255     else if ( ModeL() == EFirstTimeRemindMode )
       
  1256         {
       
  1257         FLOG(" current mode is FirstTimeRemindMode");
       
  1258         interval = FirstTimeDialogReminderIntervalInMinutesL();
       
  1259         }
  1180     else
  1260     else
  1181         {
  1261         {
  1182         //nothing
  1262         //nothing
  1183         FLOG(" current mode is wrong!!");
  1263         FLOG(" current mode is wrong!!");
  1184         User::LeaveIfError( KErrArgument );
  1264         User::LeaveIfError( KErrArgument );
  1208     iMode = ModeL(); 
  1288     iMode = ModeL(); 
  1209     
  1289     
  1210       switch ( iMode )
  1290       switch ( iMode )
  1211           {
  1291           {
  1212           case EFirstTimeMode:
  1292           case EFirstTimeMode:
       
  1293           case EFirstTimeRemindMode:     
  1213                  {
  1294                  {
  1214                  
  1295                  
  1215                  FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode");
  1296                  FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode");
  1216                  if ( !aIsAccepted )
  1297                  if ( !aIsAccepted )
  1217                      {
  1298                      {
  1218                      FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode, not accepted");
  1299                      FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode not accepted");
  1219                      //in sleep mode now
  1300                      iMode = EFirstTimeMode2;
  1220                      iMode = ESleepMode;
       
  1221                      SetModeL( iMode );
  1301                      SetModeL( iMode );
  1222                      
  1302                      StartL( StartNow );
  1223                      //subscribe to cenrep key for automatic checking for wake up from sleep mode
       
  1224                      ListenAutoUpdateSettingsL();
       
  1225                      
       
  1226                      }
  1303                      }
  1227                  else
  1304                  else
  1228                      {
  1305                      {
  1229                      FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMod accepeted");
  1306                      FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMod accepeted");
  1230                      StartIaupdateL();
  1307                      StartIaupdateL();
  1231                      //iaupdate is launched
  1308                      //iaupdate is launched
  1232                      //check the disclaimer acceptance and automatic checking setting in 10mins
  1309                      //check the disclaimer acceptance and automatic checking setting in 10mins
  1233 
  1310 
  1234                      StartL( KDelayForUserToAcceptDisclaimer );
  1311                      StartL( KDelayForUserToAcceptDisclaimer );
  1235                      iMode = EFirstTimeMode2;     
  1312                      iMode = EFirstTimeMode3;     
  1236                      SetModeL( iMode );
  1313                      SetModeL( iMode );
  1237 
  1314 
  1238                      
  1315                      
  1239                      //Still in first time mode, 
  1316                      //Still in first time mode, 
  1240                      //check user's setting and disclamier after 10mins.
  1317                      //check user's setting and disclamier after 10mins.
  1241                      }
  1318                      }
  1242                  break;
  1319                  break;
  1243                  }
  1320                  }
  1244                  
  1321                  
       
  1322                  
       
  1323                  
       
  1324           case EFirstTimeMode2:
       
  1325               {
       
  1326               FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2 ");
       
  1327               if ( aIsAccepted )
       
  1328                   {
       
  1329                   FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, accepted");
       
  1330                   //user wants to be reminder so remind in 4 weeks
       
  1331                   //set to first time remind mode
       
  1332                   iMode = EFirstTimeRemindMode;
       
  1333                   SetModeL( iMode );
       
  1334                   TTimeIntervalMinutes fourweeks( FirstTimeDialogReminderIntervalInMinutesL() );            
       
  1335                   TTime currenttime;
       
  1336                   currenttime.UniversalTime();
       
  1337                         
       
  1338                   //save the next show new feature dialog time
       
  1339                   //in case use switch off the device and restarted.      
       
  1340                   User::LeaveIfError( SetLastTimeShowNewFeatureDialogL( currenttime ) );
       
  1341                         
       
  1342                   StartL( fourweeks );
       
  1343                   return;
       
  1344                   }
       
  1345               else
       
  1346                   {
       
  1347                   FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, not accepted");
       
  1348                   //in sleep mode now
       
  1349                   iMode = ESleepMode;
       
  1350                   SetModeL( iMode );
       
  1351                   
       
  1352                   //subscribe to cenrep key for automatic checking for wake up from sleep mode
       
  1353                   ListenAutoUpdateSettingsL(); 
       
  1354                   }
       
  1355               break;
       
  1356               }
       
  1357               
  1245           case ENormalMode:
  1358           case ENormalMode:
  1246               {
  1359               {
  1247               FLOG("[bgchecker] SoftNotificationCallBack ENormalMode");
  1360               FLOG("[bgchecker] SoftNotificationCallBack ENormalMode");
  1248               if ( !aIsAccepted )
  1361               if ( !aIsAccepted )
  1249                   {
  1362                   {
  1250                   FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted");
  1363                   FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted");
       
  1364                   //user wants to be reminded later
       
  1365                   TTimeIntervalMinutes oneweek( UpdateAvailableReminderIntervalInMinutesL() );   
       
  1366                   TTime currenttime;
       
  1367                   currenttime.UniversalTime();
       
  1368                   TTime nextRemindTime = currenttime + oneweek;
       
  1369 
       
  1370                   SetReminderL( ETrue );
       
  1371                   SetNextRemindTimeL( nextRemindTime );
  1251                   
  1372                   
       
  1373                   iReminderTimer->StartReminderTimerL( oneweek );
       
  1374                   
       
  1375                   //the reminder call back function will be called when reminder timer expires.
  1252                   }
  1376                   }
  1253               else
  1377               else
  1254                   {
  1378                   {
  1255                   //accepted, clear indicator entries
  1379                   //accepted, launch iad
  1256                   SetNrOfIndicatorEntriesL( 0 );
       
  1257                   // start IAD
       
  1258                   StartIaupdateL();
  1380                   StartIaupdateL();
  1259                   }
  1381                   }
  1260               break;
  1382               break;
  1261               }
  1383               }
  1262 
  1384 
  1287 TIAUpdateBGMode CIAUpdateBGTimer::CurrentMode()
  1409 TIAUpdateBGMode CIAUpdateBGTimer::CurrentMode()
  1288     {
  1410     {
  1289     return iMode;
  1411     return iMode;
  1290     }
  1412     }
  1291 
  1413 
  1292 // ----------------------------------------------------------
  1414 
  1293 // CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates )
  1415 // ----------------------------------------------------------
  1294 // ----------------------------------------------------------
  1416 // CIAUpdateBGTimer::DoReminderTimerCallBack()
  1295 void CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates )
  1417 // ----------------------------------------------------------
  1296     {
  1418 void CIAUpdateBGTimer::DoReminderTimerCallBackL()
  1297    
  1419     {
  1298     _LIT( KFirstTimeText, "Update checking" );
  1420     FLOG("[bgchecker] ReminderTimerCallBack begin");
  1299     _LIT( KNormalText, "Updates available" );
  1421     if ( !IAUpdateEnabledL() )
  1300     _LIT( KSecondText, "Tap to view" );
  1422         {
  1301 
  1423         Shutdown();
  1302     // loc:
  1424         return;
  1303     /*
  1425         }
  1304     _LIT( KIcon, "z:\\resource\\iaupdate\\qgn_note_swupdate_notification.svg" );
  1426     //Check the automatic update setting, if it has been disabled, 
  1305     _LIT(KLocFile, "Text_Map_Swupdate_");
  1427     //then go to sleep mode.   
  1306     _LIT(KLocFilePath, "z:\\resource\\iaupdate\\");
  1428     if ( IsAutoUpdateDisabledL() )
  1307     
  1429         {
  1308     _LIT(KTitleFirstTime, "txt_software_dpophead_update_checking");
  1430         FLOG("[bgchecker] ReminderTimerCallBack autoupdate is disabled, switch to sleep mode");
  1309     _LIT(KTitleOneUpdate, "txt_software_dpophead_update_available");
  1431         ListenAutoUpdateSettingsL();
  1310     _LIT(KTitleSeveralUpdates, "txt_software_dpophead_updates_available");
  1432         iMode = ESleepMode;
  1311     
  1433         SetModeL( iMode );
  1312     
  1434         return;
  1313     _LIT(KSecondFirstTime, "txt_software_dpopinfo_tap_to_view");
  1435         } 
  1314     _LIT(KSecondOneUpdate, "txt_software_dpopinfo_tap_to_view");
  1436     
  1315     _LIT(KSecondSeveralUpdates, "txt_software_dpopinfo_tap_to_view");
  1437     TTimeIntervalMinutes timetowait = TimeIntervalFromNextRefreshL();
  1316    */
  1438     
  1317     
  1439     if ( timetowait.Int() <= KRefreshTimerReminderTimerGap )
  1318     FLOG("[bgchecker] LaunchNotificationL ");
  1440         {
       
  1441         FLOG("[bgchecker] ReminderTimerCallBack refresh is about to come in one day. We don't show reminder then");
       
  1442         return;
       
  1443         }
       
  1444     
       
  1445     //if reminder is still on which means the BGTimer is not expired 
       
  1446     //and checkupdate() is not called yet, then go ahead to call DoupdatesChecking
       
  1447     //this is to avoid DoUpdateChecking being called at the same time.
       
  1448         
       
  1449     if ( ReminderOnL() )
       
  1450         {
       
  1451         FLOG("[bgchecker] ReminderTimerCallBack Reminder is still ON");
       
  1452         DoUpdatesCheckingL( EFalse );
       
  1453         }
       
  1454     FLOG("[bgchecker] ReminderTimerCallBack end");
       
  1455     }
       
  1456 
       
  1457 // ----------------------------------------------------------
       
  1458 // CIAUpdateBGTimer::ReminderTimerCallBack()
       
  1459 // ----------------------------------------------------------
       
  1460 void CIAUpdateBGTimer::ReminderTimerCallBack()
       
  1461     {
       
  1462     TRAP_IGNORE( DoReminderTimerCallBackL() );
       
  1463     }
       
  1464 
       
  1465 // ----------------------------------------------------------
       
  1466 // CIAUpdateBGTimer::LaunchSoftNotificationL()
       
  1467 // ----------------------------------------------------------
       
  1468 void CIAUpdateBGTimer::LaunchSoftNotificationL( const TInt& aResourceId, const TInt& SK1, const TInt& SK2 )
       
  1469     {     
       
  1470     iInternalFile->ReadControllerDataL(); 
       
  1471     TInt snid = iInternalFile->SoftNotificationID();
       
  1472     if ( snid ) 
       
  1473         {
       
  1474         //there is a soft notification buffered, remove it
       
  1475         iSoftNotification->RemoveSoftNotificationL( snid );
       
  1476         }
       
  1477     
       
  1478     FLOG("[bgchecker] LaunchSoftNotificationL ");
       
  1479     HBufC* text = ReadResourceLC( aResourceId );    
       
  1480     HBufC* sk1 = ReadResourceLC( SK1 );    
       
  1481     HBufC* sk2 = ReadResourceLC( SK2 );  
       
  1482     
  1319         
  1483         
  1320     iMode = ModeL();
  1484     iMode = ModeL();
  1321     
  1485     
  1322     // loc: initialize localisation text loader
  1486 /*    
  1323     /*
  1487     // Commented out, so no icon is shown in the soft notification.
  1324     TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
  1488     // Other functions, used by the code below, are also commented out.
  1325     if ( res != KErrNone )
       
  1326         {
       
  1327         // nothing to do
       
  1328         }
       
  1329     */
       
  1330     
       
  1331     
       
  1332     // loc: Resolve title text
       
  1333     /*
       
  1334     HBufC*  titleText;
       
  1335     if ( aNrOfUpdates == 0 )
       
  1336         {
       
  1337         // First time case
       
  1338         titleText = HbTextResolverSymbian::LoadL( KTitleFirstTime );
       
  1339         }
       
  1340     else if ( aNrOfUpdates == 1 )
       
  1341         {
       
  1342         // one update available
       
  1343         titleText = HbTextResolverSymbian::LoadL( KTitleOneUpdate );
       
  1344         }
       
  1345     else
       
  1346         {
       
  1347         // several updates available
       
  1348         titleText = HbTextResolverSymbian::LoadL( KTitleSeveralUpdates );
       
  1349         }
       
  1350     
       
  1351     // Resolve second text
       
  1352     HBufC*  secondText;
       
  1353     if ( aNrOfUpdates == 0 )
       
  1354         {
       
  1355         // First time case
       
  1356         secondText = HbTextResolverSymbian::LoadL( KSecondFirstTime );
       
  1357         }
       
  1358     else if ( aNrOfUpdates == 1 )
       
  1359         {
       
  1360         // one update available
       
  1361         secondText = HbTextResolverSymbian::LoadL( KSecondOneUpdate, aNrOfUpdates );
       
  1362         }
       
  1363     else
       
  1364         {
       
  1365         // several updates available
       
  1366         // loc: text.append(hbTrId("txt_software_dblist_updates_available"));
       
  1367         secondText = HbTextResolverSymbian::LoadL( KSecondSeveralUpdates, aNrOfUpdates );
       
  1368         }
       
  1369      */
       
  1370     
       
  1371     // loc: Load title and second line
       
  1372     // HBufC* titleText = HbTextResolverSymbian::LoadL(KTextTitle);
       
  1373     // CleanupStack::PushL( titleText );
       
  1374     // HBufC* secondText3 = HbTextResolverSymbian::LoadL(KTextSecond);
       
  1375     // CleanupStack::PushL( titleText );
       
  1376     
       
  1377     
       
  1378     TBuf<128> titleText;
       
  1379     TBuf<128> secondText;
       
  1380     
       
  1381     //title text (normal/first time)
       
  1382     if ( iMode == ENormalMode )
       
  1383         {
       
  1384         titleText.Append(KNormalText);
       
  1385         }
       
  1386     else
       
  1387         {
       
  1388         titleText.Append(KFirstTimeText);
       
  1389         }
       
  1390     
       
  1391     //text for 2nd line
       
  1392     secondText.Append(KSecondText);
       
  1393             
       
  1394     // icon
       
  1395     /* HLa-->
       
  1396     if ( iMode == ENormalMode )
  1489     if ( iMode == ENormalMode )
  1397         {
  1490         {
  1398         TFileName path;
  1491         TFileName path;
  1399         TInt err = GetPrivatePathL( path ); 
  1492         TInt err = GetPrivatePathL( path ); 
  1400         
  1493         
  1401         if ( err == KErrNone )
  1494         if ( err == KErrNone )
  1402             {
  1495             {
  1403             iSoftNotification->SetImagePathL( path );
  1496             HBufC8* image = LoadFileLC( path );   
  1404             //HBufC8* image = LoadFileLC( path );   
  1497             iSoftNotification->SetImageL( *image );
  1405             //iSoftNotification->SetImageL( *image );
  1498             CleanupStack::PopAndDestroy( image );
  1406             //CleanupStack::PopAndDestroy( image );
       
  1407             }
  1499             }
  1408         }
  1500         }
  1409     */
  1501 */
  1410     // loc: set image path
       
  1411     // iSoftNotification->SetImagePathL( KIcon );
       
  1412   
  1502   
  1413     // Set texts
  1503     
  1414     // loc: iSoftNotification->SetTextL( titleText->Des(), secondText->Des() );
  1504     iSoftNotification->SetTextL( *text, *text );
  1415     iSoftNotification->SetTextL( titleText, secondText );
  1505     iSoftNotification->SetSoftkeyLabelsL( *sk1, *sk2 );
  1416     
  1506    
  1417     // loc: delete text buffers
  1507     iSoftNotification->ShowSoftNotificationL();
  1418     // CleanupStack::PopAndDestroy( titleText );
  1508     FLOG("[bgchecker] LaunchSoftNotificationL 1");
  1419     // CleanupStack::PopAndDestroy( titleText );
  1509     CleanupStack::PopAndDestroy( 3 ); //text, sk1, sk2
  1420     
  1510     }
  1421     // Set number of updates for dialog and internal file
  1511 
  1422     iSoftNotification->SetNrOfUpdates( aNrOfUpdates );
  1512 
  1423     SetNrOfIndicatorEntriesL( aNrOfUpdates );
  1513 // ----------------------------------------------------------
  1424     
  1514 // CIAUpdateBGTimer::GetPrivatePathL()
  1425     iSoftNotification->ShowNotificationL();
  1515 // ----------------------------------------------------------
  1426     FLOG("[bgchecker] LaunchNotificationL 1");
  1516 TInt CIAUpdateBGTimer::GetPrivatePathL( TFileName& /*aPath*/ )
  1427     
  1517     {
  1428     return;
  1518 /*
  1429     }
  1519     RFs fsSession;  
       
  1520     User::LeaveIfError( fsSession.Connect() );
       
  1521     CleanupClosePushL( fsSession );
       
  1522 
       
  1523     // This will set the correct drive and private path 
       
  1524     // for the file server session. 
       
  1525     TInt err = KErrNone;
       
  1526     TRAP( err, SetPrivateDriveL( fsSession, KImageFile ) );
       
  1527     
       
  1528     if ( err != KErrNone )
       
  1529         {
       
  1530         CleanupStack::PopAndDestroy( &fsSession ); 
       
  1531         return err;
       
  1532         }
       
  1533    
       
  1534     err = fsSession.SessionPath( aPath );
       
  1535     aPath.Append( KImageFile );
       
  1536     
       
  1537     CleanupStack::PopAndDestroy( &fsSession ); 
       
  1538     return err;
       
  1539 */
       
  1540     return 0;
       
  1541     }
       
  1542 
       
  1543 // ----------------------------------------------------------
       
  1544 // CIAUpdateBGTimer::LoadFileLC()
       
  1545 // ----------------------------------------------------------
       
  1546  HBufC8* CIAUpdateBGTimer::LoadFileLC(const TDesC& /*aFile*/)
       
  1547      {
       
  1548 /*
       
  1549      RFs fs;
       
  1550     User::LeaveIfError( fs.Connect() );
       
  1551     CleanupClosePushL( fs );
       
  1552     RFile file;
       
  1553     User::LeaveIfError(file.Open(fs, aFile, EFileRead));
       
  1554     CleanupClosePushL(file);
       
  1555     TInt size;
       
  1556     User::LeaveIfError(file.Size(size));
       
  1557     HBufC8* imagebuf = HBufC8::NewL(size);
       
  1558     TPtr8 imageptr(imagebuf->Des());
       
  1559     file.Read(imageptr);
       
  1560     CleanupStack::PopAndDestroy( &file ); 
       
  1561     CleanupStack::PopAndDestroy( &fs ); 
       
  1562     CleanupDeletePushL(imagebuf);
       
  1563     return imagebuf;
       
  1564 */
       
  1565     return NULL;
       
  1566      } 
       
  1567 
       
  1568  
       
  1569  // ----------------------------------------------------------
       
  1570  // CIAUpdateBGTimer::SetPrivateDriveL()
       
  1571  // ----------------------------------------------------------
       
  1572  void CIAUpdateBGTimer::SetPrivateDriveL( 
       
  1573      RFs& /*aFs*/,
       
  1574      const TDesC& /*aFileName*/ ) const
       
  1575      {
       
  1576 /*
       
  1577      // First try to find the file from the private directory
       
  1578      // of the drive where the process exists.
       
  1579      RProcess process;
       
  1580 
       
  1581      // Set the session private path according to 
       
  1582      // the process file name drive.
       
  1583      TInt driveNum( 
       
  1584          SetSessionPrivatePathL( aFs, process.FileName() ) );
       
  1585 
       
  1586      // Get the session path that was set above.
       
  1587      TFileName sessionPath;
       
  1588      User::LeaveIfError( aFs.SessionPath( sessionPath ) );
       
  1589 
       
  1590      // Use the file finder to check if the file actually exists 
       
  1591      // in the given drive path. If it does not, the file finder 
       
  1592      // will automatically check from other drives. So, here we 
       
  1593      // should always find the file if any exists.
       
  1594      TFindFile finder( aFs );
       
  1595      User::LeaveIfError( finder.FindByDir( aFileName, sessionPath ) );
       
  1596 
       
  1597      // The drive may have changed if the file was not found from
       
  1598      // the first suggested drive. So, be sure to have the correct
       
  1599      // private path.
       
  1600      driveNum = SetSessionPrivatePathL( aFs, finder.File() );
       
  1601 
       
  1602      // Use the drive info to check if the drive is ROM drive.
       
  1603      // We prefer non ROM drives. But, accept ROM if nothing else is
       
  1604      // available.
       
  1605      TDriveInfo info;
       
  1606      User::LeaveIfError( aFs.Drive( info, driveNum ) );
       
  1607      TBool isRomDrive( info.iDriveAtt & KDriveAttRom );
       
  1608      if ( !isRomDrive )
       
  1609          {
       
  1610          // The current file is not in ROM drive so use that.
       
  1611          return;
       
  1612          }
       
  1613 
       
  1614      // Because previous finding was ROM file, try to find a non ROM file.
       
  1615      TInt findErrorCode( finder.Find() );
       
  1616      if ( findErrorCode == KErrNotFound )
       
  1617          {
       
  1618          // Because no new file is found, use the current settings.
       
  1619          return;
       
  1620          }
       
  1621      User::LeaveIfError( findErrorCode );
       
  1622 
       
  1623      // Update the session path for the correct file.
       
  1624      SetSessionPrivatePathL( aFs, finder.File() );
       
  1625 */
       
  1626      }
       
  1627 
       
  1628 
       
  1629  // ----------------------------------------------------------
       
  1630  // CIAUpdateBGTimer::SetSessionPrivatePathL()
       
  1631  // ----------------------------------------------------------
       
  1632  TInt CIAUpdateBGTimer::SetSessionPrivatePathL( 
       
  1633      RFs& /*aFs*/,
       
  1634      const TDesC& /*aPath*/ ) const
       
  1635      {                      
       
  1636 /*
       
  1637      // Use the parser to get the drive information from the path.
       
  1638      TParsePtrC parser( aPath );
       
  1639 
       
  1640      if ( !parser.DrivePresent() )
       
  1641          {
       
  1642          User::Leave( KErrArgument );
       
  1643          }
       
  1644 
       
  1645      // Drive check was passed above.
       
  1646      // So, drive information is safe to use.
       
  1647      const TDesC& drive( parser.Drive() );
       
  1648      const TChar driveChar( drive[ 0 ] );
       
  1649      TInt driveNum( EDriveA );
       
  1650      User::LeaveIfError( 
       
  1651          RFs::CharToDrive( driveChar, driveNum ) );
       
  1652 
       
  1653      // Set the file drive to be file session private path drive.
       
  1654      User::LeaveIfError( aFs.SetSessionToPrivate( driveNum ) );
       
  1655 
       
  1656      return driveNum;
       
  1657 */
       
  1658      return 0;
       
  1659      }
       
  1660 
       
  1661 // ----------------------------------------------------------
       
  1662 // CIAUpdateBGTimer::ReadResourceLC()
       
  1663 // ----------------------------------------------------------
       
  1664 HBufC* CIAUpdateBGTimer::ReadResourceLC( TInt aResourceId )
       
  1665     {
       
  1666     TResourceReader reader;
       
  1667     HBufC8* buff = iResourceFile.AllocReadLC( aResourceId );
       
  1668     reader.SetBuffer( buff );
       
  1669     HBufC* text = reader.ReadHBufCL();
       
  1670     CleanupStack::PopAndDestroy( buff );
       
  1671     CleanupStack::PushL( text );
       
  1672     return text;
       
  1673     }
       
  1674 
  1430 
  1675 
  1431 // ----------------------------------------------------------
  1676 // ----------------------------------------------------------
  1432 // CIAUpdateBGTimer::IsAutoUpdateDisabledL()
  1677 // CIAUpdateBGTimer::IsAutoUpdateDisabledL()
  1433 // ----------------------------------------------------------
  1678 // ----------------------------------------------------------
  1434 TBool CIAUpdateBGTimer::IsAutoUpdateDisabledL()
  1679 TBool CIAUpdateBGTimer::IsAutoUpdateDisabledL()
  1553     FLOG("[bgchecker] Shutdown() begin");
  1798     FLOG("[bgchecker] Shutdown() begin");
  1554     Cancel();
  1799     Cancel();
  1555     delete iUpdate; 
  1800     delete iUpdate; 
  1556     iUpdate = NULL;
  1801     iUpdate = NULL;
  1557     
  1802     
  1558     //delete iReminderTimer;
  1803     delete iReminderTimer;
  1559     //iReminderTimer = NULL;
  1804     iReminderTimer = NULL;
  1560     
  1805     
  1561     if ( iNotifyHandler ) 
  1806     if ( iNotifyHandler ) 
  1562         {
  1807         {
  1563         iNotifyHandler->StopListening();
  1808         iNotifyHandler->StopListening();
  1564         delete iNotifyHandler;
  1809         delete iNotifyHandler;
  1565         iNotifyHandler = NULL;
  1810         iNotifyHandler = NULL;
  1566         }
  1811         }
  1567     
  1812     
  1568     if ( iSoftNotification )
  1813     if ( iSoftNotification )
  1569         {
  1814         {
       
  1815         TRAP_IGNORE( iSoftNotification->RemoveSoftNotificationL( iSoftNotification->Id() ) );    
  1570         delete iSoftNotification;
  1816         delete iSoftNotification;
  1571         iSoftNotification = NULL;
  1817         iSoftNotification = NULL;
  1572         }
       
  1573     
       
  1574     if ( iIndicatorNotifyHandler )
       
  1575         {
       
  1576         delete iIndicatorNotifyHandler;
       
  1577         iIndicatorNotifyHandler = NULL;
       
  1578         }
  1818         }
  1579     
  1819     
  1580     CActiveScheduler::Stop();
  1820     CActiveScheduler::Stop();
  1581         
  1821         
  1582     FLOG("[bgchecker] Shutdown() end");
  1822     FLOG("[bgchecker] Shutdown() end");
  1583     }   
  1823     }
  1584 // ---------------------------------------------------------------------------
  1824 
  1585 // CIAUpdateBGTimer::HandleIndicatorRemoveL()
  1825 
  1586 // ---------------------------------------------------------------------------
       
  1587 //
       
  1588 void CIAUpdateBGTimer::HandleIndicatorRemoveL() 
       
  1589     {
       
  1590     // remove indicator from indicator menu
       
  1591     iSoftNotification->RemoveIndicatorL();
       
  1592     
       
  1593     //clear nr of indicator entries in internal file
       
  1594     SetNrOfIndicatorEntriesL( 0 );
       
  1595     }
       
  1596 
  1826 
  1597 // End of file
  1827 // End of file
       
  1828 
       
  1829