aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--launcher/Application.cpp9
-rw-r--r--launcher/Application.h2
-rw-r--r--launcher/DesktopServices.cpp19
-rw-r--r--launcher/DesktopServices.h2
-rw-r--r--launcher/FileSystem.cpp4
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp3
6 files changed, 22 insertions, 17 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index c6814abf..0c370b42 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -1136,15 +1136,6 @@ std::vector<ITheme *> Application::getValidApplicationThemes()
return ret;
}
-bool Application::isFlatpak()
-{
- #ifdef Q_OS_LINUX
- return QFile::exists("/.flatpak-info");
- #else
- return false;
- #endif
-}
-
void Application::setApplicationTheme(const QString& name, bool initial)
{
auto systemPalette = qApp->palette();
diff --git a/launcher/Application.h b/launcher/Application.h
index c453cc28..8fa0ab10 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -116,8 +116,6 @@ public:
QIcon getThemedIcon(const QString& name);
- bool isFlatpak();
-
void setIconTheme(const QString& name);
std::vector<ITheme *> getValidApplicationThemes();
diff --git a/launcher/DesktopServices.cpp b/launcher/DesktopServices.cpp
index c29cbe7d..302eaf96 100644
--- a/launcher/DesktopServices.cpp
+++ b/launcher/DesktopServices.cpp
@@ -119,7 +119,7 @@ bool openDirectory(const QString &path, bool ensureExists)
return QDesktopServices::openUrl(QUrl::fromLocalFile(dir.absolutePath()));
};
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!APPLICATION->isFlatpak())
+ if(!isFlatpak())
{
return IndirectOpen(f);
}
@@ -140,7 +140,7 @@ bool openFile(const QString &path)
return QDesktopServices::openUrl(QUrl::fromLocalFile(path));
};
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!APPLICATION->isFlatpak())
+ if(!isFlatpak())
{
return IndirectOpen(f);
}
@@ -158,7 +158,7 @@ bool openFile(const QString &application, const QString &path, const QString &wo
qDebug() << "Opening file" << path << "using" << application;
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
- if(!APPLICATION->isFlatpak())
+ if(!isFlatpak())
{
return IndirectOpen([&]()
{
@@ -178,7 +178,7 @@ bool run(const QString &application, const QStringList &args, const QString &wor
{
qDebug() << "Running" << application << "with args" << args.join(' ');
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!APPLICATION->isFlatpak())
+ if(!isFlatpak())
{
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
return IndirectOpen([&]()
@@ -203,7 +203,7 @@ bool openUrl(const QUrl &url)
return QDesktopServices::openUrl(url);
};
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!APPLICATION->isFlatpak())
+ if(!isFlatpak())
{
return IndirectOpen(f);
}
@@ -216,4 +216,13 @@ bool openUrl(const QUrl &url)
#endif
}
+bool isFlatpak()
+{
+#ifdef Q_OS_LINUX
+ return QFile::exists("/.flatpak-info");
+#else
+ return false;
+#endif
+}
+
}
diff --git a/launcher/DesktopServices.h b/launcher/DesktopServices.h
index 1c081da4..21c9cae0 100644
--- a/launcher/DesktopServices.h
+++ b/launcher/DesktopServices.h
@@ -33,4 +33,6 @@ namespace DesktopServices
* Open the URL, most likely in a browser. Maybe.
*/
bool openUrl(const QUrl &url);
+
+ bool isFlatpak();
}
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 76cfccb0..aaa75e6f 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -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
}
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index 536ab22e..4ae7509c 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -49,6 +49,7 @@
#include <FileSystem.h>
#include "Application.h"
#include "BuildConfig.h"
+#include "DesktopServices.h"
#include "ui/themes/ITheme.h"
#include <QApplication>
@@ -143,7 +144,7 @@ void LauncherPage::on_instDirBrowseBtn_clicked()
ui->instDirTextBox->setText(cooked_dir);
}
}
- else if(APPLICATION->isFlatpak() && raw_dir.startsWith("/run/user"))
+ else if(DesktopServices::isFlatpak() && raw_dir.startsWith("/run/user"))
{
QMessageBox warning;
warning.setText(tr("You're trying to specify an instance folder "