cbs/cbsui/UiSrc/CCbsUiTopicListViewContainer.cpp
branchRCL_3
changeset 44 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
43:7d48bed6ce0c 44:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2009 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 *          TopicListViewContainer owns the list box which shows topics.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDES
       
    21 #include <akncontext.h>      // CAknContextPane
       
    22 #include <cbsuiapp.mbg>      // TMbmCbsuiapp
       
    23 #include <AknsConstants.h>   // KAknsMessageSkinChange
       
    24 #include <AknsUtils.h>       // CreateIconL, SkinInstance
       
    25 #include <AknUtils.h>        // AknTextUtils
       
    26 #include <AknDef.h>          // KEikDynamicLayoutVariantSwitch
       
    27 #include <barsread.h>
       
    28 #include <aknlists.h>
       
    29 #include <gulicon.h>
       
    30 #include <eikclbd.h>
       
    31 #include <AknIconArray.h>
       
    32 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
       
    33 #include <cbsuiApp.rsg>
       
    34 #include "CbsUiId.h"
       
    35 #include <csxhelp/cbs.hlp.hrh>
       
    36 #include "CCbsUiTopicListViewContainer.h"
       
    37 #include "CCbsUiTopicListView.h"
       
    38 #include "Cbsuiapp.hrh"
       
    39 #include "CbsUiUtility.h"
       
    40 #include "CbsUiPanic.h"
       
    41 #include "CbsUiConstants.h"
       
    42 
       
    43 
       
    44 // CONSTANTS
       
    45 _LIT(KDirAndCbsUiAppMbmFile,"z:cbsuiapp.mbm");
       
    46 _LIT(KItemSeparator1, "\t ");
       
    47 _LIT(KItemSeparator2, "\t4");
       
    48 const TInt KSizeOfStatus = 1;
       
    49 const TInt KCountOfSeparator1 = 2;
       
    50 const TInt KNumberOfIconsInTopicListContainer = 5;
       
    51 const TUint KZeroFill = '0';
       
    52 const TUint KSubscribedAndNoMessages = '0';
       
    53 const TUint KSubscribedAndMessages = '1';
       
    54 const TUint KNotSubscribedAndNoMessages = '2';
       
    55 const TUint KNotSubscribedButMessagesExists = '3';
       
    56 
       
    57 
       
    58 //DATA TYPES
       
    59 enum TopicListViewIconArrayIndexes
       
    60     {
       
    61     ECbsPropCbSubs = 0,
       
    62     ECbsPropCbSubsUnread,
       
    63     ECbsPropCbUnsubs,
       
    64     ECbsPropCbUnsubsUnread,
       
    65     ECbsIndiCbHotAdd
       
    66     };
       
    67 
       
    68 
       
    69 // ================= MEMBER FUNCTIONS =======================
       
    70 
       
    71 // C++ default constructor can NOT contain any code, that
       
    72 // might leave.
       
    73 // 
       
    74 
       
    75 CCbsUiTopicListViewContainer::CCbsUiTopicListViewContainer( CCbsUiTopicListView& aListView )
       
    76     : iListView( aListView )
       
    77     {
       
    78     }
       
    79 
       
    80 // Symbian OS default constructor can leave.
       
    81 void CCbsUiTopicListViewContainer::ConstructL( const TRect& aRect )
       
    82     {
       
    83     CreateWindowL();
       
    84     
       
    85     SetMopParent(&iListView);
       
    86     
       
    87     iListBox = new(ELeave) CAknSingleGraphicHeadingStyleListBox;
       
    88     iListBox->SetContainerWindowL(*this);
       
    89     
       
    90     iListBox->ConstructL( this, EEikListBoxMultipleSelection );
       
    91     
       
    92     CDesCArrayFlat* array = 
       
    93         new (ELeave) CDesCArrayFlat(KNumberOfStandardTopics);
       
    94     
       
    95     // changing the owner, shouldn't leave 
       
    96     iListBox->Model()->SetItemTextArray( array ); 
       
    97     
       
    98     iListBox->CreateScrollBarFrameL( ETrue );
       
    99     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
       
   100         CEikScrollBarFrame::EOff,
       
   101         CEikScrollBarFrame::EAuto );
       
   102     iListBox->SetListBoxObserver( this );
       
   103     
       
   104     SetRect( aRect );
       
   105     LoadIconsL();
       
   106     }
       
   107 
       
   108 // Two-phased constructor.
       
   109 CCbsUiTopicListViewContainer* CCbsUiTopicListViewContainer::NewL( CCbsUiTopicListView& aListView, 
       
   110                                                                  const TRect& aRect )
       
   111     {
       
   112     CCbsUiTopicListViewContainer* self = 
       
   113         new (ELeave) CCbsUiTopicListViewContainer( aListView );
       
   114     
       
   115     CleanupStack::PushL( self );
       
   116     self->ConstructL( aRect );
       
   117     CleanupStack::Pop();
       
   118     
       
   119     return self;
       
   120     }
       
   121 
       
   122 // Destructor
       
   123 CCbsUiTopicListViewContainer::~CCbsUiTopicListViewContainer()
       
   124     {
       
   125     delete iListBox;
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------
       
   129 // CCbsUiTopicListViewContainer::ReloadStarts
       
   130 // 
       
   131 // 
       
   132 // ---------------------------------------------------------
       
   133 //
       
   134 void CCbsUiTopicListViewContainer::ReloadStarts() const
       
   135     {    
       
   136     MDesCArray* itemList = iListBox->Model()->ItemTextArray();
       
   137     CDesCArray* itemArray = STATIC_CAST(CDesCArray*, itemList);
       
   138     
       
   139     itemArray->Reset();
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------
       
   143 // CCbsUiTopicListViewContainer::CountComponentControls
       
   144 // 
       
   145 // 
       
   146 // ---------------------------------------------------------
       
   147 //
       
   148 TInt CCbsUiTopicListViewContainer::CountComponentControls() const
       
   149     {
       
   150     return 1;
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------
       
   154 // 
       
   155 // 
       
   156 // 
       
   157 // ---------------------------------------------------------
       
   158 //
       
   159 CCoeControl* CCbsUiTopicListViewContainer::ComponentControl( TInt /*aIndex*/ ) const 
       
   160     {
       
   161     return iListBox;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------
       
   165 // CCbsUiTopicListViewContainer::OfferKeyEventL
       
   166 // 
       
   167 // 
       
   168 // ---------------------------------------------------------
       
   169 //
       
   170 TKeyResponse CCbsUiTopicListViewContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   171                                                           TEventCode aType )
       
   172     {
       
   173     TKeyResponse result = EKeyWasNotConsumed;
       
   174     
       
   175     switch ( aKeyEvent.iCode )
       
   176         {
       
   177         case EKeyEnter: // To support qwert keyboard
       
   178         case EKeyOK:
       
   179             // to open a right topic
       
   180             iListView.MarkCurrentHandle();
       
   181             iListView.ProcessCommandL(ECbsUiappCmdSwitchOpen);
       
   182             result = EKeyWasConsumed;
       
   183             break;
       
   184         case EKeyBackspace:
       
   185             iListView.MarkCurrentHandle();
       
   186             iListView.ProcessCommandL(ECbsUiappCmdSwitchDelete);
       
   187             result = EKeyWasConsumed;
       
   188             break;
       
   189         default:
       
   190             result = iListBox->OfferKeyEventL(aKeyEvent, aType);
       
   191             break;
       
   192         }
       
   193     
       
   194     return result;
       
   195     }
       
   196 
       
   197 
       
   198 // ---------------------------------------------------------
       
   199 // CCbsUiTopicListViewContainer::SetCurrentItemIndex
       
   200 // 
       
   201 // 
       
   202 // ---------------------------------------------------------
       
   203 //
       
   204 void CCbsUiTopicListViewContainer::SetCurrentItemIndex( TInt aItemIndex ) const
       
   205     {    
       
   206     
       
   207     MDesCArray* itemList = iListBox->Model()->ItemTextArray();
       
   208     CDesCArray* itemArray = STATIC_CAST(CDesCArray*, itemList);
       
   209     
       
   210     TInt count( itemArray->MdcaCount() );
       
   211     
       
   212     __ASSERT_DEBUG( 
       
   213         aItemIndex >= EMinTopicNumber && 
       
   214         aItemIndex <= EMaxTopicNumber, 
       
   215         CbsUiPanic( EErrBadIndex ) );
       
   216     
       
   217     if ( aItemIndex < count && aItemIndex >= EMinTopicNumber )
       
   218         {
       
   219         iListBox->SetCurrentItemIndexAndDraw( aItemIndex );
       
   220         }
       
   221     }
       
   222 
       
   223 // ---------------------------------------------------------
       
   224 // CCbsUiTopicListViewContainer::ReloadOfferTopicL
       
   225 // 
       
   226 // 
       
   227 // ---------------------------------------------------------
       
   228 //
       
   229 void CCbsUiTopicListViewContainer::ReloadOfferTopicL( const TCbsTopic& aTopic ) const
       
   230     {
       
   231     
       
   232     MDesCArray* itemList = iListBox->Model()->ItemTextArray();
       
   233     CDesCArray* itemArray = STATIC_CAST(CDesCArray*, itemList);	    
       
   234     
       
   235     TBuf<KSizeOfStatus> ch;
       
   236     ch.Append( GetStatus(aTopic) );
       
   237     TBuf<KTopicNumberLength> index;
       
   238     GetIndexNumber(aTopic, index);
       
   239     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( index );
       
   240     
       
   241     HBufC* buffer = HBufC::NewLC( 
       
   242         aTopic.iName.Length() + KItemSeparator1().Length() * 
       
   243         KCountOfSeparator1 + KItemSeparator2().Length() + 
       
   244         index.Length() + ch.Length() );
       
   245     
       
   246     TPtr ptr = buffer->Des();
       
   247     ptr = ch;
       
   248     ptr.Append(KItemSeparator1);	
       
   249     ptr.Append(index);
       
   250     ptr.Append(KItemSeparator1);
       
   251     ptr.Append(aTopic.iName);
       
   252     
       
   253     if ( aTopic.iHotmarked ) 
       
   254         {
       
   255         ptr.Append(KItemSeparator2);
       
   256         }
       
   257     
       
   258     itemArray->AppendL(*buffer);		
       
   259     CleanupStack::PopAndDestroy(); // buffer
       
   260     }
       
   261 
       
   262 // ---------------------------------------------------------
       
   263 // CCbsUiTopicListViewContainer::ReloadEndsL
       
   264 // 
       
   265 // 
       
   266 // ---------------------------------------------------------
       
   267 //
       
   268 void CCbsUiTopicListViewContainer::ReloadEndsL()
       
   269     {
       
   270     iListBox->HandleItemAdditionL();
       
   271     }
       
   272 
       
   273 // ---------------------------------------------------------
       
   274 // CCbsUiTopicListViewContainer::CurrentPosition
       
   275 // 
       
   276 // 
       
   277 // ---------------------------------------------------------
       
   278 //
       
   279 TInt CCbsUiTopicListViewContainer::CurrentPosition() const
       
   280     {
       
   281     TInt result(KCbsErrValue);
       
   282     
       
   283     if ( iListBox )
       
   284         {
       
   285         result = iListBox->CurrentItemIndex();
       
   286         }
       
   287     
       
   288     return result;
       
   289     }
       
   290 
       
   291 // ---------------------------------------------------------
       
   292 // CCbsUiTopicListViewContainer::GetStatus
       
   293 // 
       
   294 // Informs which icon to use.
       
   295 // ---------------------------------------------------------
       
   296 //
       
   297 TChar CCbsUiTopicListViewContainer::GetStatus( const TCbsTopic& aTopic ) const
       
   298     {
       
   299     
       
   300     TChar retVal(KSubscribedAndNoMessages);
       
   301     
       
   302     
       
   303     if ( aTopic.iSubscribed )
       
   304         {
       
   305         if ( aTopic.iUnreadMessages == 0 )
       
   306             {
       
   307             retVal = KSubscribedAndNoMessages;
       
   308             }
       
   309         else 
       
   310             {
       
   311             retVal = KSubscribedAndMessages;
       
   312             }
       
   313         }
       
   314     else
       
   315         {
       
   316         if ( aTopic.iUnreadMessages == 0 )
       
   317             {
       
   318             retVal = KNotSubscribedAndNoMessages;
       
   319             }
       
   320         else 
       
   321             {
       
   322             retVal = KNotSubscribedButMessagesExists;    
       
   323             }
       
   324         }
       
   325     
       
   326     return retVal;
       
   327     }
       
   328 
       
   329 // ---------------------------------------------------------
       
   330 // CCbsUiTopicListViewContainer::GetIndexNumber
       
   331 // 
       
   332 // 
       
   333 // ---------------------------------------------------------
       
   334 //
       
   335 void CCbsUiTopicListViewContainer::GetIndexNumber( const TCbsTopic& aTopic , 
       
   336                                                    TBuf<KTopicNumberLength>& aIndexNumber ) const
       
   337     {
       
   338     TBuf<KTopicNumberLength> ind;
       
   339     
       
   340     __ASSERT_DEBUG( aIndexNumber.MaxSize() >= KTopicNumberLength, 
       
   341         CbsUiPanic(EErrBadLength) );
       
   342     
       
   343     ind.AppendNum( TInt(aTopic.iNumber) );
       
   344     aIndexNumber.Justify(ind , KTopicNumberLength, ERight, KZeroFill);
       
   345     }
       
   346 
       
   347 // ---------------------------------------------------------
       
   348 // CCbsUiTopicListViewContainer::SizeChanged
       
   349 // 
       
   350 // 
       
   351 // ---------------------------------------------------------
       
   352 //
       
   353 void CCbsUiTopicListViewContainer::SizeChanged()
       
   354     {
       
   355     if (iListBox) 
       
   356         {
       
   357         iListBox->SetRect( Rect() );
       
   358         }
       
   359     }
       
   360 
       
   361 // ---------------------------------------------------------
       
   362 // CCbsUiTopicListViewContainer::FocusChanged
       
   363 // ---------------------------------------------------------
       
   364 //
       
   365 void CCbsUiTopicListViewContainer::FocusChanged( TDrawNow aDrawNow )
       
   366     {
       
   367     CCoeControl::FocusChanged( aDrawNow );
       
   368     if( iListBox )
       
   369         {
       
   370         iListBox->SetFocus( IsFocused(), aDrawNow );
       
   371         }
       
   372     }
       
   373 
       
   374 // ---------------------------------------------------------
       
   375 // CCbsUiTopicListViewContainer::GetHelpContext
       
   376 // 
       
   377 // Gets the control's help context.
       
   378 // ---------------------------------------------------------
       
   379 //
       
   380 void CCbsUiTopicListViewContainer::GetHelpContext(TCoeHelpContext& aContext) const
       
   381     {
       
   382     aContext.iMajor = TUid::Uid(KUidCbsUiappDef);
       
   383     aContext.iContext = KCBS_HLP_MAIN;
       
   384     }
       
   385 
       
   386 
       
   387 
       
   388 // ----------------------------------------------------
       
   389 // CCbsUiTopicListViewContainer::HandleResourceChange
       
   390 //
       
   391 // ----------------------------------------------------
       
   392 void CCbsUiTopicListViewContainer::HandleResourceChange( TInt aType )
       
   393     {
       
   394     CCoeControl::HandleResourceChange( aType );
       
   395 
       
   396     if( aType == KEikDynamicLayoutVariantSwitch )
       
   397         {
       
   398         iListView.HandleRectChangeInContainer(); 
       
   399         } 
       
   400 
       
   401     if( aType == KAknsMessageSkinChange )
       
   402         {
       
   403         // change skin bitmap
       
   404         TRAPD( ignore, SkinBitmapChangesL( ) );
       
   405         if( ignore )
       
   406             {
       
   407             ignore = KErrNone; //Prevent ARMV5 compilation varning
       
   408             }
       
   409         }    
       
   410     }
       
   411 
       
   412 // ----------------------------------------------------
       
   413 // CCbsUiTopicListViewContainer::HandleListBoxEventL
       
   414 //
       
   415 // ----------------------------------------------------
       
   416 void CCbsUiTopicListViewContainer::HandleListBoxEventL(	CEikListBox* /*aListBox*/,
       
   417                                                         TListBoxEvent aEventType )
       
   418     {
       
   419     switch ( aEventType )
       
   420         {
       
   421         case EEventItemSingleClicked:
       
   422             {
       
   423             TKeyEvent keyEvent;
       
   424             keyEvent.iCode = EKeyOK;
       
   425             OfferKeyEventL( keyEvent, EEventKey );
       
   426             break;
       
   427             }
       
   428         default:
       
   429             break;
       
   430         }
       
   431     }
       
   432 
       
   433 // ---------------------------------------------------------
       
   434 // CCbsUiTopicListViewContainer::LoadIconsL
       
   435 // 
       
   436 // 
       
   437 // ---------------------------------------------------------
       
   438 //
       
   439 void CCbsUiTopicListViewContainer::LoadIconsL()
       
   440     {
       
   441     CAknIconArray* icons = 
       
   442         new (ELeave) CAknIconArray(KNumberOfIconsInTopicListContainer);
       
   443     CleanupStack::PushL(icons);
       
   444 
       
   445     TParse parse; 
       
   446     parse.Set(KDirAndCbsUiAppMbmFile, &KDC_APP_BITMAP_DIR, NULL); 
       
   447     TFileName mbmFileAndPathName(parse.FullName());
       
   448     
       
   449     // First icon & mask.
       
   450     AddIconL( KAknsIIDQgnPropCbSubs, icons, mbmFileAndPathName, EMbmCbsuiappQgn_prop_cb_subs,
       
   451               EMbmCbsuiappQgn_prop_cb_subs_mask );
       
   452 
       
   453     // Second icon & mask.
       
   454     AddIconL( KAknsIIDQgnPropCbSubsUnread, icons, mbmFileAndPathName, EMbmCbsuiappQgn_prop_cb_subs_unread,
       
   455               EMbmCbsuiappQgn_prop_cb_subs_unread_mask );
       
   456 
       
   457     // Third icon & mask.
       
   458     AddIconL( KAknsIIDQgnPropCbUnsubs, icons, mbmFileAndPathName, EMbmCbsuiappQgn_prop_cb_unsubs,
       
   459               EMbmCbsuiappQgn_prop_cb_unsubs_mask );
       
   460 
       
   461     // Fourth icon & mask.
       
   462     AddIconL( KAknsIIDQgnPropCbUnsubsUnread, icons, mbmFileAndPathName, EMbmCbsuiappQgn_prop_cb_unsubs_unread,
       
   463               EMbmCbsuiappQgn_prop_cb_unsubs_unread_mask );
       
   464 
       
   465     // Fifth icon & mask.
       
   466     AddIconL( KAknsIIDQgnIndiCbHotAdd, icons, mbmFileAndPathName, EMbmCbsuiappQgn_indi_cb_hot_add,
       
   467               EMbmCbsuiappQgn_indi_cb_hot_add_mask, ETrue );
       
   468 
       
   469     CleanupStack::Pop(); // icons
       
   470     
       
   471     iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
       
   472     }
       
   473 
       
   474 
       
   475 // ---------------------------------------------------------
       
   476 // CCbsUiTopicListViewContainer::AddIconL
       
   477 // 
       
   478 // 
       
   479 // ---------------------------------------------------------
       
   480 //
       
   481 void CCbsUiTopicListViewContainer::AddIconL(
       
   482     TAknsItemID aId,
       
   483     CAknIconArray* aIcons,
       
   484     const TDesC& aIconFileWithPath,
       
   485     TInt aIconGraphicsIndex,
       
   486     TInt aIconGraphicsMaskIndex,
       
   487     TBool aColorIcon )
       
   488     {    
       
   489     // icon & mask.   
       
   490     MAknsSkinInstance* skins = AknsUtils::SkinInstance();  
       
   491     
       
   492     // COnstruct the icon and append it to icon array
       
   493     CGulIcon* icon = ConstructIconL( aColorIcon, skins, aId, 
       
   494         aIconFileWithPath, aIconGraphicsIndex, aIconGraphicsMaskIndex );
       
   495     CleanupStack::PushL( icon );
       
   496     aIcons->AppendL( icon );    
       
   497     CleanupStack::Pop( ); // icon
       
   498     }
       
   499 
       
   500 // ----------------------------------------------------
       
   501 // CCbsUiTopicListViewContainer::SkinBitmapChangesL
       
   502 // ----------------------------------------------------
       
   503 void CCbsUiTopicListViewContainer::SkinBitmapChangesL()
       
   504     {    
       
   505     CArrayPtr<CGulIcon> *icons = 0;
       
   506     icons = iListBox->ItemDrawer()->ColumnData()->IconArray();
       
   507     
       
   508     TAknsItemID id; 
       
   509     id.iMajor = 0;
       
   510     id.iMinor = 0;    
       
   511     
       
   512     TInt count = icons->Count();
       
   513     TInt bitmapIndex = 0;
       
   514     TInt bitmapMaskIndex = 0;
       
   515     TBool colourIcon( EFalse );
       
   516     
       
   517     // Change list icons
       
   518     MAknsSkinInstance* skins = AknsUtils::SkinInstance();
       
   519     for ( TInt cc=count; --cc>=0; )    
       
   520         {
       
   521         switch( cc )
       
   522             {
       
   523             case ECbsPropCbSubs:                
       
   524                 bitmapIndex = EMbmCbsuiappQgn_prop_cb_subs;
       
   525                 bitmapMaskIndex = EMbmCbsuiappQgn_prop_cb_subs_mask;
       
   526                 id = KAknsIIDQgnPropCbSubs;
       
   527                 break;
       
   528             case ECbsPropCbSubsUnread:                
       
   529                 bitmapIndex = EMbmCbsuiappQgn_prop_cb_subs_unread;
       
   530                 bitmapMaskIndex = EMbmCbsuiappQgn_prop_cb_subs_unread_mask;
       
   531                 id = KAknsIIDQgnPropCbSubsUnread;
       
   532                 break;
       
   533             case ECbsPropCbUnsubs:                
       
   534                 bitmapIndex = EMbmCbsuiappQgn_prop_cb_unsubs;
       
   535                 bitmapMaskIndex = EMbmCbsuiappQgn_prop_cb_unsubs_mask;
       
   536                 id = KAknsIIDQgnPropCbUnsubs;
       
   537                 break;
       
   538             case ECbsPropCbUnsubsUnread:                
       
   539                 bitmapIndex = EMbmCbsuiappQgn_prop_cb_unsubs_unread;
       
   540                 bitmapMaskIndex = EMbmCbsuiappQgn_prop_cb_unsubs_unread_mask;
       
   541                 id = KAknsIIDQgnPropCbUnsubsUnread;
       
   542                 break;
       
   543             case ECbsIndiCbHotAdd:                
       
   544                 bitmapIndex = EMbmCbsuiappQgn_indi_cb_hot_add;
       
   545                 bitmapMaskIndex = EMbmCbsuiappQgn_indi_cb_hot_add_mask;
       
   546                 id = KAknsIIDQgnIndiCbHotAdd;
       
   547                 colourIcon = ETrue;
       
   548                 break;
       
   549             default:
       
   550                 bitmapIndex = EMbmCbsuiappQgn_prop_cb_unsubs_unread;
       
   551                 bitmapMaskIndex = EMbmCbsuiappQgn_prop_cb_unsubs_unread_mask;
       
   552                 id = KAknsIIDQgnPropCbUnsubsUnread;
       
   553                 break;           
       
   554             } 
       
   555         
       
   556         // icon & mask
       
   557         TParse parse; 
       
   558         parse.Set( KDirAndCbsUiAppMbmFile, &KDC_APP_BITMAP_DIR, NULL ); 
       
   559         TFileName mbmFileAndPathName( parse.FullName() );
       
   560         
       
   561         CGulIcon* icon = ConstructIconL( colourIcon, skins, id, 
       
   562             mbmFileAndPathName, bitmapIndex, bitmapMaskIndex );
       
   563             
       
   564         CleanupStack::PushL( icon );
       
   565         CGulIcon* iconToBeDelete = icons->At( cc );
       
   566         icons->At( cc ) = icon;
       
   567         delete iconToBeDelete;
       
   568         iconToBeDelete = NULL;
       
   569 
       
   570         CleanupStack::Pop(); // icon
       
   571         
       
   572         colourIcon = EFalse;
       
   573         }  
       
   574     }
       
   575 
       
   576 
       
   577 // ----------------------------------------------------
       
   578 // CCbsUiTopicListViewContainer::ConstructIconL
       
   579 // ----------------------------------------------------
       
   580 CGulIcon* CCbsUiTopicListViewContainer::ConstructIconL( 
       
   581     TBool& aColourIcon,
       
   582     MAknsSkinInstance* aSkins, 
       
   583     const TAknsItemID& aID,
       
   584     const TDesC& aFilename,
       
   585     const TInt aFileBitmapId, 
       
   586     const TInt aFileMaskId )
       
   587     {
       
   588     // icon & mask
       
   589     CFbsBitmap* bitmap;
       
   590     CFbsBitmap* mask;
       
   591         
       
   592     if ( aColourIcon )
       
   593         {
       
   594         AknsUtils::CreateColorIconL(
       
   595             aSkins, 
       
   596             aID, 
       
   597             KAknsIIDQsnIconColors, 
       
   598             EAknsCIQsnIconColorsCG13, // Check the used color group - this is usually correct group for D-column stuff
       
   599             bitmap, 
       
   600             mask,
       
   601             aFilename,
       
   602             aFileBitmapId,
       
   603             aFileMaskId ,
       
   604             KRgbBlack ); // This is default color used, if the color skinning fails, or there is no color defined.
       
   605         }
       
   606     else
       
   607         {
       
   608         AknsUtils::CreateIconL( aSkins, aID, bitmap,
       
   609         mask, aFilename, aFileBitmapId, 
       
   610         aFileMaskId );
       
   611         }
       
   612 
       
   613     CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
       
   614     return icon;
       
   615     }
       
   616 
       
   617 //  End of File