Commit 4119cb8c authored by Urs Fleisch's avatar Urs Fleisch
Browse files

KDE 5: Do not use KIO::trash() which does not work.

parent d8e417b4
......@@ -27,13 +27,13 @@
#include "kdeplatformtools.h"
#include <QtConfig>
#if QT_VERSION >= 0x050000
#include <KIO/CopyJob>
#include <KHelpClient>
#include <KMessageBox>
#include <KConfig>
#include <QUrl>
#include <QFileDialog>
#include "mainwindowconfig.h"
#include "coreplatformtools.h"
#define KUrl QUrl
#define KIcon QIcon::fromTheme
......@@ -94,12 +94,12 @@ ISettings* KdePlatformTools::applicationSettings()
*/
bool KdePlatformTools::moveToTrash(const QString& path) const
{
#if QT_VERSION >= 0x050000
return CorePlatformTools::moveFileToTrash(path);
#else
KUrl src;
src.setPath(path);
KIO::Job* job = KIO::trash(src);
#if QT_VERSION >= 0x050000
return job->exec();
#else
return KIO::NetAccess::synchronousRun(job, 0);
#endif
}
......
......@@ -223,7 +223,14 @@ bool findExtVolumeTrash(const QString& volumeRoot, QString& trashDir)
} // anonymous namespace
bool CorePlatformTools::moveToTrash(const QString& path) const
/**
* Move file or directory to trash.
*
* @param path path to file or directory
*
* @return true if ok.
*/
bool CorePlatformTools::moveFileToTrash(const QString& path)
{
QFileInfo fi(path);
const QString absPath(fi.absoluteFilePath());
......@@ -250,6 +257,11 @@ bool CorePlatformTools::moveToTrash(const QString& path) const
return moveToTrashDir(fi, trashDir);
}
bool CorePlatformTools::moveToTrash(const QString& path) const
{
return moveFileToTrash(path);
}
#endif
/**
......
......@@ -77,6 +77,17 @@ public:
*/
virtual QString getNameFilterPatterns(const QString& nameFilter) const;
#if !defined Q_OS_WIN32 && !defined Q_OS_MAC
/**
* Move file or directory to trash.
*
* @param path path to file or directory
*
* @return true if ok.
*/
static bool moveFileToTrash(const QString& path);
#endif
private:
QSettings* m_settings;
ISettings* m_config;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment