diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp index 027f6de91..4f111a6e0 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp @@ -7,75 +7,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/linux/file_utilities_linux.h" -#include "base/platform/linux/base_linux_app_launch_context.h" #include "platform/linux/linux_xdp_open_with_dialog.h" -#include - -#include - -using namespace gi::repository; - namespace Platform { namespace File { -void UnsafeOpenUrl(const QString &url) { - { - const auto result = Gio::AppInfo::launch_default_for_uri( - url.toStdString(), - base::Platform::AppLaunchContext()); - - if (!result) { - LOG(("App Error: %1").arg(result.error().what())); - } else if (*result) { - return; - } - } - - QDesktopServices::openUrl(url); -} - -void UnsafeOpenEmailLink(const QString &email) { - UnsafeOpenUrl(u"mailto:"_q + email); -} - bool UnsafeShowOpenWith(const QString &filepath) { - if (internal::ShowXDPOpenWithDialog(filepath)) { - return true; - } - - return false; -} - -void UnsafeLaunch(const QString &filepath) { - if ([&] { - const auto filename = GLib::filename_to_uri(filepath.toStdString()); - if (!filename) { - LOG(("App Error: %1").arg(filename.error().what())); - - return false; - } - - const auto result = Gio::AppInfo::launch_default_for_uri( - *filename, - base::Platform::AppLaunchContext()); - - if (!result) { - LOG(("App Error: %1").arg(result.error().what())); - - return false; - } - - return *result; - }()) { - return; - } - - if (UnsafeShowOpenWith(filepath)) { - return; - } - - QDesktopServices::openUrl(QUrl::fromLocalFile(filepath)); + return internal::ShowXDPOpenWithDialog(filepath); } } // namespace File diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.h b/Telegram/SourceFiles/platform/linux/file_utilities_linux.h index 9b41c6707..76ccf00aa 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.h +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.h @@ -16,10 +16,22 @@ inline QString UrlToLocal(const QUrl &url) { return ::File::internal::UrlToLocalDefault(url); } +inline void UnsafeOpenUrl(const QString &url) { + return ::File::internal::UnsafeOpenUrlDefault(url); +} + +inline void UnsafeOpenEmailLink(const QString &email) { + return ::File::internal::UnsafeOpenEmailLinkDefault(email); +} + inline bool UnsafeShowOpenWithDropdown(const QString &filepath) { return false; } +inline void UnsafeLaunch(const QString &filepath) { + return ::File::internal::UnsafeLaunchDefault(filepath); +} + inline void PostprocessDownloaded(const QString &filepath) { } diff --git a/Telegram/lib_base b/Telegram/lib_base index ce8f9214a..d67a11776 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit ce8f9214addfe14ac1c05437a20850836e23d45b +Subproject commit d67a11776ad720a718bae026b78ddd150f13fac5 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index d3ac9dcf9..a22254860 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit d3ac9dcf97494aa1acfbfd8b6c0a3f57950e4962 +Subproject commit a22254860f01256de3acdcd799c8fe6e1f8e0f0e