iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp
changeset 60 245df5276b97
parent 53 ae54820ef82c
child 72 a0dc14075813
equal deleted inserted replaced
53:ae54820ef82c 60:245df5276b97
    41 #include "iaupdatebgconst.h"
    41 #include "iaupdatebgconst.h"
    42 
    42 
    43 //MACROS
    43 //MACROS
    44 _LIT8( KRefreshFromNetworkDenied, "1" );
    44 _LIT8( KRefreshFromNetworkDenied, "1" );
    45 _LIT(KIAUpdateLauncherExe, "iaupdatelauncher.exe" );
    45 _LIT(KIAUpdateLauncherExe, "iaupdatelauncher.exe" );
    46 _LIT8( KFirstTimeCase, "0" );
       
    47 
    46 
    48 //CONSTANTS
    47 //CONSTANTS
    49 const TUint KIADUpdateLauncherUid( 0x2001FE2F );
    48 const TUint KIADUpdateLauncherUid( 0x2001FE2F );
    50 
    49 
    51 // ----------------------------------------------------------
    50 // ----------------------------------------------------------
    79     
    78     
    80     iInternalFile = CIAUpdateBGInternalFileHandler::NewL();
    79     iInternalFile = CIAUpdateBGInternalFileHandler::NewL();
    81     
    80     
    82     iSoftNotification = CIAUpdateBGSoftNotification::NewL( this ); 
    81     iSoftNotification = CIAUpdateBGSoftNotification::NewL( this ); 
    83     
    82     
       
    83     iIndicatorNotifyHandler = CIAUpdateBGNotifyHandler::NewL();
       
    84     
    84     // loc: initialize localisation text loader
    85     // loc: initialize localisation text loader
    85     /*
    86     /*
    86     TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
    87     TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
    87     if ( res != KErrNone )
    88     if ( res != KErrNone )
    88         {
    89         {
   108 
   109 
   109     delete iIAUpdateCRSession; 
   110     delete iIAUpdateCRSession; 
   110     delete iControllerFile;
   111     delete iControllerFile;
   111     delete iInternalFile;
   112     delete iInternalFile;
   112     delete iSoftNotification;
   113     delete iSoftNotification;
       
   114     delete iIndicatorNotifyHandler;
   113     
   115     
   114     }
   116     }
   115 
   117 
   116 // ----------------------------------------------------------
   118 // ----------------------------------------------------------
   117 // CIAUpdateBGTimer::StartProcessL()
   119 // CIAUpdateBGTimer::StartProcessL()
   118 // ----------------------------------------------------------
   120 // ----------------------------------------------------------
   119 void CIAUpdateBGTimer::StartProcessL()
   121 void CIAUpdateBGTimer::StartProcessL()
   120     {
   122     {
   121     FLOG("[bgchecker] StartProcessL");
   123     FLOG("[bgchecker] StartProcessL");
   122         
   124     
       
   125     // start listening indicator remove
       
   126     iIndicatorNotifyHandler->StartListeningL( this );
       
   127     
       
   128     
   123     iMode = ModeL();
   129     iMode = ModeL();
   124     
   130     
   125     switch ( iMode )
   131     switch ( iMode )
   126         {
   132         {
   127         case EFirstTimeMode:
   133         case EFirstTimeMode:
   253 
   259 
   254         case ENormalMode:
   260         case ENormalMode:
   255         case ERetryMode:
   261         case ERetryMode:
   256             {
   262             {
   257             
   263             
   258             // Check if indicator should be shown
   264             // Should indicator be shown ?
   259             
   265             TInt entries = NrOfIndicatorEntries();
       
   266             if  ( entries )
       
   267                 {
       
   268                 iSoftNotification->SetNrOfUpdates( entries );
       
   269                 iSoftNotification->ShowIndicatorL();
       
   270                 }
   260             
   271             
   261             StartUpdatesCheckingL();
   272             StartUpdatesCheckingL();
       
   273             
   262             break;
   274             break;
   263             }
   275             }
   264         
   276         
   265         default:
   277         default:
   266             break;
   278             break;
   443     iInternalFile->SetLastTimeShowNewFeatureDialog( aTime );
   455     iInternalFile->SetLastTimeShowNewFeatureDialog( aTime );
   444     TRAPD( err,iInternalFile->WriteControllerDataL() );
   456     TRAPD( err,iInternalFile->WriteControllerDataL() );
   445     return err;
   457     return err;
   446     }
   458     }
   447 
   459 
   448 
       
   449 // ----------------------------------------------------------
   460 // ----------------------------------------------------------
   450 // CIAUpdateBGTimer::ModeL()
   461 // CIAUpdateBGTimer::ModeL()
   451 // ----------------------------------------------------------
   462 // ----------------------------------------------------------
   452 TIAUpdateBGMode CIAUpdateBGTimer::ModeL()
   463 TIAUpdateBGMode CIAUpdateBGTimer::ModeL()
   453     {
   464     {
   464     iInternalFile->SetMode( aMode  );
   475     iInternalFile->SetMode( aMode  );
   465     TRAPD( err,iInternalFile->WriteControllerDataL() );
   476     TRAPD( err,iInternalFile->WriteControllerDataL() );
   466     return err;
   477     return err;
   467     }
   478     }
   468 
   479 
       
   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     }
   469 
   499 
   470 // ----------------------------------------------------------
   500 // ----------------------------------------------------------
   471 // CIAUpdateBGTimer::RetryTimesL()
   501 // CIAUpdateBGTimer::RetryTimesL()
   472 // ----------------------------------------------------------
   502 // ----------------------------------------------------------
   473 TInt CIAUpdateBGTimer::RetryTimesL()
   503 TInt CIAUpdateBGTimer::RetryTimesL()
  1220                   FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted");
  1250                   FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted");
  1221                   
  1251                   
  1222                   }
  1252                   }
  1223               else
  1253               else
  1224                   {
  1254                   {
  1225                   //accepted, launch iad
  1255                   //accepted, clear indicator entries
       
  1256                   SetNrOfIndicatorEntriesL( 0 );
       
  1257                   // start IAD
  1226                   StartIaupdateL();
  1258                   StartIaupdateL();
  1227                   }
  1259                   }
  1228               break;
  1260               break;
  1229               }
  1261               }
  1230 
  1262 
  1384     
  1416     
  1385     // loc: delete text buffers
  1417     // loc: delete text buffers
  1386     // CleanupStack::PopAndDestroy( titleText );
  1418     // CleanupStack::PopAndDestroy( titleText );
  1387     // CleanupStack::PopAndDestroy( titleText );
  1419     // CleanupStack::PopAndDestroy( titleText );
  1388     
  1420     
  1389     // Set number of updates
  1421     // Set number of updates for dialog and internal file
  1390     iSoftNotification->SetNrOfUpdates( aNrOfUpdates );
  1422     iSoftNotification->SetNrOfUpdates( aNrOfUpdates );
  1391    
  1423     SetNrOfIndicatorEntriesL( aNrOfUpdates );
       
  1424     
  1392     iSoftNotification->ShowNotificationL();
  1425     iSoftNotification->ShowNotificationL();
  1393     FLOG("[bgchecker] LaunchNotificationL 1");
  1426     FLOG("[bgchecker] LaunchNotificationL 1");
  1394     
  1427     
  1395     return;
  1428     return;
  1396     }
  1429     }
  1536         {
  1569         {
  1537         delete iSoftNotification;
  1570         delete iSoftNotification;
  1538         iSoftNotification = NULL;
  1571         iSoftNotification = NULL;
  1539         }
  1572         }
  1540     
  1573     
       
  1574     if ( iIndicatorNotifyHandler )
       
  1575         {
       
  1576         delete iIndicatorNotifyHandler;
       
  1577         iIndicatorNotifyHandler = NULL;
       
  1578         }
       
  1579     
  1541     CActiveScheduler::Stop();
  1580     CActiveScheduler::Stop();
  1542         
  1581         
  1543     FLOG("[bgchecker] Shutdown() end");
  1582     FLOG("[bgchecker] Shutdown() end");
  1544     }
  1583     }   
       
  1584 // ---------------------------------------------------------------------------
       
  1585 // CIAUpdateBGTimer::HandleIndicatorRemoveL()
       
  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 
  1545 // End of file
  1597 // End of file