summaryrefslogtreecommitdiffstats
path: root/logic/DesktopServices.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-01-05 07:32:52 +0100
committerPetr Mrázek <peterix@gmail.com>2016-01-05 07:32:52 +0100
commit4d0caf6254fdb18f4626a3c7937e64422b40d40c (patch)
tree76b037c8f6b6c73f8438b85e8e05a2f59da89c17 /logic/DesktopServices.h
parentd1e344f28f643c9fb0318feea0259be8ac72c8f7 (diff)
downloadMultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar
MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar.gz
MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar.lz
MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar.xz
MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.zip
GH-1389 wrap QDesktopServices and QProcess::startDetached
Essentially do not pass some environment variables to subprocesses: * LD_PRELOAD * LD_LIBRARY_PATH * LD_DEBUG * QT_PLUGIN_PATH * QT_FONTPATH
Diffstat (limited to 'logic/DesktopServices.h')
-rw-r--r--logic/DesktopServices.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/logic/DesktopServices.h b/logic/DesktopServices.h
new file mode 100644
index 00000000..1e67e4cb
--- /dev/null
+++ b/logic/DesktopServices.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include <QUrl>
+#include <QString>
+#include "multimc_logic_export.h"
+
+/**
+ * This wraps around QDesktopServices and adds workarounds where needed
+ * Use this instead of QDesktopServices!
+ */
+namespace DesktopServices
+{
+ /**
+ * Open a file in whatever application is applicable
+ */
+ MULTIMC_LOGIC_EXPORT bool openFile(const QString &path);
+
+ /**
+ * Open a file in the specified application
+ */
+ MULTIMC_LOGIC_EXPORT bool openFile(const QString &application, const QString &path, const QString & workingDirectory = QString(), qint64 *pid = 0);
+
+ /**
+ * Run an application
+ */
+ MULTIMC_LOGIC_EXPORT bool run(const QString &application,const QStringList &args, const QString & workingDirectory = QString(), qint64 *pid = 0);
+
+ /**
+ * Open a directory
+ */
+ MULTIMC_LOGIC_EXPORT bool openDirectory(const QString &path, bool ensureExists = false);
+
+ /**
+ * Open the URL, most likely in a browser. Maybe.
+ */
+ MULTIMC_LOGIC_EXPORT bool openUrl(const QUrl &url);
+};