upnpframework/upnpcommonui/src/upnpadvfindresultwindow.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2005 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:  Find results dialog class source code
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 // System
       
    21 #include <featmgr.h>
       
    22 #include <akntabgrp.h>
       
    23 #include <StringLoader.h>
       
    24 #include <aknlists.h>
       
    25 #include <commondialogs.mbg>
       
    26 #include <aknnotewrappers.h>
       
    27 #include <mmf/common/mmfcontrollerpluginresolver.h>
       
    28 
       
    29 // upnp stack api's
       
    30 #include <upnpitem.h>
       
    31 #include <upnpobject.h>
       
    32 #include <upnpstring.h>
       
    33 #include <collate.h>
       
    34 
       
    35 // upnpframework / avcontroller api
       
    36 #include "upnpavcontroller.h"   //start browse session and rendering session
       
    37 #include "upnpavbrowsingsession.h"
       
    38 #include "upnpavrenderingsession.h"
       
    39 #include "upnpavdevice.h"
       
    40 
       
    41 // upnpframework / avcontroller helper api
       
    42 #include "upnpconstantdefs.h" // upnp definitions
       
    43 #include "upnpitemutility.h"
       
    44 
       
    45 // upnpframework / internal api's
       
    46 #include "upnpcommonutils.h"
       
    47 #include "upnpfiletransferengine.h"
       
    48 #include "upnpmusicadapter.h"
       
    49 #include "upnpplaylistfiller.h"
       
    50 
       
    51 // common ui internal
       
    52 #include <hlplch.h>
       
    53 #include <upnpcommonui.mbg>
       
    54 #include <upnpcommonui.rsg>
       
    55 #include "upnpadvfindresultwindow.h"
       
    56 #include "upnpcommonui.hrh"
       
    57 #include "upnpimageplayer.h"
       
    58 #include "upnplocalplayer.h"
       
    59 #include "upnpcommonui.h"
       
    60 #include "upnpperiodic.h"
       
    61 
       
    62 _LIT( KComponentLogfile, "commonui.txt");
       
    63 #include "upnplog.h"
       
    64 
       
    65 //CONSTANTS
       
    66 _LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" );
       
    67 const TInt KMbmFileBufferSize = 256;
       
    68 _LIT8( KUnknown,    "Unknown" );
       
    69 _LIT( KUPNP_HLP_SEARCH, "UPNP_HLP_SEARCH" );
       
    70 
       
    71 // Format string for image not showing
       
    72 _LIT( KImageFormatString,  "%d\t%S\t\t" );
       
    73 
       
    74 // Format string for image showing
       
    75 _LIT( KImageShowingFormatString, "%d\t%S\t\t%d" );
       
    76 
       
    77 const TInt KLength = 100;
       
    78 
       
    79 // The delay from the Start() function of CPeriodic class 
       
    80 // to the generation of the first event, in microseconds.
       
    81 const TInt KImageTimerDelay = 800000;
       
    82 
       
    83 // A callback specifying a function to be called 
       
    84 // when the CPeriodic is scheduled after a timer event, in microseconds.
       
    85 const TInt KImageTimerInterval = 800000;
       
    86 
       
    87 enum TUPnPIconTypes
       
    88     {
       
    89     EUPnPIconMusic = 1,
       
    90     EUPnPIconVideo,
       
    91     EUPnPIconImage,
       
    92     EUPnPIconImageShowing,
       
    93     EUPnPIconOther,
       
    94     EUPnPIconLast
       
    95     };
       
    96 
       
    97 
       
    98 // ================= MEMBER FUNCTIONS =======================
       
    99 
       
   100 // --------------------------------------------------------------------------
       
   101 // CAdvancedFindResultWindow::NewL
       
   102 // Two-phased constructor.
       
   103 // --------------------------------------------------------------------------
       
   104 //
       
   105 CAdvancedFindResultWindow* CAdvancedFindResultWindow::NewL(
       
   106                                     TInt aMenuResource,
       
   107                                     RPointerArray<CUpnpObject>& aResultArray,
       
   108                                     MUPnPAVController& aAVControl,
       
   109                                     MUPnPAVBrowsingSession& aBrowseSession,
       
   110                                     CUPnPCommonUI& aCommonUI )
       
   111     {    
       
   112     CAdvancedFindResultWindow* self = new(ELeave) CAdvancedFindResultWindow(
       
   113                                                             aAVControl,
       
   114                                                             aBrowseSession,
       
   115                                                             aCommonUI );
       
   116     CleanupStack::PushL( self );
       
   117     self->ConstructL( aMenuResource, aResultArray );
       
   118     CleanupStack::Pop();
       
   119     return self;
       
   120     }
       
   121 
       
   122 // --------------------------------------------------------------------------
       
   123 // CAdvancedFindResultWindow::ConstructL
       
   124 // Symbian 2nd phase constructor can leave.
       
   125 // --------------------------------------------------------------------------
       
   126 //
       
   127 
       
   128 void CAdvancedFindResultWindow::ConstructL( 
       
   129                                 TInt aMenuResource,
       
   130                                 RPointerArray<CUpnpObject>& aResultArray )
       
   131     {
       
   132 
       
   133 
       
   134 
       
   135     iTargetDevice = CUpnpAVDevice::NewL();
       
   136     
       
   137     iImageControlTimer = CUPnPPeriodic::NewL( CActive::EPriorityUserInput );
       
   138         
       
   139     //iCommonUI = CUPnPCommonUI::NewL();
       
   140 
       
   141     for( TInt index = 0; index < aResultArray.Count(); index++ )
       
   142         {
       
   143         iResultArray.AppendL( aResultArray[index] );
       
   144         }
       
   145             
       
   146     CAknDialog::ConstructL( aMenuResource );
       
   147     }
       
   148 
       
   149 // --------------------------------------------------------------------------
       
   150 // CAdvancedFindResultWindow::CAdvancedFindResultWindow
       
   151 // C++ default constructor can NOT contain any code, that
       
   152 // might leave.
       
   153 // --------------------------------------------------------------------------
       
   154 
       
   155 CAdvancedFindResultWindow::CAdvancedFindResultWindow(
       
   156                                     MUPnPAVController& aAVControl,
       
   157                                     MUPnPAVBrowsingSession& aBrowseSession,
       
   158                                     CUPnPCommonUI& aCommonUI ):
       
   159                                     iBrowseSession(aBrowseSession),
       
   160                                     iAVControl(aAVControl),
       
   161                                     iCommonUI(aCommonUI)
       
   162     {
       
   163     iSourceDevice = &( iBrowseSession.Device() );
       
   164     iChildDialogOpen = 0;
       
   165     iMSDisappear = EFalse;
       
   166     iAction = CUPnPCommonUI::EUPnPNone;
       
   167     iIsMusicItem = EFalse;
       
   168     iLastImageItemIndex = KErrNotFound;
       
   169     iHashKeyFlag = EFalse;   
       
   170     }
       
   171 
       
   172 // Destructor
       
   173 CAdvancedFindResultWindow::~CAdvancedFindResultWindow()
       
   174     {
       
   175     if ( iNaviDecorator && iNaviPane )
       
   176         {
       
   177         iNaviPane->Pop( iNaviDecorator );
       
   178         }
       
   179     delete iNaviDecorator;
       
   180     
       
   181     iResultArray.Close();
       
   182     
       
   183     if ( iImagePlayer )
       
   184         {
       
   185         iImagePlayer->Stop();
       
   186         delete iImagePlayer;
       
   187         }
       
   188     delete iLocalPlayer;
       
   189     
       
   190     if ( iImageControlTimer )  
       
   191         {
       
   192         iImageControlTimer->Cancel();
       
   193         delete iImageControlTimer;
       
   194         }
       
   195         
       
   196     delete iTargetDevice;
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------
       
   200 // CAdvancedFindResultWindow::OkToExitL( TInt aButtonId )
       
   201 // called by framework when the softkey is pressed
       
   202 // ---------------------------------------------------------
       
   203 //
       
   204 
       
   205 TBool CAdvancedFindResultWindow::OkToExitL( TInt aButtonId )
       
   206     {
       
   207     // Translate the button presses into commands for the appui & current
       
   208     // view to handle
       
   209     
       
   210     switch ( aButtonId )        
       
   211         {                
       
   212         case EAknSoftkeyOk:
       
   213             {
       
   214             if ( iResultArray.Count() > 0 )
       
   215                 {
       
   216                 TRAPD( error, ShowPlayExtL() );
       
   217                 HandleErrorL( error );
       
   218                 }            
       
   219             break;
       
   220             }
       
   221         case EUPnPStopCmd:
       
   222             {
       
   223             StopImageControlL();
       
   224             break;
       
   225             }
       
   226         case EUPnPPlayCmd:
       
   227             {
       
   228             if( !iMusicPlay )
       
   229                 {
       
   230                 StopImageControlL();
       
   231                 TRAPD( error, PlayL( EFalse ) );
       
   232                 if( KErrNone != error )
       
   233                     {
       
   234                     iMusicPlay = EFalse;
       
   235                     }
       
   236                 HandleErrorL( error );
       
   237                 }           
       
   238             break;            
       
   239             }
       
   240         case EAknSoftkeyShow:
       
   241             {
       
   242             StopImageControlL();
       
   243             TRAPD( error, ShowVideoExtL() );
       
   244             HandleErrorL( error );
       
   245             break;
       
   246             }            
       
   247         case KErrSessionClosed: 
       
   248         case KErrDisconnected:
       
   249         case EAknCmdExit: // fall through
       
   250         case EAknSoftkeyBack:
       
   251             {
       
   252             iNaviPane->PushDefaultL();
       
   253             return ETrue;
       
   254             }
       
   255         case EAknSoftkeyOptions:
       
   256             {
       
   257             CAknDialog::DisplayMenuL();
       
   258             SetNaviPaneTextL();   
       
   259             break;
       
   260             }
       
   261         default:
       
   262             {
       
   263             break;
       
   264             }//switch (aButtonId) 
       
   265         }
       
   266     
       
   267     return EFalse;
       
   268     }
       
   269 
       
   270 // ---------------------------------------------------------
       
   271 // CAdvancedFindResultWindow::PreLayoutDynInitL()
       
   272 // called by framework before dialog is shown
       
   273 // ---------------------------------------------------------
       
   274 //
       
   275 void CAdvancedFindResultWindow::PreLayoutDynInitL()
       
   276     {
       
   277     iListBox = static_cast<CAknDoubleGraphicStyleListBox*>( 
       
   278                                             Control(EAdvFindResultBoxId) );
       
   279     iListBox->CreateScrollBarFrameL( ETrue );
       
   280     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   281             CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   282     iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
       
   283 
       
   284     CAknIconArray* icons = new (ELeave) CAknIconArray( EUPnPIconLast );
       
   285     CleanupStack::PushL( icons );
       
   286     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   287     TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
       
   288     
       
   289     
       
   290     TFileName mbmFileName( KAknCommonUIMbmFileName );
       
   291     TFileName dllName;
       
   292     Dll::FileName( dllName );
       
   293     TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
       
   294     mbmFileName.Insert( 0, drive );
       
   295     
       
   296     
       
   297     //marked icon
       
   298     AppendIconToArrayL( icons,
       
   299         skin,
       
   300         KAvkonBitmapFile,
       
   301         KAknsIIDQgnIndiMarkedAdd,
       
   302         EMbmAvkonQgn_indi_marked_add,
       
   303         EMbmAvkonQgn_indi_marked_add_mask );
       
   304     // Music icon
       
   305     AppendIconToArrayL( icons,
       
   306         skin,
       
   307         mbmFileName,
       
   308         KAknsIIDDefault,
       
   309         EMbmUpnpcommonuiQgn_prop_mserv_music,
       
   310         EMbmUpnpcommonuiQgn_prop_mserv_music_mask );
       
   311      // Video icon
       
   312     AppendIconToArrayL( icons,
       
   313         skin,
       
   314         mbmFileName,
       
   315         KAknsIIDDefault,
       
   316         EMbmUpnpcommonuiQgn_prop_mserv_other_videos,
       
   317         EMbmUpnpcommonuiQgn_prop_mserv_other_videos_mask );
       
   318     // Image icon
       
   319     AppendIconToArrayL( icons,
       
   320         skin,
       
   321         mbmFileName,
       
   322         KAknsIIDDefault,
       
   323         EMbmUpnpcommonuiQgn_prop_mserv_other_images,
       
   324         EMbmUpnpcommonuiQgn_prop_mserv_other_images_mask );
       
   325     // Image showing icon
       
   326     AppendIconToArrayL( icons,
       
   327         skin, 
       
   328         mbmFileName, 
       
   329         KAknsIIDDefault, 
       
   330         EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon, 
       
   331         EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon_mask );
       
   332     //Other icon
       
   333     AppendIconToArrayL( icons,
       
   334         skin,
       
   335         KCommonDialogsBitmapFile,
       
   336         KAknsIIDQgnPropFmgrFileSound,
       
   337         EMbmCommondialogsQgn_prop_fmgr_file_other,
       
   338         EMbmCommondialogsQgn_prop_fmgr_file_other_mask );
       
   339     iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons );
       
   340     CleanupStack::Pop(icons); 
       
   341     // set dialog title
       
   342     CEikStatusPane* statusPane = 
       
   343                     ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
       
   344     iTitlePane = (CAknTitlePane*)statusPane->ControlL( 
       
   345                                        TUid::Uid( EEikStatusPaneUidTitle ) );
       
   346     // Set the text string.
       
   347     HBufC* tempStr = StringLoader::LoadLC( 
       
   348                     R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_TITLE ); 
       
   349     iTitlePane->SetTextL( *tempStr );
       
   350     CleanupStack::PopAndDestroy( tempStr );
       
   351     LoadListItemsL();
       
   352     SetNaviPaneTextL();
       
   353     iListBox->ActivateL();
       
   354     }
       
   355 
       
   356 // ---------------------------------------------------------
       
   357 // CAdvancedFindResultWindow::PostLayoutDynInitL()
       
   358 // Called by framework before dialog is shown.
       
   359 // Needed because filter is not active until PreLayoutDynInitL().
       
   360 // ---------------------------------------------------------
       
   361 //
       
   362 /*void  CAdvancedFindResultWindow::PostLayoutDynInitL()
       
   363     {
       
   364     }*/
       
   365     
       
   366 // ---------------------------------------------------------
       
   367 // CAdvancedFindResultWindow::OfferKeyEventL()
       
   368 // called by framework when key is pressed
       
   369 // ---------------------------------------------------------
       
   370 //
       
   371 TKeyResponse CAdvancedFindResultWindow::OfferKeyEventL ( 
       
   372                                                 const TKeyEvent &aKeyEvent,
       
   373                                                 TEventCode aType )
       
   374     {
       
   375     TInt tempCounter = iListBox->CurrentItemIndex();
       
   376     if (aType != EEventKey)
       
   377         {
       
   378         if ( aKeyEvent.iScanCode == EStdKeyHash )
       
   379             {
       
   380             if ( aType == EEventKeyDown )
       
   381                 {
       
   382                 iHashKeyFlag = ETrue;
       
   383                 }
       
   384             else
       
   385                 {
       
   386                 iHashKeyFlag = EFalse;
       
   387                 }
       
   388             }
       
   389         iListBox->OfferKeyEventL( aKeyEvent, aType ); 
       
   390 
       
   391         if ( aType == EEventKeyUp && !iHashKeyFlag )
       
   392             {      
       
   393             if ( !iImageControlActive )
       
   394                 {
       
   395                 const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
   396                 if ( indexes->Count() )
       
   397                     {
       
   398                     UpdateCommandButtonAreaL( ETrue, tempCounter );
       
   399                     }
       
   400                 else
       
   401                     {
       
   402                     UpdateCommandButtonAreaL( EFalse, tempCounter );
       
   403                     }               
       
   404                 }                        
       
   405             }
       
   406         return EKeyWasConsumed;
       
   407         }
       
   408     else
       
   409         {
       
   410         if ( aKeyEvent.iCode == EKeyDownArrow ||
       
   411          aKeyEvent.iCode == EKeyUpArrow )
       
   412             {               
       
   413             if ( iImageControlActive )
       
   414                 {
       
   415                 iImageControlTimer->Cancel();
       
   416                 StartImageControlTimer();
       
   417                 }
       
   418             
       
   419             if ( aKeyEvent.iCode == EKeyDownArrow )
       
   420                 {
       
   421                 tempCounter++;
       
   422                 }
       
   423             else
       
   424                 {
       
   425                 tempCounter--;
       
   426                 }
       
   427             if ( tempCounter >= iResultArray.Count() )
       
   428                 {
       
   429                 tempCounter = 0;
       
   430                 }
       
   431             if ( tempCounter < 0 )
       
   432                 {
       
   433                 tempCounter = iResultArray.Count()-1;
       
   434                 }
       
   435             if( iImageControlActive )
       
   436                 {
       
   437                 if( UPnPItemUtility::BelongsToClass( 
       
   438                         *iResultArray[tempCounter], KClassImage ) ) // image  
       
   439                     {
       
   440                     UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
       
   441                     }
       
   442                 else if ( UPnPItemUtility::BelongsToClass( 
       
   443                         *iResultArray[tempCounter], KClassVideo ) ) // video
       
   444                     {
       
   445                     UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP );
       
   446                     }
       
   447                 else if ( UPnPItemUtility::BelongsToClass( 
       
   448                         *iResultArray[tempCounter], KClassAudio ) ) // music
       
   449                     {
       
   450                     UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP );
       
   451                     }    
       
   452                 else
       
   453                     {
       
   454                     UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
       
   455                     }    
       
   456                 }
       
   457              }
       
   458             
       
   459         CAknDialog::OfferKeyEventL( aKeyEvent, aType );
       
   460         if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 )
       
   461             {
       
   462             if ( !iImageControlActive )
       
   463                 {
       
   464                 const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
   465                 if ( indexes->Count() )
       
   466                     {
       
   467                     UpdateCommandButtonAreaL( ETrue, tempCounter );
       
   468                     }
       
   469                 else
       
   470                     {
       
   471                     UpdateCommandButtonAreaL( EFalse, tempCounter );
       
   472                     }               
       
   473                 }
       
   474             } 
       
   475         }
       
   476     return EKeyWasConsumed;
       
   477     }
       
   478 
       
   479 // ---------------------------------------------------------
       
   480 // CAdvancedFindResultWindow::SetNaviPaneText()
       
   481 // Sets navi pane text referring to the count of selected files
       
   482 // ---------------------------------------------------------
       
   483 //
       
   484 void CAdvancedFindResultWindow::SetNaviPaneTextL()
       
   485     {
       
   486     TInt itemCount = iResultArray.Count();    
       
   487     HBufC* naviText;
       
   488     if (itemCount == 1)
       
   489         {        
       
   490         naviText = StringLoader::LoadLC( 
       
   491                     R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILE, 
       
   492                     itemCount );
       
   493         
       
   494         }
       
   495     else
       
   496         {
       
   497         naviText = StringLoader::LoadLC( 
       
   498                     R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILES,
       
   499                     itemCount );
       
   500         }
       
   501     // push text to navi pane
       
   502     CEikStatusPane* statusPane = 
       
   503                     ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
       
   504     iNaviPane = ( CAknNavigationControlContainer * )statusPane->ControlL(
       
   505                                          TUid::Uid(EEikStatusPaneUidNavi ) );
       
   506     // delete previous navidecorator
       
   507     delete iNaviDecorator; iNaviDecorator = NULL;
       
   508 
       
   509     iNaviDecorator = iNaviPane->CreateNavigationLabelL( *naviText );
       
   510     iNaviPane->PushL( *iNaviDecorator );
       
   511     CleanupStack::PopAndDestroy( naviText );    
       
   512     DrawDeferred();
       
   513     }
       
   514 
       
   515 // --------------------------------------------------------------------------
       
   516 // CAdvancedFindResultWindow::AppendIconToArrayL
       
   517 // Load a possibly skinned icon (with mask) and append it to an
       
   518 // icon array.
       
   519 // --------------------------------------------------------------------------
       
   520 //
       
   521 
       
   522 void CAdvancedFindResultWindow::AppendIconToArrayL( CAknIconArray* aArray,
       
   523                                                     MAknsSkinInstance* aSkin,
       
   524                                                     const TDesC& aMbmFile,
       
   525                                                     const TAknsItemID& aID,
       
   526                                                     TInt aBitmapId,
       
   527                                                     TInt aMaskId )
       
   528     {    
       
   529     CFbsBitmap* bitmap = NULL;
       
   530     CFbsBitmap* mask = NULL;
       
   531     TBuf<KMbmFileBufferSize> buffer( aMbmFile );
       
   532     AknsUtils::CreateIconLC( aSkin, aID, bitmap, mask,
       
   533                              aMbmFile, aBitmapId, aMaskId );
       
   534     CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
       
   535     icon->SetBitmapsOwnedExternally( EFalse );
       
   536     // icon now owns the bitmaps, no need to keep on cleanup stack.
       
   537     CleanupStack::Pop( mask );
       
   538     CleanupStack::Pop( bitmap );     
       
   539     bitmap = NULL;
       
   540     mask = NULL;
       
   541     CleanupStack::PushL( icon );
       
   542     aArray->AppendL( icon );
       
   543     // aArray now owns the icon, no need to delete.
       
   544     CleanupStack::Pop( icon );
       
   545     }
       
   546 
       
   547 // --------------------------------------------------------------------------
       
   548 // CAdvancedFindResultWindow::ProcessCommandL
       
   549 // --------------------------------------------------------------------------
       
   550 //
       
   551 void CAdvancedFindResultWindow::ProcessCommandL( TInt aCommand )
       
   552     {
       
   553     TInt error = KErrNone;
       
   554     
       
   555     HideMenu();
       
   556     TInt selected_item = iListBox->CurrentItemIndex();
       
   557     switch (aCommand)
       
   558         {
       
   559         case EUPnPPlayExt:
       
   560         case EUPnPShowExt: //fall through
       
   561             {
       
   562             TRAP( error, ShowPlayExtL() );
       
   563             break;
       
   564             }
       
   565         case EUPnPPlayLocal: //    
       
   566         case EUPnPShowLocal: //fall through
       
   567             {
       
   568             TRAP( error, ShowPlayLocalL() );
       
   569             if( KErrSessionClosed == error )
       
   570                 {
       
   571                 iMSDisappear = ETrue;
       
   572                 }
       
   573             break;
       
   574             }
       
   575         case EUPnPCopy:
       
   576             {
       
   577             TRAP( error, HandleCopyL() );
       
   578             if( KErrNotFound == error )
       
   579                 {
       
   580                 iCopyIndex = 0; 
       
   581                 }
       
   582             if( error == KErrSessionClosed ) //if server lost
       
   583                 {
       
   584                 iMSDisappear = ETrue;
       
   585                 }
       
   586             break;
       
   587             }           
       
   588         case EAknCmdHelp:
       
   589             {
       
   590             TRAPD( error, HlpLauncher::LaunchHelpApplicationL(
       
   591                 iEikonEnv->WsSession(),
       
   592                 iEikonEnv->EikAppUi()->AppHelpContextL() ) );
       
   593             if ( error != KErrNone )
       
   594                 {
       
   595                 __LOG1( "CAdvancedFindResultWindow: \
       
   596     LaunchHelpApplicationL returned err=%d", error );
       
   597                 }     
       
   598             break;
       
   599             }
       
   600         case EAknCmdMark:
       
   601             {
       
   602             MarkUnmarkL( iListBox->CurrentItemIndex(), ETrue );
       
   603             break;
       
   604             }
       
   605         case EAknMarkAll:
       
   606             {
       
   607             MarkUnmarkL( -1, ETrue );
       
   608             break;
       
   609             }
       
   610         case EAknCmdUnmark:
       
   611             {
       
   612             MarkUnmarkL( iListBox->CurrentItemIndex(), EFalse );
       
   613             break;
       
   614             }
       
   615         case EAknUnmarkAll:
       
   616             {
       
   617             MarkUnmarkL( -1, EFalse );
       
   618             break;
       
   619             }
       
   620         case EAknCmdExit:
       
   621             {
       
   622             //User::Exit(0);
       
   623             TryExitL( aCommand ); //no need to go to next
       
   624             return;
       
   625             }    
       
   626         default:
       
   627             CAknDialog::ProcessCommandL( aCommand );
       
   628             break;
       
   629         }   
       
   630     HandleErrorL( error );  
       
   631     }
       
   632 
       
   633 // --------------------------------------------------------------------------
       
   634 // CAdvancedFindResultWindow::MarkUnmarkL
       
   635 // --------------------------------------------------------------------------
       
   636 //
       
   637 void CAdvancedFindResultWindow::MarkUnmarkL( TInt aItem, TBool aMark )
       
   638     {    
       
   639     CTextListBoxModel* model = iListBox->Model();
       
   640     TInt itemCount = model->NumberOfItems();
       
   641     CListBoxView* listBoxView = iListBox->View();
       
   642     if ( aMark )
       
   643         {
       
   644         for ( TUint i = 0; i < itemCount; i++ )
       
   645             {
       
   646             if ( aItem == -1 || aItem == i )
       
   647                 {
       
   648                 listBoxView->SelectItemL( i );                
       
   649                 }
       
   650             }
       
   651         UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() );
       
   652         }
       
   653     else
       
   654         {
       
   655         for ( TUint i = 0; i < itemCount; i++ )
       
   656             {
       
   657             if ( aItem == -1 || aItem == i )
       
   658                 {
       
   659                 listBoxView->DeselectItem( i );
       
   660                 }
       
   661             }
       
   662         const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
   663         if ( indexes->Count() )
       
   664             {
       
   665             UpdateCommandButtonArea( ETrue, iListBox->CurrentItemIndex() );
       
   666             }
       
   667         else
       
   668             {
       
   669             UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() );
       
   670             }        
       
   671         }
       
   672     }
       
   673 
       
   674 // --------------------------------------------------------------------------
       
   675 // CAdvancedFindResultWindow::PlayL
       
   676 // --------------------------------------------------------------------------
       
   677 void CAdvancedFindResultWindow::PlayL( TBool aLocal )
       
   678     {
       
   679     TInt error = KErrNone;
       
   680     
       
   681     // create a playlist representation
       
   682     CUPnPPlayListFiller* filler = 
       
   683                     CUPnPPlayListFiller::NewL();
       
   684     CleanupStack::PushL( filler );
       
   685     TInt firstAudioItem = KErrNotFound;
       
   686     TBool focusedItemFound = EFalse;
       
   687     const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
   688     if ( indexes->Count() > 0 )
       
   689         {
       
   690         // play the marked files
       
   691         for (TInt i = 0; i < indexes->Count(); i++)
       
   692             {
       
   693             filler->InsertObjectL(
       
   694                          *iSourceDevice, *iResultArray[ indexes->At( i ) ] );
       
   695             
       
   696             if( UPnPItemUtility::BelongsToClass( 
       
   697                 *iResultArray[ indexes->At(i) ], KClassAudio )
       
   698                 && firstAudioItem == KErrNotFound )
       
   699                 {
       
   700                 firstAudioItem = i;
       
   701                 }
       
   702             if( iResultArray[ indexes->At( i ) ]->Id()
       
   703                 == iResultArray[ iListBox->CurrentItemIndex() ]->Id() )
       
   704                 {
       
   705                 filler->SetSelectedIndex( i );
       
   706                 focusedItemFound = ETrue;
       
   707                 }
       
   708             }
       
   709 
       
   710         if( !focusedItemFound )
       
   711             {
       
   712             filler->SetSelectedIndex( firstAudioItem );
       
   713             }
       
   714         }
       
   715     else
       
   716         {
       
   717         // play all found files
       
   718         for( TInt i = 0; i < iResultArray.Count(); i++ )
       
   719             {
       
   720             filler->InsertObjectL(
       
   721                 *iSourceDevice, *iResultArray[ i ] );
       
   722             }
       
   723         filler->SetSelectedIndex( iListBox->CurrentItemIndex() );
       
   724         }
       
   725 
       
   726     if( !aLocal )
       
   727         {
       
   728         
       
   729         iChildDialogOpen++;
       
   730         error = iCommonUI.SelectDeviceL(
       
   731                               iAVControl,
       
   732                               *iTargetDevice,
       
   733                               EUPnPSearchRenderingDevicesWithAudioCapability,
       
   734                               EUPnPSelectDeviceTitle );       
       
   735         if ( KErrNone == error )
       
   736             {
       
   737             CleanupStack::Pop( filler ); // musicadapter handles delete
       
   738             
       
   739             iMusicPlay = ETrue;
       
   740             //filler ownership transferred
       
   741             error = iCommonUI.ExecuteMusicPlayerL( iAVControl, 
       
   742                                                    filler, 
       
   743                                                    iTargetDevice );
       
   744             iMusicPlay = EFalse;                                       
       
   745             iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
       
   746                                     R_AVKON_STATUS_PANE_LAYOUT_USUAL);
       
   747             iAvkonEnv->LoadAknLayoutL();
       
   748             iAvkonAppUi->ReportResourceChangedToAppL(
       
   749                                 KEikDynamicLayoutVariantSwitch );
       
   750           
       
   751             }
       
   752         else
       
   753             {
       
   754             CleanupStack::PopAndDestroy( filler );
       
   755             }
       
   756         iChildDialogOpen--;
       
   757         }
       
   758     else
       
   759         {
       
   760         CleanupStack::Pop( filler );
       
   761         iChildDialogOpen++;
       
   762         iMusicPlay = ETrue;
       
   763         //filler ownership transferred
       
   764         error = iCommonUI.ExecuteMusicPlayerL( iAVControl, filler, NULL );
       
   765         iMusicPlay = EFalse;
       
   766         iChildDialogOpen--;
       
   767         iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
       
   768                                     R_AVKON_STATUS_PANE_LAYOUT_USUAL);
       
   769         iAvkonEnv->LoadAknLayoutL();
       
   770         iAvkonAppUi->ReportResourceChangedToAppL(
       
   771                             KEikDynamicLayoutVariantSwitch );
       
   772         }
       
   773     if( KErrNone != error )
       
   774         {
       
   775         User::Leave( error );    
       
   776         }
       
   777     }
       
   778 
       
   779 // --------------------------------------------------------------------------
       
   780 // CAdvancedFindResultWindow::ShowPlayExtL
       
   781 // --------------------------------------------------------------------------
       
   782 void CAdvancedFindResultWindow::ShowPlayExtL()
       
   783     {
       
   784     //if audio file is either in marked items or highlighted, play it
       
   785     const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
   786     if ( indexes->Count() )
       
   787         {
       
   788         if( IsAudioItemMarked() && !iMusicPlay )
       
   789             {
       
   790             TRAPD( err, PlayL( EFalse ) );
       
   791             if( KErrNone != err )
       
   792                 {
       
   793                 iMusicPlay = EFalse;
       
   794                 }
       
   795             }    
       
   796         }
       
   797     else // if no marked items
       
   798         {
       
   799         if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
       
   800                           ObjectClass().Find( KClassVideo ) == 0 )
       
   801             {
       
   802             ShowVideoExtL();
       
   803             }
       
   804         else if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
       
   805                               ObjectClass().Find( KClassImage ) == 0 )
       
   806             {
       
   807             ShowImageExtL();
       
   808             }    
       
   809         else if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
       
   810                           ObjectClass().Find( KClassAudio ) == 0 && 
       
   811                           !iMusicPlay )    
       
   812             {
       
   813             PlayL( EFalse );
       
   814             }
       
   815         }
       
   816     }
       
   817 
       
   818 // --------------------------------------------------------------------------
       
   819 // CAdvancedFindResultWindow::ShowPlayLocalL
       
   820 // --------------------------------------------------------------------------
       
   821 void CAdvancedFindResultWindow::ShowPlayLocalL()
       
   822     {
       
   823     //if audio file is either in marked items or highlighted, play it
       
   824     const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
   825     if ( !iMusicPlay && UPnPItemUtility::BelongsToClass(
       
   826         *iResultArray[iListBox->CurrentItemIndex()], KClassAudio) )
       
   827         {
       
   828         TRAPD( err, PlayL( ETrue ) );
       
   829         if( KErrNone != err )
       
   830             {
       
   831             iMusicPlay = EFalse;
       
   832             }
       
   833         }
       
   834     else // if no marked items
       
   835         {
       
   836         if ( !indexes->Count() )
       
   837             {
       
   838             if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
       
   839                 ObjectClass().Find( KClassVideo ) == 0 ||
       
   840                  ( iResultArray[iListBox->CurrentItemIndex()] )->
       
   841                         ObjectClass().Find( KClassImage ) == 0 )
       
   842                 {
       
   843                  if( !iLocalPlayer )
       
   844                     {
       
   845                     iLocalPlayer = CUPnPLocalPlayer::NewL( iAVControl,
       
   846                                                            iBrowseSession,
       
   847                                                            iCommonUI );
       
   848                     }
       
   849                 const CUpnpObject* item = 
       
   850                                 iResultArray[iListBox->CurrentItemIndex()];
       
   851                 
       
   852                 iLocalPlayer->PlayL( *item );
       
   853                 }
       
   854             }
       
   855         }
       
   856     }
       
   857     
       
   858 // --------------------------------------------------------------------------
       
   859 // CAdvancedFindResultWindow::LoadListItemsL
       
   860 // loads items in result array to dialog. 
       
   861 // --------------------------------------------------------------------------
       
   862 //    
       
   863 void CAdvancedFindResultWindow::LoadListItemsL()
       
   864     {
       
   865     MarkUnmarkL( -1, EFalse ); //deselect all items
       
   866     CTextListBoxModel* model = iListBox->Model();
       
   867     MDesCArray* textArray = model->ItemTextArray();
       
   868     CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
       
   869     HBufC16* item = HBufC16::NewL(256);
       
   870     CleanupStack::PushL( item );
       
   871     listBoxItems->Reset();
       
   872     if( !iResultArray.Count() )
       
   873         {
       
   874         // show "no results" text
       
   875         HBufC* noResultsText =  StringLoader::LoadLC( 
       
   876                     R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_NO_RESULTS );
       
   877         iListBox->View()->SetListEmptyTextL( *noResultsText );
       
   878         CleanupStack::PopAndDestroy( noResultsText );
       
   879         }
       
   880     else
       
   881         {
       
   882         for (TInt i=0; i < iResultArray.Count(); i++)
       
   883             {           
       
   884             if( ( iResultArray[i])->
       
   885                     ObjectClass().Find( KClassAudio ) == 0 ) 
       
   886                 {
       
   887                 if( ( iResultArray[i]->Title().Length() ) != 0 )
       
   888                     {
       
   889                     // Get title and replace illegal characters.
       
   890                     HBufC8* tmptitle = 
       
   891                     UPnPCommonUtils::FixListboxItemTextL( 
       
   892                         iResultArray[ i ]->Title().Left( KLength ) );
       
   893                     
       
   894                     CleanupStack::PushL( tmptitle );
       
   895                     TPtrC8 tmpnameptr = *tmptitle;
       
   896                     iResultArray[i]->SetTitleL( tmpnameptr );
       
   897 
       
   898                     HBufC* tmpStr = 
       
   899                         UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) );
       
   900                     CleanupStack::PushL( tmpStr );
       
   901                     HBufC8* artist = NULL;
       
   902                     
       
   903                     const RUPnPElementsArray& elms = 
       
   904                                         iResultArray[i]->GetElements();
       
   905                     TInt count = elms.Count();
       
   906                     for( TInt i = 0; i < count; i++)
       
   907                         {
       
   908                         if( elms[ i ]->Name() == KElementArtist() )
       
   909                             {
       
   910                             artist = elms[ i ]->Value().AllocL();
       
   911                             i = count;
       
   912                             }
       
   913                         }
       
   914                     if( !artist )
       
   915                         {
       
   916                         TBufC8<7> buf( KUnknown() );
       
   917                         artist = buf.AllocL();
       
   918                         }
       
   919                     CleanupStack::PushL( artist );
       
   920                     HBufC* tmpStr2 = 
       
   921                            UpnpString::ToUnicodeL( artist->Left( KLength ) );
       
   922                     CleanupStack::PushL( tmpStr2 );
       
   923                     item->Des().Format( _L("%d\t%S\t%S\t"), 
       
   924                                         EUPnPIconMusic, 
       
   925                                         tmpStr, 
       
   926                                         tmpStr2 );
       
   927                     CleanupStack::PopAndDestroy( tmpStr2 );
       
   928                     CleanupStack::PopAndDestroy( artist );
       
   929                     CleanupStack::PopAndDestroy( tmpStr );
       
   930                     CleanupStack::PopAndDestroy( tmptitle );
       
   931                     }
       
   932                 }
       
   933             else if( (iResultArray[i])->ObjectClass().Find( KClassVideo )
       
   934                                                 == 0 ) //if video
       
   935                 {
       
   936                 if( ( iResultArray[i]->Title().Length() ) != 0 )
       
   937                     {
       
   938                     // Get title and replace illegal characters.
       
   939                     HBufC8* tmptitle = 
       
   940                     UPnPCommonUtils::FixListboxItemTextL( 
       
   941                         iResultArray[ i ]->Title().Left( KLength ) );
       
   942                     
       
   943                     CleanupStack::PushL( tmptitle );
       
   944                     TPtrC8 tmpnameptr = *tmptitle;
       
   945                     iResultArray[i]->SetTitleL( tmpnameptr );
       
   946                     
       
   947                     HBufC* tmpStr = 
       
   948                         UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) );
       
   949                     CleanupStack::PushL( tmpStr );
       
   950                     item->Des().Format( _L("%d\t%S\t\t"), 
       
   951                                         EUPnPIconVideo, 
       
   952                                         tmpStr );
       
   953                     CleanupStack::PopAndDestroy( tmpStr );
       
   954                     CleanupStack::PopAndDestroy( tmptitle );
       
   955                     }
       
   956                   
       
   957                 }
       
   958             else if( ( iResultArray[i] )->ObjectClass().Find( KClassImage )
       
   959                                                 == 0 ) //if image
       
   960                 {
       
   961                 if( ( iResultArray[i]->Title().Length() ) != 0 )
       
   962                     {
       
   963                     // Get title and replace illegal characters.
       
   964                     HBufC8* tmptitle = 
       
   965                     UPnPCommonUtils::FixListboxItemTextL( 
       
   966                         iResultArray[ i ]->Title().Left( KLength ) );
       
   967                     
       
   968                     CleanupStack::PushL( tmptitle );
       
   969                     TPtrC8 tmpnameptr = *tmptitle;
       
   970                     iResultArray[i]->SetTitleL( tmpnameptr );
       
   971                     
       
   972                     HBufC* tmpStr = UpnpString::ToUnicodeL( 
       
   973                         tmpnameptr.Left( KLength ) );
       
   974                     CleanupStack::PushL( tmpStr );
       
   975                     item->Des().Format( _L("%d\t%S\t\t"), 
       
   976                                         EUPnPIconImage, 
       
   977                                         tmpStr );
       
   978                     CleanupStack::PopAndDestroy( tmpStr );
       
   979                     CleanupStack::PopAndDestroy( tmptitle );
       
   980                     }
       
   981                  }
       
   982             else //if not recoganized media file type
       
   983                 {
       
   984                 if( ( iResultArray[i]->Title().Length() ) != 0 )
       
   985                     {
       
   986                     // Get title and replace illegal characters.
       
   987                     HBufC8* tmptitle = 
       
   988                     UPnPCommonUtils::FixListboxItemTextL( 
       
   989                         iResultArray[ i ]->Title().Left( KLength ) );
       
   990                     
       
   991                     CleanupStack::PushL( tmptitle );
       
   992                     TPtrC8 tmpnameptr = *tmptitle;
       
   993                     iResultArray[i]->SetTitleL( tmpnameptr );
       
   994 
       
   995                     HBufC* tmpStr = UpnpString::ToUnicodeL( 
       
   996                         tmpnameptr.Left( KLength ) );
       
   997                     CleanupStack::PushL( tmpStr );
       
   998                     item->Des().Format( _L("%d\t%S\t\t"), 
       
   999                                         EUPnPIconOther, 
       
  1000                                         tmpStr );
       
  1001                     CleanupStack::PopAndDestroy( tmpStr );
       
  1002                     CleanupStack::PopAndDestroy( tmptitle );
       
  1003                     }
       
  1004                 }
       
  1005             listBoxItems->AppendL( item->Des() );                
       
  1006             } //for
       
  1007         iListBox->HandleItemAdditionL(); // Update listbox
       
  1008         iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item
       
  1009         if( (iResultArray[0])->
       
  1010                           ObjectClass().Find( KClassImage ) == 0 ||
       
  1011         (iResultArray[0])->
       
  1012                           ObjectClass().Find( KClassVideo ) == 0)
       
  1013             {
       
  1014             UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
       
  1015             }
       
  1016         else if( ( iResultArray[0] )->ObjectClass()
       
  1017                                   .Find( KClassAudio ) == 0 )
       
  1018             {
       
  1019             UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
       
  1020             }        
       
  1021         else
       
  1022             {
       
  1023             UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  1024             } 
       
  1025         }
       
  1026 
       
  1027 
       
  1028     CleanupStack::PopAndDestroy( item );
       
  1029     }
       
  1030     
       
  1031 // --------------------------------------------------------------------------
       
  1032 // CAdvancedFindResultWindow::DynInitMenuPaneL(TInt aResourceId, 
       
  1033 //                                             CEikMenuPane *aMenuPane)
       
  1034 // creates dynamical menu according to result array users 
       
  1035 // selections/highlighted item
       
  1036 // --------------------------------------------------------------------------
       
  1037 //    
       
  1038 void  CAdvancedFindResultWindow::DynInitMenuPaneL( TInt aResourceId, 
       
  1039                                                    CEikMenuPane *aMenuPane )
       
  1040     {
       
  1041     TInt selected_item = iListBox->CurrentItemIndex();
       
  1042     if ( aResourceId ==  R_UPNPCOMMONUI_RESULT_WINDOW_MENU )
       
  1043         {
       
  1044         aMenuPane->SetItemDimmed( EUPnPShow, ETrue );
       
  1045         aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
       
  1046         if (iResultArray.Count() == 0)
       
  1047             {
       
  1048             aMenuPane->SetItemDimmed( EUPnPCopy, ETrue );
       
  1049             aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
       
  1050             }
       
  1051         else
       
  1052             {
       
  1053             const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
  1054             if ( indexes->Count() ) //if items are marked
       
  1055                 {
       
  1056                 if( UPnPItemUtility::BelongsToClass( 
       
  1057                                             *iResultArray[selected_item], 
       
  1058                                             KClassAudio ) 
       
  1059                     && IsAudioItemMarked() )
       
  1060                     {
       
  1061                     //if an audio is focused
       
  1062                     aMenuPane->SetItemDimmed(EUPnPPlay, EFalse);
       
  1063                     }
       
  1064                 else
       
  1065                     { 
       
  1066                     aMenuPane->SetItemDimmed(EUPnPPlay, ETrue);
       
  1067                     } 
       
  1068                 }
       
  1069             //check highlited items        
       
  1070             else if ( ( ( iResultArray[iListBox->CurrentItemIndex()])->
       
  1071                    ObjectClass().Find( KClassVideo ) == 0 ||
       
  1072                  ( iResultArray[iListBox->CurrentItemIndex()])->
       
  1073                    ObjectClass().Find( KClassImage ) == 0 ) )
       
  1074                 {
       
  1075                 aMenuPane->SetItemDimmed( EUPnPShow, EFalse );
       
  1076                 }
       
  1077             else if ( ( iResultArray[iListBox->CurrentItemIndex()])->
       
  1078                         ObjectClass().Find( KClassAudio ) 
       
  1079                         == 0 )  //if music
       
  1080                 {
       
  1081                 aMenuPane->SetItemDimmed( EUPnPPlay, EFalse );
       
  1082                 }
       
  1083             }                    
       
  1084 
       
  1085         // hide help option if not supported
       
  1086         if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
  1087             {
       
  1088             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
  1089             }
       
  1090         }
       
  1091     else if( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
       
  1092         {        
       
  1093         TBool markHidden = iListBox->View()->ItemIsSelected( selected_item );
       
  1094         TBool unmarkHidden = !iListBox->View()->
       
  1095                                             ItemIsSelected( selected_item );
       
  1096         TBool markAllHidden = iListBox->Model()->NumberOfItems() == 0 ||
       
  1097         iListBox->SelectionIndexes()->Count()==iListBox->Model()->
       
  1098                                                             NumberOfItems();
       
  1099         TBool unmarkAllHidden = iListBox->Model()->NumberOfItems() == 0 ||
       
  1100                                 iListBox->SelectionIndexes()->Count() == 0;
       
  1101         aMenuPane->SetItemDimmed( EAknCmdMark, markHidden );
       
  1102         aMenuPane->SetItemDimmed( EAknCmdUnmark, unmarkHidden );
       
  1103         aMenuPane->SetItemDimmed( EAknMarkAll, markAllHidden );
       
  1104         aMenuPane->SetItemDimmed( EAknUnmarkAll, unmarkAllHidden );
       
  1105         }
       
  1106     
       
  1107     CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
       
  1108     }
       
  1109   
       
  1110 // --------------------------------------------------------------------------
       
  1111 // CAdvancedFindResultWindow::GetHelpContext
       
  1112 // --------------------------------------------------------------------------
       
  1113 //
       
  1114 void CAdvancedFindResultWindow::GetHelpContext( 
       
  1115                                             TCoeHelpContext& aContext ) const
       
  1116     {
       
  1117     __LOG( "CAdvancedFindResultWindow::GetHelpContext");
       
  1118     
       
  1119 //  aContext.iMajor = TUid::Uid( KMediaGalleryUID3 );    
       
  1120     aContext.iContext = KUPNP_HLP_SEARCH;
       
  1121     }
       
  1122     
       
  1123 // --------------------------------------------------------------------------
       
  1124 // CAdvancedFindResultWindow::ShowVideoExtL
       
  1125 // --------------------------------------------------------------------------
       
  1126 //
       
  1127 void CAdvancedFindResultWindow::ShowVideoExtL()
       
  1128     {
       
  1129     
       
  1130     TInt error = KErrGeneral;
       
  1131     iAction = CUPnPCommonUI::EUPnPShow;
       
  1132     iChildDialogOpen++;
       
  1133     error = iCommonUI.SelectDeviceL(
       
  1134                               iAVControl,
       
  1135                               *iTargetDevice,
       
  1136                               EUPnPSearchRenderingDevicesWithVideoCapability,
       
  1137                               EUPnPSelectDeviceTitle );
       
  1138     iChildDialogOpen--;
       
  1139     if ( KErrNone == error )
       
  1140         {
       
  1141         const CUpnpObject* selectedObject = iResultArray[iListBox->
       
  1142                                    CurrentItemIndex()];
       
  1143                     
       
  1144         if( iSourceDevice )
       
  1145             {
       
  1146             
       
  1147             MUPnPAVRenderingSession* renderingSession = 
       
  1148                      &(iAVControl.StartRenderingSessionL( *iTargetDevice ) );
       
  1149             iChildDialogOpen++;
       
  1150             
       
  1151             TInt ret = KErrNone;
       
  1152             //trap here to release rendering session properly
       
  1153             TRAP( error, ret = iCommonUI.ExecuteVideoPlayerL(
       
  1154                                                    *renderingSession, 
       
  1155                                                    *selectedObject ) );
       
  1156             
       
  1157             if( ret < KErrNone )
       
  1158                 {
       
  1159                 error = ret;
       
  1160                 }
       
  1161             
       
  1162             //set back panel and navi text
       
  1163             
       
  1164             // Get device friendly name and replace illegal characters.
       
  1165             HBufC8* tmpfriendlyname = 
       
  1166             UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
       
  1167                 iSourceDevice->FriendlyName() );
       
  1168             
       
  1169             CleanupStack::PushL( tmpfriendlyname );
       
  1170             TPtrC8 friendlyname = *tmpfriendlyname;
       
  1171             
       
  1172             HBufC* titleString = 
       
  1173                 UpnpString::ToUnicodeL( friendlyname.Left( KLength ) );
       
  1174             CleanupStack::PushL( titleString );
       
  1175             
       
  1176             iTitlePane->SetTextL( *titleString );
       
  1177             CleanupStack::PopAndDestroy( titleString );
       
  1178             CleanupStack::PopAndDestroy( tmpfriendlyname );
       
  1179             
       
  1180             SetNaviPaneTextL();
       
  1181             
       
  1182             renderingSession->RemoveObserver();
       
  1183             iAVControl.StopRenderingSession( *renderingSession );
       
  1184             
       
  1185             iChildDialogOpen--;
       
  1186             }
       
  1187         }
       
  1188     if( KErrNone != error )
       
  1189         {
       
  1190         User::Leave( error );    
       
  1191         }
       
  1192     }
       
  1193 
       
  1194 // --------------------------------------------------------------------------
       
  1195 // CAdvancedFindResultWindow::ShowImageExtL
       
  1196 // --------------------------------------------------------------------------
       
  1197 //
       
  1198 void CAdvancedFindResultWindow::ShowImageExtL()
       
  1199     {
       
  1200     TInt error = KErrNone;
       
  1201     iAction = CUPnPCommonUI::EUPnPShow;
       
  1202     iChildDialogOpen++;
       
  1203     error= iCommonUI.SelectDeviceL(
       
  1204                               iAVControl,
       
  1205                               *iTargetDevice,
       
  1206                               EUPnPSearchRenderingDevicesWithImageCapability,
       
  1207                               EUPnPSelectDeviceTitle );
       
  1208     iChildDialogOpen--;
       
  1209     
       
  1210     if ( KErrNone == error )
       
  1211         {
       
  1212         if( !iImagePlayer )
       
  1213             {
       
  1214             iImagePlayer = CUpnpImagePlayer::NewL( iAVControl, 
       
  1215                                                    *this,
       
  1216                                                    iCommonUI );
       
  1217             }
       
  1218         iImagePlayer->SetTargetDeviceL( *iTargetDevice );
       
  1219         
       
  1220         StartImageControlTimer();
       
  1221         iImageControlActive = ETrue;
       
  1222         UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
       
  1223         }
       
  1224     else
       
  1225         {
       
  1226         User::Leave( error );
       
  1227         }    
       
  1228     }
       
  1229 
       
  1230 // --------------------------------------------------------------------------
       
  1231 // CAdvancedFindResultWindow::ShowCurrentImageL
       
  1232 // --------------------------------------------------------------------------
       
  1233 void CAdvancedFindResultWindow::ShowCurrentImageL( TBool aShowImage )
       
  1234     {    
       
  1235     TInt currentItemIndex = iListBox->CurrentItemIndex();
       
  1236     if ( currentItemIndex < 0 )
       
  1237         {
       
  1238         currentItemIndex = 0;
       
  1239         }
       
  1240     
       
  1241     CDesCArray* listBoxItems = 
       
  1242         static_cast<CDesCArray*>( iListBox->Model()->ItemTextArray() );
       
  1243     
       
  1244     if( iLastImageItemIndex >= 0 ) // if last item was image
       
  1245         {
       
  1246         TBuf<KMaxFileName> lastItem;
       
  1247         HBufC *lastTmpItem = UpnpString::ToUnicodeL( 
       
  1248             iResultArray[iLastImageItemIndex]->Title().Left( KLength ) );
       
  1249         CleanupStack::PushL( lastTmpItem );
       
  1250         lastItem.Format( KImageFormatString(), 
       
  1251                          EUPnPIconImage, 
       
  1252                          lastTmpItem);
       
  1253         CleanupStack::PopAndDestroy ( lastTmpItem );
       
  1254                  
       
  1255         listBoxItems->Delete( iLastImageItemIndex );
       
  1256         listBoxItems->InsertL( iLastImageItemIndex, lastItem );
       
  1257         iListBox->HandleItemAdditionL();
       
  1258         if( !( UPnPItemUtility::BelongsToClass( 
       
  1259                 *iResultArray[iListBox->CurrentItemIndex()], KClassImage ) ) )
       
  1260             {
       
  1261             iLastImageItemIndex = KErrNotFound;    
       
  1262             }
       
  1263         }    
       
  1264 
       
  1265     if( UPnPItemUtility::BelongsToClass( 
       
  1266             *iResultArray[iListBox->CurrentItemIndex()], KClassImage ) )
       
  1267         {
       
  1268         if( ( CUpnpItem* )iResultArray[currentItemIndex]
       
  1269                                                 ->Title().Length() != 0 )
       
  1270             {
       
  1271             HBufC *tmpItem = UpnpString::ToUnicodeL( 
       
  1272                 iResultArray[ currentItemIndex ]->Title().Left( KLength ) );
       
  1273             CleanupStack::PushL( tmpItem );
       
  1274             
       
  1275             TBuf<KMaxFileName> item;
       
  1276             // if not showing an image
       
  1277             if ( !aShowImage )
       
  1278                 {   
       
  1279                 item.Format( KImageFormatString(), EUPnPIconImage, tmpItem);
       
  1280                 iLastImageItemIndex = KErrNotFound;
       
  1281                 listBoxItems->Delete( currentItemIndex );
       
  1282                 listBoxItems->InsertL( currentItemIndex, item );
       
  1283                 }
       
  1284             else // if showing an image
       
  1285                 {
       
  1286                 
       
  1287                 item.Format( KImageShowingFormatString() ,EUPnPIconImage,
       
  1288                                                tmpItem,
       
  1289                                                EUPnPIconImageShowing );
       
  1290                 if(iImagePlayer)
       
  1291                     {
       
  1292                     iAction = CUPnPCommonUI::EUPnPShow;
       
  1293                     TRAPD( error, iImagePlayer->PlayL( 
       
  1294                                   *iResultArray[currentItemIndex] ) );
       
  1295                     
       
  1296                     HandleErrorL( error );
       
  1297                     
       
  1298                    }     
       
  1299 
       
  1300                 // listBoxItem.Set( item );
       
  1301                 listBoxItems->Delete( currentItemIndex );
       
  1302                 listBoxItems->InsertL( currentItemIndex, item );
       
  1303                 iLastImageItemIndex = currentItemIndex;
       
  1304                 }
       
  1305             CleanupStack::PopAndDestroy ( tmpItem );
       
  1306             iListBox->HandleItemAdditionL();
       
  1307             iListBox->SetCurrentItemIndexAndDraw( currentItemIndex );
       
  1308             }
       
  1309         }
       
  1310     }
       
  1311 
       
  1312 // --------------------------------------------------------------------------
       
  1313 // CAdvancedFindResultWindow::StartImageControlTimer
       
  1314 // Starts periodic timer
       
  1315 // --------------------------------------------------------------------------
       
  1316 void CAdvancedFindResultWindow::StartImageControlTimer()
       
  1317     {
       
  1318     __LOG( "CAdvancedFindResultWindow::StartImageControlTimer" );
       
  1319     iImageControlTimer->Start( 
       
  1320                         KImageTimerDelay,
       
  1321                         KImageTimerInterval,
       
  1322                         TCallBack( ImageControlTimerCallbackL, this ) );
       
  1323     __LOG( "CAdvancedFindResultWindow::StartImageControlTimer-END" );
       
  1324     }
       
  1325 
       
  1326 // --------------------------------------------------------------------------
       
  1327 // CAdvancedFindResultWindow::ImageControlTimerCallbackL
       
  1328 // Callback method for the Timer.
       
  1329 // --------------------------------------------------------------------------
       
  1330 TInt CAdvancedFindResultWindow::ImageControlTimerCallbackL( TAny* aDlg )
       
  1331     {
       
  1332     __LOG( "CAdvancedFindResultWindow::ImageControlTimerCallbackL" );
       
  1333     
       
  1334     static_cast< CAdvancedFindResultWindow* >( aDlg )->
       
  1335                                         iImageControlTimer->Cancel();
       
  1336     static_cast< CAdvancedFindResultWindow* >( aDlg )->
       
  1337                                         ShowCurrentImageL( ETrue );
       
  1338     
       
  1339     __LOG( "CAdvancedFindResultWindow::ImageControlTimerCallbackL-END" );
       
  1340     return KErrNone;
       
  1341 }
       
  1342 
       
  1343 // --------------------------------------------------------------------------
       
  1344 // CAdvancedFindResultWindow::StopImageControlL
       
  1345 // --------------------------------------------------------------------------
       
  1346 void CAdvancedFindResultWindow::StopImageControlL()
       
  1347     {
       
  1348     __LOG( "CAdvancedFindResultWindow::StopImageControlL" );
       
  1349         
       
  1350     if ( iImageControlActive )
       
  1351         {
       
  1352         iImageControlActive = EFalse;
       
  1353         iImageControlTimer->Cancel();
       
  1354         ShowCurrentImageL( EFalse );
       
  1355         
       
  1356         const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
  1357         if ( indexes->Count() )
       
  1358             {
       
  1359             if( UPnPItemUtility::BelongsToClass( 
       
  1360                             *iResultArray[iListBox->CurrentItemIndex()], 
       
  1361                             KClassAudio )
       
  1362                 && IsAudioItemMarked() ) 
       
  1363                 {
       
  1364                 UpdateSoftkeysL( 
       
  1365                             R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
       
  1366                 }
       
  1367             else
       
  1368                 {
       
  1369                 UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  1370                 }
       
  1371             }
       
  1372         else // check the hightlighted item
       
  1373             {
       
  1374             TInt tempCounter = iListBox->CurrentItemIndex();
       
  1375             if( UPnPItemUtility::BelongsToClass( 
       
  1376                     *iResultArray[tempCounter], KClassImage ) ||
       
  1377                 UPnPItemUtility::BelongsToClass( 
       
  1378                     *iResultArray[tempCounter], KClassVideo ) )
       
  1379                 {
       
  1380                 UpdateSoftkeysL(
       
  1381                         R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
       
  1382                 }
       
  1383             else if( UPnPItemUtility::BelongsToClass( 
       
  1384                     *iResultArray[tempCounter], KClassAudio ) )
       
  1385                 {
       
  1386                 UpdateSoftkeysL( 
       
  1387                         R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
       
  1388                 }        
       
  1389             else
       
  1390                 {
       
  1391                 UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  1392                 }
       
  1393             }
       
  1394 
       
  1395         iAction = CUPnPCommonUI::EUPnPNone;
       
  1396         iImagePlayer->Stop();
       
  1397         }
       
  1398     
       
  1399     __LOG( "CAdvancedFindResultWindow::StopImageControlL-END" );
       
  1400     }
       
  1401 
       
  1402 // --------------------------------------------------------------------------
       
  1403 // CAdvancedFindResultWindow::DismissItselfL
       
  1404 // --------------------------------------------------------------------------
       
  1405 //
       
  1406 void CAdvancedFindResultWindow::DismissItselfL( TInt aError )
       
  1407     {
       
  1408     __LOG( "CAdvancedFindResultWindow::DismissItselfL" );
       
  1409     iMSDisappear = ETrue;
       
  1410     if( iChildDialogOpen > 0 ) //if video or music dialog open
       
  1411         {
       
  1412         __LOG( "CAdvancedFindResultWindow::iCommonUI.DismissDialogL" );
       
  1413         iCommonUI.DismissDialogL( aError );
       
  1414         }
       
  1415     else
       
  1416         {
       
  1417         __LOG( "CAdvancedFindResultWindow::TryExitL" );
       
  1418         TryExitL( aError ); //media server disappeared or WLAN lost
       
  1419         }
       
  1420     __LOG( "CAdvancedFindResultWindow::DismissItselfL End" );
       
  1421     }
       
  1422 
       
  1423 // --------------------------------------------------------------------------
       
  1424 // CAdvancedFindResultWindow::DeviceDisappeared
       
  1425 // called by image play only, no implementation
       
  1426 // --------------------------------------------------------------------------
       
  1427 //   
       
  1428 void CAdvancedFindResultWindow::DeviceDisappeared( TInt aError )
       
  1429     {
       
  1430     TRAP_IGNORE( HandleErrorL( aError ) );
       
  1431     }
       
  1432 
       
  1433 // --------------------------------------------------------------------------
       
  1434 // CAdvancedFindResultWindow::HandleCopyL
       
  1435 // --------------------------------------------------------------------------
       
  1436 //   
       
  1437 void CAdvancedFindResultWindow::HandleCopyL()
       
  1438     {
       
  1439     iAction = CUPnPCommonUI::EUPnPCopy;
       
  1440     iCopyIndex = NULL;
       
  1441     RPointerArray<CUpnpItem> tempArrayForCopy;
       
  1442     CleanupResetAndDestroyPushL( tempArrayForCopy );            
       
  1443     const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
  1444     if ( indexes->Count() )
       
  1445         {            
       
  1446         for (TInt count=0; count < indexes->Count(); count++)
       
  1447             {
       
  1448             CUpnpItem* tempItem = CUpnpItem::NewL();
       
  1449             CleanupStack::PushL( tempItem );
       
  1450             tempItem->CopyL( *iResultArray[indexes->At(count)] );
       
  1451             tempArrayForCopy.AppendL( tempItem );
       
  1452             CleanupStack::Pop( tempItem );
       
  1453             }
       
  1454         iCopyIndex = indexes->Count();    
       
  1455         }                
       
  1456     else
       
  1457         {             
       
  1458         CUpnpItem* tempItem = CUpnpItem::NewL();
       
  1459         CleanupStack::PushL( tempItem );
       
  1460         tempItem->
       
  1461                 CopyL( *iResultArray[iListBox->CurrentItemIndex()] );
       
  1462         tempArrayForCopy.AppendL( tempItem );
       
  1463         CleanupStack::Pop( tempItem );
       
  1464         iCopyIndex = 1;
       
  1465         }            
       
  1466     
       
  1467     CUpnpFileTransferEngine* ftEngine = NULL;
       
  1468     // Instantiate the UPnP File Transfer Engine
       
  1469     ftEngine = CUpnpFileTransferEngine::NewL( &iBrowseSession );
       
  1470     CleanupStack::PushL( ftEngine );
       
  1471         
       
  1472     ftEngine->CopyRemoteItemsToHandsetL( tempArrayForCopy );
       
  1473         // Clean up ftEngine
       
  1474     CleanupStack::PopAndDestroy( ftEngine );
       
  1475     ftEngine = NULL;
       
  1476         
       
  1477     // Clean up tempArrayForCopy
       
  1478     CleanupStack::PopAndDestroy( &tempArrayForCopy );
       
  1479     }
       
  1480 // --------------------------------------------------------------------------
       
  1481 // CAdvancedFindResultWindow::HandleErrorL
       
  1482 // --------------------------------------------------------------------------
       
  1483 //     
       
  1484 void CAdvancedFindResultWindow::HandleErrorL( TInt aError )
       
  1485     {
       
  1486     iCommonUI.GetUpnpAction( iAction );
       
  1487     //if media server or WLAN lost, close the browse dialog    
       
  1488     if( ( KErrSessionClosed == aError && iMSDisappear )||
       
  1489           KErrDisconnected == aError ||
       
  1490           EAknCmdExit == aError ||
       
  1491           EEikCmdExit == aError )
       
  1492         {
       
  1493         if( iChildDialogOpen > 0 ) 
       
  1494             {
       
  1495             //if some dialos are open on the top of browse dialog, 
       
  1496             //close those dialogs and do the corresponding action via
       
  1497             //errors returned from them 
       
  1498             iCommonUI.DismissDialogL( aError );
       
  1499             }
       
  1500         else //if no, do the corresponding action via the error
       
  1501             {
       
  1502             TryExitL( aError );    
       
  1503             }
       
  1504         }
       
  1505      else
       
  1506         {
       
  1507         // if media renderer disappears
       
  1508         if( KErrSessionClosed == aError && !iMSDisappear )
       
  1509             {
       
  1510             StopImageControlL();   
       
  1511             }
       
  1512         
       
  1513         iCommonUI.HandleCommonErrorL( aError, iCopyIndex );
       
  1514         iAction = CUPnPCommonUI::EUPnPNone;
       
  1515         iCopyIndex = NULL;
       
  1516         }
       
  1517     }
       
  1518 
       
  1519 // --------------------------------------------------------------------------
       
  1520 // CAdvancedFindResultWindow::UpdateSoftkeysL
       
  1521 // Update CBA-keys
       
  1522 // --------------------------------------------------------------------------
       
  1523 
       
  1524 void CAdvancedFindResultWindow::UpdateSoftkeysL( TInt aResourceId )
       
  1525     {   
       
  1526     __LOG( "CAdvancedFindResultWindow::UpdateSoftkeysL" );
       
  1527     CEikButtonGroupContainer* cba = &ButtonGroupContainer();
       
  1528     cba->SetCommandSetL( aResourceId );
       
  1529     cba->DrawDeferred();
       
  1530     __LOG( "CAdvancedFindResultWindow::UpdateSoftkeysL-END" );
       
  1531     }
       
  1532     
       
  1533 // --------------------------------------------------------------------------
       
  1534 // CAdvancedFindResultWindow::IsAudioItemMarked
       
  1535 // --------------------------------------------------------------------------
       
  1536 TBool CAdvancedFindResultWindow::IsAudioItemMarked( void )
       
  1537     {
       
  1538     TBool mark = EFalse;
       
  1539     const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
       
  1540     if ( indexes->Count() ) //if items are marked
       
  1541         {
       
  1542         for (TInt count=0; count < indexes->Count(); count++)
       
  1543             {
       
  1544             if ( ( iResultArray[indexes->At(count)])->
       
  1545                                 ObjectClass().Find( KClassAudio )
       
  1546                    == 0 ) //audio
       
  1547                 {
       
  1548                 mark = ETrue;
       
  1549                 count = indexes->Count();
       
  1550                 }                
       
  1551             }
       
  1552         }
       
  1553     __LOG( "CAdvancedFindResultWindow::IsAudioItemMarked-END" );      
       
  1554     return mark;
       
  1555 
       
  1556     }
       
  1557 
       
  1558 // --------------------------------------------------------------------------
       
  1559 // CAdvancedFindResultWindow::UpdateCommandButtonAreaL( 
       
  1560 //      TBool aMark, TInt tempCounter )
       
  1561 // Updates command button area
       
  1562 // --------------------------------------------------------------------------
       
  1563 void CAdvancedFindResultWindow::UpdateCommandButtonAreaL( TBool aMark,
       
  1564         TInt aTempCounter )
       
  1565     {
       
  1566     if( aTempCounter>=0 && iResultArray.Count() )
       
  1567         {
       
  1568         if( !aMark ) // no marked items in the list box
       
  1569             {
       
  1570             if( ( UPnPItemUtility::BelongsToClass(
       
  1571                     *iResultArray[aTempCounter], KClassImage ) ) ||
       
  1572             ( UPnPItemUtility::BelongsToClass(
       
  1573                     *iResultArray[aTempCounter], KClassVideo ) ) )
       
  1574                 {
       
  1575                 UpdateSoftkeysL( 
       
  1576                         R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
       
  1577                 }
       
  1578             else if( ( UPnPItemUtility::BelongsToClass(
       
  1579                     *iResultArray[aTempCounter], KClassAudio ) ) )
       
  1580                 {
       
  1581                 UpdateSoftkeysL( 
       
  1582                         R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
       
  1583                 }        
       
  1584             else if( ( UPnPItemUtility::BelongsToClass(
       
  1585                     *iResultArray[aTempCounter], KClassContainer ) ) )
       
  1586                 {
       
  1587                 UpdateSoftkeysL( 
       
  1588                         R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
       
  1589                 }
       
  1590             else
       
  1591                 {
       
  1592                 UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  1593                 }        
       
  1594             }
       
  1595         else // at least one marked item in the list box
       
  1596             {
       
  1597             if( ( UPnPItemUtility::BelongsToClass(
       
  1598                     *iResultArray[aTempCounter], KClassContainer ) ) )
       
  1599                 {
       
  1600                 UpdateSoftkeysL( 
       
  1601                         R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
       
  1602                 }        
       
  1603             else if( !IsAudioItemMarked() )
       
  1604                 {
       
  1605                 //if no audio item have been marked.
       
  1606                 UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  1607                 }
       
  1608             else
       
  1609                 {
       
  1610                 if( !( UPnPItemUtility::BelongsToClass(
       
  1611                         *iResultArray[aTempCounter], KClassAudio ) ) )
       
  1612                     {
       
  1613                     UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  1614                     }
       
  1615                 else
       
  1616                     {
       
  1617                     UpdateSoftkeysL( 
       
  1618                             R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
       
  1619                     }
       
  1620                 }       
       
  1621             }
       
  1622         }
       
  1623     }
       
  1624 
       
  1625 // --------------------------------------------------------------------------
       
  1626 // CAdvancedFindResultWindow::UpdateCommandButtonArea( 
       
  1627 //      TBool aMark, TInt tempCounter )
       
  1628 // Updates command button area
       
  1629 // --------------------------------------------------------------------------
       
  1630 void CAdvancedFindResultWindow::UpdateCommandButtonArea( TBool aMark,
       
  1631         TInt aTempCounter )
       
  1632     {
       
  1633     TInt error = KErrNone;
       
  1634     TRAP( error, UpdateCommandButtonAreaL( aMark, aTempCounter ) );
       
  1635     if( error )
       
  1636         {
       
  1637         __LOG1( "UpdateCommandButtonAreaL error,error=%d", error );
       
  1638         }
       
  1639     }
       
  1640 // End of file