ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp
changeset 24 99ad1390cd33
parent 23 74c9f037fd5d
child 26 c499df2dbb33
--- a/ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp	Fri Mar 19 09:28:59 2010 +0200
+++ b/ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp	Fri Apr 16 14:58:46 2010 +0300
@@ -24,52 +24,84 @@
 #include <mglxmedialist.h>
 #include <glxcommandfactory.h>
 #include <glxmpxcommandhandler.h>
-#include <QDebug>
+#include <glxfetchcontextremover.h>
+#include <glxmedialistiterator.h>
+#include <glxattributecontext.h>
+#include <glxattributeretriever.h>
+#include <glxuistd.h>
 
-GlxMpxCommandHandler::GlxMpxCommandHandler()
-{
+#include <textresolver.h>
+#include <hbmessagebox.h>
+#include <e32debug.h>
+#include <hbprogressdialog.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "glxmpxcommandhandlerTraces.h"
+#endif
+
+GlxMpxCommandHandler::GlxMpxCommandHandler() :
+    iProgressComplete(EFalse)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_ENTRY );
     iMediaList = NULL;
-}
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_EXIT );
+    }
 
 GlxMpxCommandHandler::~GlxMpxCommandHandler()
-{
+    {
+    OstTraceFunctionEntry0( DUP1_GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_ENTRY );
     //close the existing instance of Media List
-    if ( iMediaList ) { 
+    if (iMediaList)
+        {
         iMediaList->Close();
         iMediaList = NULL;
+        }
+    OstTraceFunctionExit0( DUP1_GLXMPXCOMMANDHANDLER_GLXMPXCOMMANDHANDLER_EXIT );
     }
-}
 
-void GlxMpxCommandHandler::executeCommand(int commandId,int collectionId)
-{
-    qDebug("GlxMpxCommandHandler::executeCommand ");
-    int aHierarchyId = 0; 
+void GlxMpxCommandHandler::executeCommand(int commandId, int collectionId,QList<QModelIndex>  indexList)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_EXECUTECOMMAND_ENTRY );
+    int aHierarchyId = 0;
     TGlxFilterItemType aFilterType = EGlxFilterImage;
 
-	//CreateMediaListL(aCollectionId, aHierarchyId,aFilterType);
-	if(collectionId != KGlxAlbumsMediaId)
-		{
-        qDebug("GlxMpxCommandHandler::executeCommand ::CreateMediaListL");
-		CreateMediaListL(collectionId, aHierarchyId,aFilterType);
-		}
-	else
-		{
-        qDebug("GlxMpxCommandHandler::executeCommand ::CreateMediaListAlbumItemL");
-		//for creating Medial List for Albums Media path Items
-		CreateMediaListAlbumItemL(collectionId, aHierarchyId,aFilterType);
-		}
+    //CreateMediaListL(aCollectionId, aHierarchyId,aFilterType);
+    if (collectionId != KGlxAlbumsMediaId)
+        {
+        OstTrace0( TRACE_NORMAL, DUP2_GLXMPXCOMMANDHANDLER_EXECUTECOMMAND, "GlxMpxCommandHandler::executeCommand::CreateMediaListL" );
+        CreateMediaListL(collectionId, aHierarchyId, aFilterType);
+        }
+    else
+        {
+        OstTrace0( TRACE_NORMAL, DUP3_GLXMPXCOMMANDHANDLER_EXECUTECOMMAND, "GlxMpxCommandHandler::executeCommand::CreateMediaListAlbumItemL" );
+        //for creating Medial List for Albums Media path Items
+        CreateMediaListAlbumItemL(collectionId, aHierarchyId, aFilterType);
+        }
 
     TBool consume = ETrue;
-	//Execute Command 
-	DoExecuteCommandL(commandId,*iMediaList,consume);
-	//Create MPX command if any
-    CMPXCommand* command = CreateCommandL(commandId,*iMediaList,consume);
-    if(command){
-        command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId, static_cast<TAny*>(this));
-        iMediaList->AddMediaListObserverL(this);
-        iMediaList->CommandL(*command);
+    iProgressComplete = EFalse;
+    //Execute Command 
+    DoExecuteCommandL(commandId, *iMediaList, consume);
+    //Create MPX command if any
+    consume = ConfirmationNoteL(*iMediaList);
+    if(consume)
+        {
+        CMPXCommand* command = CreateCommandL(commandId, *iMediaList, consume);
+        if (command)
+            {
+            command->SetTObjectValueL<TAny*> (KMPXCommandGeneralSessionId,
+                    static_cast<TAny*> (this));
+            iMediaList->AddMediaListObserverL(this);
+            iMediaList->CommandL(*command);
+            ProgressNoteL(commandId);
+            }
+        }
+    else //command cancelled,so unmark all items
+        {
+        MGlxMediaList::UnmarkAllL(*iMediaList);
+        }
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_EXECUTECOMMAND_EXIT );
     }
