2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-06 17:45:11 +00:00

Use xdg-activation to open URLs&files

This commit is contained in:
Ilya Fedin
2022-08-02 19:25:48 +04:00
committed by John Preston
parent c5702f0887
commit d500714242
4 changed files with 26 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/linux/file_utilities_linux.h"
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "base/platform/linux/base_linux_app_launch_context.h"
#include "platform/linux/linux_xdp_open_with_dialog.h"
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
@@ -24,7 +25,9 @@ namespace File {
void UnsafeOpenUrl(const QString &url) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
try {
if (Gio::AppInfo::launch_default_for_uri(url.toStdString())) {
if (Gio::AppInfo::launch_default_for_uri(
url.toStdString(),
base::Platform::AppLaunchContext())) {
return;
}
} catch (const Glib::Error &e) {
@@ -53,7 +56,8 @@ void UnsafeLaunch(const QString &filepath) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
try {
if (Gio::AppInfo::launch_default_for_uri(
Glib::filename_to_uri(filepath.toStdString()))) {
Glib::filename_to_uri(filepath.toStdString()),
base::Platform::AppLaunchContext())) {
return;
}
} catch (const Glib::Error &e) {