diff -r c499df2dbb33 -r 112f0ac2d1f0 ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp --- a/ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp Mon May 03 12:31:32 2010 +0300 +++ b/ui/commandhandlers/commandhandlerbase/src/glxmpxcommandhandler.cpp Mon May 03 00:53:50 2010 +0530 @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,8 @@ #include "glxmpxcommandhandlerTraces.h" #endif +#include + GlxMpxCommandHandler::GlxMpxCommandHandler() : iProgressComplete(EFalse) { @@ -66,7 +67,6 @@ int aHierarchyId = 0; TGlxFilterItemType aFilterType = EGlxFilterImage; - //CreateMediaListL(aCollectionId, aHierarchyId,aFilterType); if (collectionId != KGlxAlbumsMediaId) { OstTrace0( TRACE_NORMAL, DUP2_GLXMPXCOMMANDHANDLER_EXECUTECOMMAND, "GlxMpxCommandHandler::executeCommand::CreateMediaListL" ); @@ -81,27 +81,38 @@ TBool consume = ETrue; iProgressComplete = EFalse; + mProgressDialog = NULL; //Execute Command DoExecuteCommandL(commandId, *iMediaList, consume); - //Create MPX command if any - consume = ConfirmationNoteL(*iMediaList); - if(consume) + mCommandId = commandId; + ConfirmationNoteL(*iMediaList); + OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_EXECUTECOMMAND_EXIT ); + } + +void GlxMpxCommandHandler::executeMpxCommand(bool execute) + { + if(execute && !iMediaList->IsCommandActive()) { - CMPXCommand* command = CreateCommandL(commandId, *iMediaList, consume); + TBool consume = ETrue; + CMPXCommand* command = CreateCommandL(mCommandId, *iMediaList, consume); if (command) { command->SetTObjectValueL (KMPXCommandGeneralSessionId, static_cast (this)); iMediaList->AddMediaListObserverL(this); iMediaList->CommandL(*command); - ProgressNoteL(commandId); + + if(iMediaList->SelectionCount() > 1) + { + ProgressNoteL(mCommandId); + } } } else //command cancelled,so unmark all items { MGlxMediaList::UnmarkAllL(*iMediaList); } - OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_EXECUTECOMMAND_EXIT ); + } // --------------------------------------------------------------------------- @@ -347,6 +358,7 @@ DismissProgressNoteL(); iMediaList->RemoveMediaListObserver(this); CompletionNoteL(); + iProgressComplete = EFalse; } OstTraceFunctionExit0( GLXMPXCOMMANDHANDLER_TRYEXITL_EXIT ); } @@ -394,18 +406,20 @@ { 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; + if(mProgressDialog) + { + mProgressDialog->close(); + delete mProgressDialog; + mProgressDialog = NULL; + } } -bool GlxMpxCommandHandler::ConfirmationNoteL(MGlxMediaList& aMediaList) const +void GlxMpxCommandHandler::ConfirmationNoteL(MGlxMediaList& aMediaList) { TInt selectionCount = aMediaList.SelectionCount(); @@ -418,23 +432,18 @@ } // Show confirmation note - bool confirmed = true; if ( selectionCount == 1 ) { - confirmed = ConfirmationNoteSingleL(aMediaList); + ConfirmationNoteSingleL(aMediaList); } else { - confirmed = ConfirmationNoteMultipleL(aMediaList); + ConfirmationNoteMultipleL(aMediaList); } - - return confirmed; } -bool GlxMpxCommandHandler::ConfirmationNoteSingleL(MGlxMediaList& aMediaList) const +void GlxMpxCommandHandler::ConfirmationNoteSingleL(MGlxMediaList& aMediaList) { - bool confirmAction = true; - QString qtText = ConfirmationTextL(); if(!qtText.isEmpty ()) @@ -472,46 +481,41 @@ qtText.append(QString("%1").arg(qtItemName)); } // (else) If error, assume confirmed anyway - - CleanupStack::PopAndDestroy(attributeContext); - - HbMessageBox box(HbMessageBox::MessageTypeQuestion); - box.setDismissPolicy(HbDialog::NoDismiss); + CleanupStack::PopAndDestroy(attributeContext); + HbMessageBox::question(qtText, this, SLOT(messageDialogClose(HbAction*))); + } + else{ + executeMpxCommand(true); + } + } - // 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 +void GlxMpxCommandHandler::ConfirmationNoteMultipleL(MGlxMediaList& /*aMediaList*/) { - 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; - } + HbMessageBox::question(qtText, this, SLOT(messageDialogClose(HbAction*))); } - return confirmAction; + else{ + executeMpxCommand(true); + } } - + +void GlxMpxCommandHandler::messageDialogClose(HbAction* action) + { + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + executeMpxCommand(true); + } + else + { + // Cancellation is done. + executeMpxCommand(false); + } + } + + QString GlxMpxCommandHandler::ConfirmationTextL(bool /*multiSelection */) const { return QString();