-}
 
 // ---------------------------------------------------------------------------
 // CreateMediaListL()
@@ -77,65 +109,77 @@
 // Create a filter as requested filtertype
 // Creates the medialist
 // ---------------------------------------------------------------------------
-void GlxMpxCommandHandler::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) 
-{
-   	Q_UNUSED(aHierarchyId);
-   	Q_UNUSED(aFilterType);	
-   	
-	//close the existing instance of Media List
-	if ( iMediaList ) { 
-	    iMediaList->Close();
-	    iMediaList = NULL;
-	}
+void GlxMpxCommandHandler::CreateMediaListL(int aCollectionId,
+        int aHierarchyId, TGlxFilterItemType aFilterType)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTL_ENTRY );
+    Q_UNUSED(aHierarchyId);
+    Q_UNUSED(aFilterType);
+
+    //close the existing instance of Media List
+    if (iMediaList)
+        {
+        iMediaList->Close();
+        iMediaList = NULL;
+        }
 
-	// Create path to the list of images and videos
-	CMPXCollectionPath* path = CMPXCollectionPath::NewL();
-	CleanupStack::PushL( path );
-	path->AppendL(aCollectionId);
-	// Create filter to filter out either images or videos
-	CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(EGlxFilterImage);   //todo take actual filter type
-	CleanupStack::PushL(filter);
-	
-	// Create the media list
-	iMediaList =  MGlxMediaList::InstanceL( *path, 
-	                  TGlxHierarchyId(0), filter );  //todo take actual hierarchy 
-	CleanupStack::PopAndDestroy( filter );
-	
-	CleanupStack::PopAndDestroy(path);
-}
+    // Create path to the list of images and videos
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL();
+    CleanupStack::PushL(path);
+    path->AppendL(aCollectionId);
+    // Create filter to filter out either images or videos
+    CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(
+            EGlxFilterImage); //todo take actual filter type
+    CleanupStack::PushL(filter);
+
+    // Create the media list
+    iMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(0), filter); //todo take actual hierarchy 
+    CleanupStack::PopAndDestroy(filter);
+
+    CleanupStack::PopAndDestroy(path);
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTL_EXIT );
+    }
     
+
 // ---------------------------------------------------------------------------
 // CreateMediaListAlbumItemL()
 // Creates the media list for the album Item 
 // ---------------------------------------------------------------------------
-void GlxMpxCommandHandler::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType)
-	{
-	Q_UNUSED(aCollectionId);
-	Q_UNUSED(aHierarchyId);
-	//retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList
-	CreateMediaListL(KGlxCollectionPluginAlbumsImplementationUid,0,EGlxFilterAlbum);
-	//retrieve the path of the focussed item of the MediaList
-	CMPXCollectionPath* path = iMediaList->PathLC(NGlxListDefs:: EPathFocusOrSelection);
-	//close the existing instance of Media List
-	iMediaList->Close();
-	iMediaList = NULL;
-	//create new media list with the derived path
-	CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
-	CleanupStack::PushL(filter);
-	iMediaList = MGlxMediaList::InstanceL( *path, 
-	                  TGlxHierarchyId(0), filter );  //todo take actual hierarchy
-	CleanupStack::PopAndDestroy( filter );
-	
-	CleanupStack::PopAndDestroy(path);
-	}
+void GlxMpxCommandHandler::CreateMediaListAlbumItemL(int aCollectionId,
+        int aHierarchyId, TGlxFilterItemType aFilterType)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTALBUMITEML_ENTRY );
+    Q_UNUSED(aCollectionId);
+    Q_UNUSED(aHierarchyId);
+    //retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList
+    CreateMediaListL(KGlxCollectionPluginAlbumsImplementationUid, 0,
+            EGlxFilterAlbum);
+    //retrieve the path of the focussed item of the MediaList
+    CMPXCollectionPath* path = iMediaList->PathLC(
+            NGlxListDefs::EPathFocusOrSelection);
+    //close the existing instance of Media List
+    iMediaList->Close();
+    iMediaList = NULL;
+    //create new media list with the derived path
+    CMPXFilter* filter =
+            TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);
+    CleanupStack::PushL(filter);
+    iMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(0), filter); //todo take actual hierarchy
+    CleanupStack::PopAndDestroy(filter);
+
+    CleanupStack::PopAndDestroy(path);
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_CREATEMEDIALISTALBUMITEML_EXIT );
+    }
 // -----------------------------------------------------------------------------
 // HandleItemAddedL
 // -----------------------------------------------------------------------------
 //  
