summarylogtreecommitdiffstats
path: root/use_xdg-open.patch
blob: 2e22efb26db47f025682ed9f11c332f0148b53a1 (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
Description: use xdg-open to open things in external applications
Credits: novie

diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp
index 0531a5b45..0879fb232 100644
--- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 #include "platform/linux/specific_linux.h"
 #include "storage/localstorage.h"
 
+#include <QtCore/QProcess>
 #include <QtGui/QDesktopServices>
 
 extern "C" {
@@ -65,6 +66,10 @@ QByteArray EscapeShell(const QByteArray &content) {
 } // namespace internal
 
 void UnsafeOpenUrl(const QString &url) {
+	QProcess process;
+	process.startDetached(qsl("xdg-open"), {url});
+	return;
+
 	if (!g_app_info_launch_default_for_uri(
 		url.toUtf8(),
 		nullptr,
@@ -79,6 +84,9 @@ void UnsafeOpenEmailLink(const QString &email) {
 
 void UnsafeLaunch(const QString &filepath) {
 	const auto absolutePath = QFileInfo(filepath).absoluteFilePath();
+	QProcess process;
+	process.startDetached(qsl("xdg-open"), {absolutePath});
+	return;
 
 	if (!g_app_info_launch_default_for_uri(
 		("file://" + absolutePath).toUtf8(),