homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp
branchRCL_3
changeset 78 1b207dd38b72
parent 74 edd621764147
child 82 ace62b58f4b2
equal deleted inserted replaced
74:edd621764147 78:1b207dd38b72
   125     iDefaultSpecificationSet = EFalse;
   125     iDefaultSpecificationSet = EFalse;
   126     iDefaultSpecification = ELangNone;
   126     iDefaultSpecification = ELangNone;
   127     iInstallationMode = EServiceHandler;
   127     iInstallationMode = EServiceHandler;
   128     iTrustedInstallation = EFalse;
   128     iTrustedInstallation = EFalse;
   129 	iInstallationType = EInstallationTypeNew;
   129 	iInstallationType = EInstallationTypeNew;
       
   130 	iInstallFromUDAEmmc = ETrue;
   130 	iFamilyMask = 0;
   131 	iFamilyMask = 0;
   131     }
   132     }
   132     
   133     
   133 // -----------------------------------------------------------------------------
   134 // -----------------------------------------------------------------------------
   134 // ChspsInstallationHandler::NewL
   135 // ChspsInstallationHandler::NewL
  1985             TFileName fullName;
  1986             TFileName fullName;
  1986             hspsServerUtil::FindFile(
  1987             hspsServerUtil::FindFile(
  1987                     iFsSession,                    
  1988                     iFsSession,                    
  1988                     iThemeFilePath, 
  1989                     iThemeFilePath, 
  1989                     nameBuf->Des(),
  1990                     nameBuf->Des(),
       
  1991                     iInstallFromUDAEmmc,
  1990                     fullName );
  1992                     fullName );
  1991             delete nameBuf;
  1993             delete nameBuf;
  1992             nameBuf = NULL;
  1994             nameBuf = NULL;
  1993             if( !fullName.Length() )
  1995             if( !fullName.Length() )
  1994                 {
  1996                 {
  2182 // -----------------------------------------------------------------------------
  2184 // -----------------------------------------------------------------------------
  2183 //
  2185 //
  2184 void ChspsInstallationHandler::DisableNotifications()    
  2186 void ChspsInstallationHandler::DisableNotifications()    
  2185     {
  2187     {
  2186     iDisableNotifications = ETrue;
  2188     iDisableNotifications = ETrue;
       
  2189     }
       
  2190 
       
  2191 // -----------------------------------------------------------------------------
       
  2192 // Disables eclipsing from UDA and eMMC drives
       
  2193 // -----------------------------------------------------------------------------
       
  2194 //
       
  2195 void ChspsInstallationHandler::DisableUdaEmmcInstallations()
       
  2196     {
       
  2197     iInstallFromUDAEmmc = EFalse;
  2187     }
  2198     }
  2188 
  2199 
  2189 // -----------------------------------------------------------------------------
  2200 // -----------------------------------------------------------------------------
  2190 // Finds locale specific subdirectories and DTD resources and appends those
  2201 // Finds locale specific subdirectories and DTD resources and appends those
  2191 // into the resource array 
  2202 // into the resource array 
  2341 // Should be executed prior to the CheckHeader method!
  2352 // Should be executed prior to the CheckHeader method!
  2342 // -----------------------------------------------------------------------------
  2353 // -----------------------------------------------------------------------------
  2343 //
  2354 //
  2344 void ChspsInstallationHandler::AddLocalesL(
  2355 void ChspsInstallationHandler::AddLocalesL(
  2345         const TDesC& aPath )
  2356         const TDesC& aPath )
  2346     {           
  2357     {
  2347     // Find all locale specific subfolders
  2358     // Retrieve phone supported language.
  2348     TFindFile fileFinder( iFsSession );
  2359     CArrayFixFlat<TInt>* languageCodes = NULL;
  2349     _LIT( KFilter, "*" );
  2360     hspsServerUtil::GetInstalledLanguagesL( languageCodes );
  2350     CDir* fileList( NULL );    
  2361     CleanupStack::PushL( languageCodes );     
  2351     fileFinder.FindWildByDir( KFilter, aPath, fileList );
  2362     
  2352     if ( fileList )
  2363     // Ensure that path contains '\' at the end.
  2353         {
  2364     TFileName xuikonPath;
  2354         CleanupStack::PushL( fileList );
  2365     xuikonPath.Copy( aPath );
  2355         TFileName localePath;
  2366     if( xuikonPath.Length() > KPathDelim().Length() )
  2356         for( TInt i = 0; i < fileList->Count(); i++ )       
  2367         {
  2357             {
  2368         if( xuikonPath.Mid( xuikonPath.Length() -
  2358             const TEntry& entry = (*fileList)[i];                        
  2369                             KPathDelim().Length()
  2359             if ( entry.IsDir() )
  2370                             ).Compare( KPathDelim ) != 0 )
  2360                 {
  2371             {
  2361                 TInt languageIndex = 0;
  2372             xuikonPath.Append( KPathDelim );
  2362                 TLex lex( entry.iName );
  2373             }
  2363                 TInt error = lex.Val( languageIndex );    
  2374         }
  2364                                 
  2375             
  2365                 // See enumarations from e32lang.h
  2376     _LIT( KFormatting, "%02d" );    
  2366                 if( !error && languageIndex >= ELangTest )
  2377     TFileName localePath;
  2367                     {                   
  2378     
  2368                 
  2379     for( TInt i = 0; i < languageCodes->Count(); i++ )
  2369                     // Process only supported languages
  2380         {                       
  2370                     CArrayFixFlat<TInt>* languageCodes = NULL;
  2381         const TInt languageCode = languageCodes->At( i );
  2371                     hspsServerUtil::GetInstalledLanguagesL( languageCodes );
  2382 
  2372                     CleanupStack::PushL( languageCodes );                    
  2383         // Construct locale path using two digit minium
  2373                     TBool isSupported = EFalse;
  2384         // width and zero as padding.
  2374                     for( TInt i=0; i<languageCodes->Count(); i++ )
  2385         
  2375                         {
  2386         localePath.Copy( xuikonPath );
  2376                         if( languageCodes->At( i ) == languageIndex )
  2387         localePath.AppendFormat( KFormatting, languageCode );        
  2377                             {
  2388         localePath.Append( KPathDelim );
  2378                             isSupported = ETrue;
  2389 
  2379                             break;
  2390         // Check if folder for supported language exists.        
  2380                             }
  2391         TBool exists = EFalse;
  2381                         }
  2392         
  2382                     CleanupStack::PopAndDestroy( languageCodes );                                       
  2393         if( BaflUtils::FolderExists( iFsSession, localePath ) )
  2383                     if( !isSupported )
  2394             {
  2384                         {
  2395             exists = ETrue;
  2385                         continue;
  2396             }
  2386                         }          
  2397         
  2387                 
  2398         // Support also one digit type folder naming.
  2388                     // If we found the first language specification          
  2399         if( !exists && languageCode < 10 )
  2389                     if ( !iDefaultSpecificationSet )
  2400             {
  2390                         {
  2401             localePath.Copy( xuikonPath );
  2391                         // Assume this is the default language shown incase 
  2402             localePath.AppendNum( languageCode );        
  2392                         // there is no locale for the active UI language
  2403             localePath.Append( KPathDelim );
  2393                         iDefaultSpecification = (TLanguage)languageIndex;
  2404             
  2394                         iDefaultSpecificationSet = ETrue;
  2405             if( BaflUtils::FolderExists( iFsSession, localePath ) )
  2395                         }                                                            
  2406                 {
  2396                                                             
  2407                 exists = ETrue;
  2397                     // Setup a path to the subdirectory 
  2408                 }            
  2398                     localePath.Copy( aPath );
  2409             }
  2399                     localePath.Append( entry.iName );
  2410 
  2400                     localePath.Append( KPathDelim );
  2411         if( exists )
  2401                     
  2412             {
  2402                     // Find localized resources 
  2413             // If we found the first language specification          
  2403                     AddLocalizedResourcesL( 
  2414             if ( !iDefaultSpecificationSet )
  2404                         localePath,
  2415                 {
  2405                         (TLanguage)languageIndex );
  2416                 // Assume this is the default language shown incase 
  2406                     }                                       
  2417                 // there is no locale for the active UI language
  2407                 }
  2418                 iDefaultSpecification = (TLanguage)languageCode;
  2408                         
  2419                 iDefaultSpecificationSet = ETrue;
       
  2420                 }                                                            
       
  2421         
       
  2422         
       
  2423             // Find and add localized resources 
       
  2424             AddLocalizedResourcesL( 
       
  2425                     localePath,
       
  2426                     (TLanguage)languageCode );            
  2409             }        
  2427             }        
  2410         CleanupStack::PopAndDestroy( fileList );
  2428         }
  2411         fileList = NULL;
  2429     
  2412         }
  2430     CleanupStack::PopAndDestroy( languageCodes );
       
  2431     languageCodes = NULL;
  2413     }
  2432     }
  2414 
  2433 
  2415 // -----------------------------------------------------------------------------
  2434 // -----------------------------------------------------------------------------
  2416 // Adds localized resources from the provided subdirectory
  2435 // Adds localized resources from the provided subdirectory
  2417 // -----------------------------------------------------------------------------
  2436 // -----------------------------------------------------------------------------
  2459         }
  2478         }
  2460     
  2479     
  2461     // Find localized files from the provided directory
  2480     // Find localized files from the provided directory
  2462     RArray<TInt> driveArray;
  2481     RArray<TInt> driveArray;
  2463     CleanupClosePushL( driveArray );   
  2482     CleanupClosePushL( driveArray );   
       
  2483     driveArray.Append( EDriveE );
  2464     driveArray.Append( EDriveC );
  2484     driveArray.Append( EDriveC );
  2465         
  2485         
  2466     FindResourceFilesL( aPath, EFalse, driveArray, NULL );
  2486     FindResourceFilesL( aPath, EFalse, driveArray, NULL );
  2467     
  2487     
  2468     CleanupStack::PopAndDestroy(); // driveArray        
  2488     CleanupStack::PopAndDestroy(); // driveArray