ShatteredPrism/launcher/DesktopServices.h
Sefa Eyeoglu 6f5d074b4b fix: open paths directly
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
(cherry picked from commit 0ccdcd23e3)
2024-01-17 14:19:03 +00:00

50 lines
1.1 KiB
C++

#pragma once
#include <QString>
#include <QUrl>
class QFileInfo;
/**
* This wraps around QDesktopServices and adds workarounds where needed
* Use this instead of QDesktopServices!
*/
namespace DesktopServices {
/**
* Open a path in whatever application is applicable.
* @param ensurePathExists Make sure the path exists
*/
bool openPath(const QFileInfo& path, bool ensurePathExists = false);
/**
* Open a path in whatever application is applicable.
* @param ensurePathExists Make sure the path exists
*/
bool openPath(const QString& path, bool ensurePathExists = false);
/**
* Run an application
*/
bool run(const QString& application, const QStringList& args, const QString& workingDirectory = QString(), qint64* pid = 0);
/**
* Open the URL, most likely in a browser. Maybe.
*/
bool openUrl(const QUrl& url);
/**
* Determine whether the launcher is running in a Flatpak environment
*/
bool isFlatpak();
/**
* Determine whether the launcher is running in a Snap environment
*/
bool isSnap();
/**
* Determine whether the launcher is running in a sandboxed (Flatpak or Snap) environment
*/
bool isSandbox();
} // namespace DesktopServices