MediaPlayer: Select previous item after item deletion

* Little usability improvement, avoid to select the item each time
in case the user want to delete more than one element.
* Minor cleanup included.
This commit is contained in:
Dario Casalinuovo 2016-05-04 18:27:43 +02:00
parent f022c304b0
commit 663ed1f6a0
2 changed files with 11 additions and 0 deletions

View File

@ -722,11 +722,19 @@ DragSortableListView::RemoveSelected()
{
BList indices;
GetSelectedItems(indices);
int32 index = CurrentSelection()-1;
DeselectAll();
if (indices.CountItems() > 0)
RemoveItemList(indices);
if (CountItems() > 0) {
if (index < 0)
index = 0;
Select(index);
}
}
// RemoveAll

View File

@ -240,9 +240,11 @@ PlaylistWindow::MessageReceived(BMessage* message)
case M_PLAYLIST_RANDOMIZE:
fListView->Randomize();
break;
case M_PLAYLIST_REMOVE:
fListView->RemoveSelected();
break;
case M_PLAYLIST_MOVE_TO_TRASH:
{
int32 index;
@ -252,6 +254,7 @@ PlaylistWindow::MessageReceived(BMessage* message)
fListView->RemoveSelectionToTrash();
break;
}
default:
BWindow::MessageReceived(message);
break;