-void GlxMpxCommandHandler::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
+void GlxMpxCommandHandler::HandleItemAddedL(TInt /*aStartIndex*/,
+        TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
     {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMADDEDL_ENTRY );
     // Do nothing
-    qDebug("New item added ");
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMADDEDL_EXIT );
     }
 
 // -----------------------------------------------------------------------------
@@ -143,18 +187,23 @@
 // -----------------------------------------------------------------------------
 //	
 void GlxMpxCommandHandler::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/)
-	{
-	// Do nothing
-	}
-	
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEMEDIAL_ENTRY );
+    // Do nothing
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEMEDIAL_EXIT );
+    }
+
 // -----------------------------------------------------------------------------
 // HandleItemRemovedL
 // -----------------------------------------------------------------------------
 //	
-void GlxMpxCommandHandler::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
-	{
-	// Do nothing
-	}
+void GlxMpxCommandHandler::HandleItemRemovedL(TInt /*aStartIndex*/,
+        TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMREMOVEDL_ENTRY );
+    // Do nothing
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMREMOVEDL_EXIT );
+    }
 	
 // -----------------------------------------------------------------------------
 // HandleItemModifiedL
@@ -163,7 +212,9 @@
 void GlxMpxCommandHandler::HandleItemModifiedL(const RArray<TInt>& /*aItemIndexes*/, 
         MGlxMediaList* /*aList*/)
 	{
+	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMMODIFIEDL_ENTRY );
 	// Do nothing
+	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMMODIFIEDL_EXIT );
 	}	
 
 // -----------------------------------------------------------------------------
@@ -173,7 +224,9 @@
 void GlxMpxCommandHandler::HandleAttributesAvailableL(TInt /*aItemIndex*/, 	
 	const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/)
 	{
+	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEATTRIBUTESAVAILABLEL_ENTRY );
 	// Do nothing
+	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEATTRIBUTESAVAILABLEL_EXIT );
 	}
 		
 // -----------------------------------------------------------------------------
@@ -183,7 +236,9 @@
 void GlxMpxCommandHandler::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, 
         TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) 
 	{
+	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEFOCUSCHANGEDL_ENTRY );
 	// Do nothing
+	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEFOCUSCHANGEDL_EXIT );
 	}
 	
 // -----------------------------------------------------------------------------
@@ -193,39 +248,58 @@
 void GlxMpxCommandHandler::HandleItemSelectedL(TInt /*aIndex*/, 
         TBool /*aSelected*/, MGlxMediaList* /*aList*/)
 	{
+	OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEITEMSELECTEDL_ENTRY );
 	// Do nothing
+	OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEITEMSELECTEDL_EXIT );
 	}
 
 // -----------------------------------------------------------------------------
 // HandleMessageL
 // -----------------------------------------------------------------------------
 //	
-void GlxMpxCommandHandler::HandleMessageL(const CMPXMessage& aMessage, 
-        MGlxMediaList* aList)
-{
-    if ((aMessage.IsSupported(KMPXMessageGeneralId) && (aMessage.IsSupported(KMPXCommandGeneralSessionId))))
+void GlxMpxCommandHandler::HandleMessageL(const CMPXMessage& aMessage,
+        MGlxMediaList*/* aList*/)
     {
-        TInt msgId = aMessage.ValueTObjectL<TInt>(KMPXMessageGeneralId);
-        TAny* sessionId = aMessage.ValueTObjectL<TAny*>(KMPXCommandGeneralSessionId);
-
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEMESSAGEL_ENTRY );
+    if ((aMessage.IsSupported(KMPXMessageGeneralId) && (aMessage.IsSupported(
+            KMPXCommandGeneralSessionId))))
+        {
+        TInt msgId = aMessage.ValueTObjectL<TInt> (KMPXMessageGeneralId);
+        TAny* sessionId = aMessage.ValueTObjectL<TAny*> (
+                KMPXCommandGeneralSessionId);
+        TInt error = KErrNone;
         // Check if this is a progress message and intended for this object
+        TryExitL(error);
+        }
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEMESSAGEL_EXIT );
     }
