Telegram-Desktop: add OpenWith support

This commit is contained in:
Gerasim Troeglazov
2018-05-14 22:58:30 +10:00
parent 268b364b67
commit e19a981fc1
2 changed files with 73 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
From 1a550aac69bc6f7ebc336e3a7267f8a5535257ee Mon Sep 17 00:00:00 2001
From 25b87f354e86f94ed023534b7c3e0591f9ee2201 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Sat, 9 Sep 2017 02:14:52 +0300
Subject: Haiku fixes
@@ -946,7 +946,7 @@ index 209c737..07d7438 100644
2.16.2
From ed09692c9368815a32939102fe0cc1dc721ad69d Mon Sep 17 00:00:00 2001
From 83d1bc6fa3e20e39f856296b7c9c9ad5c5c4b779 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:01:57 +1000
Subject: Fix typo
@@ -969,7 +969,7 @@ index 0d09e7d..793310e 100644
2.16.2
From b1e9d35446433dd6be798b142dc304f132a5c238 Mon Sep 17 00:00:00 2001
From 33a0eadf8e61bbd13833e70dde93b161a1ba1b4f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:05:59 +1000
Subject: Add haiku platform modules
@@ -2312,7 +2312,7 @@ index e303272..1bd4c74 100644
2.16.2
From 4f0f835b6240da38a0ad1d041f3100f87d100acb Mon Sep 17 00:00:00 2001
From 214ce9e63a7a86d28a8223ac573af504dd5ccbd2 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:09:06 +1000
Subject: Add haiku platform for settings
@@ -2346,7 +2346,7 @@ index 4306551..df713a3 100644
2.16.2
From a93de62231eb3724938b5f3b8f28a95977d57f5f Mon Sep 17 00:00:00 2001
From a1340f3a185ebcf9c7f867d9ed1e7c8cca35b072 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:09:59 +1000
Subject: Fix Qt plugins path
@@ -2371,7 +2371,7 @@ index 4684e2a..c65879b 100644
2.16.2
From df4847382e8320e60c3c99fcdf3f770d5dec691a Mon Sep 17 00:00:00 2001
From 1d02c12b4441c881bd7e56c7ed3ad9cf0e672e33 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:10:59 +1000
Subject: Fix crash
@@ -2402,7 +2402,7 @@ index b0a1ade..9c84a34 100644
2.16.2
From 7499c1b40e600dfd23819a13043c6b463cf8c288 Mon Sep 17 00:00:00 2001
From 38d9f402a28afabdfd7b56921f7fb646564cc96e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:14:32 +1000
Subject: Add haiku platform files to build
@@ -2478,7 +2478,7 @@ index 58f2789..f86e6e6 100644
2.16.2
From 79ddabd435ce60dc0c104e9546d00d4d0918a747 Mon Sep 17 00:00:00 2001
From ae174c17ba3577fcb2aa1a3574690d19358a9f5d Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 Sep 2017 23:06:27 +1000
Subject: Move working dir to user settings
@@ -2535,7 +2535,7 @@ index ce9091a..b303e1d 100644
2.16.2
From bb80a1982f948ae40b8d33a0c0cdcbd4da2ec3c9 Mon Sep 17 00:00:00 2001
From 507355cb8f1d8b55de4de5cfef3934b880a1b5fe Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Tue, 12 Dec 2017 14:37:08 +0300
Subject: Fix Qt search paths
@@ -2586,7 +2586,7 @@ index b9e1d5a..a592932 100644
2.16.2
From 437f64789b6917d33f927c2ae5466a0eff09481e Mon Sep 17 00:00:00 2001
From 95663b1a66ded9cd4ed60da7abebed2aa18ddc55 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 31 Mar 2018 20:13:20 +0200
Subject: Split large resource file.
@@ -2634,7 +2634,7 @@ index 8fdd119..a10225b 100644
2.16.2
From 5f5d48fa84adbbb5b8f25edd9948e48c2e509690 Mon Sep 17 00:00:00 2001
From 535be8d00088ffbfb6977336222be719d4a143d7 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 13 May 2018 23:30:34 +1000
Subject: gypi files templating
@@ -2722,7 +2722,7 @@ index eec9f5b..9a7846c 100644
2.16.2
From df40180759b04f7e9dcb6c0d57ad9670c56be47b Mon Sep 17 00:00:00 2001
From fa09ff02074f808ba19a17d0520f2c1a7c430f39 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 13 May 2018 23:42:48 +1000
Subject: Fix qt headers variable for qt.gypi
@@ -2765,26 +2765,23 @@ index 504af0d..6029935 100644
2.16.2
From 27b4637f57badb7787f3f691c214ca90e53ae46e Mon Sep 17 00:00:00 2001
From 04bb1da88bdb593540cd235143617aa44161b245 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 13 May 2018 23:03:55 +0000
Date: Mon, 14 May 2018 19:00:42 +1000
Subject: Fix Qt add-ons path for secondary arch
diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp
index c65879b..afae2f5 100644
index c65879b..1e6fd20 100644
--- a/Telegram/SourceFiles/main.cpp
+++ b/Telegram/SourceFiles/main.cpp
@@ -41,7 +41,13 @@ int main(int argc, char *argv[]) {
@@ -41,7 +41,10 @@ int main(int argc, char *argv[]) {
Platform::start(); // must be started before QApplication is created
// I don't know why path is not in QT_PLUGIN_PATH by default
- QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5");
+#if defined(__HAIKU__) && defined(__X86_64__)
+#if defined(Q_OS_HAIKU)
+ QCoreApplication::addLibraryPath("/system/add-ons/Qt5");
+#endif
+
+#if defined(__HAIKU__) && !defined(__X86_64__)
+ QCoreApplication::addLibraryPath("/system/add-ons/x86/Qt5");
+#endif
@@ -2793,3 +2790,58 @@ index c65879b..afae2f5 100644
--
2.16.2
From 937c4a8dd5b3355923127cdd08eb6efdd83df4c6 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 14 May 2018 22:53:07 +1000
Subject: Add OpenWith function for Haiku platform
diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
index 1a8afbd..5faf1a9 100644
--- a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
@@ -63,9 +63,25 @@ void UnsafeShowInFolder(const QString &filepath) {
auto command = qsl("open");
auto arguments = QStringList();
arguments << QFileInfo(filepath).absoluteDir().absolutePath();
+
+ if (!process.startDetached(command, arguments)) {
+ LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' ')));
+ }
+}
+
+bool UnsafeShowOpenWith(const QString &filepath) {
+ auto absolutePath = QFileInfo(filepath).absoluteFilePath();
+
+ QProcess process;
+ auto command = qsl("open");
+ auto arguments = QStringList();
+ arguments << absolutePath;
+
if (!process.startDetached(command, arguments)) {
LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' ')));
+ return false;
}
+ return true;
}
} // namespace File
diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h
index 103ccb6..23e4a1f 100644
--- a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h
@@ -47,10 +47,6 @@ inline bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosit
return false;
}
-inline bool UnsafeShowOpenWith(const QString &filepath) {
- return false;
-}
-
inline void UnsafeLaunch(const QString &filepath) {
return ::File::internal::UnsafeLaunchDefault(filepath);
}
--
2.16.2

View File

@@ -3,7 +3,7 @@ DESCRIPTION="Official desktop version of Telegram messaging app."
HOMEPAGE="https://www.telegram.org/"
COPYRIGHT="2013-2017 Telegram"
LICENSE="GNU GPL v3"
REVISION="13"
REVISION="14"
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz"
SOURCE_DIR="tdesktop-$portVersion"
CHECKSUM_SHA256="56b7fce84adf85a4af1c3174353169f32d0b0c052a4e7a284fc741fa96b04030"