iaupdate/IAD/updater/src/iaupdaterdialog.cpp
changeset 44 329d304c1aa1
parent 29 26b6f0522fd8
child 77 d1838696558c
--- a/iaupdate/IAD/updater/src/iaupdaterdialog.cpp	Fri Jun 11 13:45:18 2010 +0300
+++ b/iaupdate/IAD/updater/src/iaupdaterdialog.cpp	Thu Jun 24 12:37:54 2010 +0300
@@ -22,6 +22,12 @@
 #include "iaupdatercancelobserver.h"
 #include "iaupdatedebug.h"
 
+#include <hbtextresolversymbian.h>
+
+
+_LIT(KFilename, "iaupdate.ts");
+_LIT(KPath, "z://data");
+_LIT(KInstalling, "txt_software_info_installing_1"); 
 
 // ======== LOCAL FUNCTIONS ========
 
@@ -33,26 +39,23 @@
 // C++ default constructor 
 // -----------------------------------------------------------------------------
 //
-CIAUpdaterDialog::CIAUpdaterDialog( RFs& aFs, 
-                                    MIAUpdaterCancelObserver& aObserver )
-: CActive( CActive::EPriorityStandard ),
-  iFs( aFs ),
-  iObserver ( &aObserver ) 
+CIAUpdaterDialog::CIAUpdaterDialog( MIAUpdaterCancelObserver& aObserver )
+: iObserver ( &aObserver ) 
     {
-    CActiveScheduler::Add( this );
+
     }
 
 
+
 // -----------------------------------------------------------------------------
 // CIAUpdaterDialog::NewL
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-CIAUpdaterDialog* CIAUpdaterDialog::NewL( RFs& aFs, 
-                                          MIAUpdaterCancelObserver& aObserver )
+CIAUpdaterDialog* CIAUpdaterDialog::NewL( MIAUpdaterCancelObserver& aObserver )
     {
     CIAUpdaterDialog* self =
-        CIAUpdaterDialog::NewLC( aFs, aObserver );
+        CIAUpdaterDialog::NewLC( aObserver );
     CleanupStack::Pop( self );
     return self;    
     }
@@ -63,11 +66,10 @@
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-CIAUpdaterDialog* CIAUpdaterDialog::NewLC( RFs& aFs, 
-                                           MIAUpdaterCancelObserver& aObserver )
+CIAUpdaterDialog* CIAUpdaterDialog::NewLC( MIAUpdaterCancelObserver& aObserver )
     {
     CIAUpdaterDialog* self = 
-        new( ELeave ) CIAUpdaterDialog( aFs, aObserver );
+        new( ELeave ) CIAUpdaterDialog( aObserver );
     CleanupStack::PushL( self );
     self->ConstructL();
     return self;    
@@ -84,18 +86,8 @@
     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL begin");
     
     // Get resource file path
-    /*TFileName fileName;
-    fileName.Copy( TParsePtrC( RProcess().FileName() ).Drive() );
-    fileName.Append( KDC_APP_RESOURCE_DIR );
-    fileName.Append( IAUpdaterDefs::KIAUpdaterResourceFile );
+    iIsResolverSuccess = HbTextResolverSymbian::Init(KFilename, KPath);
     
-    // Get language of resource file        
-    BaflUtils::NearestLanguageFile( iFs, fileName );
-
-    // Open resource file
-    iResourceFile.OpenL( iFs, fileName );
-    iResourceFile.ConfirmSignatureL(); */   
-
     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL end");
     }
 
@@ -107,9 +99,7 @@
 //
 CIAUpdaterDialog::~CIAUpdaterDialog()
     {
-    Cancel();
-    //delete iNote;
-    //iResourceFile.Close();    
+    DestroyGlobalWaitNote();
     }
 
 
@@ -118,54 +108,30 @@
 // Show global waiting note during installing.
 // -----------------------------------------------------------------------------
 // 
