iaupdate/IAD/updater/src/iaupdaterdialog.cpp
changeset 29 26b6f0522fd8
parent 0 ba25891c3a9e
child 44 329d304c1aa1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2010 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".
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 #include <AknGlobalNote.h>
       
    21 #include <avkon.rsg>
       
    22 #include <bautils.h>
       
    23 #include <data_caging_path_literals.hrh> 
       
    24 #include <iaupdater.rsg>
       
    25 #include <StringLoader.h>
       
    26 #include <AknUtils.h>   //For AknTextUtils
       
    27 
       
    28 #include "iaupdaterdialog.h"
    20 #include "iaupdaterdialog.h"
    29 #include "iaupdaterdefs.h"
    21 #include "iaupdaterdefs.h"
    30 #include "iaupdatercancelobserver.h"
    22 #include "iaupdatercancelobserver.h"
    31 #include "iaupdatedebug.h"
    23 #include "iaupdatedebug.h"
    32 
    24 
    90 void CIAUpdaterDialog::ConstructL()
    82 void CIAUpdaterDialog::ConstructL()
    91     {
    83     {
    92     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL begin");
    84     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL begin");
    93     
    85     
    94     // Get resource file path
    86     // Get resource file path
    95     TFileName fileName;
    87     /*TFileName fileName;
    96     fileName.Copy( TParsePtrC( RProcess().FileName() ).Drive() );
    88     fileName.Copy( TParsePtrC( RProcess().FileName() ).Drive() );
    97     fileName.Append( KDC_APP_RESOURCE_DIR );
    89     fileName.Append( KDC_APP_RESOURCE_DIR );
    98     fileName.Append( IAUpdaterDefs::KIAUpdaterResourceFile );
    90     fileName.Append( IAUpdaterDefs::KIAUpdaterResourceFile );
    99     
    91     
   100     // Get language of resource file        
    92     // Get language of resource file        
   101     BaflUtils::NearestLanguageFile( iFs, fileName );
    93     BaflUtils::NearestLanguageFile( iFs, fileName );
   102 
    94 
   103     // Open resource file
    95     // Open resource file
   104     iResourceFile.OpenL( iFs, fileName );
    96     iResourceFile.OpenL( iFs, fileName );
   105     iResourceFile.ConfirmSignatureL();    
    97     iResourceFile.ConfirmSignatureL(); */   
   106 
    98 
   107     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL end");
    99     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL end");
   108     }
   100     }
   109 
   101 
   110  
   102  
   114 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   115 //
   107 //
   116 CIAUpdaterDialog::~CIAUpdaterDialog()
   108 CIAUpdaterDialog::~CIAUpdaterDialog()
   117     {
   109     {
   118     Cancel();
   110     Cancel();
   119     delete iNote;
   111     //delete iNote;
   120     iResourceFile.Close();    
   112     //iResourceFile.Close();    
   121     }
   113     }
   122 
   114 
   123 
   115 
   124 // -----------------------------------------------------------------------------
   116 // -----------------------------------------------------------------------------
   125 // CIAUpdaterDialog::ShowWaitingNoteL  
   117 // CIAUpdaterDialog::ShowWaitingNoteL  
   126 // Show global waiting note during installing.
   118 // Show global waiting note during installing.
   127 // -----------------------------------------------------------------------------
   119 // -----------------------------------------------------------------------------
   128 // 
   120 // 
   129 void CIAUpdaterDialog::ShowWaitingNoteL( const TDesC& aName, TInt aIndex, TInt aTotalCount )
   121 void CIAUpdaterDialog::ShowWaitingNoteL( const TDesC& /*aName*/, TInt /*aIndex*/, TInt /*aTotalCount*/ )
   130 	{	
   122 	{	
   131 	IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL begin");
   123 	IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL begin");
   132 	if ( iNoteId == 0 )
   124 	if ( iNoteId == 0 )
   133 		{ 		                             
   125 		{ 		                             
   134 	    IAUPDATE_TRACE("[IAUpdater] Creating global waiting note.");
   126 	    IAUPDATE_TRACE("[IAUpdater] Creating global waiting note.");
   135 	
   127 	
   136         // Get localiced string from resc. file. 
   128         // Get localiced string from resc. file. 
   137         HBufC* string = ReadResourceLC( R_IAUPDATER_INSTALLING ); 
   129         //HBufC* string = ReadResourceLC( R_IAUPDATER_INSTALLING ); 
   138                                           
   130                                           
   139         HBufC* temp1 = HBufC::NewLC( string->Length() + aName.Length() );          
   131         //HBufC* temp1 = HBufC::NewLC( string->Length() + aName.Length() );          
   140         TPtr temp1Ptr = temp1->Des();
   132         //TPtr temp1Ptr = temp1->Des();
   141         
   133         
   142         // Add pkg's name to string (U0).
   134         // Add pkg's name to string (U0).
   143         StringLoader::Format( temp1Ptr, *string, 0, aName );
   135         //StringLoader::Format( temp1Ptr, *string, 0, aName );
   144                                         
   136                                         
   145         // Increase buffer length for the number.        
   137         // Increase buffer length for the number.        
   146         HBufC* temp2 = 
   138         //HBufC* temp2 = 
   147             HBufC::NewLC( temp1->Length() + IAUpdaterDefs::KIAUpdaterParamLen );        
   139         //    HBufC::NewLC( temp1->Length() + IAUpdaterDefs::KIAUpdaterParamLen );        
   148         TPtr temp2Ptr = temp2->Des();
   140         //TPtr temp2Ptr = temp2->Des();
   149          
   141          
   150         // Add index number to string (N1) 
   142         // Add index number to string (N1) 
   151         StringLoader::Format( temp2Ptr, *temp1, 1, aIndex );
   143         //StringLoader::Format( temp2Ptr, *temp1, 1, aIndex );
   152                         
   144                         
   153         // Increase buffer length for the number.  
   145         // Increase buffer length for the number.  
   154         HBufC* finalString = 
   146         //HBufC* finalString = 
   155             HBufC::NewLC( temp2->Length() + IAUpdaterDefs::KIAUpdaterParamLen );        
   147         //    HBufC::NewLC( temp2->Length() + IAUpdaterDefs::KIAUpdaterParamLen );        
   156         TPtr finalPtr = finalString->Des();
   148         //TPtr finalPtr = finalString->Des();
   157         
   149         
   158         // Add max count number to string (N2) 
   150         // Add max count number to string (N2) 
   159         StringLoader::Format( finalPtr, *temp2, 2, aTotalCount );
   151         //StringLoader::Format( finalPtr, *temp2, 2, aTotalCount );
   160         
   152         
   161         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finalPtr );         
   153         //AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finalPtr );         
   162         if ( !iNote )
   154         //if ( !iNote )
   163             {
   155         //    {
   164         	iNote = CAknGlobalNote::NewL();   
   156         //	iNote = CAknGlobalNote::NewL();   
   165     	    iNote->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
   157     	//    iNote->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
   166             }
   158         //    }
   167      	
   159      	
   168 	    IAUPDATE_TRACE("[IAUpdater] Showing global waiting note.");
   160 	//    IAUPDATE_TRACE("[IAUpdater] Showing global waiting note.");
   169     	iNoteId = iNote->ShowNoteL( iStatus, EAknGlobalWaitNote, *finalString );
   161     	//iNoteId = iNote->ShowNoteL( iStatus, EAknGlobalWaitNote, *finalString );
   170     	SetActive();    	    	
   162     	SetActive();    	    	
   171      
   163      
   172     	CleanupStack::PopAndDestroy( finalString );
   164     	//CleanupStack::PopAndDestroy( finalString );
   173     	CleanupStack::PopAndDestroy( temp2 );
   165     	//CleanupStack::PopAndDestroy( temp2 );
   174     	CleanupStack::PopAndDestroy( temp1 );
   166     	//CleanupStack::PopAndDestroy( temp1 );
   175     	CleanupStack::PopAndDestroy( string );
   167     	//CleanupStack::PopAndDestroy( string );
   176 		}
   168 		}
   177 	IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL end");
   169 	IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL end");
   178 	}
   170 	}
   179 
   171 
   180 	
   172 	
   185 // 
   177 // 
   186 void CIAUpdaterDialog::CancelWaitingNoteL()
   178 void CIAUpdaterDialog::CancelWaitingNoteL()
   187 	{
   179 	{
   188     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL begin");
   180     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL begin");
   189 	
   181 	
   190 	if ( iNoteId != 0 )
   182 	/*if ( iNoteId != 0 )
   191 		{
   183 		{
   192         IAUPDATE_TRACE("[IAUpdater] Cancel waiting note.");
   184         IAUPDATE_TRACE("[IAUpdater] Cancel waiting note.");
   193 	    iNote->CancelNoteL( iNoteId );
   185 	    iNote->CancelNoteL( iNoteId );
   194 	    iNoteId = 0;
   186 	    iNoteId = 0;
   195 		}
   187 		}*/
   196 
   188 
   197     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL end");
   189     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL end");
   198 	}
   190 	}
   199 
   191 
   200 	
   192 	
   201 // -----------------------------------------------------------------------------	
   193 
   202 // CIAUpdaterDialog::LoadResourceLC
       
   203 // Read resource string.
       
   204 // -----------------------------------------------------------------------------
       
   205 // 
       
   206 HBufC* CIAUpdaterDialog::ReadResourceLC( TInt aResourceId )
       
   207     {
       
   208     TResourceReader reader;
       
   209     HBufC8* buff = iResourceFile.AllocReadLC( aResourceId );    
       
   210     reader.SetBuffer( buff );
       
   211     HBufC* text = reader.ReadHBufCL();
       
   212     CleanupStack::PopAndDestroy( buff );
       
   213     CleanupStack::PushL( text );
       
   214 
       
   215     return text;
       
   216     }
       
   217     
   194     
   218     
   195     
   219 // ---------------------------------------------------------------------------
   196 // ---------------------------------------------------------------------------
   220 // CIAUpdaterDialog:::DoCancel
   197 // CIAUpdaterDialog:::DoCancel
   221 // 
   198 // 
   233 //
   210 //
   234 void CIAUpdaterDialog::RunL()
   211 void CIAUpdaterDialog::RunL()
   235     {
   212     {
   236     IAUPDATE_TRACE_1("[IAUpdater] CIAUpdaterDialog::RunL() iStatus : %d", iStatus.Int() );
   213     IAUPDATE_TRACE_1("[IAUpdater] CIAUpdaterDialog::RunL() iStatus : %d", iStatus.Int() );
   237     iNoteId = 0;
   214     iNoteId = 0;
   238     if ( iStatus.Int() == EAknSoftkeyCancel )
   215     /*if ( iStatus.Int() == EAknSoftkeyCancel )
   239         {
   216         {
   240     	iObserver->UserCancel();
   217     	iObserver->UserCancel();
   241         }
   218         }
   242     else
   219     else
   243         {
   220         {
   244         iObserver->UserExit();	
   221         iObserver->UserExit();	
   245         }
   222         }*/
   246     }
   223     }
   247 
   224 
   248 // ======== GLOBAL FUNCTIONS ========
   225 // ======== GLOBAL FUNCTIONS ========
   249 
   226 
   250 //  EOF  
   227 //  EOF