aboutsummaryrefslogtreecommitdiff
path: root/launcher/DesktopServices.h
blob: 151db5557610957cec5bea007e59a08b4bfb7c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include <QString>
#include <QUrl>

/**
 * This wraps around QDesktopServices and adds workarounds where needed
 * Use this instead of QDesktopServices!
 */
namespace DesktopServices {
/**
 * Open a file in whatever application is applicable
 */
bool openFile(const QString& path);

/**
 * Open a file in the specified application
 */
bool openFile(const QString& application, const QString& path, const QString& workingDirectory = QString(), qint64* pid = 0);

/**
 * Run an application
 */
bool run(const QString& application, const QStringList& args, const QString& workingDirectory = QString(), qint64* pid = 0);

/**
 * Open a directory
 */
bool openDirectory(const QString& path, bool ensureExists = false);

/**
 * 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