profilesservices/FileList/Src/CFLDPopupList.cpp
changeset 0 8c5d936e5675
child 2 051d34a3f367
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation of the CFLDPopupList.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // CLASS HEADER
       
    21 #include    "CFLDPopupList.h"
       
    22 
       
    23 // INTERNAL INCLUDES
       
    24 #include    "CFLDFileListModel.h"
       
    25 #include    "MFLDFileObserver.h"
       
    26 #include    "MFLDFileListBoxObserver.h"
       
    27 
       
    28 // EXTERNAL INCLUDES
       
    29 #include <AknIconArray.h>
       
    30 #include <aknmemorycardui.mbg>
       
    31 #include <AknsUtils.h>
       
    32 #include <gulicon.h>
       
    33 #include <aknconsts.h> // KAvkonBitmapFile, KAvkonVariatedBitmapsFile
       
    34 #include <variatedbitmaps.mbg> // MBM indices for seamless link
       
    35 #include <avkon.mbg>
       
    36 #include <data_caging_path_literals.hrh>
       
    37 #include <aknlists.h>
       
    38 #include <commondialogs.mbg>
       
    39 #include <filelist.mbg>
       
    40 
       
    41 // CONSTANTS
       
    42 namespace
       
    43 	{
       
    44     _LIT( KFLDMassStorageBitmapFile, "z:filelist.mbm" );
       
    45     _LIT( KFLDMemoryCardUiBitmapFile, "z:aknmemorycardui.mbm" );
       
    46 
       
    47 	const TInt KIconGranularity( 3 );
       
    48 	}
       
    49 
       
    50 
       
    51 // ============================ MEMBER FUNCTIONS ===============================
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CFLDPopupList::CFLDPopupList
       
    55 // C++ constructor can NOT contain any code, that might leave.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CFLDPopupList::CFLDPopupList(
       
    59 	MFLDFileObserver& aFileObserver,
       
    60     MFLDFileListBoxObserver* aListBoxObserver,
       
    61 	CFLDFileListModel& aModel )
       
    62 	:	CAknPopupList(),
       
    63 		iFileObserver( aFileObserver ),
       
    64         iListBoxObserver( aListBoxObserver ),
       
    65 		iModel( aModel ),
       
    66 		iPoint(-1,-1)
       
    67     {
       
    68     }
       
    69 
       
    70 
       
    71 void CFLDPopupList::ConstructL(
       
    72  CEikListBox* aListBox, TInt aCbaResource, AknPopupLayouts::TAknPopupLayouts aType )
       
    73 	{
       
    74 	// Notify foreground lost
       
    75     CCoeEnv* coeEnv = CCoeEnv::Static();
       
    76     coeEnv->AddForegroundObserverL( *this );
       
    77     coeEnv->AddFocusObserverL( *this );
       
    78     
       
    79     CAknPopupList::ConstructL( aListBox, aCbaResource, aType );
       
    80 	}
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CFLDPopupList::NewL
       
    84 // Two-phased constructor.
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CFLDPopupList* CFLDPopupList::NewL(
       
    88 	CEikListBox* aListBox,
       
    89 	TInt aCbaResource,
       
    90 	MFLDFileObserver& aFileObserver,
       
    91     MFLDFileListBoxObserver* aListBoxObserver,
       
    92 	CFLDFileListModel& aModel,
       
    93 	AknPopupLayouts::TAknPopupLayouts aType )
       
    94 	{
       
    95 	CFLDPopupList* self = new( ELeave )
       
    96         CFLDPopupList( aFileObserver, aListBoxObserver, aModel );
       
    97 	CleanupStack::PushL( self );
       
    98 	self->ConstructL( aListBox, aCbaResource, aType );
       
    99 	CleanupStack::Pop( self );
       
   100 	return self;
       
   101 	}
       
   102 
       
   103 // Destructor
       
   104  CFLDPopupList::~CFLDPopupList()
       
   105     {
       
   106     CCoeEnv::Static()->RemoveForegroundObserver( *this );
       
   107     CCoeEnv::Static()->RemoveFocusObserver( *this );
       
   108     }
       
   109     
       
   110  // -----------------------------------------------------------------------------
       
   111  // CFLDPopupList::HandlePointerEventL
       
   112  // (other items were commented in a header).
       
   113  // -----------------------------------------------------------------------------
       
   114  //
       
   115  void CFLDPopupList::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   116 	 {
       
   117 	 if ( aPointerEvent.iType == TPointerEvent::EButton1Down)
       
   118 		 {
       
   119 		 iPoint = aPointerEvent.iPosition;
       
   120 		 CancelPreview();
       
   121 		 }
       
   122 	 if ( Rect().Contains( iPoint ) )
       
   123 		 {
       
   124 		 CCoeControl::HandlePointerEventL( aPointerEvent );
       
   125 		 }
       
   126 	 else
       
   127 		 {
       
   128 		 AttemptExitL(EFalse);    
       
   129 		 }
       
   130 	 }
       
   131 // -----------------------------------------------------------------------------
       
   132 // CFLDPopupList::AttemptExitL
       
   133 // (other items were commented in a header).
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CFLDPopupList::AttemptExitL( TBool aAccept )
       
   137 	{
       
   138 	if( iExitChecksDone )
       
   139 	    {
       
   140 	    CAknPopupList::AttemptExitL( aAccept );
       
   141 	    return;
       
   142 	    }
       
   143 
       
   144 	TFileName fileName( KNullDesC );
       
   145 	iModel.GetFileName( fileName, iListBox->CurrentItemIndex() );
       
   146 
       
   147 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   148 	// Get current softkey state
       
   149 	if( iListBoxObserver )
       
   150     	{
       
   151 		iListBoxObserver->HandleSoftKeyState( iSoftKeyState );
       
   152     	}
       
   153 	TBool isVideo( EFalse );
       
   154 	if ( iModel.MediaFileType( fileName ) == ECLFMediaTypeVideo )
       
   155 		{
       
   156 		isVideo = ETrue;
       
   157 		}
       
   158 #endif
       
   159 
       
   160 	if( aAccept )
       
   161 		{
       
   162 		// User made a selection (didn't press cancel).
       
   163 
       
   164 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   165 		if( isVideo )
       
   166 			{
       
   167 			if( iSoftKeyState ==
       
   168 			 MFLDFileListBoxObserver::EToneSelectionSoftKeyState )
       
   169 				{
       
   170 				// Cancel listbox timer
       
   171         		if( iListBoxObserver )
       
   172             		{
       
   173             		iListBoxObserver->HandleFileListBoxEventL(
       
   174                 		MFLDFileListBoxObserver::EOtherKeyEvent,
       
   175                 		fileName );
       
   176             		}
       
   177 				}
       
   178 			else
       
   179 				{
       
   180 				// No need to cancel timer
       
   181 				// (it has been already cancelled)
       
   182 				}
       
   183 			}
       
   184 		else
       
   185 			{
       
   186         	// Cancel listbox timer
       
   187         	if( iListBoxObserver )
       
   188             	{
       
   189             	iListBoxObserver->HandleFileListBoxEventL(
       
   190                 	MFLDFileListBoxObserver::EOtherKeyEvent,
       
   191                 	fileName );
       
   192             	}
       
   193 			}
       
   194 #else
       
   195 		// Cancel listbox timer
       
   196         if( iListBoxObserver )
       
   197         	{
       
   198             iListBoxObserver->HandleFileListBoxEventL(
       
   199             	MFLDFileListBoxObserver::EOtherKeyEvent,
       
   200                 fileName );
       
   201             }
       
   202 #endif
       
   203 
       
   204 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   205 	if( !isVideo )	// Only perform file validity check for audio files here
       
   206 		{
       
   207 		// Ask the observer if the file is valid.
       
   208         if( !iFileObserver.IsFileValidL(
       
   209          fileName, MFLDFileObserver::ESelect ) )
       
   210 			{
       
   211             // Not ok to close the pop-up.
       
   212             // Return. Don't call CAknPopupList::AttemptExitL.
       
   213 			return;
       
   214 			}
       
   215 		}
       
   216 
       
   217 #else
       
   218         // Ask the observer if the file is valid.
       
   219     if( !iFileObserver.IsFileValidL(
       
   220      fileName, MFLDFileObserver::ESelect ) )
       
   221     	{
       
   222 	    // Not ok to close the pop-up.
       
   223         // Return. Don't call CAknPopupList::AttemptExitL.
       
   224 		return;
       
   225 		}
       
   226 #endif
       
   227 
       
   228 
       
   229 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   230 		if( iListBoxObserver )
       
   231 			{
       
   232 			// Ask the observer if the file is video
       
   233 			if( isVideo )
       
   234 				{// File is a video
       
   235 
       
   236 				// Change the softkeys back to normal
       
   237 				iListBoxObserver->HandleFileListBoxEventL(
       
   238  						MFLDFileListBoxObserver::EVideoPreviewCanceled,
       
   239  						 fileName );
       
   240  						
       
   241 				if( iSoftKeyState
       
   242 				 == MFLDFileListBoxObserver::EToneSelectionSoftKeyState )
       
   243 			 		{	// File is a video and we are in tone selection list
       
   244 
       
   245 			 		// Ask the observer if the file is valid.
       
   246         			if( !iFileObserver.IsFileValidL(
       
   247         			 fileName, MFLDFileObserver::ESelect ) )
       
   248         				{
       
   249 						// Not ok to close the pop-up.
       
   250             			// Return. Don't call CAknPopupList::AttemptExitL.
       
   251 						return;
       
   252         				}
       
   253 			 		}
       
   254 			 	else if( iSoftKeyState
       
   255 			 	 == MFLDFileListBoxObserver::EPreviewSoftKeyState )
       
   256 			 		{	// File is a video and it has been focused for 1s
       
   257 
       
   258 			 		// Ask the observer if the file is valid.
       
   259         			if( !iFileObserver.IsFileValidL(
       
   260         			 fileName, MFLDFileObserver::EPlay ) )
       
   261         				{
       
   262 						// Not ok to close the pop-up.
       
   263             			// Return. Don't call CAknPopupList::AttemptExitL.
       
   264 						return;
       
   265         				}
       
   266 
       
   267 			 		iListBoxObserver->HandleFileListBoxEventL(
       
   268                 		MFLDFileListBoxObserver::EVideoPreview,
       
   269                 		fileName );
       
   270                 	
       
   271 			 		// Disable scrollbar
       
   272 			 		ListBox()->ScrollBarFrame()->VerticalScrollBar()->SetDimmed( ETrue );
       
   273 
       
   274 			 		// Remove the focus from listbox
       
   275                 	ListBox()->SetDimmed( ETrue );
       
   276 
       
   277                 	// Not ok to close the pop-up.
       
   278             		// Return. Don't call CAknPopupList::AttemptExitL.
       
   279                 	return;
       
   280 			 		}
       
   281 			 	else if( iSoftKeyState
       
   282 			 	 == MFLDFileListBoxObserver::EPreviewSelectSoftKeyState )
       
   283 			 		{	// File is a video and it is in preview state
       
   284 
       
   285 			 		// Ask the observer if the file is valid.
       
   286         			if( !iFileObserver.IsFileValidL(
       
   287         			 fileName, MFLDFileObserver::ESelect ) )
       
   288 						{
       
   289 						// When video screen is closed,
       
   290 						// listbox must be forced to be refreshed
       
   291 						// ( otherwise scrollbar is not redrawn)
       
   292 						ListBox()->SetDimmed( EFalse );
       
   293 	                    ListBox()->ScrollBarFrame()->VerticalScrollBar()->SetDimmed( EFalse );
       
   294 						DrawNow( CEikonEnv::Static()->EikAppUi()->ApplicationRect() );
       
   295 						// Not ok to close the pop-up.
       
   296             			// Return. Don't call CAknPopupList::AttemptExitL.
       
   297 						return;
       
   298 						}
       
   299 
       
   300 					// When video screen is closed, listbox must be refreshed
       
   301 					DrawDeferred();
       
   302 	            	}
       
   303 				}
       
   304 			}
       
   305 		}
       
   306 	else	// 	if( aAccept )
       
   307 		{
       
   308 		// User canceled selection
       
   309 		if( iListBoxObserver )
       
   310 			{
       
   311 			if( isVideo )
       
   312 				{	// File is a video
       
   313 				
       
   314 				// Change the softkeys back to normal
       
   315 				iListBoxObserver->HandleFileListBoxEventL(
       
   316 	       			MFLDFileListBoxObserver::EVideoPreviewCanceled,
       
   317 	       			 fileName );
       
   318 				
       
   319 	 			if( iSoftKeyState ==
       
   320 	 			 MFLDFileListBoxObserver::EPreviewSelectSoftKeyState )
       
   321 					{	// File is a video and it is in preview state
       
   322 
       
   323 					// When video screen is closed,
       
   324 					// listbox must be forced to be refreshed
       
   325 					// ( otherwise scrollbar is not redrawn)
       
   326 					ListBox()->SetDimmed( EFalse );
       
   327                     ListBox()->ScrollBarFrame()->VerticalScrollBar()->SetDimmed( EFalse );
       
   328 					DrawNow( CEikonEnv::Static()->EikAppUi()->ApplicationRect() );
       
   329 					// Not ok to close the pop-up.
       
   330             		// Return. Don't call CAknPopupList::AttemptExitL.
       
   331 					return;
       
   332 					}
       
   333 	 			}
       
   334 			}
       
   335 #endif
       
   336 
       
   337 		}
       
   338 
       
   339 	iExitChecksDone = ETrue;
       
   340 	CAknPopupList::AttemptExitL( aAccept );
       
   341 	}
       
   342 
       
   343 // -----------------------------------------------------------------------------
       
   344 // CFLDPopupList::HandleResourceChange
       
   345 // (other items were commented in a header).
       
   346 // -----------------------------------------------------------------------------
       
   347 //
       
   348 void CFLDPopupList::HandleResourceChange( TInt aType )
       
   349     {
       
   350 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   351     if( aType == KEikDynamicLayoutVariantSwitch ||
       
   352          aType == KAknsMessageSkinChange )
       
   353         {
       
   354 		if( iListBoxObserver )
       
   355 			{
       
   356  			TRAP_IGNORE( iListBoxObserver->HandleFileListBoxEventL(
       
   357  				MFLDFileListBoxObserver::EVideoPreviewCanceled ) );
       
   358  		    if( ListBox()->IsFocused() )
       
   359  		        {
       
   360  		        ListBox()->SetDimmed( EFalse );
       
   361                 ListBox()->ScrollBarFrame()->VerticalScrollBar()->SetDimmed( EFalse );
       
   362  		        }
       
   363 			}
       
   364         }
       
   365 #endif
       
   366     if( aType == KAknsMessageSkinChange )
       
   367         {
       
   368         TRAP_IGNORE( PopulateIconArrayL() );
       
   369         }
       
   370 
       
   371     CAknPopupList::HandleResourceChange( aType );
       
   372     }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CFLDPopupList::GetFileListBoxObserver
       
   376 // (other items were commented in a header).
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 MFLDFileListBoxObserver* CFLDPopupList::GetFileListBoxObserver()
       
   380 	{
       
   381 	return iListBoxObserver;
       
   382 	}
       
   383 
       
   384 // -----------------------------------------------------------------------------
       
   385 // CFLDPopupList::HandleListBoxEventL
       
   386 // (other items were commented in a header).
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 void CFLDPopupList::HandleListBoxEventL( CEikListBox* aListBox,
       
   390 	TListBoxEvent aEventType )
       
   391     {
       
   392 	switch( aEventType )
       
   393 		{
       
   394 		// Special handling for touch: first click just starts preview;
       
   395 		// second click (double click) will select the tone.
       
   396 		// Fall through.
       
   397 		case EEventItemClicked:
       
   398 			{
       
   399 			iModel.GetFileName( iCurrentFileName, iListBox->CurrentItemIndex() );
       
   400 			iListBoxObserver->HandleFileListBoxEventL( 
       
   401 				MFLDFileListBoxObserver::EFocusChanged, iCurrentFileName );
       
   402 			return;
       
   403 			}
       
   404 
       
   405 		case EEventItemDoubleClicked:
       
   406 			AttemptExitL( ETrue );
       
   407 			return;
       
   408 
       
   409 		default:
       
   410 			break;
       
   411 		}
       
   412 
       
   413 	CAknPopupList::HandleListBoxEventL( aListBox, aEventType );
       
   414     }
       
   415 
       
   416 // -----------------------------------------------------------------------------
       
   417 // CFLDPopupList::CancelPreview
       
   418 // (other items were commented in a header).
       
   419 // -----------------------------------------------------------------------------
       
   420 //
       
   421 void CFLDPopupList::CancelPreview()
       
   422     {
       
   423     if( iListBoxObserver )
       
   424     	{
       
   425         TRAP_IGNORE( iListBoxObserver->HandleFileListBoxEventL(
       
   426          				MFLDFileListBoxObserver::EOtherKeyEvent, KNullDesC ) );
       
   427     	}
       
   428     }
       
   429 
       
   430 // -----------------------------------------------------------------------------
       
   431 // CFLDPopupList::PopupListWindow::
       
   432 // (other items were commented in a header).
       
   433 // -----------------------------------------------------------------------------
       
   434 //
       
   435 RWindow& CFLDPopupList::PopupListWindow() const
       
   436 	{
       
   437 	return Window();
       
   438 	}
       
   439 
       
   440 // -----------------------------------------------------------------------------
       
   441 // CFLDPopupList::HandleGainingForeground
       
   442 // (other items were commented in a header).
       
   443 // -----------------------------------------------------------------------------
       
   444 //
       
   445 void CFLDPopupList::HandleGainingForeground()
       
   446 	{
       
   447 	TRAP_IGNORE( ListBox()->HandleItemAdditionL() );
       
   448 	}
       
   449 // -----------------------------------------------------------------------------
       
   450 // CFLDPopupList::HandleLosingForeground
       
   451 // (other items were commented in a header).
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 void CFLDPopupList::HandleLosingForeground()
       
   455 	{
       
   456     if( iListBoxObserver )
       
   457         {
       
   458         iListBoxObserver->HandleSoftKeyState( iSoftKeyState );
       
   459         if( iSoftKeyState == MFLDFileListBoxObserver::EPreviewSelectSoftKeyState )
       
   460             {
       
   461             TRAP_IGNORE( iListBoxObserver->HandleFileListBoxEventL(
       
   462                 MFLDFileListBoxObserver::EVideoPreviewCanceled, KNullDesC ) );
       
   463             DrawNow();
       
   464             }
       
   465 
       
   466         // Set the vertical scroll bar and listbox to not dimmed.        
       
   467         if ( ListBox()->IsFocused() )
       
   468             {
       
   469             ListBox()->SetDimmed( EFalse );
       
   470             ListBox()->ScrollBarFrame()->VerticalScrollBar()->SetDimmed( EFalse );
       
   471             }
       
   472         }
       
   473 	}	
       
   474 
       
   475 // -----------------------------------------------------------------------------
       
   476 // CFLDPopupList::HandleChangeInFocus
       
   477 // (other items were commented in a header).
       
   478 // -----------------------------------------------------------------------------
       
   479 //
       
   480 void CFLDPopupList::HandleChangeInFocus()
       
   481 	{
       
   482 	if( ListBox()->IsFocused() )
       
   483 		{
       
   484 		ListBox()->SetDimmed( EFalse );
       
   485 		}
       
   486 	}	
       
   487 // -----------------------------------------------------------------------------
       
   488 // CFLDPopupList::HandleDestructionOfFocusedItem
       
   489 // (other items were commented in a header).
       
   490 // -----------------------------------------------------------------------------
       
   491 //
       
   492 void CFLDPopupList::HandleDestructionOfFocusedItem()
       
   493 	{
       
   494 	}	
       
   495 
       
   496 // -----------------------------------------------------------------------------
       
   497 // CFLDPopupList::PopulateIconArrayL
       
   498 // (other items were commented in a header).
       
   499 // -----------------------------------------------------------------------------
       
   500 //
       
   501 void CFLDPopupList::PopulateIconArrayL()
       
   502     {
       
   503     CAknSingleGraphicBtPopupMenuStyleListBox* listBox = 
       
   504     	static_cast<CAknSingleGraphicBtPopupMenuStyleListBox*>( ListBox() );
       
   505 
       
   506 	if( !listBox )
       
   507 		{
       
   508 		return;
       
   509 		}
       
   510 
       
   511     // Create new icon array
       
   512     CArrayPtr<CGulIcon>* iconArray = new( ELeave ) CAknIconArray( KIconGranularity );
       
   513     CleanupStack::PushL( iconArray );
       
   514 
       
   515     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   516 
       
   517     //    
       
   518     // Create an empty icon in icon array position 0
       
   519     // 
       
   520     CGulIcon* icon =
       
   521         AknsUtils::CreateGulIconL( skin, KAknsIIDQgnPropEmpty, KAvkonBitmapFile,
       
   522         EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask  );
       
   523     CleanupStack::PushL( icon );
       
   524     iconArray->AppendL( icon );
       
   525     CleanupStack::Pop( icon );
       
   526 
       
   527     //
       
   528     // Create an URL icon for download tones in icon array position 1
       
   529     //
       
   530     icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnPropLinkEmbdSmall,
       
   531         KAvkonVariatedBitmapsFile,
       
   532         EMbmVariatedbitmapsQgn_prop_link_embd_small,
       
   533         EMbmVariatedbitmapsQgn_prop_link_embd_small_mask );
       
   534     CleanupStack::PushL( icon );
       
   535     iconArray->AppendL( icon );
       
   536     CleanupStack::Pop( icon );
       
   537 
       
   538     //
       
   539     // Create an memory card icon in icon array position 2
       
   540     //		
       
   541 	TParse* fp = new(ELeave) TParse();
       
   542 	fp->Set(KFLDMemoryCardUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL);
       
   543 	TFileName resourceFileName( fp->FullName() );
       
   544 	delete fp;
       
   545         
       
   546     TRgb defaultColour( KRgbBlack );
       
   547     CFbsBitmap* bmap = NULL;
       
   548     CFbsBitmap* mask = NULL;
       
   549 
       
   550     AknsUtils::GetCachedColor( skin, defaultColour,
       
   551                KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13 );
       
   552     AknsUtils::CreateColorIconLC( skin, KAknsIIDQgnPropLinkEmbdSmall,
       
   553                 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, bmap, mask,
       
   554                 resourceFileName, EMbmAknmemorycarduiQgn_indi_mmc_add,
       
   555                 EMbmAknmemorycarduiQgn_indi_mmc_add_mask,
       
   556                 defaultColour );
       
   557     icon = CGulIcon::NewL( bmap, mask );
       
   558     icon->SetBitmapsOwnedExternally( EFalse );
       
   559     CleanupStack::Pop( 2 ); // icon owns the bitmaps now
       
   560         
       
   561     CleanupStack::PushL( icon );
       
   562     iconArray->AppendL( icon );
       
   563     CleanupStack::Pop( icon );
       
   564      
       
   565     //
       
   566     // Create an audio file icon in icon array position 3
       
   567     //
       
   568     icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnPropFmgrFileSound,
       
   569         KCommonDialogsBitmapFile,
       
   570         EMbmCommondialogsQgn_prop_fmgr_file_sound,
       
   571         EMbmCommondialogsQgn_prop_fmgr_file_sound_mask );
       
   572     CleanupStack::PushL( icon );
       
   573     iconArray->AppendL( icon );
       
   574     CleanupStack::Pop( icon );
       
   575 
       
   576     //
       
   577     // Create a video file icon in icon array position 4
       
   578     //
       
   579     icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnPropFmgrFileVideo,
       
   580         KCommonDialogsBitmapFile,
       
   581         EMbmCommondialogsQgn_prop_fmgr_file_video,
       
   582         EMbmCommondialogsQgn_prop_fmgr_file_video_mask );
       
   583     CleanupStack::PushL( icon );
       
   584     iconArray->AppendL( icon );
       
   585     CleanupStack::Pop( icon );
       
   586 
       
   587     //
       
   588     // create mass storage icon in icon array position 5
       
   589     //
       
   590 	TParse* fp2 = new(ELeave) TParse();
       
   591 	fp2->Set(KFLDMassStorageBitmapFile, &KDC_APP_BITMAP_DIR, NULL);
       
   592 	resourceFileName = fp2->FullName();
       
   593 	delete fp2;
       
   594 
       
   595     TRgb defaultColour2( KRgbBlack );
       
   596     CFbsBitmap* bmap2 = NULL;
       
   597     CFbsBitmap* mask2 = NULL;
       
   598 
       
   599     AknsUtils::GetCachedColor( skin, defaultColour2,
       
   600                KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13 );
       
   601     AknsUtils::CreateColorIconLC( skin, KAknsIIDQgnPropLinkEmbdSmall,
       
   602                 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, bmap2, mask2,
       
   603                 resourceFileName, EMbmFilelistQgn_indi_fmgr_ms_add,
       
   604                 EMbmFilelistQgn_indi_fmgr_ms_add_mask,
       
   605                 defaultColour2 );
       
   606     
       
   607     icon = CGulIcon::NewL( bmap2, mask2 );
       
   608     icon->SetBitmapsOwnedExternally( EFalse );
       
   609     CleanupStack::Pop( 2 ); // icon owns the bitmaps now
       
   610         
       
   611     CleanupStack::PushL( icon );
       
   612     iconArray->AppendL( icon );
       
   613     CleanupStack::Pop( icon );
       
   614 
       
   615 
       
   616     // Delete old icons
       
   617     CArrayPtr<CGulIcon>* arr = listBox->ItemDrawer()->ColumnData()->IconArray();
       
   618     if( arr )
       
   619     	{
       
   620     	arr->ResetAndDestroy();
       
   621 	    delete arr;
       
   622 	    arr = NULL;
       
   623     	}
       
   624 
       
   625 	listBox->ItemDrawer()->ColumnData()->SetIconArrayL( iconArray );
       
   626 	CleanupStack::Pop( iconArray );
       
   627 
       
   628     }
       
   629 
       
   630 
       
   631 //  End of File