browser: add support for deleting group of selected items

This commit is contained in:
Andrzej Rybczak
2010-07-12 07:48:10 +02:00
parent 5d37d56c64
commit f627dc854d
3 changed files with 49 additions and 17 deletions

View File

@@ -520,6 +520,27 @@ void Browser::ChangeBrowseMode()
GetDirectory(itsBrowsedDir);
RedrawHeader = 1;
}
bool Browser::DeleteItem(const MPD::Item &item)
{
// parent dir
if (item.type == itDirectory && item.song)
return false;
// playlist creatd by mpd
if (!isLocal() && item.type == itPlaylist && CurrentDir() == "/")
return Mpd.DeletePlaylist(locale_to_utf_cpy(item.name));
std::string path;
if (!isLocal())
path = Config.mpd_music_dir;
path += item.type == itSong ? item.song->GetFile() : item.name;
if (item.type == itDirectory)
ClearDirectory(path);
return remove(path.c_str()) == 0;
}
#endif // !WIN32
void Browser::UpdateItemList()