menufw/hierarchynavigator/hnmetadatamodel/src/hnmdvalueimage.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 25 137ebc85284b
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    34 #include "hnattributebase.h"
    34 #include "hnattributebase.h"
    35 #include "hnattributeimage.h"
    35 #include "hnattributeimage.h"
    36 #include "menudebug.h"
    36 #include "menudebug.h"
    37 #include "hnbitmapidcache.h"
    37 #include "hnbitmapidcache.h"
    38 
    38 
       
    39 _LIT( KGridRootMif, "gridroot.mif" );
    39 // ======== MEMBER FUNCTIONS ========
    40 // ======== MEMBER FUNCTIONS ========
    40 
    41 
    41 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
    42 // 
    43 // 
    43 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
   275 // ---------------------------------------------------------------------------
   276 // ---------------------------------------------------------------------------
   276 //
   277 //
   277 HBufC* CHnMdValueImage::FindMatchigMifFileL( const RFs& aFs, TDesC& aFileName )
   278 HBufC* CHnMdValueImage::FindMatchigMifFileL( const RFs& aFs, TDesC& aFileName )
   278     {
   279     {
   279     DEBUG16(("_MM_: CHnMdValueImage::FindMatchigMifFileL IN"));
   280     DEBUG16(("_MM_: CHnMdValueImage::FindMatchigMifFileL IN"));
   280 
   281     HBufC* ret = NULL;
   281     _LIT( KGridRootMif, "gridroot.mif" );
       
   282 
       
   283     // whole path to the mif file was not specified
       
   284     TDriveList driveList;
   282     TDriveList driveList;
   285     HBufC* ret = NULL;
   283     if ( KErrNone == aFs.DriveList( driveList ) )
   286 
       
   287     if ( aFileName == KGridRootMif )
       
   288         {
       
   289         ret = HBufC::NewL(
       
   290                 1 + KRscPath().Length() + // 1 - drive letter len.
       
   291                 aFileName.Length() );
       
   292         TPtr ptr( ret->Des() );
       
   293         TChar driveLetter;
       
   294         aFs.DriveToChar( EDriveZ, driveLetter );
       
   295         ptr.Append( driveLetter );
       
   296         ptr.Append( KRscPath );
       
   297         ptr.Append( aFileName );
       
   298         }
       
   299     else if ( KErrNone == aFs.DriveList( driveList ) )
       
   300         {
   284         {
   301         TInt driveNumber( EDriveY ); // start with drive Y
   285         TInt driveNumber( EDriveY ); // start with drive Y
   302         do // iterates through drives: Y, X, W, ..., C, B, A, Z
   286         do // iterates through drives: Y, X, W, ..., C, B, A, Z
   303             {
   287             {
   304             if ( driveList[ driveNumber ] )
   288             if ( driveList[ driveNumber ] )
   350     CleanupClosePushL( tmpBuf );
   334     CleanupClosePushL( tmpBuf );
   351 
   335 
   352     TInt errCode = HnLiwUtils::GetStringL( *iParamList, iMifFile8, iPos, tmpBuf );
   336     TInt errCode = HnLiwUtils::GetStringL( *iParamList, iMifFile8, iPos, tmpBuf );
   353     if ( tmpBuf.Length() )
   337     if ( tmpBuf.Length() )
   354         {
   338         {
   355         if ( BaflUtils::FileExists( iCmnPtrs->iFs, tmpBuf ) )
   339         TDriveList driveList;
       
   340         if ( tmpBuf == KGridRootMif )
       
   341             {
       
   342             HBufC* temp = HBufC::NewL(
       
   343                    1 + KRscPath().Length() + // 1 - drive letter len.
       
   344                    tmpBuf.Length() );
       
   345             TPtr ptr( temp->Des() );
       
   346             TChar driveLetter;
       
   347             iCmnPtrs->iFs.DriveToChar( EDriveZ, driveLetter );
       
   348             ptr.Append( driveLetter );
       
   349             ptr.Append( KRscPath );
       
   350             ptr.Append( tmpBuf );
       
   351             ret = temp;
       
   352             }
       
   353         else if ( BaflUtils::FileExists( iCmnPtrs->iFs, tmpBuf ) )
   356             {
   354             {
   357             // return fileName as it is
   355             // return fileName as it is
   358             ret = tmpBuf.AllocL();
   356             ret = tmpBuf.AllocL();
   359             }
   357             }
   360         else
   358         else
   570 	aKeyMask.CreateL( iMifFile8.Length() + aMaskIdBuf.Length() );
   568 	aKeyMask.CreateL( iMifFile8.Length() + aMaskIdBuf.Length() );
   571 	aKeyMask.Copy( iMifFile8 );
   569 	aKeyMask.Copy( iMifFile8 );
   572 	aKeyMask.Append( aMaskIdBuf );
   570 	aKeyMask.Append( aMaskIdBuf );
   573 	}
   571 	}
   574 
   572 
   575 // ---------------------------------------------------------------------------
   573 
   576 // 
       
   577 // ---------------------------------------------------------------------------
       
   578 //  
       
   579 //CGulIcon* CHnMdValueImage::GetIconL(
       
   580 //        const CLiwGenericParamList* aQueriesResultsList, TInt aPos )
       
   581 //    {
       
   582 //    CGulIcon* gulIcon = NULL;
       
   583 //
       
   584 //    iParamList = aQueriesResultsList;
       
   585 //    iPos = aPos;
       
   586 //    
       
   587 //    // only to set iImageSource, to be optimized    
       
   588 //    SetImageSourceL();
       
   589 //    
       
   590 //    TSize defaultSize( KDefaultIconSize, KDefaultIconSize );
       
   591 //    
       
   592 //    CFbsBitmap* bitmap = NULL; 
       
   593 //    CFbsBitmap* mask = NULL;
       
   594 //        
       
   595 //    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   596 //    
       
   597 //    switch( iImageSource )
       
   598 //        {
       
   599 //        case EImageSourceResource:
       
   600 //            {
       
   601 //            TInt bitmapId = 0;
       
   602 //            TInt maskId = 0;
       
   603 //            GetBitmapAndMaskIdL(bitmapId, maskId);
       
   604 //            if ( iMifFileName && bitmapId != KErrNotFound )
       
   605 //                {
       
   606 //                AknsUtils::CreateIconL(
       
   607 //                        skin, SkinIdL(), bitmap, mask,
       
   608 //                        *iMifFileName, bitmapId, maskId );
       
   609 //                }
       
   610 //            }
       
   611 //            break;
       
   612 //        default:
       
   613 //            {
       
   614 //            User::Panic( KMatrixPanic , 1 );
       
   615 //            }    
       
   616 //        }
       
   617 //       
       
   618 //    if ( EImageSourceUndefined != iImageSource )
       
   619 //        {        
       
   620 //        if ( EImageSourceFile != iImageSource )
       
   621 //            {
       
   622 //            gulIcon = CGulIcon::NewL( bitmap, mask );
       
   623 //            AknIconUtils::SetSize( mask, defaultSize );
       
   624 //            AknIconUtils::SetSize( bitmap, defaultSize );
       
   625 //            }
       
   626 //        else
       
   627 //            {
       
   628 //            gulIcon = CGulIcon::NewL( bitmap );
       
   629 //            AknIconUtils::SetSize( bitmap, defaultSize );
       
   630 //            }
       
   631 //        }
       
   632 //    
       
   633 //    return gulIcon;
       
   634 //    }
       
   635