-}
 
 // -----------------------------------------------------------------------------
 // HandleCommandCompleteL
 // -----------------------------------------------------------------------------
 //	
-void GlxMpxCommandHandler::HandleCommandCompleteL(TAny* aSessionId, CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList)
+void GlxMpxCommandHandler::HandleCommandCompleteL(TAny* aSessionId,
+        CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList)
     {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLECOMMANDCOMPLETEL_ENTRY );
+    MGlxMediaList::UnmarkAllL(*iMediaList);
 
-    MGlxMediaList::UnmarkAllL(*iMediaList);
+    DoHandleCommandCompleteL(aSessionId, aCommandResult, aError, aList);
+    iProgressComplete = ETrue;
+    TryExitL(aError);
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLECOMMANDCOMPLETEL_EXIT );
+    }
+
+// -----------------------------------------------------------------------------
+// HandleError
+// -----------------------------------------------------------------------------
+//  
+void GlxMpxCommandHandler::HandleError(TInt /*aError*/)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEERROR_ENTRY );
     
-    DoHandleCommandCompleteL(aSessionId, aCommandResult, aError, aList);
-    
-    iMediaList->RemoveMediaListObserver(this);
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEERROR_EXIT );
     }
-    
 // -----------------------------------------------------------------------------
 // Default implementation of advanced command handling does nothing
 // -----------------------------------------------------------------------------
@@ -233,6 +307,9 @@
 void GlxMpxCommandHandler::DoHandleCommandCompleteL(TAny* /*aSessionId*/, 
         CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/)
     {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_DOHANDLECOMMANDCOMPLETEL_ENTRY );
+    
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_DOHANDLECOMMANDCOMPLETEL_EXIT );
     }
  
 // -----------------------------------------------------------------------------
@@ -240,7 +317,203 @@
 // -----------------------------------------------------------------------------
 //
 
