mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Use portals via glib to open urls & files in snap
This commit is contained in:
parent
152f1ef17f
commit
3742db2b91
2 changed files with 3 additions and 8 deletions
|
@ -68,10 +68,7 @@ QByteArray EscapeShell(const QByteArray &content) {
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
void UnsafeOpenUrl(const QString &url) {
|
void UnsafeOpenUrl(const QString &url) {
|
||||||
if (InSnap()) {
|
if (!g_app_info_launch_default_for_uri(
|
||||||
QProcess process;
|
|
||||||
process.startDetached(qsl("xdg-open"), {url});
|
|
||||||
} else if (!g_app_info_launch_default_for_uri(
|
|
||||||
url.toUtf8(),
|
url.toUtf8(),
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr)) {
|
nullptr)) {
|
||||||
|
@ -86,10 +83,7 @@ void UnsafeOpenEmailLink(const QString &email) {
|
||||||
void UnsafeLaunch(const QString &filepath) {
|
void UnsafeLaunch(const QString &filepath) {
|
||||||
const auto absolutePath = QFileInfo(filepath).absoluteFilePath();
|
const auto absolutePath = QFileInfo(filepath).absoluteFilePath();
|
||||||
|
|
||||||
if (InSnap()) {
|
if (!g_app_info_launch_default_for_uri(
|
||||||
QProcess process;
|
|
||||||
process.startDetached(qsl("xdg-open"), {absolutePath});
|
|
||||||
} else if (!g_app_info_launch_default_for_uri(
|
|
||||||
("file://" + absolutePath).toUtf8(),
|
("file://" + absolutePath).toUtf8(),
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr)) {
|
nullptr)) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ apps:
|
||||||
environment:
|
environment:
|
||||||
# Use GTK3 cursor theme, icon theme and open/save file dialogs.
|
# Use GTK3 cursor theme, icon theme and open/save file dialogs.
|
||||||
QT_QPA_PLATFORMTHEME: gtk3
|
QT_QPA_PLATFORMTHEME: gtk3
|
||||||
|
GTK_USE_PORTAL: 1
|
||||||
plugs:
|
plugs:
|
||||||
- alsa
|
- alsa
|
||||||
- audio-playback
|
- audio-playback
|
||||||
|
|
Loading…
Add table
Reference in a new issue