ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp
branchRCL_3
changeset 59 8e5f6eea9c9f
equal deleted inserted replaced
57:ea65f74e6de4 59:8e5f6eea9c9f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 #include <mpxcommandgeneraldefs.h>
       
    18 #include <mpxcollectionpath.h>
       
    19 #include <mpxmessagegeneraldefs.h>
       
    20 #include <mpxmessageprogressdefs.h>
       
    21 
       
    22 #include <glxfilterfactory.h>
       
    23 #include <glxcollectionpluginall.hrh>
       
    24 #include <mglxmedialist.h>
       
    25 #include <glxmpxcommandhandler.h>
       
    26 #include <glxfetchcontextremover.h>
       
    27 #include <glxmedialistiterator.h>
       
    28 #include <glxattributecontext.h>
       
    29 #include <glxattributeretriever.h>
       
    30 #include <glxuistd.h>
       
    31 
       
    32 #include <textresolver.h>
       
    33 #include <hbmessagebox.h>
       
    34 #include <hbnotificationdialog.h>
       
    35 #include <e32debug.h>
       
    36 #include <hbprogressdialog.h>
       
    37 #include "OstTraceDefinitions.h"
       
    38 #ifdef OST_TRACE_COMPILER_IN_USE
       
    39 #include "glxmpxcommandhandlerTraces.h"
       
    40 #endif
       
    41 
       
    42 #include <hbaction.h>
       
    43 
       
    44 GlxMpxCommandHandler::GlxMpxCommandHandler() :
       
    45     iProgressComplete(EFalse)
       
    46     {
       
    47     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_ENTRY );
       
    48     iMediaList = NULL;
       
    49     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_EXIT );
       
    50     }
       
    51 
       
    52 GlxMpxCommandHandler::~GlxMpxCommandHandler()
       
    53     {
       
    54     OstTraceFunctionEntry0( DUP1_GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_ENTRY );
       
    55     //close the existing instance of Media List
       
    56     if (iMediaList)
       
    57         {
       
    58         iMediaList->Close();
       
    59         iMediaList = NULL;
       
    60         }
       
    61     OstTraceFunctionExit0( DUP1_GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_EXIT );
       
    62     }
       
    63 
       
    64 void GlxMpxCommandHandler::executeCommand(int commandId, int collectionId,QList<QModelIndex>  indexList)
       
    65     {
       
    66     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_EXECUTECOMMAND_ENTRY );
       
    67     Q_UNUSED(indexList);
       
    68     int aHierarchyId = 0;
       
    69     TGlxFilterItemType aFilterType = EGlxFilterImage;
       
    70 
       
    71     if (collectionId != KGlxAlbumsMediaId)
       
    72         {
       
    73         OstTrace0( TRACE_NORMAL, DUP2_GLXMPXCOMMANDHANDLER_EXECUTECOMMAND, "GlxMpxCommandHandler::executeCommand::CreateMediaListL" );
       
    74         CreateMediaListL(collectionId, aHierarchyId, aFilterType);
       
    75         }
       
    76     else
       
    77         {
       
    78         OstTrace0( TRACE_NORMAL, DUP3_GLXMPXCOMMANDHANDLER_EXECUTECOMMAND, "GlxMpxCommandHandler::executeCommand::CreateMediaListAlbumItemL" );
       
    79         //for creating Medial List for Albums Media path Items
       
    80         CreateMediaListAlbumItemL(collectionId, aHierarchyId, aFilterType);
       
    81         }
       
    82 
       
    83     TBool consume = ETrue;
       
    84     iProgressComplete = EFalse;
       
    85     mProgressDialog = NULL;
       
    86     //Execute Command 
       
    87     DoExecuteCommandL(commandId, *iMediaList, consume);
       
    88     mCommandId = commandId;
       
    89     ConfirmationNoteL(*iMediaList);
       
    90     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_EXECUTECOMMAND_EXIT );
       
    91     }
       
    92 
       
    93 void GlxMpxCommandHandler::executeMpxCommand(bool execute)
       
    94     {
       
    95     if(execute && !iMediaList->IsCommandActive())            
       
    96         {
       
    97         TBool consume = ETrue;
       
    98         CMPXCommand* command = CreateCommandL(mCommandId, *iMediaList, consume);
       
    99         if (command)
       
   100             {
       
   101             command->SetTObjectValueL<TAny*> (KMPXCommandGeneralSessionId,
       
   102                     static_cast<TAny*> (this));
       
   103             iMediaList->AddMediaListObserverL(this);
       
   104             iMediaList->CommandL(*command);
       
   105             
       
   106             if(iMediaList->SelectionCount() > 1)
       
   107                 {
       
   108                  ProgressNoteL(mCommandId);
       
   109                 }
       
   110             }
       
   111         }
       
   112     else //command cancelled,so unmark all items
       
   113         {
       
   114         MGlxMediaList::UnmarkAllL(*iMediaList);
       
   115         }
       
   116     
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CreateMediaListL()
       
   121 // Creates a collection path
       
   122 // Create a filter as requested filtertype
       
   123 // Creates the medialist
       
   124 // ---------------------------------------------------------------------------
       
   125 void GlxMpxCommandHandler::CreateMediaListL(int aCollectionId,
       
   126         int aHierarchyId, TGlxFilterItemType aFilterType)
       
   127     {
       
   128     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTL_ENTRY );
       
   129     Q_UNUSED(aHierarchyId);
       
   130     Q_UNUSED(aFilterType);
       
   131 
       
   132     //close the existing instance of Media List
       
   133     if (iMediaList)
       
   134         {
       
   135         iMediaList->Close();
       
   136         iMediaList = NULL;
       
   137         }
       
   138 
       
   139     // Create path to the list of images and videos
       
   140     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   141     CleanupStack::PushL(path);
       
   142     path->AppendL(aCollectionId);
       
   143     // Create filter to filter out either images or videos
       
   144     CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(
       
   145             EGlxFilterImage); //todo take actual filter type
       
   146     CleanupStack::PushL(filter);
       
   147 
       
   148     // Create the media list
       
   149     iMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(0), filter); //todo take actual hierarchy 
       
   150     CleanupStack::PopAndDestroy(filter);
       
   151 
       
   152     CleanupStack::PopAndDestroy(path);
       
   153     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTL_EXIT );
       
   154     }
       
   155     
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CreateMediaListAlbumItemL()
       
   159 // Creates the media list for the album Item 
       
   160 // ---------------------------------------------------------------------------
       
   161 void GlxMpxCommandHandler::CreateMediaListAlbumItemL(int aCollectionId,
       
   162         int aHierarchyId, TGlxFilterItemType aFilterType)
       
   163     {
       
   164     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTALBUMITEML_ENTRY );
       
   165     Q_UNUSED(aCollectionId);
       
   166     Q_UNUSED(aHierarchyId);
       
   167     //retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList
       
   168     CreateMediaListL(KGlxCollectionPluginAlbumsImplementationUid, 0,
       
   169             EGlxFilterAlbum);
       
   170     //retrieve the path of the focussed item of the MediaList
       
   171     CMPXCollectionPath* path = iMediaList->PathLC(
       
   172             NGlxListDefs::EPathFocusOrSelection);
       
   173     //close the existing instance of Media List
       
   174     iMediaList->Close();
       
   175     iMediaList = NULL;
       
   176     //create new media list with the derived path
       
   177     CMPXFilter* filter =
       
   178             TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);
       
   179     CleanupStack::PushL(filter);
       
   180     iMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(0), filter); //todo take actual hierarchy
       
   181     CleanupStack::PopAndDestroy(filter);
       
   182 
       
   183     CleanupStack::PopAndDestroy(path);
       
   184     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTALBUMITEML_EXIT );
       
   185     }
       
   186 // -----------------------------------------------------------------------------
       
   187 // HandleItemAddedL
       
   188 // -----------------------------------------------------------------------------
       
   189 //  
       
   190 void GlxMpxCommandHandler::HandleItemAddedL(TInt /*aStartIndex*/,
       
   191         TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
       
   192     {
       
   193     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMADDEDL_ENTRY );
       
   194     // Do nothing
       
   195     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMADDEDL_EXIT );
       
   196     }
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 // HandleMediaL
       
   200 // -----------------------------------------------------------------------------
       
   201 //	
       
   202 void GlxMpxCommandHandler::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/)
       
   203     {
       
   204     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEMEDIAL_ENTRY );
       
   205     // Do nothing
       
   206     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEMEDIAL_EXIT );
       
   207     }
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 // HandleItemRemovedL
       
   211 // -----------------------------------------------------------------------------
       
   212 //	
       
   213 void GlxMpxCommandHandler::HandleItemRemovedL(TInt /*aStartIndex*/,
       
   214         TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
       
   215     {
       
   216     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMREMOVEDL_ENTRY );
       
   217     // Do nothing
       
   218     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMREMOVEDL_EXIT );
       
   219     }
       
   220 	
       
   221 // -----------------------------------------------------------------------------
       
   222 // HandleItemModifiedL
       
   223 // -----------------------------------------------------------------------------
       
   224 //	
       
   225 void GlxMpxCommandHandler::HandleItemModifiedL(const RArray<TInt>& /*aItemIndexes*/, 
       
   226         MGlxMediaList* /*aList*/)
       
   227 	{
       
   228 	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMMODIFIEDL_ENTRY );
       
   229 	// Do nothing
       
   230 	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMMODIFIEDL_EXIT );
       
   231 	}	
       
   232 
       
   233 // -----------------------------------------------------------------------------
       
   234 // HandleAttributesAvailableL
       
   235 // -----------------------------------------------------------------------------
       
   236 //	
       
   237 void GlxMpxCommandHandler::HandleAttributesAvailableL(TInt /*aItemIndex*/, 	
       
   238 	const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/)
       
   239 	{
       
   240 	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEATTRIBUTESAVAILABLEL_ENTRY );
       
   241 	// Do nothing
       
   242 	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEATTRIBUTESAVAILABLEL_EXIT );
       
   243 	}
       
   244 		
       
   245 // -----------------------------------------------------------------------------
       
   246 // HandleFocusChangedL
       
   247 // -----------------------------------------------------------------------------
       
   248 //	
       
   249 void GlxMpxCommandHandler::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, 
       
   250         TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) 
       
   251 	{
       
   252 	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEFOCUSCHANGEDL_ENTRY );
       
   253 	// Do nothing
       
   254 	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEFOCUSCHANGEDL_EXIT );
       
   255 	}
       
   256 	
       
   257 // -----------------------------------------------------------------------------
       
   258 // HandleItemSelectedL
       
   259 // -----------------------------------------------------------------------------
       
   260 //	
       
   261 void GlxMpxCommandHandler::HandleItemSelectedL(TInt /*aIndex*/, 
       
   262         TBool /*aSelected*/, MGlxMediaList* /*aList*/)
       
   263 	{
       
   264 	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMSELECTEDL_ENTRY );
       
   265 	// Do nothing
       
   266 	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMSELECTEDL_EXIT );
       
   267 	}
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // HandleMessageL
       
   271 // -----------------------------------------------------------------------------
       
   272 //	
       
   273 void GlxMpxCommandHandler::HandleMessageL(const CMPXMessage& aMessage,
       
   274         MGlxMediaList*/* aList*/)
       
   275     {
       
   276     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEMESSAGEL_ENTRY );
       
   277     if ((aMessage.IsSupported(KMPXMessageGeneralId) && (aMessage.IsSupported(
       
   278             KMPXCommandGeneralSessionId))))
       
   279         {
       
   280         TInt msgId = aMessage.ValueTObjectL<TInt> (KMPXMessageGeneralId);
       
   281         TAny* sessionId = aMessage.ValueTObjectL<TAny*> (
       
   282                 KMPXCommandGeneralSessionId);
       
   283         TInt error = KErrNone;
       
   284         // Check if this is a progress message and intended for this object
       
   285         TryExitL(error);
       
   286         }
       
   287     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEMESSAGEL_EXIT );
       
   288     }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // HandleCommandCompleteL
       
   292 // -----------------------------------------------------------------------------
       
   293 //	
       
   294 void GlxMpxCommandHandler::HandleCommandCompleteL(TAny* aSessionId,
       
   295         CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList)
       
   296     {
       
   297     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLECOMMANDCOMPLETEL_ENTRY );
       
   298     MGlxMediaList::UnmarkAllL(*iMediaList);
       
   299 
       
   300     DoHandleCommandCompleteL(aSessionId, aCommandResult, aError, aList);
       
   301     iProgressComplete = ETrue;
       
   302     TryExitL(aError);
       
   303     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLECOMMANDCOMPLETEL_EXIT );
       
   304     }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // HandleError
       
   308 // -----------------------------------------------------------------------------
       
   309 //  
       
   310 void GlxMpxCommandHandler::HandleError(TInt /*aError*/)
       
   311     {
       
   312     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEERROR_ENTRY );
       
   313     
       
   314     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEERROR_EXIT );
       
   315     }
       
   316 // -----------------------------------------------------------------------------
       
   317 // Default implementation of advanced command handling does nothing
       
   318 // -----------------------------------------------------------------------------
       
   319 //	
       
   320 void GlxMpxCommandHandler::DoHandleCommandCompleteL(TAny* /*aSessionId*/, 
       
   321         CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
       
   322     {
       
   323     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_DOHANDLECOMMANDCOMPLETEL_ENTRY );
       
   324     
       
   325     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_DOHANDLECOMMANDCOMPLETEL_EXIT );
       
   326     }
       
   327  
       
   328 // -----------------------------------------------------------------------------
       
   329 // Default implementation of advanced command handling does nothing
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 
       
   333 void GlxMpxCommandHandler::DoExecuteCommandL(TInt /*aCommandId*/,
       
   334         MGlxMediaList& /*aMediaList*/, TBool& /*aConsume*/)
       
   335     {
       
   336     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_DOEXECUTECOMMANDL_ENTRY );
       
   337 
       
   338     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_DOEXECUTECOMMANDL_EXIT );
       
   339     }
       
   340 
       
   341 // -----------------------------------------------------------------------------
       
   342 // TryExitL
       
   343 // -----------------------------------------------------------------------------
       
   344 //  
       
   345 void GlxMpxCommandHandler::TryExitL(TInt aErrorCode)
       
   346     {
       
   347     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_TRYEXITL_ENTRY );
       
   348     if (KErrNone != aErrorCode)
       
   349         {
       
   350         // @todo error received. Close progress note 
       
   351         DismissProgressNoteL();
       
   352         iMediaList->RemoveMediaListObserver(this);
       
   353         iMediaList->Close();
       
   354         iMediaList = NULL;
       
   355         // handle error
       
   356         HandleErrorL(aErrorCode);
       
   357         }
       
   358     else if (iProgressComplete)
       
   359         {
       
   360         DismissProgressNoteL();
       
   361         iMediaList->RemoveMediaListObserver(this);
       
   362         iMediaList->Close();
       
   363         iMediaList = NULL;
       
   364         CompletionNoteL();
       
   365         iProgressComplete = EFalse;
       
   366         }
       
   367     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_TRYEXITL_EXIT );
       
   368     }
       
   369 
       
   370 // -----------------------------------------------------------------------------
       
   371 // Default implementation shows an error note
       
   372 // -----------------------------------------------------------------------------
       
   373 //	
       
   374 void GlxMpxCommandHandler::HandleErrorL(TInt aErrorCode)
       
   375     {
       
   376     OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEERRORL_ENTRY );
       
   377     // show error note
       
   378     // TextResolver instance for error resolving.
       
   379     CTextResolver* textresolver = CTextResolver::NewLC();
       
   380     // Resolve the error text
       
   381     const TDesC& text = textresolver->ResolveErrorString(aErrorCode);
       
   382 
       
   383     QString qtText = QString::fromUtf16(text.Ptr(), text.Length());
       
   384 
       
   385 	HbNotificationDialog::launchDialog(qtText);
       
   386     CleanupStack::PopAndDestroy(textresolver);
       
   387     OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEERRORL_EXIT );
       
   388     }
       
   389 
       
   390 void GlxMpxCommandHandler::CompletionNoteL() const
       
   391     {
       
   392     QString displayText = CompletionTextL();
       
   393     if (!displayText.isNull())
       
   394         {
       
   395 		HbNotificationDialog::launchDialog(displayText);
       
   396         }
       
   397     }
       
   398 
       
   399 QString GlxMpxCommandHandler::CompletionTextL() const
       
   400     {
       
   401     return QString();
       
   402     }
       
   403 
       
   404 QString GlxMpxCommandHandler::ProgressTextL() const
       
   405     {
       
   406     return QString("Progressing...");
       
   407     }
       
   408 
       
   409 void GlxMpxCommandHandler::ProgressNoteL(TInt /*aCommandId*/)
       
   410     {
       
   411     mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
       
   412     mProgressDialog->setText(ProgressTextL());
       
   413     mProgressDialog->show();
       
   414     }
       
   415 
       
   416 void GlxMpxCommandHandler::DismissProgressNoteL()
       
   417     {
       
   418     if(mProgressDialog)
       
   419         {
       
   420         mProgressDialog->close();
       
   421         delete mProgressDialog;
       
   422         mProgressDialog = NULL;
       
   423         }
       
   424     }
       
   425 
       
   426 void GlxMpxCommandHandler::ConfirmationNoteL(MGlxMediaList& aMediaList)
       
   427     {
       
   428 	TInt selectionCount = aMediaList.SelectionCount();
       
   429 
       
   430     // If media list is not empty, treat focused item as selected
       
   431     // At this point can assume that the command was disabled 
       
   432     // if static items were not supported	
       
   433 	if ( selectionCount == 0  )
       
   434 		{
       
   435 		selectionCount = 1;
       
   436 		}
       
   437 	
       
   438     // Show confirmation note
       
   439 	if ( selectionCount == 1 )
       
   440 	    {
       
   441 		ConfirmationNoteSingleL(aMediaList);
       
   442 	    }
       
   443 	else
       
   444 	    {
       
   445 		ConfirmationNoteMultipleL(aMediaList);
       
   446 	    }
       
   447     }
       
   448 
       
   449 void GlxMpxCommandHandler::ConfirmationNoteSingleL(MGlxMediaList& aMediaList)
       
   450     {
       
   451     QString qtText = ConfirmationTextL();
       
   452     
       
   453     if(!qtText.isEmpty ())
       
   454         {
       
   455         // create fetch context
       
   456         TGlxSelectionIterator iterator;
       
   457         iterator.SetRange(1);
       
   458         CGlxAttributeContext* attributeContext = new(ELeave) CGlxAttributeContext(&iterator);
       
   459         CleanupStack::PushL(attributeContext);
       
   460         attributeContext->AddAttributeL(KMPXMediaGeneralTitle);
       
   461                         
       
   462         // add context to media list
       
   463         aMediaList.AddContextL(attributeContext, KGlxFetchContextPriorityLow);
       
   464             
       
   465         // TGlxContextRemover will remove the context when it goes out of scope
       
   466         // Used here to avoid a trap and still have safe cleanup
       
   467         TGlxFetchContextRemover contextRemover(attributeContext, aMediaList);
       
   468         // put to cleanupstack as cleanupstack is emptied before stack objects
       
   469         // are deleted
       
   470         CleanupClosePushL( contextRemover);
       
   471         // retrieve title attribute
       
   472         TInt err = GlxAttributeRetriever::RetrieveL(*attributeContext, aMediaList, EFalse);
       
   473         // context off the list
       
   474         CleanupStack::PopAndDestroy( &contextRemover );
       
   475     
       
   476         if ( err == KErrNone )
       
   477             {
       
   478             // use iterator to get the index of the right item 
       
   479             iterator.SetToFirst(&aMediaList);
       
   480             const CGlxMedia* media = aMediaList.Item(iterator++).Properties();
       
   481         
       
   482             // noteText has a place for a title string in it
       
   483             const TDesC& itemName = media->ValueText(KMPXMediaGeneralTitle);
       
   484             QString qtItemName = QString::fromUtf16(itemName.Ptr(),itemName.Length());
       
   485             QString localisedString  = qtText.arg(qtItemName);
       
   486             qtText = localisedString;          
       
   487             }
       
   488             // (else) If error, assume confirmed anyway
       
   489         CleanupStack::PopAndDestroy(attributeContext);
       
   490         HbMessageBox::question(qtText, this, SLOT(messageDialogClose(HbAction*)),HbMessageBox::Ok | HbMessageBox::Cancel);
       
   491         }
       
   492     else{
       
   493         executeMpxCommand(true);
       
   494         }
       
   495     }
       
   496 
       
   497 void GlxMpxCommandHandler::ConfirmationNoteMultipleL(MGlxMediaList& /*aMediaList*/)
       
   498     {
       
   499     QString qtText = ConfirmationTextL(true);
       
   500     if(!qtText.isEmpty ())
       
   501         {
       
   502         HbMessageBox::question(qtText, this, SLOT(messageDialogClose(HbAction*)),HbMessageBox::Ok |HbMessageBox::Cancel);
       
   503         }    
       
   504     else{
       
   505         executeMpxCommand(true);
       
   506         }
       
   507     }
       
   508 
       
   509 void GlxMpxCommandHandler::messageDialogClose(HbAction* action)
       
   510     {
       
   511     HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
       
   512     if(action == dlg->actions().at(0)) 
       
   513         {
       
   514         executeMpxCommand(true);
       
   515         }
       
   516     else
       
   517         {
       
   518         // Cancellation is done.
       
   519         executeMpxCommand(false);
       
   520         }
       
   521     }
       
   522 
       
   523 
       
   524 QString GlxMpxCommandHandler::ConfirmationTextL(bool /*multiSelection */) const
       
   525     {
       
   526     return QString();
       
   527     }