mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhglistboxarray.cpp
changeset 0 ff3acec5bc43
child 17 c8156a91d13c
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Listbox array for collection view container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <StringLoader.h>
       
    21 #include <gulicon.h>
       
    22 #include <AknsUtils.h>
       
    23 #include <AknUtils.h>
       
    24 #include <aknconsts.h>
       
    25 #include <AknIconArray.h>
       
    26 #include <avkon.mbg>
       
    27 #include <f32file.h>
       
    28 #include <data_caging_path_literals.hrh>
       
    29 #include <mpxmedia.h>
       
    30 #include <mpxmediacontainerdefs.h>
       
    31 #include <mpxmediageneraldefs.h>
       
    32 #include <mpxmediaarray.h>
       
    33 #include <mpxlog.h>
       
    34 #include <mpxcollectionviewhg.mbg>
       
    35 #include <mpxcollectionpath.h>  // TMPXItemId
       
    36 #include <mpxplaybackframeworkdefs.h>
       
    37 #include <mpxcollectionviewhg.rsg>
       
    38 #include <mpxuser.h>
       
    39 
       
    40 #include <mpxcommonuihelper.h>
       
    41 #include "mpxcollectionviewhg.hrh"
       
    42 #include "mpxcommoncontainer.hrh"
       
    43 #include "mpxcommonlistboxarrayobserver.h"
       
    44 #include "mpxcollectionviewhglistboxarray.h"
       
    45 
       
    46 // CONSTANTS
       
    47 _LIT( KMPXCommonListboxFormatString, "%d\t%S" );
       
    48 _LIT( KMPXTab, "\t" );
       
    49 _LIT( KMPXCollectionViewIconFile, "mpxcollectionviewhg.mbm" );
       
    50 
       
    51 // ============================ MEMBER FUNCTIONS ===============================
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // Two-phased constructor.
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CMPXCollectionViewListBoxArray* CMPXCollectionViewListBoxArray::NewL()
       
    58     {
       
    59     MPX_FUNC( "CMPXCollectionViewListBoxArray::NewL" );
       
    60     CMPXCollectionViewListBoxArray* self =
       
    61         new ( ELeave ) CMPXCollectionViewListBoxArray();
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop( self );
       
    65     return self;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CMPXCollectionViewListBoxArray::CMPXCollectionViewListBoxArray
       
    70 // C++ default constructor can NOT contain any code, that
       
    71 // might leave.
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CMPXCollectionViewListBoxArray::CMPXCollectionViewListBoxArray() :
       
    75     CMPXCommonListBoxArrayBase()
       
    76     {
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // Destructor.
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 CMPXCollectionViewListBoxArray::~CMPXCollectionViewListBoxArray()
       
    84     {
       
    85     MPX_FUNC( "CMPXCollectionViewListBoxArray::~CMPXCollectionViewListBoxArray" );
       
    86     delete iUnknown;
       
    87     delete iMediaOwned;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // Two-phased constructor.
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CMPXCollectionViewListBoxArray::ConstructL()
       
    95     {
       
    96     MPX_FUNC( "CMPXCollectionViewListBoxArray::ConstructL" );
       
    97     iUnknown = StringLoader::LoadL(R_MPX_QTN_MP_UNKNOWN );
       
    98     iMMCDrive = CMPXCommonUiHelper::MMCDriveNumber();
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // Sets playback status
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 TInt CMPXCollectionViewListBoxArray::SetPlaybackStatusByIdL(
       
   106     TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex )
       
   107     {
       
   108     MPX_FUNC( "CMPXCollectionViewListBoxArray::SetPlaybackStatusByIdL" );
       
   109     // fix crash when click back too quick after play a song
       
   110     // aIndex < 0 means no icon to place, iMedia->Count() == 0 means no song, don't search
       
   111     if ( iMedia == NULL || aIndex < 0 || iMedia->Count() == 0)
       
   112         {
       
   113         return SetPlaybackStatusByIndex( KErrNotFound, aStatus );
       
   114         }
       
   115 
       
   116     TInt index( KErrNotFound );
       
   117     TInt count( iMedia->Count() );
       
   118     // Search start from aIndex, then aIndex-1, aIndex+1, aIndex-2, aIndex+2
       
   119     // until the boundary reach then search for the rest
       
   120     if ( aIndex > count - 1 ) // remove song before the last
       
   121         {
       
   122         aIndex = count - 1;
       
   123         }
       
   124     CMPXMedia* origMedia( iMedia->AtL( aIndex ) );
       
   125     TMPXItemId id( origMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   126     if ( id == aId )
       
   127         {
       
   128         index = aIndex;
       
   129         }
       
   130     else
       
   131         {
       
   132         TInt upBound( ( count - 1 ) - aIndex );
       
   133         TInt loBound( aIndex - 0 );
       
   134         TInt biBound( Min( upBound, loBound ) );
       
   135         for ( TInt i = 1; i <= biBound; i++ )
       
   136             {
       
   137             CMPXMedia* entry( iMedia->AtL( aIndex - i ) );
       
   138             TMPXItemId id( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   139             if ( id == aId )
       
   140                 {
       
   141                 index = aIndex - i;
       
   142                 break;
       
   143                 }
       
   144 
       
   145             entry = iMedia->AtL( aIndex + i );
       
   146             id = entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
       
   147             if ( id == aId )
       
   148                 {
       
   149                 index = aIndex + i;
       
   150                 break;
       
   151                 }
       
   152             }
       
   153         if ( index == KErrNotFound && upBound != loBound ) // still not found search for the rest
       
   154             {
       
   155             TInt begin( ( loBound > upBound ) ? 0 : aIndex + biBound + 1 );
       
   156             TInt end( ( loBound>upBound ) ? aIndex - biBound : count );
       
   157             for ( TInt i = begin; i < end; i++ )
       
   158                 {
       
   159                 CMPXMedia* entry( iMedia->AtL( i ) );
       
   160                 TMPXItemId id( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   161                 if ( id == aId )
       
   162                     {
       
   163                     index = i;
       
   164                     break;
       
   165                     }
       
   166                 }
       
   167             }
       
   168         }
       
   169     return SetPlaybackStatusByIndex( index, aStatus );
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // Activates reorder mode
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 void CMPXCollectionViewListBoxArray::ActivateReorderMode( TBool aEnable )
       
   177     {
       
   178     MPX_FUNC( "CMPXCollectionViewListBoxArray::ActivateReorderMode" );
       
   179     iReorderActivated = aEnable;
       
   180     if ( !iMediaOwned && aEnable )
       
   181         {
       
   182         // make a copy of the current array so that any modification to the array
       
   183         // does not pollute the master copy
       
   184         MPX_TRAPD( error, iMediaOwned = CMPXMediaArray::NewL() );
       
   185         if ( error == KErrNone )
       
   186             {
       
   187             TInt count( iMedia->Count() );
       
   188             TRAP_IGNORE(
       
   189                 for ( TInt i = 0; i < count; i++ )
       
   190                     {
       
   191                     CMPXMedia* entry( iMedia->AtL( i ) );
       
   192                     iMediaOwned->AppendL( *entry );
       
   193                     } );
       
   194             // no need to delete iMedia, we don't own it
       
   195             // iMedia might get reset before we have a chance to delete it
       
   196             // keep a copy of the pointer so that we can delete
       
   197             iMedia = iMediaOwned;
       
   198             }
       
   199         }
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // Set reorder mode
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 void CMPXCollectionViewListBoxArray::SetReorderGrabbedMode(
       
   207     TBool aEnable, TInt aIndex )
       
   208     {
       
   209     MPX_FUNC( "CMPXCollectionViewListBoxArray::SetReorderGrabbedMode" );
       
   210     iReorder = aEnable;
       
   211     iOriginalIndex = aIndex;
       
   212     iMovedIndex = aIndex;
       
   213     if ( aEnable && aIndex == iIndex )
       
   214         {
       
   215         // if the item currently being moved is now playing
       
   216         // manually move the icon after it's complete, and before the result
       
   217         // is saved to db
       
   218         iMoveNowPlaying = ETrue;
       
   219         }
       
   220     else
       
   221         {
       
   222         iMoveNowPlaying = EFalse;
       
   223         }
       
   224     }
       
   225 
       
   226 // ---------------------------------------------------------------------------
       
   227 // Move current reorder index
       
   228 // ---------------------------------------------------------------------------
       
   229 //
       
   230 void CMPXCollectionViewListBoxArray::MoveReorderIndex( TInt aDirection )
       
   231     {
       
   232     MPX_FUNC( "CMPXCollectionViewListBoxArray::MoveReorderIndex" );
       
   233     if ( iReorder )
       
   234         {
       
   235         if ( ( aDirection == 1 ) && ( iMovedIndex < MdcaCount() - 1 ) )
       
   236             {
       
   237             iMovedIndex++;
       
   238             }
       
   239         else if ( ( aDirection == -1 ) && ( iMovedIndex > 0 ) )
       
   240             {
       
   241             iMovedIndex--;
       
   242             }
       
   243         }
       
   244     }
       
   245 
       
   246 // ---------------------------------------------------------------------------
       
   247 // Set current reorder index
       
   248 // ---------------------------------------------------------------------------
       
   249 //
       
   250 void CMPXCollectionViewListBoxArray::SetReorderIndex( TInt aIndex )
       
   251     {
       
   252     MPX_FUNC( "CMPXCollectionViewListBoxArray::SetReorderIndex" );
       
   253     iMovedIndex = aIndex;
       
   254     }
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // Confirm reorder
       
   258 // ---------------------------------------------------------------------------
       
   259 //
       
   260 void CMPXCollectionViewListBoxArray::ConfirmReorderL()
       
   261     {
       
   262     MPX_FUNC( "CMPXCollectionViewListBoxArray::ConfirmReorderL" );
       
   263     CMPXMedia* origMedia( iMedia->AtL( iOriginalIndex ) );
       
   264     CMPXMedia* entry( CMPXMedia::NewL( *origMedia ) );
       
   265     iMedia->Remove( iOriginalIndex );
       
   266     iMedia->Insert( entry, iMovedIndex ); // iMedia takes ownership
       
   267     if ( iMoveNowPlaying )
       
   268         {
       
   269         iIndex = iMovedIndex;
       
   270         iMoveNowPlaying = EFalse;
       
   271         }
       
   272     iOriginalIndex = KErrNotFound;
       
   273     iMovedIndex = KErrNotFound;
       
   274     }
       
   275 
       
   276 // ---------------------------------------------------------------------------
       
   277 // Cancel reorder
       
   278 // ---------------------------------------------------------------------------
       
   279 //
       
   280 void CMPXCollectionViewListBoxArray::CancelReorder()
       
   281     {
       
   282     MPX_FUNC( "CMPXCollectionViewListBoxArray::CancelReorder" );
       
   283     iOriginalIndex = KErrNotFound;
       
   284     iMovedIndex = KErrNotFound;
       
   285     }
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // Gets original index of currently selected item
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 TInt CMPXCollectionViewListBoxArray::GetOriginalIndex() const
       
   292     {
       
   293     MPX_FUNC( "CMPXCollectionViewListBoxArray::GetOriginalIndex" );
       
   294     return iOriginalIndex;
       
   295     }
       
   296 
       
   297 // ---------------------------------------------------------------------------
       
   298 // Gets the index for the song that's currently playing
       
   299 // ---------------------------------------------------------------------------
       
   300 //
       
   301 TInt CMPXCollectionViewListBoxArray::GetPlaybackIndex() const
       
   302     {
       
   303     MPX_FUNC( "CMPXCollectionViewListBoxArray::GetPlaybackIndex" );
       
   304     return iIndex;
       
   305     }
       
   306 
       
   307 // -----------------------------------------------------------------------------
       
   308 // Indicates if Unknown entry exists in this view
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 TBool CMPXCollectionViewListBoxArray::IsCategoryUnknownExist() const
       
   312     {
       
   313     return iIsUnknownExist;
       
   314     }
       
   315 
       
   316 // -----------------------------------------------------------------------------
       
   317 // Checks if the current item is a broken link
       
   318 // -----------------------------------------------------------------------------
       
   319 //
       
   320 TBool CMPXCollectionViewListBoxArray::IsItemBrokenLinkL( TInt aIndex ) const
       
   321     {
       
   322     TBool ret( EFalse );
       
   323     if ( iMedia )
       
   324         {
       
   325         CMPXMedia* entry( iMedia->AtL( aIndex ) );
       
   326         TUint flags( 0 );
       
   327         if( entry->IsSupported( KMPXMediaGeneralFlags ) )
       
   328             {
       
   329             flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
       
   330             ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) );
       
   331             }
       
   332         }
       
   333     return ret;
       
   334     }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // Checks if the current item is corrupted
       
   338 // -----------------------------------------------------------------------------
       
   339 //
       
   340 TBool CMPXCollectionViewListBoxArray::IsItemCorruptedL( TInt aIndex ) const
       
   341     {
       
   342     TBool ret( EFalse );
       
   343     if ( iMedia )
       
   344         {
       
   345         CMPXMedia* entry( iMedia->AtL( aIndex ) );
       
   346         TUint flags( 0 );
       
   347         if( entry->IsSupported( KMPXMediaGeneralFlags ) )
       
   348             {
       
   349             flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
       
   350             ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
       
   351             }
       
   352         }
       
   353     return ret;
       
   354     }
       
   355 
       
   356 // -----------------------------------------------------------------------------
       
   357 // CMPXCollectionViewListBoxArray::IndicationIconIndices
       
   358 // Get array of indicator icon indices at the specified view index
       
   359 // Only used when using Hitchcock container.
       
   360 // -----------------------------------------------------------------------------
       
   361 //
       
   362 RArray<TInt> CMPXCollectionViewListBoxArray::IndicatorIconIndicesL(
       
   363     TInt aIndex )
       
   364     {
       
   365     RArray<TInt> iconIndices;
       
   366 
       
   367     TInt index( GetArrayIndexForListBoxIndex( aIndex ) );
       
   368     CMPXMedia* entry( iMedia->AtL( index ) );
       
   369 
       
   370     TMPXGeneralType type( EMPXNoType );
       
   371     if ( entry->IsSupported( KMPXMediaGeneralType ) )
       
   372         {
       
   373         type = entry->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
       
   374         }
       
   375     TMPXGeneralCategory category( EMPXNoCategory );
       
   376     if ( entry->IsSupported( KMPXMediaGeneralCategory ) )
       
   377         {
       
   378         category = entry->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
       
   379         }
       
   380     TUint flags(0);
       
   381     if ( entry->IsSupported( KMPXMediaGeneralFlags ) )
       
   382         {
       
   383         flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
       
   384         }
       
   385 
       
   386     // reorder icon
       
   387     if ( ( iReorder ) && ( aIndex == iMovedIndex ) )
       
   388         {
       
   389         iconIndices.Append( GetReorderIcon() );
       
   390         }
       
   391     else if ( !iReorderActivated )
       
   392         {
       
   393         // playback status icon
       
   394         if ( iIndex == index )
       
   395             {
       
   396             switch ( iPbState )
       
   397                 {
       
   398                 case EPbStatePlaying:
       
   399                     {
       
   400                     iconIndices.Append( EMPXClvIconPlay );
       
   401                     break;
       
   402                     }
       
   403                 case EPbStatePaused:
       
   404                     {
       
   405                     iconIndices.Append( EMPXClvIconPause );
       
   406                     break;
       
   407                     }
       
   408                 default:
       
   409                     {
       
   410                     // other playback states, not handled
       
   411                     break;
       
   412                     }
       
   413                 }
       
   414             }
       
   415         }
       
   416 
       
   417     if ( category == EMPXSong && type == EMPXItem )
       
   418         {
       
   419         if ( flags & KMPXMediaGeneralFlagsIsInvalid )
       
   420             {
       
   421             iconIndices.Append( EMPXClvIconBrokenTrack );
       
   422             }
       
   423         else if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
       
   424             {
       
   425             iconIndices.Append( EMPXClvIconCorruptTrack );
       
   426             }
       
   427         else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
       
   428             {
       
   429             iconIndices.Append( EMPXClvIconDrmExpired );
       
   430             }
       
   431         }
       
   432     else if ( category == EMPXPlaylist )
       
   433         {
       
   434         if ( flags & KMPXMediaGeneralFlagsIsInvalid )
       
   435             {
       
   436             iconIndices.Append( EMPXClvIconBrokenPlaylist );
       
   437             }
       
   438         }
       
   439 
       
   440     TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
       
   441     if ( driveNum == iMMCDrive )
       
   442         {
       
   443         // The MMC icon is displayed in the first Indicator slot
       
   444         iconIndices.Append( EMPXClvIconMMC );
       
   445         }
       
   446 
       
   447     return iconIndices;
       
   448     }
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // CMPXCollectionViewListBoxArray::MdcaPoint
       
   452 // indexes into a descriptor array.
       
   453 // -----------------------------------------------------------------------------
       
   454 //
       
   455 TPtrC CMPXCollectionViewListBoxArray::MdcaPoint( TInt aIndex ) const
       
   456     {
       
   457     //MPX_FUNC( "CMPXCollectionViewListBoxArray::MdcaPoint" );
       
   458     //MPX_DEBUG2( "CMPXCollectionViewListBoxArray::MdcaPoint media count %d", iMedia->Count() );
       
   459     TPtrC item( KNullDesC );
       
   460     TRAP_IGNORE( item.Set( GetMdcaPointL( aIndex ) ) );
       
   461     return item;
       
   462     }
       
   463 
       
   464 // -----------------------------------------------------------------------------
       
   465 // CMPXCollectionViewListBoxArray::CreateIconArrayL
       
   466 // creates icon array.
       
   467 // -----------------------------------------------------------------------------
       
   468 //
       
   469 CAknIconArray* CMPXCollectionViewListBoxArray::CreateIconArrayL()
       
   470     {
       
   471     MPX_FUNC( "CMPXCollectionViewListBoxArray::CreateIconArrayL" );
       
   472     TParse mbmFileName;
       
   473     mbmFileName.Set( KMPXCollectionViewIconFile,
       
   474                      &KDC_APP_RESOURCE_DIR, NULL );
       
   475     TFileName iconFile( mbmFileName.FullName() );
       
   476     User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
       
   477 
       
   478 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
       
   479     // Prepare icon array for listbox
       
   480     CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 27 ); // magic: array granularity
       
   481 #else
       
   482     // Prepare icon array for listbox
       
   483     CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 26 ); // magic: array granularity
       
   484 #endif
       
   485 
       
   486     // Update the enums when this list is updated
       
   487     AppendColorIconToArrayL( iconArray,
       
   488         KAknsIIDQgnIndiMarkedAdd,
       
   489         KAknsIIDNone,
       
   490         EAknsMinorNone,
       
   491         KAvkonBitmapFile,
       
   492         EMbmAvkonQgn_indi_marked_add,
       
   493         EMbmAvkonQgn_indi_marked_add_mask);
       
   494    AppendColorIconToArrayL( iconArray,
       
   495         KAknsIIDQgnPropEmpty,
       
   496         KAknsIIDNone,
       
   497         EAknsMinorNone,
       
   498         KAvkonBitmapFile,
       
   499         EMbmAvkonQgn_prop_empty,
       
   500         EMbmAvkonQgn_prop_empty_mask);
       
   501     AppendColorIconToArrayL( iconArray,
       
   502         KAknsIIDQgnPropMupSongs,
       
   503         KAknsIIDNone,
       
   504         EAknsMinorNone,
       
   505         iconFile,
       
   506         EMbmMpxcollectionviewhgQgn_prop_mup_songs,
       
   507         EMbmMpxcollectionviewhgQgn_prop_mup_songs_mask );
       
   508     AppendColorIconToArrayL( iconArray,
       
   509         KAknsIIDQgnPropMupArtist,
       
   510         KAknsIIDNone,
       
   511         EAknsMinorNone,
       
   512         iconFile,
       
   513         EMbmMpxcollectionviewhgQgn_prop_mup_artist,
       
   514         EMbmMpxcollectionviewhgQgn_prop_mup_artist_mask );
       
   515     AppendColorIconToArrayL( iconArray,
       
   516         KAknsIIDQgnPropMupAlbum,
       
   517         KAknsIIDNone,
       
   518         EAknsMinorNone,
       
   519         iconFile,
       
   520         EMbmMpxcollectionviewhgQgn_prop_mup_album,
       
   521         EMbmMpxcollectionviewhgQgn_prop_mup_album_mask );
       
   522     AppendColorIconToArrayL( iconArray,
       
   523         KAknsIIDQgnPropMupPlaylist,
       
   524         KAknsIIDNone,
       
   525         EAknsMinorNone,
       
   526         iconFile,
       
   527         EMbmMpxcollectionviewhgQgn_prop_mup_playlist,
       
   528         EMbmMpxcollectionviewhgQgn_prop_mup_playlist_mask);
       
   529     AppendColorIconToArrayL( iconArray,
       
   530         KAknsIIDQgnPropMupPlaylist,
       
   531         KAknsIIDNone,
       
   532         EAknsMinorNone,
       
   533         iconFile,
       
   534         EMbmMpxcollectionviewhgQgn_graf_mup_lst_userplayl,
       
   535         EMbmMpxcollectionviewhgQgn_graf_mup_lst_userplayl_mask );
       
   536     AppendColorIconToArrayL( iconArray,
       
   537         KAknsIIDQgnPropMupPlaylistAuto,
       
   538         KAknsIIDNone,
       
   539         EAknsMinorNone,
       
   540         iconFile,
       
   541         EMbmMpxcollectionviewhgQgn_prop_mup_playlist_auto,
       
   542         EMbmMpxcollectionviewhgQgn_prop_mup_playlist_auto_mask );
       
   543     AppendColorIconToArrayL( iconArray,
       
   544         KAknsIIDQgnPropMupGenre,
       
   545         KAknsIIDNone,
       
   546         EAknsMinorNone,
       
   547         iconFile,
       
   548         EMbmMpxcollectionviewhgQgn_prop_mup_genre,
       
   549         EMbmMpxcollectionviewhgQgn_prop_mup_genre_mask );
       
   550     AppendColorIconToArrayL( iconArray,
       
   551         KAknsIIDQgnPropMupComposer,
       
   552         KAknsIIDNone,
       
   553         EAknsMinorNone,
       
   554         iconFile,
       
   555         EMbmMpxcollectionviewhgQgn_prop_mup_composer,
       
   556         EMbmMpxcollectionviewhgQgn_prop_mup_composer_mask );
       
   557     AppendColorIconToArrayL( iconArray,
       
   558         KAknsIIDQgnMenuFolderApps,
       
   559         KAknsIIDNone,
       
   560         EAknsMinorNone,
       
   561         iconFile,
       
   562         EMbmMpxcollectionviewhgQgn_menu_folder_apps,
       
   563         EMbmMpxcollectionviewhgQgn_menu_folder_apps_mask );
       
   564     AppendColorIconToArrayL( iconArray,
       
   565         KAknsIIDQgnPropMupAudio,
       
   566         KAknsIIDNone,
       
   567         EAknsMinorNone,
       
   568         iconFile,
       
   569         EMbmMpxcollectionviewhgQgn_prop_mup_audio,
       
   570         EMbmMpxcollectionviewhgQgn_prop_mup_audio_mask );
       
   571     AppendColorIconToArrayL( iconArray,
       
   572         KAknsIIDNone,
       
   573         KAknsIIDNone,
       
   574         EAknsMinorNone,
       
   575         iconFile,
       
   576         EMbmMpxcollectionviewhgQgn_graf_mup_lst_corrupttrack,
       
   577         EMbmMpxcollectionviewhgQgn_graf_mup_lst_corrupttrack_mask );
       
   578     AppendColorIconToArrayL( iconArray,
       
   579         KAknsIIDNone,
       
   580         KAknsIIDNone,
       
   581         EAknsMinorNone,
       
   582         iconFile,
       
   583         EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokentrack,
       
   584         EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokentrack_mask );
       
   585     AppendColorIconToArrayL( iconArray,
       
   586         KAknsIIDNone,
       
   587         KAknsIIDNone,
       
   588         EAknsMinorNone,
       
   589         iconFile,
       
   590         EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokenplayl,
       
   591         EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokenplayl_mask );
       
   592     AppendColorIconToArrayL( iconArray,
       
   593         KAknsIIDNone,
       
   594         KAknsIIDNone,
       
   595         EAknsMinorNone,
       
   596         iconFile,
       
   597         EMbmMpxcollectionviewhgQgn_graf_mup_lst_drm_exp,
       
   598         EMbmMpxcollectionviewhgQgn_graf_mup_lst_drm_exp_mask );
       
   599     AppendColorIconToArrayL( iconArray,
       
   600         KAknsIIDQgnPropUnknown,
       
   601         KAknsIIDNone,
       
   602         EAknsMinorNone,
       
   603         iconFile,
       
   604         EMbmMpxcollectionviewhgQgn_prop_unknown,
       
   605         EMbmMpxcollectionviewhgQgn_prop_unknown_mask );
       
   606     AppendColorIconToArrayL( iconArray,
       
   607         KAknsIIDQgnIndiMmcAdd,
       
   608         KAknsIIDQsnIconColors,
       
   609         EAknsCIQsnIconColorsCG26,
       
   610         iconFile,
       
   611         EMbmMpxcollectionviewhgQgn_indi_mmc_add,
       
   612         EMbmMpxcollectionviewhgQgn_indi_mmc_add_mask );
       
   613     AppendColorIconToArrayL( iconArray,
       
   614         KAknsIIDQgnIndiMupPlay,
       
   615         KAknsIIDQsnIconColors,
       
   616         EAknsCIQsnIconColorsCG26,
       
   617         iconFile,
       
   618         EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_play,
       
   619         EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_play_mask );
       
   620     AppendColorIconToArrayL( iconArray,
       
   621         KAknsIIDQgnIndiMupPause,
       
   622         KAknsIIDQsnIconColors,
       
   623         EAknsCIQsnIconColorsCG26,
       
   624         iconFile,
       
   625         EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_pause,
       
   626         EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_pause_mask );
       
   627     AppendColorIconToArrayL( iconArray,
       
   628         KAknsIIDQgnIndiMupForwAdd,
       
   629         KAknsIIDQsnIconColors,
       
   630         EAknsCIQsnIconColorsCG26,
       
   631         iconFile,
       
   632         EMbmMpxcollectionviewhgQgn_indi_mup_forw_add,
       
   633         EMbmMpxcollectionviewhgQgn_indi_mup_forw_add_mask );
       
   634     AppendColorIconToArrayL( iconArray,
       
   635         KAknsIIDQgnIndiMupRewAdd,
       
   636         KAknsIIDQsnIconColors,
       
   637         EAknsCIQsnIconColorsCG26,
       
   638         iconFile,
       
   639         EMbmMpxcollectionviewhgQgn_indi_mup_rew_add,
       
   640         EMbmMpxcollectionviewhgQgn_indi_mup_rew_add_mask );
       
   641     AppendColorIconToArrayL( iconArray,
       
   642         KAknsIIDQgnIndiMmcAdd,
       
   643         KAknsIIDQsnIconColors,
       
   644         EAknsCIQsnIconColorsCG26,
       
   645         iconFile,
       
   646         EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_down,
       
   647         EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_down_mask );
       
   648     AppendColorIconToArrayL( iconArray,
       
   649         KAknsIIDQgnIndiMmcAdd,
       
   650         KAknsIIDQsnIconColors,
       
   651         EAknsCIQsnIconColorsCG26,
       
   652         iconFile,
       
   653         EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_up,
       
   654         EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_up_mask );
       
   655     AppendColorIconToArrayL( iconArray,
       
   656         KAknsIIDQgnIndiMmcAdd,
       
   657         KAknsIIDQsnIconColors,
       
   658         EAknsCIQsnIconColorsCG26,
       
   659         iconFile,
       
   660         EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_updown,
       
   661         EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_updown_mask );
       
   662 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
       
   663     AppendColorIconToArrayL( iconArray,
       
   664         KAknsIIDQgnGrafMupDlstPodcast,
       
   665         KAknsIIDNone,
       
   666         EAknsMinorNone,
       
   667         iconFile,
       
   668         EMbmMpxcollectionviewhgQgn_graf_mup_dlst_podcast,
       
   669         EMbmMpxcollectionviewhgQgn_graf_mup_dlst_podcast_mask );
       
   670 #endif
       
   671     AppendColorIconToArrayL( iconArray,
       
   672         KAknsIIDQgnIndiMupRandom,
       
   673         KAknsIIDNone,
       
   674         EAknsMinorNone,
       
   675         iconFile,
       
   676         EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_shuffle,
       
   677         EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_shuffle_mask );
       
   678 
       
   679     return iconArray;
       
   680     }
       
   681 
       
   682 // -----------------------------------------------------------------------------
       
   683 // CMPXCollectionViewListBoxArray::AppendMediaL
       
   684 // Appends media array to the current array
       
   685 // -----------------------------------------------------------------------------
       
   686 //
       
   687 void CMPXCollectionViewListBoxArray::AppendMediaL( const CMPXMedia& aMedia )
       
   688     {
       
   689     MPX_FUNC( "CMPXCollectionViewListBoxArray::AppendMediaL" );
       
   690     if ( iMediaOwned )
       
   691         {
       
   692         delete iMediaOwned;
       
   693         iMediaOwned = NULL;
       
   694         }
       
   695     CMPXCommonListBoxArrayBase::AppendMediaL( aMedia );
       
   696     iIsUnknownExist = EFalse;
       
   697 
       
   698     if ( iMedia )
       
   699         {
       
   700         TInt entriesCount( iMedia->Count() );
       
   701         if ( entriesCount > 0 )
       
   702             {
       
   703             // check if the last entry is "unknown" entry
       
   704             // if the last entry has a length of 0, then it's
       
   705             // "unknown" category and needs to be localized
       
   706             CMPXMedia* origMedia( iMedia->AtL( entriesCount - 1 ) );
       
   707             if ( origMedia->ValueText(
       
   708                 KMPXMediaGeneralTitle ).Length() == 0 )
       
   709                 {
       
   710                 iIsUnknownExist = ETrue;
       
   711                 }
       
   712             }
       
   713         }
       
   714     if ( iContainerMedia )
       
   715         {
       
   716         if ( iContainerMedia->IsSupported( KMPXMediaGeneralTitle ) )
       
   717             {
       
   718             if ( iContainerMedia->ValueText(
       
   719                 KMPXMediaGeneralTitle ).Length() == 0 )
       
   720                 {
       
   721                 TMPXGeneralCategory containerCategory(
       
   722                     iContainerMedia->ValueTObjectL<TMPXGeneralCategory>(
       
   723                         KMPXMediaGeneralCategory ) );
       
   724                 HBufC* text( NULL );
       
   725                 switch ( containerCategory )
       
   726                     {
       
   727                     case EMPXArtist:
       
   728                         {
       
   729                         text = StringLoader::LoadLC(
       
   730                             R_MPX_QTN_NMP_UNKNOWN_ARTIST );
       
   731                         break;
       
   732                         }
       
   733                     case EMPXAlbum:
       
   734                         {
       
   735                         text = StringLoader::LoadLC(
       
   736                             R_MPX_QTN_MUS_TITLE_UNKNOWN_ALBUM );
       
   737                         break;
       
   738                         }
       
   739                     case EMPXGenre:
       
   740                         {
       
   741                         text = StringLoader::LoadLC(
       
   742                             R_MPX_QTN_MUS_TITLE_UNKNOWN_GENRE );
       
   743                         break;
       
   744                         }
       
   745                     case EMPXComposer:
       
   746                         {
       
   747                         text = StringLoader::LoadLC(
       
   748                             R_MPX_QTN_MUS_TITLE_UNKNOWN_COMPOSER );
       
   749                         break;
       
   750                         }
       
   751                     default:
       
   752                         {
       
   753                         text = StringLoader::LoadLC(
       
   754                             R_MPX_QTN_MP_UNKNOWN );
       
   755                         break;
       
   756                         }
       
   757                     }
       
   758                 iContainerMedia->SetTextValueL(
       
   759                     KMPXMediaGeneralTitle, *text );
       
   760                 CleanupStack::PopAndDestroy( text );
       
   761                 }
       
   762             }
       
   763         }
       
   764     }
       
   765 
       
   766 // -----------------------------------------------------------------------------
       
   767 // Append icon to array
       
   768 // -----------------------------------------------------------------------------
       
   769 //
       
   770 void CMPXCollectionViewListBoxArray::AppendColorIconToArrayL(
       
   771     CAknIconArray* aArray,
       
   772     const TAknsItemID& aID,
       
   773     const TAknsItemID& aColorId,
       
   774     TInt aColorIndex,
       
   775     const TDesC& aMbmFile,
       
   776     TInt aBitmapId,
       
   777     TInt aMaskId )
       
   778     {
       
   779     MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
       
   780 
       
   781     CFbsBitmap* bitmap( NULL );
       
   782     CFbsBitmap* mask( NULL );
       
   783 
       
   784     if ( aColorId == KAknsIIDNone )
       
   785         {
       
   786         // do not use theme color, use the default color from the file
       
   787         AknsUtils::CreateIconLC( skin, aID,
       
   788             bitmap, mask, aMbmFile, aBitmapId, aMaskId );
       
   789         }
       
   790     else
       
   791         {
       
   792         // use theme color
       
   793         AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
       
   794             bitmap, mask, aMbmFile, aBitmapId, aMaskId, KRgbBlack );
       
   795         }
       
   796 
       
   797     CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
       
   798     icon->SetBitmapsOwnedExternally( EFalse );
       
   799 
       
   800     // icon now owns the bitmaps, no need to keep on cleanup stack.
       
   801     CleanupStack::Pop( 2 ); // mask, bitmap
       
   802 
       
   803     CleanupStack::PushL( icon );
       
   804     aArray->AppendL( icon );
       
   805     // aArray now owns the icon, no need to delete.
       
   806     CleanupStack::Pop( icon );
       
   807     }
       
   808 
       
   809 // -----------------------------------------------------------------------------
       
   810 // Maps list box index to array index in reorder mode
       
   811 // -----------------------------------------------------------------------------
       
   812 //
       
   813 TInt CMPXCollectionViewListBoxArray::GetArrayIndexForListBoxIndex(
       
   814     TInt aIndex ) const
       
   815     {
       
   816     TInt index( aIndex );
       
   817 
       
   818     if ( ( iReorder ) && ( iOriginalIndex != iMovedIndex ) )
       
   819         {
       
   820         if ( iMovedIndex > iOriginalIndex )
       
   821             {
       
   822             // moved down
       
   823             if ( aIndex < iOriginalIndex )
       
   824                 {
       
   825                 // do nothing
       
   826                 }
       
   827             else if ( aIndex > iMovedIndex )
       
   828                 {
       
   829                 // do nothing
       
   830                 }
       
   831             else if ( aIndex < iMovedIndex )
       
   832                 {
       
   833                 // between original index and moved index
       
   834                 index = aIndex + 1;
       
   835                 }
       
   836             else if ( aIndex == iMovedIndex )
       
   837                 {
       
   838                 index = iOriginalIndex;
       
   839                 }
       
   840             }
       
   841         else
       
   842             {
       
   843             // moved up
       
   844             if ( aIndex > iOriginalIndex )
       
   845                 {
       
   846                 // do nothing
       
   847                 }
       
   848             else if ( aIndex < iMovedIndex )
       
   849                 {
       
   850                 // do nothing
       
   851                 }
       
   852             else if ( aIndex > iMovedIndex )
       
   853                 {
       
   854                 // between original index and moved index
       
   855                 index = aIndex - 1;
       
   856                 }
       
   857             else if ( aIndex == iMovedIndex )
       
   858                 {
       
   859                 index = iOriginalIndex;
       
   860                 }
       
   861             }
       
   862         }
       
   863 
       
   864     return index;
       
   865     }
       
   866 
       
   867 // -----------------------------------------------------------------------------
       
   868 // Get reorder icon
       
   869 // -----------------------------------------------------------------------------
       
   870 //
       
   871 TBool CMPXCollectionViewListBoxArray::GetReorderIcon() const
       
   872     {
       
   873     TInt icon( EMPXClvIconNone );
       
   874 
       
   875     // Determine the icon to display
       
   876     if ( iReorder )
       
   877         {
       
   878         if ( iMovedIndex == 0 )
       
   879             {
       
   880             icon = EMPXClvIconReorderDown;
       
   881             }
       
   882         else if ( MdcaCount() - 1 == iMovedIndex )
       
   883             {
       
   884             icon = EMPXClvIconReorderUp;
       
   885             }
       
   886         else
       
   887             {
       
   888             icon = EMPXClvIconReorderUpDown;
       
   889             }
       
   890         }
       
   891     return icon;
       
   892     }
       
   893 
       
   894 // -----------------------------------------------------------------------------
       
   895 // CMPXCollectionViewListBoxArray::GetMdcaPointL
       
   896 // indexes into a descriptor array.
       
   897 // -----------------------------------------------------------------------------
       
   898 //
       
   899 TPtrC CMPXCollectionViewListBoxArray::GetMdcaPointL( TInt aIndex ) const
       
   900     {
       
   901     TInt index( GetArrayIndexForListBoxIndex( aIndex ) );
       
   902     TPtrC item( KNullDesC );
       
   903     CMPXMedia* entry( iMedia->AtL( index ) );
       
   904     if( entry->IsSupported( KMPXMediaGeneralTitle ) )
       
   905         {
       
   906         TPtrC title( entry->ValueText( KMPXMediaGeneralTitle ) );
       
   907         if ( IsCategoryUnknownExist() && aIndex== MdcaCount() - 1 && title.Length()==0 )
       
   908             {
       
   909             title.Set( *iUnknown );
       
   910             }
       
   911 
       
   912         TMPXGeneralType type( EMPXNoType );
       
   913         if( entry->IsSupported( KMPXMediaGeneralType ) )
       
   914             {
       
   915             type = entry->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
       
   916             }
       
   917         TMPXGeneralCategory category( EMPXNoCategory );
       
   918         if( entry->IsSupported( KMPXMediaGeneralCategory ) )
       
   919             {
       
   920             category = entry->ValueTObjectL<TMPXGeneralCategory>(
       
   921                         KMPXMediaGeneralCategory );
       
   922             }
       
   923         TUint flags(0);
       
   924         if( entry->IsSupported( KMPXMediaGeneralFlags ) )
       
   925             {
       
   926             flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
       
   927             }
       
   928         //MPX_DEBUG3( "CMPXCollectionViewListBoxArray::MdcaPoint (%d) Name: %S", aIndex, &title );
       
   929         //MPX_DEBUG4( "CMPXCollectionViewListBoxArray::MdcaPoint (%d) Type: %d, Category: %d", aIndex, type, category );
       
   930         TInt iconID( EMPXClvIconNone );
       
   931         switch( category )
       
   932             {
       
   933             case EMPXSong:
       
   934                 {
       
   935                 if ( type == EMPXGroup )
       
   936                     {
       
   937                     iconID = EMPXClvIconSongs;
       
   938                     }
       
   939                 else
       
   940                     {
       
   941                     TUint flags(0);
       
   942                     if( entry->IsSupported( KMPXMediaGeneralFlags ) )
       
   943                         {
       
   944                         flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
       
   945                         }
       
   946                     if ( flags & KMPXMediaGeneralFlagsIsInvalid )
       
   947                         {
       
   948                         iconID = EMPXClvIconBrokenTrack;
       
   949                         }
       
   950                     else if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
       
   951                         {
       
   952                         iconID = EMPXClvIconCorruptTrack;
       
   953                         }
       
   954                     else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
       
   955                         {
       
   956                         iconID = EMPXClvIconDrmExpired;
       
   957                         }
       
   958                     else
       
   959                         {
       
   960                         iconID = EMPXClvIconAudio;
       
   961                         }
       
   962                     }
       
   963                 break;
       
   964                 }
       
   965             case EMPXArtist:
       
   966                 {
       
   967                 iconID = EMPXClvIconArtist;
       
   968                 break;
       
   969                 }
       
   970             case EMPXAlbum:
       
   971                 {
       
   972                 iconID = EMPXClvIconAlbum;
       
   973                 if ( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
       
   974                     iContainerMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) )
       
   975                     {
       
   976                     // if id == containerid, "all" under artist/album
       
   977                     iconID = EMPXClvIconSongs;
       
   978                     }
       
   979                 break;
       
   980                 }
       
   981             case EMPXPlaylist:
       
   982                 {
       
   983                 if ( flags & KMPXMediaGeneralFlagsIsInvalid )
       
   984                     {
       
   985                     iconID = EMPXClvIconBrokenPlaylist;
       
   986                     }
       
   987                 else
       
   988                     {
       
   989                     if ( type == EMPXGroup )
       
   990                         {
       
   991                         iconID = EMPXClvIconPlaylist;
       
   992                         }
       
   993                     else
       
   994                         {
       
   995                         iconID = EMPXClvIconUserPlaylist;
       
   996                         }
       
   997                     if ( type == EMPXItem )
       
   998                         {
       
   999                         if ( entry->IsSupported(
       
  1000                             KMPXMediaGeneralNonPermissibleActions ) )
       
  1001                             {
       
  1002                             // check for auto playlist and display a different icon
       
  1003                             TMPXGeneralNonPermissibleActions attr(
       
  1004                                 entry->ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  1005                                     KMPXMediaGeneralNonPermissibleActions ) );
       
  1006                             if ( attr & EMPXWrite )
       
  1007                                 {
       
  1008                                 iconID = EMPXClvIconPlaylistAuto;
       
  1009                                 }
       
  1010                             }
       
  1011                         }
       
  1012                     }
       
  1013                 break;
       
  1014                 }
       
  1015             case EMPXGenre:
       
  1016                 {
       
  1017                 iconID = EMPXClvIconGenre;
       
  1018                 break;
       
  1019                 }
       
  1020             case EMPXComposer:
       
  1021                 {
       
  1022                 iconID = EMPXClvIconComposer;
       
  1023                 break;
       
  1024                 }
       
  1025 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
       
  1026             case EMPXPodcast:
       
  1027                 {
       
  1028                 iconID = EMPXClvIconPodcasts;
       
  1029                 break;
       
  1030                 }
       
  1031 #endif
       
  1032             case EMPXFile:
       
  1033                 {
       
  1034                 // a group of files is a folder
       
  1035                 iconID = EMPXClvIconFolder;
       
  1036                 break;
       
  1037                 }
       
  1038 
       
  1039             default:
       
  1040                 {
       
  1041                 // unknown folder icon
       
  1042                 iconID = EMPXClvIconUnknowFile;
       
  1043                 break;
       
  1044                 }
       
  1045             }
       
  1046         TPtr ptr = iItem->Des();
       
  1047         ptr.Zero();
       
  1048 
       
  1049         ptr.Format( KMPXCommonListboxFormatString, iconID, &title );
       
  1050 
       
  1051         iconID = EMPXClvIconNone;
       
  1052         // reorder icon
       
  1053         if ( ( iReorder ) && ( aIndex == iMovedIndex ) )
       
  1054             {
       
  1055             iconID = GetReorderIcon();
       
  1056             }
       
  1057         else if ( !iReorderActivated )
       
  1058             {
       
  1059             // playback status icon
       
  1060             if ( iIndex == index )
       
  1061                 {
       
  1062                 switch ( iPbState )
       
  1063                     {
       
  1064                     case EPbStatePlaying:
       
  1065                         {
       
  1066                         iconID = EMPXClvIconPlay;
       
  1067                         break;
       
  1068                         }
       
  1069                     case EPbStatePaused:
       
  1070                         {
       
  1071                         iconID = EMPXClvIconPause;
       
  1072                         break;
       
  1073                         }
       
  1074                     case EPbStateSeekingForward:
       
  1075                         {
       
  1076                         iconID = EMPXClvIconForward;
       
  1077                         break;
       
  1078                         }
       
  1079                     case EPbStateSeekingBackward:
       
  1080                         {
       
  1081                         iconID = EMPXClvIconRewind;
       
  1082                         break;
       
  1083                         }
       
  1084                     default:
       
  1085                         {
       
  1086                         // other playback states, not handled
       
  1087                         break;
       
  1088                         }
       
  1089                     }
       
  1090                 }
       
  1091             }
       
  1092         else
       
  1093             {
       
  1094             // Do nothing
       
  1095             }
       
  1096 
       
  1097         if ( iconID != EMPXClvIconNone )
       
  1098             {
       
  1099             ptr.Append( KMPXTab );
       
  1100             ptr.AppendNum( iconID );
       
  1101             }
       
  1102 
       
  1103         // mmc icon
       
  1104         TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
       
  1105         if ( driveNum == iMMCDrive )
       
  1106             {
       
  1107             ptr.Append( KMPXTab );
       
  1108             ptr.AppendNum( EMPXClvIconMMC );
       
  1109             }
       
  1110 
       
  1111         item.Set( *iItem );
       
  1112         }
       
  1113     return item;
       
  1114     }
       
  1115 
       
  1116 // ---------------------------------------------------------------------------
       
  1117 // Sets playback status
       
  1118 // ---------------------------------------------------------------------------
       
  1119 //
       
  1120 TInt CMPXCollectionViewListBoxArray::SetPlaybackStatusByIndex(
       
  1121     TInt aIndex, TMPXPlaybackState aStatus )
       
  1122     {
       
  1123     MPX_FUNC( "CMPXCollectionViewListBoxArray::SetPlaybackStatusByIndex" );
       
  1124     TInt ret( iIndex );
       
  1125     iIndex = aIndex;
       
  1126 
       
  1127     // Not to display seeking icons for seeking mode
       
  1128     if ( aStatus != EPbStateSeekingForward &&
       
  1129         aStatus != EPbStateSeekingBackward )
       
  1130         {
       
  1131         iPbState = aStatus;
       
  1132         }
       
  1133     return ret;
       
  1134     }
       
  1135 
       
  1136 //  End of File