MediaPlayer: Delete playlist items use plain old delete
... fixing a TODO now that #7078 is fixed. There are 2 remove playlist actions: 'Remove' and 'Move file to Trash' * 'Remove' playlist shortcut: Cmd+Delete => Delete (This also works from the main window to remove the file you're currently focused on/listening to from the playlist.) * 'Remove file from playlist' shortcut has been removed. We have decided not to Trash files from MediaPlayer's playlist anymore, you'll have to trash the files from a regular Tracker window. The 'Remove' shortcut gets plain old delete as the author intended. Change-Id: I3b1e19405e029d9c5f398cfd7a8dbab49fb21fc7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7292 Tested-by: Commit checker robot <[email protected]> Haiku-Format: Haiku-format Bot <[email protected]> Reviewed-by: nephele nephele <[email protected]> Reviewed-by: John Scipione <[email protected]>
This commit is contained in:
@@ -2471,17 +2471,10 @@ MainWin::_KeyDown(BMessage* msg)
|
||||
break;
|
||||
|
||||
case B_DELETE:
|
||||
case 'd': // d for delete
|
||||
case 't': // t for Trash
|
||||
if ((modifiers() & B_COMMAND_KEY) != 0) {
|
||||
BAutolock _(fPlaylist);
|
||||
BMessage removeMessage(M_PLAYLIST_MOVE_TO_TRASH);
|
||||
removeMessage.AddInt32("playlist index",
|
||||
fPlaylist->CurrentItemIndex());
|
||||
fPlaylistWindow->PostMessage(&removeMessage);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
BAutolock _(fPlaylist);
|
||||
BMessage removeMessage(M_PLAYLIST_REMOVE);
|
||||
fPlaylistWindow->PostMessage(&removeMessage);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
|
||||
@@ -398,13 +398,13 @@ DragSortableListView::MessageReceived(BMessage* message)
|
||||
void
|
||||
DragSortableListView::KeyDown( const char* bytes, int32 numBytes )
|
||||
{
|
||||
if ( numBytes < 1 )
|
||||
if (numBytes < 1)
|
||||
return;
|
||||
|
||||
if ( ( bytes[0] == B_BACKSPACE ) || ( bytes[0] == B_DELETE ) )
|
||||
if (bytes[0] == B_BACKSPACE)
|
||||
RemoveSelected();
|
||||
|
||||
BListView::KeyDown( bytes, numBytes );
|
||||
BListView::KeyDown(bytes, numBytes);
|
||||
}
|
||||
|
||||
// MouseDown
|
||||
|
||||
@@ -396,7 +396,6 @@ PlaylistListView::KeyDown(const char* bytes, int32 numBytes)
|
||||
break;
|
||||
|
||||
case B_BACKSPACE:
|
||||
case B_DELETE:
|
||||
RemoveSelected();
|
||||
break;
|
||||
|
||||
@@ -567,24 +566,6 @@ PlaylistListView::Randomize()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistListView::RemoveSelectionToTrash()
|
||||
{
|
||||
BList indices;
|
||||
GetSelectedItems(indices);
|
||||
RemoveItemList(indices, true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistListView::RemoveToTrash(int32 index)
|
||||
{
|
||||
BList indices;
|
||||
indices.AddItem((void*)(addr_t)index);
|
||||
RemoveItemList(indices, true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistListView::RemoveItemList(const BList& indices, bool intoTrash)
|
||||
{
|
||||
|
||||
@@ -47,8 +47,6 @@ public:
|
||||
int32 appendIndex);
|
||||
|
||||
void Randomize();
|
||||
void RemoveSelectionToTrash();
|
||||
void RemoveToTrash(int32 index);
|
||||
void RemoveItemList(const BList& indices,
|
||||
bool intoTrash);
|
||||
virtual void SkipBackward();
|
||||
|
||||
@@ -246,16 +246,6 @@ PlaylistWindow::MessageReceived(BMessage* message)
|
||||
fListView->RemoveSelected();
|
||||
break;
|
||||
|
||||
case M_PLAYLIST_MOVE_TO_TRASH:
|
||||
{
|
||||
int32 index;
|
||||
if (message->FindInt32("playlist index", &index) == B_OK)
|
||||
fListView->RemoveToTrash(index);
|
||||
else
|
||||
fListView->RemoveSelectionToTrash();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
@@ -282,28 +272,21 @@ PlaylistWindow::_CreateMenu(BRect& frame)
|
||||
|
||||
fileMenu->AddSeparatorItem();
|
||||
|
||||
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
|
||||
new BMessage(B_QUIT_REQUESTED), 'W'));
|
||||
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED), 'W'));
|
||||
|
||||
BMenu* editMenu = new BMenu(B_TRANSLATE("Edit"));
|
||||
fUndoMI = new BMenuItem(B_TRANSLATE("Undo"), new BMessage(B_UNDO), 'Z');
|
||||
editMenu->AddItem(fUndoMI);
|
||||
fRedoMI = new BMenuItem(B_TRANSLATE("Redo"), new BMessage(B_REDO), 'Z',
|
||||
B_SHIFT_KEY);
|
||||
fRedoMI = new BMenuItem(B_TRANSLATE("Redo"), new BMessage(B_REDO), 'Z', B_SHIFT_KEY);
|
||||
editMenu->AddItem(fRedoMI);
|
||||
editMenu->AddSeparatorItem();
|
||||
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
|
||||
new BMessage(B_SELECT_ALL), 'A'));
|
||||
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Select all"), new BMessage(B_SELECT_ALL), 'A'));
|
||||
editMenu->AddSeparatorItem();
|
||||
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Randomize"),
|
||||
new BMessage(M_PLAYLIST_RANDOMIZE), 'R'));
|
||||
editMenu->AddItem(
|
||||
new BMenuItem(B_TRANSLATE("Randomize"), new BMessage(M_PLAYLIST_RANDOMIZE), 'R'));
|
||||
editMenu->AddSeparatorItem();
|
||||
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove"),
|
||||
new BMessage(M_PLAYLIST_REMOVE)/*, B_DELETE, 0*/));
|
||||
// TODO: See if we can support the modifier-less B_DELETE
|
||||
// and draw it properly too. B_NO_MODIFIER?
|
||||
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Move file to Trash"),
|
||||
new BMessage(M_PLAYLIST_MOVE_TO_TRASH), 'T'));
|
||||
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove"), new BMessage(M_PLAYLIST_REMOVE),
|
||||
B_DELETE, B_NO_COMMAND_KEY));
|
||||
|
||||
menuBar->AddItem(editMenu);
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ enum {
|
||||
|
||||
// edit
|
||||
M_PLAYLIST_RANDOMIZE = 'rand',
|
||||
M_PLAYLIST_REMOVE = 'rmov',
|
||||
M_PLAYLIST_MOVE_TO_TRASH = 'trsh'
|
||||
M_PLAYLIST_REMOVE = 'rmov'
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user