fix: do not trash instances in Flatpak

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2022-10-30 18:54:52 +01:00
parent b4be28b9bb
commit 29d362a6e0
6 changed files with 22 additions and 17 deletions

View File

@ -44,6 +44,7 @@
#include <QStandardPaths>
#include <QTextStream>
#include <QUrl>
#include "DesktopServices.h"
#if defined Q_OS_WIN32
#include <objbase.h>
@ -228,6 +229,9 @@ bool trash(QString path, QString *pathInTrash = nullptr)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
return false;
#else
// FIXME: Figure out trash in Flatpak. Qt seemingly doesn't use the Trash portal
if (DesktopServices::isFlatpak())
return false;
return QFile::moveToTrash(path, pathInTrash);
#endif
}