mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
changeset 1 8118492f1bdf
parent 0 ff3acec5bc43
child 2 b70d77332e66
equal deleted inserted replaced
0:ff3acec5bc43 1:8118492f1bdf
   617     			EMPXUSBUnblockingPSStatusActive );
   617     			EMPXUSBUnblockingPSStatusActive );
   618     	}
   618     	}
   619     }
   619     }
   620 
   620 
   621 // ---------------------------------------------------------------------------
   621 // ---------------------------------------------------------------------------
       
   622 // Delete the selected items in TBone View
       
   623 // ---------------------------------------------------------------------------
       
   624 //
       
   625 void CMPXCollectionViewHgImp::DeleteSelectedTBoneItemsL(TInt aCommand)
       
   626     {
       
   627     MPX_FUNC( "CMPXCollectionViewHgImp::DeleteSelectedTBoneItemsL" );
       
   628      // if reorder mode is on, or something is currently deleting, disable delete
       
   629     TBool isIgnore( iContainer->IsInReorderMode() || iIsDeleting );
       
   630 
       
   631     if ( !isIgnore  && iCollectionReady )
       
   632         {
       
   633         CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
       
   634         const CMPXMedia& containerMedia( listboxArray->ContainerMedia() );
       
   635 
       
   636         TMPXGeneralType containerType(
       
   637             containerMedia.ValueTObjectL<TMPXGeneralType>(
       
   638                 KMPXMediaGeneralType ) );
       
   639         TMPXGeneralCategory containerCategory(
       
   640             containerMedia.ValueTObjectL<TMPXGeneralCategory>(
       
   641                 KMPXMediaGeneralCategory ) );
       
   642 
       
   643         const TMPXItemId containerId = containerMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
   644 
       
   645         HBufC* promptTxt( NULL );
       
   646         HBufC* waitNoteText( NULL );
       
   647         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
       
   648         
       
   649         // Create a copy of collection path
       
   650         CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
       
   651         CleanupStack::PushL( path );
       
   652 
       
   653         if ( containerType == EMPXItem && containerCategory == EMPXAlbum )    
       
   654             {             
       
   655              //get the media object of the selected track in TBone View
       
   656             CMPXMedia* albumTrack = iContainer->SelectedItemMediaL();
       
   657             
       
   658             TMPXGeneralType mediaType(
       
   659                     albumTrack->ValueTObjectL<TMPXGeneralType>(
       
   660                             KMPXMediaGeneralType ) );
       
   661             TMPXGeneralCategory mediaCategory(
       
   662                     albumTrack->ValueTObjectL<TMPXGeneralCategory>(
       
   663                     KMPXMediaGeneralCategory ) );
       
   664 
       
   665             if ( mediaType == EMPXItem && mediaCategory == EMPXSong )
       
   666                 {
       
   667                 // tracks level in Tbone View
       
   668                 TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
   669                 const TDesC& trackTitle( albumTrack->ValueText( KMPXMediaGeneralTitle ) );
       
   670                 // create the item path to delete
       
   671                  path->Back();
       
   672                  path->Back();
       
   673                  path->AppendL(containerId);
       
   674                  path->AppendL(trackId);
       
   675 
       
   676                 waitNoteText = StringLoader::LoadLC(
       
   677                     R_MPX_QTN_ALBUM_WAITING_DELETING, trackTitle );
       
   678                 promptTxt = StringLoader::LoadLC(
       
   679                     R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
       
   680                     trackTitle );
       
   681 
       
   682                 iConfirmationDlg = CAknQueryDialog::NewL(
       
   683                 CAknQueryDialog::EConfirmationTone );
       
   684 
       
   685                 waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
       
   686                 
       
   687                 iConfirmationDlg->SetPromptL( *promptTxt );
       
   688                 CleanupStack::PopAndDestroy( promptTxt );
       
   689                 TBool performDelete(EFalse);
       
   690                 if(iCachedCommand == aCommand)
       
   691                    {
       
   692                    performDelete = ETrue;
       
   693                    }
       
   694                 if (!performDelete)
       
   695                     {
       
   696                     if ( iConfirmationDlg->ExecuteLD( R_MPX_CUI_DELETE_CONFIRMATION_QUERY ) )
       
   697                         {
       
   698                         performDelete = ETrue;
       
   699                         }
       
   700                     }
       
   701                 if (performDelete)
       
   702                     {
       
   703                     HandleCommandL( EMPXCmdIgnoreExternalCommand );
       
   704                     MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
       
   705                     if(iCachedCommand != aCommand)
       
   706                         {
       
   707                         iIsWaitNoteCanceled = EFalse;
       
   708                         StartProgressNoteL();
       
   709                         TPtr buf = waitNoteText->Des();
       
   710                         UpdateProcessL(0, buf);
       
   711                         }
       
   712                     if ( !iIsWaitNoteCanceled )
       
   713                         {
       
   714                         iIsDeleting = ETrue;
       
   715                         iCollectionUiHelper->DeleteL( *path, this );
       
   716                         }
       
   717                     else if( iContainer )
       
   718                         {
       
   719                         // delete was canceled before it even began, clear marked items
       
   720                         iContainer->ClearLbxSelection();
       
   721                         }
       
   722                     iIsWaitNoteCanceled = EFalse;
       
   723         
       
   724                     if(iContainer->FindBoxVisibility())
       
   725                         {
       
   726                         iContainer->EnableFindBox(EFalse);
       
   727                         }
       
   728                     }
       
   729                 iConfirmationDlg = NULL;
       
   730                 CleanupStack::PopAndDestroy( waitNoteText );
       
   731                 }
       
   732             }
       
   733         CleanupStack::PopAndDestroy( path );
       
   734         }
       
   735     }
       
   736 
       
   737 
       
   738 // ---------------------------------------------------------------------------
   622 // Delete the selected items
   739 // Delete the selected items
   623 // ---------------------------------------------------------------------------
   740 // ---------------------------------------------------------------------------
   624 //
   741 //
   625 void CMPXCollectionViewHgImp::DeleteSelectedItemsL(TInt aCommand)
   742 void CMPXCollectionViewHgImp::DeleteSelectedItemsL(TInt aCommand)
   626     {
   743     {
  2780                 }
  2897                 }
  2781             }
  2898             }
  2782         }
  2899         }
  2783     return isHidden;
  2900     return isHidden;
  2784     }
  2901     }
       
  2902 
       
  2903 
       
  2904 
       
  2905 // -----------------------------------------------------------------------------
       
  2906 // Handle send command in TBone view.
       
  2907 // -----------------------------------------------------------------------------
       
  2908 //
       
  2909 void CMPXCollectionViewHgImp::DoSendTBoneListItemL(TMPXItemId aContainerId)
       
  2910     {
       
  2911 
       
  2912     MPX_FUNC( "CMPXCollectionViewHgImp::DoSendTBoneListItemL" );
       
  2913     
       
  2914     CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
       
  2915     CleanupStack::PushL( path );
       
  2916     
       
  2917     CMPXMedia* albumTrack = iContainer->SelectedItemMediaL();
       
  2918     TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
  2919 
       
  2920     path->Back();
       
  2921     path->Back();
       
  2922     path->AppendL(aContainerId);
       
  2923     path->AppendL(trackId); 
       
  2924 
       
  2925     RArray<TMPXAttribute> attrs;
       
  2926     CleanupClosePushL(attrs);
       
  2927     attrs.Append(
       
  2928         TMPXAttribute( KMPXMediaIdGeneral,
       
  2929             EMPXMediaGeneralUri | EMPXMediaGeneralSize |
       
  2930             EMPXMediaGeneralCollectionId |
       
  2931             EMPXMediaGeneralFlags | EMPXMediaGeneralId |
       
  2932             EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
       
  2933     iCurrentMediaLOp = EMPXOpMediaLSend;
       
  2934     iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
       
  2935     CleanupStack::PopAndDestroy( &attrs );
       
  2936     CleanupStack::PopAndDestroy( path );
       
  2937 }
       
  2938 
       
  2939 
       
  2940 
  2785 
  2941 
  2786 // -----------------------------------------------------------------------------
  2942 // -----------------------------------------------------------------------------
  2787 // Handle send command.
  2943 // Handle send command.
  2788 // -----------------------------------------------------------------------------
  2944 // -----------------------------------------------------------------------------
  2789 //
  2945 //
  3836                 RProperty::Set( KMPXViewPSUid,
  3992                 RProperty::Set( KMPXViewPSUid,
  3837                                 KMPXUSBUnblockingPSStatus,
  3993                                 KMPXUSBUnblockingPSStatus,
  3838                                 EMPXUSBUnblockingPSStatusActive );
  3994                                 EMPXUSBUnblockingPSStatusActive );
  3839 				}
  3995 				}
  3840 
  3996 
  3841             if ( iIsEmbedded && type == EMcMsgUSBMassStorageEnd )
  3997             if ( iContainer && iIsEmbedded && type == EMcMsgUSBMassStorageEnd )
  3842             	{
  3998             	{
  3843             	DoIncrementalOpenL();
  3999             	DoIncrementalOpenL();
  3844             	}
  4000             	}
  3845             } // if event == EBroadcastEvent
  4001             } // if event == EBroadcastEvent
  3846         } // if ( KMPXMessageGeneral == id )
  4002         } // if ( KMPXMessageGeneral == id )
  5180             }
  5336             }
  5181         case EMPXCmdDelete: // fall through
  5337         case EMPXCmdDelete: // fall through
  5182         case EMPXCmdRemove:
  5338         case EMPXCmdRemove:
  5183             {
  5339             {
  5184             StoreListboxItemIndexL();
  5340             StoreListboxItemIndexL();
  5185             DeleteSelectedItemsL(aCommand);
  5341             if ( iContainer->IsTBoneView() )
       
  5342                 {
       
  5343                 DeleteSelectedTBoneItemsL(aCommand);
       
  5344                 }
       
  5345             else
       
  5346                 {
       
  5347                 DeleteSelectedItemsL(aCommand);    
       
  5348                 }
  5186             break;
  5349             break;
  5187             }
  5350             }
  5188         case EMPXCmdSend:
  5351         case EMPXCmdSend:
  5189             {
  5352             {
  5190             const CMPXMedia& media =
  5353             const CMPXMedia& media =
  5194             TMPXGeneralType type(
  5357             TMPXGeneralType type(
  5195                 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
  5358                 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
  5196             TMPXGeneralCategory category(
  5359             TMPXGeneralCategory category(
  5197                 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
  5360                 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
  5198 
  5361 
  5199             if ( iContainer->CurrentSelectionIndicesL()->Count() == 0 &&
  5362             if( type == EMPXItem && category == EMPXAlbum && 
       
  5363                     iContainer->IsTBoneView() )
       
  5364                 {
       
  5365                 const TMPXItemId containerId = media.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
  5366                 DoSendTBoneListItemL(containerId);
       
  5367                 }
       
  5368             else if ( iContainer->CurrentSelectionIndicesL()->Count() == 0 &&
  5200                 type == EMPXItem &&
  5369                 type == EMPXItem &&
  5201                 category == EMPXPlaylist )
  5370                 category == EMPXPlaylist )
  5202                 {
  5371                 {
  5203                 // sending a playlist
  5372                 // sending a playlist
  5204                 DoSendPlaylistL( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  5373                 DoSendPlaylistL( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  5522                         if ( iContainer && !AppUi()->IsDisplayingDialog() )
  5691                         if ( iContainer && !AppUi()->IsDisplayingDialog() )
  5523                             {
  5692                             {
  5524                             StopDisplayingMenuBar();
  5693                             StopDisplayingMenuBar();
  5525                             }
  5694                             }
  5526                         iPlayIndex = KErrNotFound;
  5695                         iPlayIndex = KErrNotFound;
  5527                         if(iCollectionCacheReady)
  5696 
  5528                             {
  5697                         if (iContainer->IsSelectedItemASong())
  5529                             iCollectionUtility->Collection().OpenL( currentItem, EMPXOpenPlaylistOnly );
  5698 							{
  5530                             iFirstIncrementalBatch = ETrue;
  5699 							if(iCollectionCacheReady)
  5531                             }
  5700 								{
       
  5701 								iCollectionUtility->Collection().OpenL( currentItem, EMPXOpenPlaylistOnly );
       
  5702 								iFirstIncrementalBatch = ETrue;
       
  5703 								}
       
  5704 							}
       
  5705 						else
       
  5706 							{
       
  5707 							iContainer->HandleItemCommandL(EMPXCmdPlay);
       
  5708 							}
       
  5709 
  5532                         }
  5710                         }
  5533                     }
  5711                     }
  5534                 else
  5712                 else
  5535                     {
  5713                     {
  5536                     AppUi()->HandleCommandL( aCommand );
  5714                     AppUi()->HandleCommandL( aCommand );
  6435                                 TBool fileDetailVisibility( FileDetailsOptionVisibilityL() );
  6613                                 TBool fileDetailVisibility( FileDetailsOptionVisibilityL() );
  6436                                 // use the same criteria for showing/hiding song details
  6614                                 // use the same criteria for showing/hiding song details
  6437                                 // and album art
  6615                                 // and album art
  6438                                 aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
  6616                                 aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
  6439                                     fileDetailVisibility );
  6617                                     fileDetailVisibility );
  6440                                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt,
  6618                                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
  6441                                     fileDetailVisibility );
       
  6442 #ifdef SINGLE_CLICK_INCLUDED
  6619 #ifdef SINGLE_CLICK_INCLUDED
  6443                                 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );  
  6620                                 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );  
  6444 #else
  6621 #else
  6445                                 TBool vis = ETrue;
  6622                                 TBool vis = ETrue;
  6446                                 TRAPD( err, vis = SetAsRingToneOptionVisibilityL() );
  6623                                 TRAPD( err, vis = SetAsRingToneOptionVisibilityL() );
  7711         cba->MakeVisible( aVisible );
  7888         cba->MakeVisible( aVisible );
  7712 		cba->DrawDeferred();
  7889 		cba->DrawDeferred();
  7713 		}
  7890 		}
  7714     }
  7891     }
  7715 
  7892 
       
  7893 void CMPXCollectionViewHgImp::UpdateCba()
       
  7894     {
       
  7895     TRAP_IGNORE( 
       
  7896         {
       
  7897         CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
       
  7898         CleanupStack::PushL( cpath );
       
  7899     
       
  7900         CMPXCommonListBoxArrayBase* listboxArray(
       
  7901             iContainer->ListBoxArray() );
       
  7902         const CMPXMedia& media( listboxArray->ContainerMedia() );
       
  7903     
       
  7904         TMPXGeneralType containerType( EMPXNoType );
       
  7905         if ( media.IsSupported( KMPXMediaGeneralType ) )
       
  7906             {
       
  7907             containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
       
  7908             }
       
  7909     
       
  7910         TMPXGeneralCategory containerCategory( EMPXNoCategory );
       
  7911         if ( media.IsSupported( KMPXMediaGeneralCategory ) )
       
  7912             {
       
  7913             containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
       
  7914             }
       
  7915         TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
       
  7916         CEikButtonGroupContainer* cba = Cba();
       
  7917         if ( cba && containerType == EMPXGroup && containerCategory == EMPXAlbum && landscapeOrientation )
       
  7918             {
       
  7919             cba->SetCommandSetL( R_MPX_COLLECTION_TRANSPARENT_CBA );
       
  7920             cba->MakeVisible( EFalse );
       
  7921             cba->DrawDeferred();
       
  7922             }
       
  7923         else if ( cba )
       
  7924             {
       
  7925             cba->SetCommandSetL(
       
  7926                 ( cpath->Levels() == 3 && !iIsEmbedded ) ?
       
  7927                 R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  7928             cba->MakeVisible( ETrue );
       
  7929             cba->DrawDeferred();
       
  7930             }
       
  7931         CleanupStack::PopAndDestroy(cpath);
       
  7932         });
       
  7933     }
  7716 
  7934 
  7717 // -----------------------------------------------------------------------------
  7935 // -----------------------------------------------------------------------------
  7718 // CMPXCollectionViewHgImp::OpenAllSongsL
  7936 // CMPXCollectionViewHgImp::OpenAllSongsL
  7719 // Open the collection at all songs level.
  7937 // Open the collection at all songs level.
  7720 // -----------------------------------------------------------------------------
  7938 // -----------------------------------------------------------------------------