homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp
branchRCL_3
changeset 14 15e4dd19031c
parent 12 502e5d91ad42
child 15 a0713522ab97
equal deleted inserted replaced
12:502e5d91ad42 14:15e4dd19031c
  1658     
  1658     
  1659     return parent;
  1659     return parent;
  1660     }
  1660     }
  1661 
  1661 
  1662 // -----------------------------------------------------------------------------
  1662 // -----------------------------------------------------------------------------
  1663 // hspsServerUtil::IsFile
  1663 // hspsServerUtil::IsLogoFile
  1664 // -----------------------------------------------------------------------------
  1664 // -----------------------------------------------------------------------------
  1665 //
  1665 //
  1666 TBool hspsServerUtil::IsFile(
  1666 TBool hspsServerUtil::IsLogoFile(
  1667         const TDesC& aFileDeclaration,
  1667         const TDesC& aFileDeclaration,
  1668         TFileName& aFilename )        
  1668         TFileName& aFilename )        
  1669     {
  1669     {
  1670     _LIT(KDeclarationSkin, "SKIN(");        // prefixes for filelogo/filepreview values 
  1670     _LIT(KDeclarationSkin, "SKIN(");        // prefixes for filelogo/filepreview values 
  1671     _LIT(KDeclarationMif, "MIF(");
  1671     _LIT(KDeclarationMif, "MIF(");
  1889              }
  1889              }
  1890          }
  1890          }
  1891               
  1891               
  1892      return err;
  1892      return err;
  1893      }
  1893      }
       
  1894      
       
  1895 // -----------------------------------------------------------------------------
       
  1896 // hspsServerUtil::ResolveLogoPathL
       
  1897 // -----------------------------------------------------------------------------
       
  1898 void hspsServerUtil::PopulateLogoPathsL(
       
  1899         const TDesC& aLogoDeclaration,
       
  1900         const TUint aAppUid,
       
  1901         RBuf& aTargetPath,
       
  1902         RBuf& aSourcePath,
       
  1903         RBuf& aUpdatedDeclaration)
       
  1904     {        
       
  1905     // Process widget types only 
       
  1906     if ( aLogoDeclaration.Length() && aAppUid > 0 )
       
  1907         {                          
       
  1908         // Get possible file name from the optional logo declaration
       
  1909         // and if found, populate the paths and update the declaration 
       
  1910         TFileName filename;
       
  1911         if( IsLogoFile( aLogoDeclaration, filename ) )
       
  1912             {      
       
  1913             // Get client's private directory                
       
  1914             _LIT( KClientPrivatePath, "c:\\private\\%X\\");
       
  1915             TPath clientPath;            
       
  1916             clientPath.Format( KClientPrivatePath, aAppUid );
       
  1917                                     
       
  1918             // Updated logo declaration
       
  1919             TInt offset = aLogoDeclaration.FindF( filename );                       
       
  1920             __ASSERT_DEBUG( offset != KErrNotFound, User::Leave( KErrCorrupt ) );            
       
  1921             if( aLogoDeclaration.Length() + aLogoDeclaration.Mid( offset ).Length() < KMaxFileName )
       
  1922                 {
       
  1923                 aUpdatedDeclaration.Copy( aLogoDeclaration );
       
  1924                 aUpdatedDeclaration.Insert( offset, clientPath );
       
  1925                                                                
       
  1926                 // Set path and name of the target file            
       
  1927                 if( clientPath.Length() + filename.Length() < KMaxFileName )
       
  1928                     {
       
  1929                     aTargetPath.Copy( clientPath );
       
  1930                     aTargetPath.Append( filename );
       
  1931                     
       
  1932                     // Set name of the source file
       
  1933                     _LIT( KServerPrivateFolder, "c:\\private\\200159c0\\themes\\" );
       
  1934                     if( KServerPrivateFolder().Length() + filename.Length() < KMaxFileName )
       
  1935                         {                       
       
  1936                         aSourcePath.Copy( KServerPrivateFolder );
       
  1937                         aSourcePath.Append( filename );                        
       
  1938                         }
       
  1939                     }
       
  1940                 }
       
  1941                         
       
  1942             }
       
  1943         }
       
  1944     }     
  1894 
  1945 
  1895 // -----------------------------------------------------------------------------
  1946 // -----------------------------------------------------------------------------
  1896 // hspsServerUtil::hspsServerUtil
  1947 // hspsServerUtil::hspsServerUtil
  1897 // -----------------------------------------------------------------------------
  1948 // -----------------------------------------------------------------------------
  1898 //
  1949 //