-void GlxMpxCommandHandler::DoExecuteCommandL(TInt /*aCommandId*/, MGlxMediaList& /*aMediaList*/, TBool& /*aConsume*/)
-{
+void GlxMpxCommandHandler::DoExecuteCommandL(TInt /*aCommandId*/,
+        MGlxMediaList& /*aMediaList*/, TBool& /*aConsume*/)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_DOEXECUTECOMMANDL_ENTRY );
+
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_DOEXECUTECOMMANDL_EXIT );
+    }
+
+// -----------------------------------------------------------------------------
+// TryExitL
+// -----------------------------------------------------------------------------
+//  
+void GlxMpxCommandHandler::TryExitL(TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_TRYEXITL_ENTRY );
+    if (KErrNone != aErrorCode)
+        {
+        // @todo error received. Close progress note 
+        DismissProgressNoteL();
+        iMediaList->RemoveMediaListObserver(this);
+
+        // handle error
+        HandleErrorL(aErrorCode);
+        }
+    else if (iProgressComplete)
+        {
+        DismissProgressNoteL();
+        iMediaList->RemoveMediaListObserver(this);
+        CompletionNoteL();
+        }
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_TRYEXITL_EXIT );
+    }
+
+// -----------------------------------------------------------------------------
+// Default implementation shows an error note
+// -----------------------------------------------------------------------------
+//	
+void GlxMpxCommandHandler::HandleErrorL(TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( GLXMPXCOMMANDHANDLER_HANDLEERRORL_ENTRY );
+    // show error note
+    // TextResolver instance for error resolving.
+    CTextResolver* textresolver = CTextResolver::NewLC();
+    // Resolve the error text
+    const TDesC& text = textresolver->ResolveErrorString(aErrorCode);
+
+    QString qtText = QString::fromUtf16(text.Ptr(), text.Length());
+
+    HbMessageBox box(HbMessageBox::MessageTypeInformation);
+    box.setText(qtText);
+    box.exec();
+    CleanupStack::PopAndDestroy(textresolver);
+    OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_HANDLEERRORL_EXIT );
+    }
+
+void GlxMpxCommandHandler::CompletionNoteL() const
+    {
+    QString displayText = CompletionTextL();
+    if (!displayText.isNull())
+        {
+        HbMessageBox::information(displayText);
+        }
+    }
+
+QString GlxMpxCommandHandler::CompletionTextL() const
+    {
+    return QString();
+    }
+
+QString GlxMpxCommandHandler::ProgressTextL() const
+    {
+    return QString("Progressing...");
+    }
+
+void GlxMpxCommandHandler::ProgressNoteL(TInt /*aCommandId*/)
+    {
+    mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    mProgressDialog->setText(ProgressTextL());
+    mProgressDialog->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    mProgressDialog->show();
+    }
+
+void GlxMpxCommandHandler::DismissProgressNoteL()
+    {
+    mProgressDialog->close();
+    delete mProgressDialog;
+    mProgressDialog = NULL;
+    }
+
+bool GlxMpxCommandHandler::ConfirmationNoteL(MGlxMediaList& aMediaList) const
+    {
+	TInt selectionCount = aMediaList.SelectionCount();
 
-}
+    // If media list is not empty, treat focused item as selected
+    // At this point can assume that the command was disabled 
+    // if static items were not supported	
+	if ( selectionCount == 0  )
+		{
+		selectionCount = 1;
+		}
+	
+    // Show confirmation note
+	bool confirmed = true;
+	if ( selectionCount == 1 )
+	    {
+		confirmed = ConfirmationNoteSingleL(aMediaList);
+	    }
+	else
+	    {
+		confirmed = ConfirmationNoteMultipleL(aMediaList);
+	    }
+		
+	return confirmed;
+    }
+
+bool GlxMpxCommandHandler::ConfirmationNoteSingleL(MGlxMediaList& aMediaList) const
+    {
+    bool confirmAction = true;
+
+    QString qtText = ConfirmationTextL();
+    
+    if(!qtText.isEmpty ())
+        {
+        // create fetch context
+        TGlxSelectionIterator iterator;
+        iterator.SetRange(1);
+        CGlxAttributeContext* attributeContext = new(ELeave) CGlxAttributeContext(&iterator);
+        CleanupStack::PushL(attributeContext);
+        attributeContext->AddAttributeL(KMPXMediaGeneralTitle);
+                        
+        // add context to media list
+        aMediaList.AddContextL(attributeContext, KGlxFetchContextPriorityLow);
+            
+        // TGlxContextRemover will remove the context when it goes out of scope
+        // Used here to avoid a trap and still have safe cleanup
+        TGlxFetchContextRemover contextRemover(attributeContext, aMediaList);
+        // put to cleanupstack as cleanupstack is emptied before stack objects
+        // are deleted
+        CleanupClosePushL( contextRemover);
+        // retrieve title attribute
+        TInt err = GlxAttributeRetriever::RetrieveL(*attributeContext, aMediaList, EFalse);
+        // context off the list
+        CleanupStack::PopAndDestroy( &contextRemover );
+    
+        if ( err == KErrNone )
+            {
+            // use iterator to get the index of the right item 
+            iterator.SetToFirst(&aMediaList);
+            const CGlxMedia* media = aMediaList.Item(iterator++).Properties();
+        
+            // noteText has a place for a title string in it
+            const TDesC& itemName = media->ValueText(KMPXMediaGeneralTitle);
+            QString qtItemName = QString::fromUtf16(itemName.Ptr(),itemName.Length());
+            qtText.append(QString("%1").arg(qtItemName));
+            }
+            // (else) If error, assume confirmed anyway
+            	
+            CleanupStack::PopAndDestroy(attributeContext);
+        
+        HbMessageBox box(HbMessageBox::MessageTypeQuestion);
+        box.setDismissPolicy(HbDialog::NoDismiss);
+
+        // Set timeout to zero to wait user to either click Ok or Cancel
+        box.setTimeout(HbDialog::NoTimeout);
+        
+        box.setText(qtText);
+        HbAction *action = box.exec();
+        if(action != box.primaryAction())
+            {
+            confirmAction = false;
+            }
+        }    
+    return confirmAction;
+    }
+    
+bool GlxMpxCommandHandler::ConfirmationNoteMultipleL(MGlxMediaList& /*aMediaList*/) const
+    {
+    bool confirmAction = true;
+
+    QString qtText = ConfirmationTextL(true);
+    if(!qtText.isEmpty ())
+        {
+        HbMessageBox box(HbMessageBox::MessageTypeQuestion);
+        box.setDismissPolicy(HbDialog::NoDismiss);
+        // Set timeout to zero to wait user to either click Ok or Cancel
+        box.setTimeout(HbDialog::NoTimeout);
+        box.setText(qtText);
+        HbAction *action = box.exec();
+        if(action != box.primaryAction())
+            {
+            confirmAction = false;
+            }
+        }    
+    return confirmAction;
+    }
+    
+QString GlxMpxCommandHandler::ConfirmationTextL(bool /*multiSelection */) const
+    {
+    return QString();
+    }