menufw/hierarchynavigator/hnmetadatamodel/src/hnmdvalueimage.cpp
changeset 0 f72a12da539e
child 50 137ebc85284b
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <xmlengdom.h>
       
    20 #include <bautils.h>
       
    21 #include <liwcommon.h>
       
    22 #include <AknsSkinInstance.h> 
       
    23 #include <AknsDrawUtils.h> 
       
    24 #include <gulicon.h> 
       
    25 
       
    26 #include "hnmdvalueimage.h"
       
    27 #include "hnglobals.h"
       
    28 #include "hnmdmodel.h"
       
    29 #include "AknsUtils.h"
       
    30 #include "hnconvutils.h"
       
    31 #include "hnliwutils.h"
       
    32 #include "hnutils.h"
       
    33 #include "bitdev.h"
       
    34 #include "hnattributebase.h"
       
    35 #include "hnattributeimage.h"
       
    36 #include "menudebug.h"
       
    37 #include "hnbitmapidcache.h"
       
    38 
       
    39 // ======== MEMBER FUNCTIONS ========
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // 
       
    43 // ---------------------------------------------------------------------------
       
    44 //  
       
    45 CHnMdValueImage* CHnMdValueImage::NewLC(
       
    46         const TXmlEngElement& aElement, THnMdCommonPointers* aCmnPtrs )
       
    47     {
       
    48     CHnMdValueImage* self = 
       
    49         new (ELeave)CHnMdValueImage();
       
    50     CleanupStack::PushL(self);
       
    51     self->ConstructL( aElement, aCmnPtrs );
       
    52     return self;
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // 
       
    57 // ---------------------------------------------------------------------------
       
    58 //  
       
    59 CHnMdValueImage* CHnMdValueImage::NewL(
       
    60         const TXmlEngElement& aElement, THnMdCommonPointers* aCmnPtrs )
       
    61     {
       
    62     CHnMdValueImage* self =
       
    63         CHnMdValueImage::NewLC( aElement, aCmnPtrs );
       
    64     CleanupStack::Pop(); // self;
       
    65     return self;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // 
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 void CHnMdValueImage::ConstructL( const TXmlEngElement& aElement,
       
    73         THnMdCommonPointers* aCmnPtrs )
       
    74     {
       
    75     iCmnPtrs = aCmnPtrs;
       
    76     iPos = 0;
       
    77     
       
    78     HnUtils::SetAttributeL( aElement, KFile8, iFileNameSrc8 );
       
    79     if ( iFileNameSrc8.Length( ) == 0 )
       
    80         {
       
    81         HnUtils::SetAttributeL( aElement, iFileNameSrc8 );
       
    82         }
       
    83     HnUtils::SetAttributeL( aElement, KSkinIdMinor8, iSkinIdMinor8 );
       
    84     HnUtils::SetAttributeL( aElement, KSkinIdMajor8, iSkinIdMajor8 );
       
    85     HnUtils::SetAttributeL( aElement, KBitmapId8, iBitmapId8 );
       
    86     HnUtils::SetAttributeL( aElement, KMaskId8, iMaskId8 );
       
    87     HnUtils::SetAttributeL( aElement, KMifFile8, iMifFile8 );
       
    88     HnUtils::SetAttributeL( aElement, KAppUid8, iApplicationUid8 );
       
    89     HnUtils::SetAttributeL( aElement, KBitmap8, iBitmap8 );
       
    90     HnUtils::SetAttributeL( aElement, KMask8, iMask8 );
       
    91     
       
    92     iMifFileName = GetMifFileNameL();
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // 
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 TInt CHnMdValueImage::GetResourceIdL( const TDesC8& aResourceFileContents,
       
   100         const TDesC8& aResourceName )
       
   101     {
       
   102     HBufC8* resourceWithSeparator = 
       
   103         HBufC8::NewLC( aResourceName.Length() + KResourceSeparator().Length() );   
       
   104     resourceWithSeparator->Des().Append( aResourceName ); 
       
   105     resourceWithSeparator->Des().Append( KResourceSeparator() );
       
   106     
       
   107     TInt position = aResourceFileContents.Find( *resourceWithSeparator );
       
   108 
       
   109     TInt id( KErrNotFound );
       
   110     
       
   111     if ( position >= 0 )
       
   112         {
       
   113         TPtrC8 contentAfterMid = aResourceFileContents.Mid(
       
   114                     position + resourceWithSeparator->Length() );    
       
   115     
       
   116         TChar comma( KComma()[0] );
       
   117         TInt posEnd = contentAfterMid.Locate( comma );
       
   118         
       
   119         if ( posEnd >= 0 )
       
   120             {
       
   121     
       
   122             TPtrC8 resourceId = contentAfterMid.Left( posEnd );
       
   123         
       
   124             HBufC8* resourceTrimmed = resourceId.AllocL();
       
   125             resourceTrimmed->Des().Trim();
       
   126         
       
   127             // GET ICON ID
       
   128             HnConvUtils::Str8ToInt( *resourceTrimmed, id );
       
   129             
       
   130             delete resourceTrimmed; 
       
   131             }
       
   132         }
       
   133     
       
   134     //cleanup    
       
   135     CleanupStack::PopAndDestroy( resourceWithSeparator );
       
   136     
       
   137     return id;        
       
   138     }
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // 
       
   142 // ---------------------------------------------------------------------------
       
   143 // 
       
   144 void CHnMdValueImage::SetImageSourceL()
       
   145     {
       
   146     if ( iBitmapId8.Length() > 0 && iMaskId8.Length() > 0 &&
       
   147             iMifFile8.Length() > 0 )
       
   148         {
       
   149         iImageSource = EImageSourceResource;
       
   150         // check if file exists
       
   151         if ( !iMifFileName ||
       
   152                 !BaflUtils::FileExists( iCmnPtrs->iFs, *iMifFileName ) )
       
   153             {
       
   154             iImageSource = EImageSourceUndefined;
       
   155             }
       
   156         }
       
   157     else if ( iFileNameSrc8.Length() > 0  )
       
   158         {
       
   159         iImageSource = EImageSourceFile;
       
   160         // check if file exists
       
   161         HBufC* fn = GetFileNameSrcL();
       
   162         CleanupStack::PushL( fn );
       
   163         if ( EFalse == BaflUtils::FileExists( iCmnPtrs->iFs, *fn ) )
       
   164             {
       
   165             iImageSource = EImageSourceUndefined;
       
   166             }
       
   167         CleanupStack::PopAndDestroy( fn );
       
   168         }
       
   169     else if ( iBitmap8.Length() > 0 && iMask8.Length() > 0 ) 
       
   170         {
       
   171         iImageSource = EImageSourceLiw;
       
   172         }
       
   173     else if ( iApplicationUid8.Length() > 0 )
       
   174         {
       
   175         iImageSource = EImageSourceApplicationUid;
       
   176         }
       
   177     else
       
   178         {
       
   179         iImageSource = EImageSourceUndefined;
       
   180         }
       
   181     }
       
   182 
       
   183 // ---------------------------------------------------------------------------
       
   184 // 
       
   185 // ---------------------------------------------------------------------------
       
   186 //  
       
   187 CHnMdValueImage::CHnMdValueImage()
       
   188     {
       
   189     // No implementation required
       
   190     }
       
   191 
       
   192 // ---------------------------------------------------------------------------
       
   193 // 
       
   194 // ---------------------------------------------------------------------------
       
   195 //  
       
   196 CHnMdValueImage::~CHnMdValueImage()
       
   197     {
       
   198     iFileNameSrc8.Close();
       
   199     //iFileName.Close();
       
   200     iBitmap8.Close();
       
   201     iMask8.Close();
       
   202     iSkinIdMinor8.Close();
       
   203     iSkinIdMajor8.Close();
       
   204     iBitmapId8.Close();
       
   205     iMaskId8.Close();
       
   206     iApplicationUid8.Close();
       
   207     iMifFile8.Close();
       
   208     iReturnValue.Close();
       
   209     delete iMifFileName;
       
   210     }
       
   211 
       
   212 // ---------------------------------------------------------------------------
       
   213 // 
       
   214 // ---------------------------------------------------------------------------
       
   215 //  
       
   216 CHnAttributeBase* CHnMdValueImage::CreateAttributeL( 
       
   217         const CLiwGenericParamList* aParamList,
       
   218         TInt aPos )
       
   219     {
       
   220     iParamList = aParamList;
       
   221     iPos = aPos;
       
   222     CHnAttributeImage* attr = CHnAttributeImage::NewLC();
       
   223     SetAttributeDataL( attr );
       
   224     CleanupStack::Pop( attr );
       
   225     return attr;
       
   226     }
       
   227 
       
   228 // ---------------------------------------------------------------------------
       
   229 // 
       
   230 // ---------------------------------------------------------------------------
       
   231 //    
       
   232 void CHnMdValueImage::SetAttributeDataL( CHnAttributeImage* aAttr )
       
   233     {
       
   234     TInt bitmapId = 0;
       
   235     TInt maskId = 0;
       
   236     delete iMifFileName;
       
   237     iMifFileName = NULL;
       
   238     iMifFileName = GetMifFileNameL(); 
       
   239     GetBitmapAndMaskIdL( bitmapId, maskId );
       
   240     
       
   241     if ( iMifFileName )
       
   242         {
       
   243         aAttr->SetMifFile( iMifFileName->AllocL() );
       
   244         }
       
   245     else
       
   246         {
       
   247         aAttr->SetMifFile( NULL );
       
   248         }
       
   249     aAttr->SetSkinId( SkinIdL() );
       
   250     aAttr->SetBitmapId( bitmapId );
       
   251     aAttr->SetMaskId( maskId );
       
   252     aAttr->SetApplicationUid( ApplicationUidL() );
       
   253     aAttr->SetBitmap( BitmapL() );
       
   254     aAttr->SetMask( MaskL() );
       
   255     aAttr->SetFileNameSrc( GetFileNameSrcL() );
       
   256     }
       
   257 
       
   258 // ---------------------------------------------------------------------------
       
   259 // 
       
   260 // ---------------------------------------------------------------------------
       
   261 //
       
   262 HBufC* CHnMdValueImage::GetFileNameSrcL()
       
   263     {
       
   264     RBuf tmpBuf;
       
   265     CleanupClosePushL( tmpBuf );
       
   266     
       
   267     HnLiwUtils::GetStringL( *iParamList, iFileNameSrc8, iPos, tmpBuf );
       
   268     HBufC* ret = tmpBuf.AllocL();
       
   269     CleanupStack::PopAndDestroy( &tmpBuf );
       
   270     return ret;
       
   271     }
       
   272 
       
   273 // ---------------------------------------------------------------------------
       
   274 // 
       
   275 // ---------------------------------------------------------------------------
       
   276 //
       
   277 HBufC* CHnMdValueImage::FindMatchigMifFileL( const RFs& aFs, TDesC& aFileName )
       
   278     {
       
   279     DEBUG16(("_MM_: CHnMdValueImage::FindMatchigMifFileL IN"));
       
   280 
       
   281     // whole path to the mif file was not specified
       
   282     TDriveList driveList;
       
   283     HBufC* ret = NULL;
       
   284 
       
   285     if ( KErrNone == aFs.DriveList( driveList ) )
       
   286         {
       
   287         TInt driveNumber( EDriveY ); // start with drive Y
       
   288         do // iterates through drives: Y, X, W, ..., C, B, A, Z
       
   289             {
       
   290             if ( driveList[ driveNumber ] )
       
   291                 {
       
   292                 ret = HBufC::NewLC(
       
   293                         1 + KRscPath().Length() + // 1 - drive letter len. 
       
   294                         aFileName.Length() );
       
   295                 TPtr ptr( ret->Des() );
       
   296                 TChar driveLetter;
       
   297                 aFs.DriveToChar( driveNumber, driveLetter );
       
   298                 ptr.Append( driveLetter );
       
   299                 ptr.Append( KRscPath );
       
   300                 ptr.Append( aFileName );
       
   301                 
       
   302                 if ( BaflUtils::FileExists( aFs, *ret ) )
       
   303                     {
       
   304                     // break if file was found
       
   305                     CleanupStack::Pop( ret );
       
   306                     break;
       
   307                     }
       
   308                 else
       
   309                     {
       
   310                     CleanupStack::PopAndDestroy( ret );
       
   311                     ret = NULL;
       
   312                     }
       
   313                 }
       
   314             /* The below formula is created so that the loop itarates
       
   315                through drives in the following order:
       
   316                Y, X, W, ..., D, C, B, A, Z.
       
   317                Drive Y is most important. */
       
   318             ( --driveNumber >= 0 ) ? driveNumber %= KMaxDrives :
       
   319                 driveNumber = EDriveZ;
       
   320             }
       
   321         while( EDriveY != driveNumber );
       
   322         }
       
   323     DEBUG16(("_MM_: CHnMdValueImage::FindMatchigMifFileL OUT"));
       
   324     return ret;
       
   325     }
       
   326 
       
   327 // ---------------------------------------------------------------------------
       
   328 // 
       
   329 // ---------------------------------------------------------------------------
       
   330 //
       
   331 HBufC* CHnMdValueImage::GetMifFileNameL()
       
   332     {
       
   333     DEBUG16(("_MM_: CHnMdValueImage::GetMifFileNameL IN"));
       
   334     HBufC* ret = NULL;
       
   335     RBuf tmpBuf;
       
   336     CleanupClosePushL( tmpBuf );
       
   337 
       
   338     TInt errCode = HnLiwUtils::GetStringL( *iParamList, iMifFile8, iPos, tmpBuf );
       
   339     if ( !BaflUtils::FileExists( iCmnPtrs->iFs, tmpBuf ) && tmpBuf.Length() )
       
   340         {
       
   341         // fileName was retrieved but corresponding file was not found
       
   342         ret = FindMatchigMifFileL( iCmnPtrs->iFs, tmpBuf );
       
   343         }
       
   344     else if ( tmpBuf.Length() )
       
   345         {
       
   346         // return fileName as it is
       
   347         ret = tmpBuf.AllocL();
       
   348         }
       
   349     
       
   350     // clean up
       
   351     CleanupStack::PopAndDestroy( &tmpBuf );
       
   352    
       
   353     DEBUG16(("_MM_: CHnMdValueImage::GetMifFileNameL OUT"));
       
   354     return ret;
       
   355     }
       
   356 
       
   357 // ---------------------------------------------------------------------------
       
   358 // 
       
   359 // ---------------------------------------------------------------------------
       
   360 //   
       
   361 TAknsItemID CHnMdValueImage::SkinIdL()
       
   362     {
       
   363     TAknsItemID retItemId( KAknsIIDNone );
       
   364     
       
   365     TInt skinIdMinor( KErrNotFound );
       
   366     TInt skinIdMajor( KErrNotFound );
       
   367     
       
   368     RBuf8 bufMajor;
       
   369     RBuf8 bufMinor;
       
   370     CleanupClosePushL(bufMinor);
       
   371     CleanupClosePushL(bufMajor);
       
   372     
       
   373     HnLiwUtils::GetStringL( *iParamList, iSkinIdMajor8, iPos, bufMajor );
       
   374     HnLiwUtils::GetStringL( *iParamList, iSkinIdMinor8, iPos, bufMinor );
       
   375 
       
   376     if ( KErrNone == HnConvUtils::Str8ToInt( bufMinor, skinIdMinor) &&
       
   377             KErrNone == HnConvUtils::Str8ToInt( bufMajor, skinIdMajor) )
       
   378         {
       
   379         retItemId.Set( skinIdMajor, skinIdMinor );
       
   380         }
       
   381      
       
   382     CleanupStack::PopAndDestroy(&bufMajor);
       
   383     CleanupStack::PopAndDestroy(&bufMinor);
       
   384     return retItemId;
       
   385     }
       
   386 
       
   387 // ---------------------------------------------------------------------------
       
   388 // 
       
   389 // ---------------------------------------------------------------------------
       
   390 //   
       
   391 void CHnMdValueImage::GetBitmapAndMaskIdL( TInt& aBitmapId, TInt& aMaskId )
       
   392     {
       
   393     aBitmapId = KErrNotFound;
       
   394     aMaskId = KErrNotFound;
       
   395         
       
   396     RBuf8 bitmapIdBuf;
       
   397     CleanupClosePushL( bitmapIdBuf );
       
   398     RBuf8 maskIdBuf;
       
   399     CleanupClosePushL( maskIdBuf );
       
   400     
       
   401     HnLiwUtils::GetStringL( *iParamList, iBitmapId8, iPos, bitmapIdBuf );
       
   402     HnLiwUtils::GetStringL( *iParamList, iMaskId8, iPos, maskIdBuf );
       
   403     TBool bitmapIdLookupNeeded =
       
   404             HnConvUtils::Str8ToInt( bitmapIdBuf, aBitmapId ) != KErrNone;
       
   405     TBool maskIdLookupNeeded =
       
   406             HnConvUtils::Str8ToInt( maskIdBuf, aMaskId ) != KErrNone;
       
   407     
       
   408     // if bitmap and mas ids are stored in mbg file
       
   409     if ( ( bitmapIdLookupNeeded || maskIdLookupNeeded ) && iMifFileName )
       
   410         {
       
   411         // look up in cache
       
   412         RBuf8 keyBitmap;
       
   413         RBuf8 keyMask;
       
   414         CreateKeysLC( keyBitmap, bitmapIdBuf, keyMask, maskIdBuf );
       
   415         
       
   416         iCmnPtrs->iBitmapIdCache->GetL( keyBitmap, aBitmapId );
       
   417         iCmnPtrs->iBitmapIdCache->GetL( keyMask, aMaskId );
       
   418         
       
   419         // if not found in cache read ids from mbg file
       
   420         if ( aBitmapId == KErrNotFound || aMaskId == KErrNotFound )
       
   421             {
       
   422             HBufC* path = ReplaceFileExtensionLC( *iMifFileName, KMbg() );
       
   423             HBufC8* fileContents = NULL;
       
   424             TRAPD( readFileErr, fileContents = HnUtils::ReadFileL( *path ) );
       
   425             if ( !readFileErr && fileContents )
       
   426                 {
       
   427                 CleanupStack::PushL( fileContents );
       
   428                 if ( bitmapIdLookupNeeded )
       
   429                     {
       
   430                     aBitmapId = GetResourceIdL( *fileContents,  bitmapIdBuf );
       
   431                     iCmnPtrs->iBitmapIdCache->AddL( keyBitmap, aBitmapId );
       
   432                     }
       
   433                 if ( maskIdLookupNeeded )
       
   434                     {
       
   435                     aMaskId = GetResourceIdL( *fileContents,  maskIdBuf );
       
   436                     iCmnPtrs->iBitmapIdCache->AddL( keyMask, aMaskId );
       
   437                     }
       
   438                 CleanupStack::PopAndDestroy( fileContents );
       
   439                 }
       
   440             CleanupStack::PopAndDestroy( path );
       
   441             }
       
   442         CleanupStack::PopAndDestroy( &keyMask );
       
   443         CleanupStack::PopAndDestroy( &keyBitmap );
       
   444         }
       
   445     
       
   446     CleanupStack::PopAndDestroy( &maskIdBuf );
       
   447     CleanupStack::PopAndDestroy( &bitmapIdBuf );
       
   448     }
       
   449 
       
   450 // ---------------------------------------------------------------------------
       
   451 // 
       
   452 // ---------------------------------------------------------------------------
       
   453 //
       
   454 HBufC* CHnMdValueImage::ReplaceFileExtensionLC(
       
   455         const TDesC& aPath, const TDesC& aNewExt )
       
   456     {
       
   457     HBufC* newPath = HBufC::NewLC( aPath.Length() );
       
   458     newPath->Des().Copy( aPath );
       
   459     TInt extPos = newPath->LocateReverse( '.' );
       
   460     User::LeaveIfError( extPos );
       
   461     newPath->Des().Replace( extPos, newPath->Length() - extPos, aNewExt );
       
   462     return newPath;
       
   463     }
       
   464 
       
   465 // ---------------------------------------------------------------------------
       
   466 // 
       
   467 // ---------------------------------------------------------------------------
       
   468 //   
       
   469 TUid CHnMdValueImage::ApplicationUidL()
       
   470     {
       
   471     TUid uid;
       
   472     TUint result( 0 );
       
   473     
       
   474     RBuf8 buf;
       
   475     CleanupClosePushL(buf);
       
   476     HnLiwUtils::GetStringL( *iParamList, iApplicationUid8, iPos, buf );
       
   477     
       
   478     if( buf.Length() )
       
   479         {
       
   480         TLex8 lex( buf );
       
   481         if( !buf.Find( KHexPrefix8 ) )
       
   482             {
       
   483             lex.Inc( KHexPrefix8().Length() );
       
   484             lex.Mark();
       
   485             }
       
   486         lex.Val( result, EHex );
       
   487         }
       
   488     uid.iUid = result;
       
   489     
       
   490     CleanupStack::PopAndDestroy(&buf);
       
   491     return uid;
       
   492     }
       
   493 
       
   494 // ---------------------------------------------------------------------------
       
   495 // 
       
   496 // ---------------------------------------------------------------------------
       
   497 // 
       
   498 TLiwVariant* CHnMdValueImage::BitmapFromLiwL( const TDesC8& aPath )
       
   499     {
       
   500     TLiwVariant* ret = new( ELeave ) TLiwVariant;
       
   501     TInt err( KErrNone ); 
       
   502     TInt check( KErrNone );
       
   503     TRAP( err, check = HnLiwUtils::GetVariantL( *iParamList, aPath, iPos, *ret ) );
       
   504     if( err != KErrNone || check != KErrNone )
       
   505         {
       
   506         ret->Reset();
       
   507         delete ret;
       
   508         ret = NULL;
       
   509         }
       
   510     return ret;
       
   511     }
       
   512     
       
   513 // ---------------------------------------------------------------------------
       
   514 // 
       
   515 // ---------------------------------------------------------------------------
       
   516 //  
       
   517 TLiwVariant* CHnMdValueImage::BitmapL()
       
   518     {
       
   519     TLiwVariant* ret = NULL;
       
   520     if( iBitmap8.Length() )
       
   521         {
       
   522         ret = BitmapFromLiwL( iBitmap8 );
       
   523         }
       
   524     return ret;
       
   525     }
       
   526 
       
   527 // ---------------------------------------------------------------------------
       
   528 // 
       
   529 // ---------------------------------------------------------------------------
       
   530 //  
       
   531 TLiwVariant* CHnMdValueImage::MaskL()
       
   532     {
       
   533     TLiwVariant* ret = NULL;
       
   534     if( iMask8.Length() )
       
   535         {
       
   536         ret = BitmapFromLiwL( iMask8 );
       
   537         }
       
   538     return ret;
       
   539     }
       
   540 
       
   541 // ---------------------------------------------------------------------------
       
   542 // 
       
   543 // ---------------------------------------------------------------------------
       
   544 //  
       
   545 void CHnMdValueImage::CreateKeysLC( RBuf8& aKeyBitmap, RBuf8& aBitmapIdBuf, 
       
   546 		RBuf8& aKeyMask, RBuf8& aMaskIdBuf )	
       
   547 	{
       
   548 	CleanupClosePushL( aKeyBitmap );
       
   549 	CleanupClosePushL( aKeyMask );
       
   550 	aKeyBitmap.CreateL( iMifFile8.Length() + aBitmapIdBuf.Length() );
       
   551 	aKeyBitmap.Copy( iMifFile8 );
       
   552 	aKeyBitmap.Append( aBitmapIdBuf );
       
   553 	aKeyMask.CreateL( iMifFile8.Length() + aMaskIdBuf.Length() );
       
   554 	aKeyMask.Copy( iMifFile8 );
       
   555 	aKeyMask.Append( aMaskIdBuf );
       
   556 	}
       
   557 
       
   558 // ---------------------------------------------------------------------------
       
   559 // 
       
   560 // ---------------------------------------------------------------------------
       
   561 //  
       
   562 //CGulIcon* CHnMdValueImage::GetIconL(
       
   563 //        const CLiwGenericParamList* aQueriesResultsList, TInt aPos )
       
   564 //    {
       
   565 //    CGulIcon* gulIcon = NULL;
       
   566 //
       
   567 //    iParamList = aQueriesResultsList;
       
   568 //    iPos = aPos;
       
   569 //    
       
   570 //    // only to set iImageSource, to be optimized    
       
   571 //    SetImageSourceL();
       
   572 //    
       
   573 //    TSize defaultSize( KDefaultIconSize, KDefaultIconSize );
       
   574 //    
       
   575 //    CFbsBitmap* bitmap = NULL; 
       
   576 //    CFbsBitmap* mask = NULL;
       
   577 //        
       
   578 //    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   579 //    
       
   580 //    switch( iImageSource )
       
   581 //        {
       
   582 //        case EImageSourceResource:
       
   583 //            {
       
   584 //            TInt bitmapId = 0;
       
   585 //            TInt maskId = 0;
       
   586 //            GetBitmapAndMaskIdL(bitmapId, maskId);
       
   587 //            if ( iMifFileName && bitmapId != KErrNotFound )
       
   588 //                {
       
   589 //                AknsUtils::CreateIconL(
       
   590 //                        skin, SkinIdL(), bitmap, mask,
       
   591 //                        *iMifFileName, bitmapId, maskId );
       
   592 //                }
       
   593 //            }
       
   594 //            break;
       
   595 //        default:
       
   596 //            {
       
   597 //            User::Panic( KMatrixPanic , 1 );
       
   598 //            }    
       
   599 //        }
       
   600 //       
       
   601 //    if ( EImageSourceUndefined != iImageSource )
       
   602 //        {        
       
   603 //        if ( EImageSourceFile != iImageSource )
       
   604 //            {
       
   605 //            gulIcon = CGulIcon::NewL( bitmap, mask );
       
   606 //            AknIconUtils::SetSize( mask, defaultSize );
       
   607 //            AknIconUtils::SetSize( bitmap, defaultSize );
       
   608 //            }
       
   609 //        else
       
   610 //            {
       
   611 //            gulIcon = CGulIcon::NewL( bitmap );
       
   612 //            AknIconUtils::SetSize( bitmap, defaultSize );
       
   613 //            }
       
   614 //        }
       
   615 //    
       
   616 //    return gulIcon;
       
   617 //    }
       
   618