homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp
branchRCL_3
changeset 31 8baec10861af
parent 30 a5a39a295112
equal deleted inserted replaced
30:a5a39a295112 31:8baec10861af
   393     iResult->iIntValue2 = 0;
   393     iResult->iIntValue2 = 0;
   394     
   394     
   395     TRAPD( err, DoInstallThemeL(aManifestFileName) );
   395     TRAPD( err, DoInstallThemeL(aManifestFileName) );
   396     if( !err )
   396     if( !err )
   397         {
   397         {
   398         // correct headerdata is in iHeaderData set by CheckHeaderL()
   398         // correct headerdata is in iHeaderData set by CheckHeaderL(), check space
   399         aHeaderData = iHeaderData->Des();        
   399         const TUint bytesRequired = iHeaderData->Des().Length(); 
   400                    
   400         const TUint bytesAllocated = aHeaderData.MaxLength();
   401         // Set next phase
   401         if( bytesRequired <= bytesAllocated )
   402         iInstallationPhase = EhspsPhaseCleanup;
   402             {            
   403         ret = EhspsInstallThemeSuccess;
   403             aHeaderData = iHeaderData->Des();
       
   404             
       
   405             // Set next phase
       
   406             iInstallationPhase = EhspsPhaseCleanup;
       
   407             ret = EhspsInstallThemeSuccess;
       
   408             }
       
   409         else
       
   410             {
       
   411             err = KErrOverflow;
       
   412             iInstallationPhase = EhspsPhaseIdle;
       
   413             }        
   404         }
   414         }
   405     else
   415     else
   406         {     
   416         {     
   407 #ifdef HSPS_LOG_ACTIVE  
   417 #ifdef HSPS_LOG_ACTIVE  
   408         if( iLogBus )
   418         if( iLogBus )
  1586                 pluginIds[j], 
  1596                 pluginIds[j], 
  1587                 EFalse,
  1597                 EFalse,
  1588                 KNullDesC(),
  1598                 KNullDesC(),
  1589                 (TLanguage)( fullODT->OdtLanguage() ) );
  1599                 (TLanguage)( fullODT->OdtLanguage() ) );
  1590             
  1600             
  1591             notifications.Append( info );
  1601             notifications.AppendL( info );
  1592             }        
  1602             }
  1593         
  1603         
  1594         CleanupStack::PopAndDestroy(); // pluginIds.
  1604         CleanupStack::PopAndDestroy(); // pluginIds.
  1595         CleanupStack::PopAndDestroy( fullODT );
  1605         CleanupStack::PopAndDestroy( fullODT );
  1596         fullODT = NULL;
  1606         fullODT = NULL;
  1597         
  1607         
  2258     RArray<TInt> driveArray;
  2268     RArray<TInt> driveArray;
  2259     CleanupClosePushL( driveArray );   
  2269     CleanupClosePushL( driveArray );   
  2260     TInt drive = hspsServerUtil::GetEmmcDrivePath( iFsSession );
  2270     TInt drive = hspsServerUtil::GetEmmcDrivePath( iFsSession );
  2261     if ( drive != KErrNotFound )
  2271     if ( drive != KErrNotFound )
  2262         {
  2272         {
  2263         driveArray.Append( drive );
  2273         driveArray.AppendL( drive );
  2264         }
  2274         }
  2265     
  2275     
  2266     driveArray.Append( EDriveC );
  2276     driveArray.AppendL( EDriveC );
  2267     driveArray.Append( EDriveZ );     
  2277     driveArray.AppendL( EDriveZ );     
  2268     
  2278     
  2269     FindResourceFilesL( aPath, ETrue, driveArray, systemEpocLanguageCodes );
  2279     FindResourceFilesL( aPath, ETrue, driveArray, systemEpocLanguageCodes );
  2270    
  2280    
  2271     CleanupStack::PopAndDestroy(); // driveArray
  2281     CleanupStack::PopAndDestroy(); // driveArray
  2272     CleanupStack::PopAndDestroy( systemEpocLanguageCodes );    
  2282     CleanupStack::PopAndDestroy( systemEpocLanguageCodes );    
  2279 // -----------------------------------------------------------------------------
  2289 // -----------------------------------------------------------------------------
  2280 //
  2290 //
  2281 void ChspsInstallationHandler::AddLocalesL(
  2291 void ChspsInstallationHandler::AddLocalesL(
  2282         const TDesC& aPath,
  2292         const TDesC& aPath,
  2283         const TBool aProcessOnlyDTD )
  2293         const TBool aProcessOnlyDTD )
  2284     {
  2294     {    
  2285     // Retrieve phone supported language.
       
  2286     CArrayFixFlat<TInt>* languageCodes = NULL;
       
  2287     hspsServerUtil::GetInstalledLanguagesL( languageCodes );
       
  2288     CleanupStack::PushL( languageCodes );     
       
  2289     
       
  2290     // Ensure that path contains '\' at the end.
  2295     // Ensure that path contains '\' at the end.
  2291     TFileName pathBase;
  2296     TFileName pathBase;
  2292     pathBase.Copy( aPath );
  2297     pathBase.Copy( aPath );
  2293     if( pathBase.Length() > KPathDelim().Length() )
  2298     if( pathBase.Length() > KPathDelim().Length() )
  2294         {
  2299         {
  2297                          ).Compare( KPathDelim ) != 0 )
  2302                          ).Compare( KPathDelim ) != 0 )
  2298             {
  2303             {
  2299             pathBase.Append( KPathDelim );
  2304             pathBase.Append( KPathDelim );
  2300             }
  2305             }
  2301         }
  2306         }
  2302             
  2307 
       
  2308 #if defined(WINSCW) || defined(__WINS__)
       
  2309     
       
  2310     // Emulator environment supports all languages, include all directories    
       
  2311     CDir* dir( NULL );                      
       
  2312     TFindFile fileFinder( iFsSession );      
       
  2313     fileFinder.SetFindMask( KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
       
  2314     fileFinder.FindWildByPath( aPath, NULL, dir );
       
  2315     if ( dir )
       
  2316         {
       
  2317         CleanupStack::PushL( dir );
       
  2318                 
       
  2319         for ( TInt i=0; i < dir->Count(); i++ )
       
  2320             {
       
  2321             const TEntry& dirEntry = (*dir)[i];
       
  2322             if ( dirEntry.IsDir() )
       
  2323                 {       
       
  2324                 TInt languageId = KErrNotFound;
       
  2325                 TLex lex( dirEntry.iName );        
       
  2326                 if( lex.Val( languageId ) == KErrNone )
       
  2327                     {             
       
  2328                     TPath path( aPath );
       
  2329                     path.Append( dirEntry.iName );
       
  2330                     path.Append( KPathDelim );
       
  2331                     
       
  2332                     DoAddLocalesL(
       
  2333                         path, 
       
  2334                         (TLanguage)languageId, 
       
  2335                         aProcessOnlyDTD );
       
  2336                     }                
       
  2337                 }
       
  2338             }                       
       
  2339         CleanupStack::PopAndDestroy( dir );
       
  2340         }
       
  2341     
       
  2342 #else        
       
  2343     
       
  2344     // Devices have less languages, therefore include specific directories only
       
  2345     CArrayFixFlat<TInt>* languageCodes = NULL;        
       
  2346     hspsServerUtil::GetInstalledLanguagesL( languageCodes );
       
  2347     CleanupStack::PushL( languageCodes );
       
  2348                        
  2303     TParsePtrC driveParser( pathBase );
  2349     TParsePtrC driveParser( pathBase );
  2304     TInt driveEnum = KErrNotFound;
  2350                         
  2305     
       
  2306     if( !aProcessOnlyDTD )
       
  2307         {
       
  2308         if( driveParser.DrivePresent() && driveParser.Drive().Length() > 0 )
       
  2309             {
       
  2310             User::LeaveIfError(
       
  2311                     RFs::CharToDrive( ( driveParser.Drive() )[0],
       
  2312                             driveEnum ) );
       
  2313             }
       
  2314         }
       
  2315     
       
  2316     _LIT( KFormatNN, "%02d" );    
  2351     _LIT( KFormatNN, "%02d" );    
  2317     TFileName localePath;
  2352     TFileName localePath;
  2318     
  2353     
  2319     for( TInt i = 0; i < languageCodes->Count(); i++ )
  2354     for( TInt i = 0; i < languageCodes->Count(); i++ )
  2320         {                       
  2355         {                       
  2354                 exists = ETrue;
  2389                 exists = ETrue;
  2355                 }            
  2390                 }            
  2356             }
  2391             }
  2357 
  2392 
  2358         if( exists )
  2393         if( exists )
  2359             {
  2394             {            
  2360             // If we found the first language specification          
  2395             DoAddLocalesL(
  2361             if ( !iDefaultSpecificationSet )
  2396                 localePath, 
  2362                 {
  2397                 (TLanguage)languageCode, 
  2363                 // Assume this is the default language shown incase 
  2398                 aProcessOnlyDTD );
  2364                 // there is no locale for the active UI language
       
  2365                 iDefaultSpecification = (TLanguage)languageCode;
       
  2366                 iDefaultSpecificationSet = ETrue;
       
  2367                 }                                                            
       
  2368                 
       
  2369             // Add dtd file if existing.
       
  2370             AddDtdFileL( localePath, (TLanguage)languageCode );
       
  2371             
       
  2372             if( !aProcessOnlyDTD )
       
  2373                 {
       
  2374                 // Find localized files from the provided directory
       
  2375                 RArray<TInt> driveArray;
       
  2376                 CleanupClosePushL( driveArray );                
       
  2377                 driveArray.Append( driveEnum );
       
  2378                 
       
  2379                 FindResourceFilesL( localePath,
       
  2380                                     EFalse,
       
  2381                                     driveArray,
       
  2382                                     NULL );
       
  2383                 
       
  2384                 CleanupStack::PopAndDestroy(); // driveArray
       
  2385                 }
       
  2386             }        
  2399             }        
  2387         }
  2400         }
  2388     
  2401     
  2389     CleanupStack::PopAndDestroy( languageCodes );
  2402     CleanupStack::PopAndDestroy( languageCodes );
  2390     languageCodes = NULL;
  2403     languageCodes = NULL;
       
  2404 #endif   
       
  2405     }
       
  2406 
       
  2407 void ChspsInstallationHandler::DoAddLocalesL(
       
  2408         const TDesC& aPath, 
       
  2409         const TLanguage aLanguage,
       
  2410         const TBool aProcessOnlyDTD )
       
  2411     {   
       
  2412     // If we found the first language specification          
       
  2413     if ( !iDefaultSpecificationSet )
       
  2414         {
       
  2415         // Assume this is the default language shown incase 
       
  2416         // there is no locale for the active UI language
       
  2417         iDefaultSpecification = aLanguage;
       
  2418         iDefaultSpecificationSet = ETrue;
       
  2419         }                                                            
       
  2420         
       
  2421     // Add DTD files holding localized widget name and desc
       
  2422     AddDtdFileL( aPath, aLanguage );
       
  2423         
       
  2424     if( !aProcessOnlyDTD )
       
  2425         {
       
  2426         TParsePtrC driveParser( aPath );
       
  2427         TInt driveEnum = KErrNotFound;
       
  2428         if( driveParser.DrivePresent() && driveParser.Drive().Length() > 0 )
       
  2429             {
       
  2430             User::LeaveIfError( RFs::CharToDrive( ( driveParser.Drive() )[0], driveEnum ) );
       
  2431             }
       
  2432 
       
  2433         // Find localized resources from the subdirectory
       
  2434         RArray<TInt> driveArray;
       
  2435         CleanupClosePushL( driveArray );                
       
  2436         driveArray.AppendL( driveEnum );
       
  2437         
       
  2438         FindResourceFilesL( aPath,
       
  2439                             EFalse,
       
  2440                             driveArray,
       
  2441                             NULL );
       
  2442         
       
  2443         CleanupStack::PopAndDestroy(); // driveArray
       
  2444         }
  2391     }
  2445     }
  2392 
  2446 
  2393 // -----------------------------------------------------------------------------
  2447 // -----------------------------------------------------------------------------
  2394 // Adds localized dtd resources from the provided subdirectory
  2448 // Adds localized dtd resources from the provided subdirectory
  2395 // -----------------------------------------------------------------------------
  2449 // -----------------------------------------------------------------------------