Version: JuK 2.0.1 (using KDE KDE 3.2.2) Installed from: Unspecified OS: I Don't Know There's feature in JuK whcih allows you to remove files from disk. I accidentally removed important music files once. It could be nice feature if JuK moved files to trash instead of removing them immediately.
CVS commit by mpyne: Fix bug 83495 by making JuK move deleted music to the Trash instead of removing them immediately. This also caught a poor KDE developer whom I'll leave nameless, so I figured it was time to hurry up and fix this. =D A better move IMO would be making this action undo-able, or perhaps removing the option from the default RMB menu. We already have a mean dialog up, but that's been proven to not have much of an effect. ;-) CCMAIL:83495-done@bugs.kde.org M +11 -12 playlist.cpp 1.248 --- kdemultimedia/juk/playlist.cpp #1.247:1.248 @@ -24,4 +24,7 @@ #include <kdebug.h> #include <kinputdialog.h> +#include <kglobalsettings.h> +#include <kurl.h> +#include <kio/netaccess.h> #include <qheader.h> @@ -735,23 +738,19 @@ void Playlist::removeFromDisk(const Play files.append((*it)->file().absFilePath()); + KURL trashDir = KGlobalSettings::trashPath(); + QString message; if(files.count() == 1) - message = i18n("Do you really want to delete this item from your disk?"); + message = i18n("Do you really want to move this item to the trash?"); else - message = i18n("Do you really want to delete these %1 items from your disk?").arg(QString::number(files.count())); + message = i18n("Do you really want to move these %1 items to the trash?").arg(QString::number(files.count())); if(KMessageBox::warningContinueCancelList(this, message, files, i18n("Delete Items?"), KGuiItem(i18n("&Delete"),"editdelete")) == KMessageBox::Continue) { for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it) { - - // If we delete the item we're playing, we have to switch songs because of the - // m_playingItem pointer. The 'best' thing to do would be to switch to the - // next song (or stop if that's it and loop isn't set), but I don't feel like - // duplicating all the code, so we'll just stop playback. - if(m_playingItem == *it) - PlayerManager::instance()->stop(); + action("forward")->activate(); - if(QFile::remove((*it)->file().absFilePath())) { + if(KIO::NetAccess::move((*it)->file().absFilePath(), trashDir)) { if(!m_randomList.isEmpty() && !m_visibleChanged) m_randomList.remove(*it); @@ -763,5 +762,5 @@ void Playlist::removeFromDisk(const Play } else - KMessageBox::sorry(this, i18n("Could not delete ") + (*it)->file().absFilePath() + "."); + KMessageBox::sorry(this, i18n("Could not move ") + (*it)->file().absFilePath() + "."); }
In my opinion there would be an even better solution: Why not just use this type of a message box? : ----------------------------------------------------------- "What do you want to do with these files?" file1.mp3 file2.mp3 "Move to Trash" (=default button) "Delete from Disk" "Cancel" -----------------------------------------------------------
There's now a checkbox to actually remove the files and the setting is stored between invocations.