clementine Issue 858

This commit is contained in:
Jonathan Anderson 2011-03-23 11:23:55 +00:00
parent 4f83d59f59
commit ddfb90a0a1
1 changed files with 18 additions and 1 deletions

View File

@ -15,8 +15,14 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "filesystemmusicstorage.h"
#include "config.h"
#ifdef HAVE_GIO
# include <gio/gio.h>
#endif
#include "filesystemmusicstorage.h"
#include <QByteArray>
#include <QDir>
#include <QFile>
@ -52,5 +58,16 @@ bool FilesystemMusicStorage::CopyToStorage(const CopyJob& job) {
}
bool FilesystemMusicStorage::DeleteFromStorage(const DeleteJob& job) {
#ifdef HAVE_GIO
//convert QString to char
QByteArray ba = job.metadata_.filename().toLocal8Bit();
const char *filepathChar = ba.data();
GFile *file = g_file_new_for_path (filepathChar);
bool success = g_file_trash(file, NULL, NULL);
g_object_unref(file);
return success;
#else
return QFile::remove(job.metadata_.filename());
#endif
}