-void CIAUpdaterDialog::ShowWaitingNoteL( const TDesC& /*aName*/, TInt /*aIndex*/, TInt /*aTotalCount*/ )
+void CIAUpdaterDialog::ShowWaitingNoteL( const TDesC& aName, TInt /*aIndex*/, TInt /*aTotalCount*/ )
 	{	
 	IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL begin");
-	if ( iNoteId == 0 )
-		{ 		                             
-	    IAUPDATE_TRACE("[IAUpdater] Creating global waiting note.");
 	
-        // Get localiced string from resc. file. 
-        //HBufC* string = ReadResourceLC( R_IAUPDATER_INSTALLING ); 
-                                          
-        //HBufC* temp1 = HBufC::NewLC( string->Length() + aName.Length() );          
-        //TPtr temp1Ptr = temp1->Des();
-        
-        // Add pkg's name to string (U0).
-        //StringLoader::Format( temp1Ptr, *string, 0, aName );
-                                        
-        // Increase buffer length for the number.        
-        //HBufC* temp2 = 
-        //    HBufC::NewLC( temp1->Length() + IAUpdaterDefs::KIAUpdaterParamLen );        
-        //TPtr temp2Ptr = temp2->Des();
-         
-        // Add index number to string (N1) 
-        //StringLoader::Format( temp2Ptr, *temp1, 1, aIndex );
-                        
-        // Increase buffer length for the number.  
-        //HBufC* finalString = 
-        //    HBufC::NewLC( temp2->Length() + IAUpdaterDefs::KIAUpdaterParamLen );        
-        //TPtr finalPtr = finalString->Des();
-        
-        // Add max count number to string (N2) 
-        //StringLoader::Format( finalPtr, *temp2, 2, aTotalCount );
-        
-        //AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finalPtr );         
-        //if ( !iNote )
-        //    {
-        //	iNote = CAknGlobalNote::NewL();   
-    	//    iNote->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
-        //    }
-     	
-	//    IAUPDATE_TRACE("[IAUpdater] Showing global waiting note.");
-    	//iNoteId = iNote->ShowNoteL( iStatus, EAknGlobalWaitNote, *finalString );
-    	SetActive();    	    	
-     
-    	//CleanupStack::PopAndDestroy( finalString );
-    	//CleanupStack::PopAndDestroy( temp2 );
-    	//CleanupStack::PopAndDestroy( temp1 );
-    	//CleanupStack::PopAndDestroy( string );
-		}
+	DestroyGlobalWaitNote();
+    
+    iGlobalWaitNote = CHbDeviceProgressDialogSymbian::NewL(
+            CHbDeviceProgressDialogSymbian::EWaitDialog );
+    
+    // loc: Load string 
+    iGlobalResource = HbTextResolverSymbian::LoadL( KInstalling, aName );
+    if ( iGlobalResource )
+        iGlobalWaitNote->SetTextL( iGlobalResource->Des() );
+
+    // Icon ?
+    //iGlobalWaitNote->SetIconNameL(const TDesC& aIconName);
+    
+    // Button ?
+    iGlobalWaitNote->SetButton(ETrue);
+    
+    iGlobalWaitNote->SetObserver( this );
+    iGlobalWaitNote->SetAutoClose(EFalse);
+    iGlobalWaitNote->ShowL();
+    
 	IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL end");
 	}
 
@@ -178,50 +144,39 @@
 void CIAUpdaterDialog::CancelWaitingNoteL()
 	{
     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL begin");
-	
-	/*if ( iNoteId != 0 )
-		{
-        IAUPDATE_TRACE("[IAUpdater] Cancel waiting note.");
-	    iNote->CancelNoteL( iNoteId );
-	    iNoteId = 0;
-		}*/
-
+    
+    DestroyGlobalWaitNote();
+    
     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL end");
 	}
 
-	
-
+void CIAUpdaterDialog::ProgressDialogCancelled(
+    const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/ )
+    {
     
+    iObserver->UserCancel();
     
-// ---------------------------------------------------------------------------
-// CIAUpdaterDialog:::DoCancel
-// 
-// ---------------------------------------------------------------------------
-// 
-void CIAUpdaterDialog::DoCancel()
+    }
+
+void CIAUpdaterDialog::ProgressDialogClosed(
+    const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/ )
     {
-    TRAP_IGNORE( CancelWaitingNoteL() );
+    
     }
 
-// ---------------------------------------------------------------------------
-// CIAUpdateNetworkRegistration::RunL()
-// 
-// ---------------------------------------------------------------------------
-//
-void CIAUpdaterDialog::RunL()
+// -----------------------------------------------------------------------------
+// CIAUpdaterDialog::DestroyGlobalWaitNote
+// -----------------------------------------------------------------------------
+void CIAUpdaterDialog::DestroyGlobalWaitNote()
     {
-    IAUPDATE_TRACE_1("[IAUpdater] CIAUpdaterDialog::RunL() iStatus : %d", iStatus.Int() );
-    iNoteId = 0;
-    /*if ( iStatus.Int() == EAknSoftkeyCancel )
+    if ( iGlobalWaitNote )
         {
-    	iObserver->UserCancel();
+        iGlobalWaitNote->Close();
+        delete iGlobalWaitNote;
+        iGlobalWaitNote = NULL;
+        delete iGlobalResource;
+        iGlobalResource = NULL;
         }
-    else
-        {
-        iObserver->UserExit();	
-        }*/
     }
-
-// ======== GLOBAL FUNCTIONS ========
-
+    
 //  EOF