iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp
changeset 60 245df5276b97
parent 53 ae54820ef82c
child 72 a0dc14075813
--- a/iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp	Tue Jul 06 14:23:31 2010 +0300
+++ b/iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp	Wed Aug 18 09:55:45 2010 +0300
@@ -43,7 +43,6 @@
 //MACROS
 _LIT8( KRefreshFromNetworkDenied, "1" );
 _LIT(KIAUpdateLauncherExe, "iaupdatelauncher.exe" );
-_LIT8( KFirstTimeCase, "0" );
 
 //CONSTANTS
 const TUint KIADUpdateLauncherUid( 0x2001FE2F );
@@ -81,6 +80,8 @@
     
     iSoftNotification = CIAUpdateBGSoftNotification::NewL( this ); 
     
+    iIndicatorNotifyHandler = CIAUpdateBGNotifyHandler::NewL();
+    
     // loc: initialize localisation text loader
     /*
     TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
@@ -110,6 +111,7 @@
     delete iControllerFile;
     delete iInternalFile;
     delete iSoftNotification;
+    delete iIndicatorNotifyHandler;
     
     }
 
@@ -119,7 +121,11 @@
 void CIAUpdateBGTimer::StartProcessL()
     {
     FLOG("[bgchecker] StartProcessL");
-        
+    
+    // start listening indicator remove
+    iIndicatorNotifyHandler->StartListeningL( this );
+    
+    
     iMode = ModeL();
     
     switch ( iMode )
@@ -255,10 +261,16 @@
         case ERetryMode:
             {
             
-            // Check if indicator should be shown
-            
+            // Should indicator be shown ?
+            TInt entries = NrOfIndicatorEntries();
+            if  ( entries )
+                {
+                iSoftNotification->SetNrOfUpdates( entries );
+                iSoftNotification->ShowIndicatorL();
+                }
             
             StartUpdatesCheckingL();
+            
             break;
             }
         
@@ -445,7 +457,6 @@
     return err;
     }
 
-
 // ----------------------------------------------------------
 // CIAUpdateBGTimer::ModeL()
 // ----------------------------------------------------------
@@ -466,6 +477,25 @@
     return err;
     }
 
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::NrOfIndicatorEntries()
+// ----------------------------------------------------------
+TInt CIAUpdateBGTimer::NrOfIndicatorEntries()
+    {
+    iInternalFile->ReadControllerDataL();
+    return iInternalFile->NrOfIndicatorEntries();
+    }
+
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::SetNrOfIndicatorEntriesL()
+// ----------------------------------------------------------
+TInt CIAUpdateBGTimer::SetNrOfIndicatorEntriesL( TInt aEntries )
+    {
+    iInternalFile->SetNrOfIndicatorEntries( aEntries );
+    TRAPD( err,iInternalFile->WriteControllerDataL() );
+    return err;
+    }
 
 // ----------------------------------------------------------
 // CIAUpdateBGTimer::RetryTimesL()
@@ -1222,7 +1252,9 @@
                   }
               else
                   {
-                  //accepted, launch iad
+                  //accepted, clear indicator entries
+                  SetNrOfIndicatorEntriesL( 0 );
+                  // start IAD
                   StartIaupdateL();
                   }
               break;
@@ -1386,9 +1418,10 @@
     // CleanupStack::PopAndDestroy( titleText );
     // CleanupStack::PopAndDestroy( titleText );
     
-    // Set number of updates
+    // Set number of updates for dialog and internal file
     iSoftNotification->SetNrOfUpdates( aNrOfUpdates );
-   
+    SetNrOfIndicatorEntriesL( aNrOfUpdates );
+    
     iSoftNotification->ShowNotificationL();
     FLOG("[bgchecker] LaunchNotificationL 1");
     
@@ -1538,8 +1571,27 @@
         iSoftNotification = NULL;
         }
     
+    if ( iIndicatorNotifyHandler )
+        {
+        delete iIndicatorNotifyHandler;
+        iIndicatorNotifyHandler = NULL;
+        }
+    
     CActiveScheduler::Stop();
         
     FLOG("[bgchecker] Shutdown() end");
+    }   
+// ---------------------------------------------------------------------------
+// CIAUpdateBGTimer::HandleIndicatorRemoveL()
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateBGTimer::HandleIndicatorRemoveL() 
+    {
+    // remove indicator from indicator menu
+    iSoftNotification->RemoveIndicatorL();
+    
+    //clear nr of indicator entries in internal file
+    SetNrOfIndicatorEntriesL( 0 );
     }
+
 // End of file