|
|
|
|
@ -781,21 +781,40 @@ void VolumeDown::Run() |
|
|
|
|
Mpd.SetVolume(Mpd.GetVolume()-1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Delete::Run() |
|
|
|
|
bool DeletePlaylistItems::canBeRun() const |
|
|
|
|
{ |
|
|
|
|
if (myScreen == myPlaylist && !myPlaylist->main().empty()) |
|
|
|
|
return (myScreen == myPlaylist && !myPlaylist->main().empty()) |
|
|
|
|
|| (myScreen->isActiveWindow(myPlaylistEditor->Content) && !myPlaylistEditor->Content.empty()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DeletePlaylistItems::Run() |
|
|
|
|
{ |
|
|
|
|
if (myScreen == myPlaylist) |
|
|
|
|
{ |
|
|
|
|
Statusbar::msg("Deleting items..."); |
|
|
|
|
auto delete_fun = std::bind(&MPD::Connection::Delete, _1, _2); |
|
|
|
|
if (deleteSelectedSongs(myPlaylist->main(), delete_fun)) |
|
|
|
|
Statusbar::msg("Item(s) deleted"); |
|
|
|
|
} |
|
|
|
|
# ifndef WIN32 |
|
|
|
|
else if (myScreen == myBrowser && !myBrowser->main().empty()) |
|
|
|
|
else if (myScreen->isActiveWindow(myPlaylistEditor->Content)) |
|
|
|
|
{ |
|
|
|
|
if (!myBrowser->isLocal() && !isMPDMusicDirSet()) |
|
|
|
|
return; |
|
|
|
|
std::string playlist = myPlaylistEditor->Playlists.current().value(); |
|
|
|
|
auto delete_fun = std::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2); |
|
|
|
|
Statusbar::msg("Deleting items..."); |
|
|
|
|
if (deleteSelectedSongs(myPlaylistEditor->Content, delete_fun)) |
|
|
|
|
Statusbar::msg("Item(s) deleted"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool DeleteBrowserItems::canBeRun() const |
|
|
|
|
{ |
|
|
|
|
return myScreen == myBrowser |
|
|
|
|
&& !myBrowser->main().empty() |
|
|
|
|
&& isMPDMusicDirSet(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DeleteBrowserItems::Run() |
|
|
|
|
{ |
|
|
|
|
std::string question; |
|
|
|
|
if (hasSelected(myBrowser->main().begin(), myBrowser->main().end())) |
|
|
|
|
question = "Delete selected items?"; |
|
|
|
|
@ -833,17 +852,23 @@ void Delete::Run() |
|
|
|
|
} |
|
|
|
|
if (success) |
|
|
|
|
{ |
|
|
|
|
if (!myBrowser->isLocal()) |
|
|
|
|
if (myBrowser->isLocal()) |
|
|
|
|
myBrowser->GetDirectory(myBrowser->CurrentDir()); |
|
|
|
|
else |
|
|
|
|
Mpd.UpdateDirectory(myBrowser->CurrentDir()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
Statusbar::msg("Aborted"); |
|
|
|
|
} |
|
|
|
|
# endif // !WIN32
|
|
|
|
|
else if (myScreen == myPlaylistEditor && !myPlaylistEditor->Content.empty()) |
|
|
|
|
|
|
|
|
|
bool DeleteStoredPlaylist::canBeRun() const |
|
|
|
|
{ |
|
|
|
|
if (myScreen->isActiveWindow(myPlaylistEditor->Playlists)) |
|
|
|
|
return myScreen->isActiveWindow(myPlaylistEditor->Playlists) |
|
|
|
|
&& myPlaylistEditor->Playlists.empty(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DeleteStoredPlaylist::Run() |
|
|
|
|
{ |
|
|
|
|
std::string question; |
|
|
|
|
if (hasSelected(myPlaylistEditor->Playlists.begin(), myPlaylistEditor->Playlists.end())) |
|
|
|
|
@ -867,16 +892,6 @@ void Delete::Run() |
|
|
|
|
else |
|
|
|
|
Statusbar::msg("Aborted"); |
|
|
|
|
} |
|
|
|
|
else if (myScreen->isActiveWindow(myPlaylistEditor->Content)) |
|
|
|
|
{ |
|
|
|
|
std::string playlist = myPlaylistEditor->Playlists.current().value(); |
|
|
|
|
auto delete_fun = std::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2); |
|
|
|
|
Statusbar::msg("Deleting items..."); |
|
|
|
|
if (deleteSelectedSongs(myPlaylistEditor->Content, delete_fun)) |
|
|
|
|
Statusbar::msg("Item(s) deleted"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ReplaySong::Run() |
|
|
|
|
{ |
|
|
|
|
@ -2552,7 +2567,9 @@ void populateActions() |
|
|
|
|
insertAction(new SlaveScreen()); |
|
|
|
|
insertAction(new VolumeUp()); |
|
|
|
|
insertAction(new VolumeDown()); |
|
|
|
|
insertAction(new Delete()); |
|
|
|
|
insertAction(new DeletePlaylistItems()); |
|
|
|
|
insertAction(new DeleteStoredPlaylist()); |
|
|
|
|
insertAction(new DeleteBrowserItems()); |
|
|
|
|
insertAction(new ReplaySong()); |
|
|
|
|
insertAction(new PreviousSong()); |
|
|
|
|
insertAction(new NextSong()); |
|
|
|
|
|