videocollection/hgmyvideos/src/vcxhgmyvideosvideolistimpl.cpp
branchRCL_3
changeset 9 5294c000a26d
parent 8 ce5ada96ab30
child 10 112a725ff2c2
equal deleted inserted replaced
8:ce5ada96ab30 9:5294c000a26d
   310 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   311 //
   311 //
   312 void CVcxHgMyVideosVideoListImpl::DeleteVideosL()
   312 void CVcxHgMyVideosVideoListImpl::DeleteVideosL()
   313     {
   313     {
   314     IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoListImpl::DeleteVideosL()" );
   314     IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoListImpl::DeleteVideosL()" );
   315     RArray<TInt> operationTargets;
   315     RArray<TInt> operationTargetIndexes;
   316     CleanupClosePushL( operationTargets );
   316 	RArray<TInt> operationTargetIds;
   317     
   317     CleanupClosePushL( operationTargetIndexes );
   318     GetOperationTargetIndexesL( operationTargets );
   318     CleanupClosePushL( operationTargetIds );
   319 
   319     
   320     if ( ConfirmDeleteVideosL( operationTargets.Count(),
   320     GetOperationTargetIndexesL( operationTargetIndexes );
   321                                iVideoModel->GetVideoName( operationTargets[0] ) ) )
   321     OperationTargetsToMpxIdsL( operationTargetIndexes, operationTargetIds );
       
   322 
       
   323     if ( ConfirmDeleteVideosL( operationTargetIndexes.Count(),
       
   324                                iVideoModel->GetVideoName( operationTargetIndexes[0] ) ) )
   322         {
   325         {
   323         HandleMarkCommandL( EVcxHgMyVideosCmdUnmarkAll );
   326         HandleMarkCommandL( EVcxHgMyVideosCmdUnmarkAll );
   324 
   327 
   325         // Wait note is closed in destructor (CloseDeleteWaitNote()), 
   328         // Wait note is closed in destructor (CloseDeleteWaitNote()), 
   326         // in DialogDismissedL() or in VideoDeletionCompletedL().
   329         // in DialogDismissedL() or in VideoDeletionCompletedL().
   327         OpenDeleteWaitNoteL();
   330         OpenDeleteWaitNoteL();
   328 
   331 
   329         iVideoModel->DeleteVideosL( operationTargets );
   332         TRAPD( err, iVideoModel->DeleteVideosL( operationTargetIds ) );
   330         }
   333         
   331     CleanupStack::PopAndDestroy( &operationTargets );
   334         if( err != KErrNone )
       
   335             {
       
   336             CloseDeleteWaitNote();
       
   337             }
       
   338         }
       
   339 
       
   340     CleanupStack::PopAndDestroy( &operationTargetIds );
       
   341     CleanupStack::PopAndDestroy( &operationTargetIndexes );
   332     }
   342     }
   333 
   343 
   334 // -----------------------------------------------------------------------------
   344 // -----------------------------------------------------------------------------
   335 // CVcxHgMyVideosVideoListImpl::ConfirmDeleteVideosL()
   345 // CVcxHgMyVideosVideoListImpl::ConfirmDeleteVideosL()
   336 // -----------------------------------------------------------------------------
   346 // -----------------------------------------------------------------------------
   649 // CVcxHgMyVideosVideoListImpl::HandleMoveOrCopyCommandL() 
   659 // CVcxHgMyVideosVideoListImpl::HandleMoveOrCopyCommandL() 
   650 // -----------------------------------------------------------------------------
   660 // -----------------------------------------------------------------------------
   651 //
   661 //
   652 void CVcxHgMyVideosVideoListImpl::HandleMoveOrCopyCommandL( TBool aCopy )
   662 void CVcxHgMyVideosVideoListImpl::HandleMoveOrCopyCommandL( TBool aCopy )
   653     {
   663     {
   654     RArray<TInt> operationTargets;
   664     RArray<TInt> operationTargetIndexes;
   655     CleanupClosePushL( operationTargets );
   665 	RArray<TInt> operationTargetIds;
   656     
   666     CleanupClosePushL( operationTargetIndexes );
   657     GetOperationTargetIndexesL( operationTargets );
   667     CleanupClosePushL( operationTargetIds );
       
   668     
       
   669     GetOperationTargetIndexesL( operationTargetIndexes );
       
   670     OperationTargetsToMpxIdsL( operationTargetIndexes, operationTargetIds );
       
   671     
   658     HandleMarkCommandL( EVcxHgMyVideosCmdUnmarkAll );
   672     HandleMarkCommandL( EVcxHgMyVideosCmdUnmarkAll );
   659     iVideoCopier->MoveOrCopyL( operationTargets, aCopy );
   673     iVideoCopier->MoveOrCopyL( operationTargetIds, aCopy );
   660     
   674     
   661     CleanupStack::PopAndDestroy( &operationTargets );
   675     CleanupStack::PopAndDestroy( &operationTargetIds );
       
   676     CleanupStack::PopAndDestroy( &operationTargetIndexes );
   662     }
   677     }
   663 
   678 
   664 // -----------------------------------------------------------------------------
   679 // -----------------------------------------------------------------------------
   665 // CVcxHgMyVideosVideoListImpl::VideoMoveOrCopyCompletedL()
   680 // CVcxHgMyVideosVideoListImpl::VideoMoveOrCopyCompletedL()
   666 // -----------------------------------------------------------------------------
   681 // -----------------------------------------------------------------------------
  1138         iAiwMenuHandler->AttachMenuL( R_VCXHGMYVIDEOS_USE_AS_SUBMENU );
  1153         iAiwMenuHandler->AttachMenuL( R_VCXHGMYVIDEOS_USE_AS_SUBMENU );
  1139         }
  1154         }
  1140     return iAiwMenuHandler;
  1155     return iAiwMenuHandler;
  1141     }
  1156     }
  1142 #endif
  1157 #endif
       
  1158 
       
  1159 // ---------------------------------------------------------------------------
       
  1160 // CVcxHgMyVideosVideoListImpl::OperationTargetsToMpxIdsL()
       
  1161 // ---------------------------------------------------------------------------
       
  1162 //
       
  1163 void CVcxHgMyVideosVideoListImpl::OperationTargetsToMpxIdsL( 
       
  1164                                        RArray<TInt>& aOperationTargetIndexes,  
       
  1165                                        RArray<TInt>& aOperationTargetIds )
       
  1166     {
       
  1167     for ( TInt i = 0; i < aOperationTargetIndexes.Count(); i++ )
       
  1168         {
       
  1169 		if ( iVideoModel->GetVideoId( aOperationTargetIndexes[i] ) != KErrNotFound )
       
  1170             {
       
  1171             aOperationTargetIds.Append( iVideoModel->GetVideoId( aOperationTargetIndexes[i] ) );
       
  1172             }
       
  1173         }
       
  1174     }