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:
@@ -722,11 +722,19 @@ DragSortableListView::RemoveSelected()
|
|||||||
{
|
{
|
||||||
BList indices;
|
BList indices;
|
||||||
GetSelectedItems(indices);
|
GetSelectedItems(indices);
|
||||||
|
int32 index = CurrentSelection()-1;
|
||||||
|
|
||||||
DeselectAll();
|
DeselectAll();
|
||||||
|
|
||||||
if (indices.CountItems() > 0)
|
if (indices.CountItems() > 0)
|
||||||
RemoveItemList(indices);
|
RemoveItemList(indices);
|
||||||
|
|
||||||
|
if (CountItems() > 0) {
|
||||||
|
if (index < 0)
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
Select(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAll
|
// RemoveAll
|
||||||
|
|||||||
@@ -240,9 +240,11 @@ PlaylistWindow::MessageReceived(BMessage* message)
|
|||||||
case M_PLAYLIST_RANDOMIZE:
|
case M_PLAYLIST_RANDOMIZE:
|
||||||
fListView->Randomize();
|
fListView->Randomize();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_PLAYLIST_REMOVE:
|
case M_PLAYLIST_REMOVE:
|
||||||
fListView->RemoveSelected();
|
fListView->RemoveSelected();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_PLAYLIST_MOVE_TO_TRASH:
|
case M_PLAYLIST_MOVE_TO_TRASH:
|
||||||
{
|
{
|
||||||
int32 index;
|
int32 index;
|
||||||
@@ -252,6 +254,7 @@ PlaylistWindow::MessageReceived(BMessage* message)
|
|||||||
fListView->RemoveSelectionToTrash();
|
fListView->RemoveSelectionToTrash();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user