mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-03 16:15:13 +00:00
Switch XDP open with dialog to QWaylandWindow::requestXdgActivationToken
This commit is contained in:
@@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
|
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
||||||
#include "base/platform/linux/base_linux_wayland_integration.h"
|
#include "base/platform/linux/base_linux_xdg_activation_token.h"
|
||||||
#include "base/random.h"
|
#include "base/random.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -23,6 +23,7 @@ namespace {
|
|||||||
|
|
||||||
constexpr auto kXDPOpenURIInterface = "org.freedesktop.portal.OpenURI";
|
constexpr auto kXDPOpenURIInterface = "org.freedesktop.portal.OpenURI";
|
||||||
constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties";
|
constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties";
|
||||||
|
const auto XdgActivationToken = base::Platform::XdgActivationToken;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@@ -61,14 +62,6 @@ bool ShowXDPOpenWithDialog(const QString &filepath) {
|
|||||||
const auto handleToken = Glib::ustring("tdesktop")
|
const auto handleToken = Glib::ustring("tdesktop")
|
||||||
+ std::to_string(base::RandomValue<uint>());
|
+ std::to_string(base::RandomValue<uint>());
|
||||||
|
|
||||||
const auto activationToken = []() -> Glib::ustring {
|
|
||||||
using base::Platform::WaylandIntegration;
|
|
||||||
if (const auto integration = WaylandIntegration::Instance()) {
|
|
||||||
return integration->activationToken().toStdString();
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}();
|
|
||||||
|
|
||||||
auto uniqueName = connection->get_unique_name();
|
auto uniqueName = connection->get_unique_name();
|
||||||
uniqueName.erase(0, 1);
|
uniqueName.erase(0, 1);
|
||||||
uniqueName.replace(uniqueName.find('.'), 1, 1, '_');
|
uniqueName.replace(uniqueName.find('.'), 1, 1, '_');
|
||||||
@@ -118,7 +111,8 @@ bool ShowXDPOpenWithDialog(const QString &filepath) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"activation_token",
|
"activation_token",
|
||||||
Glib::create_variant(activationToken)
|
Glib::create_variant(
|
||||||
|
Glib::ustring(XdgActivationToken().toStdString()))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ask",
|
"ask",
|
||||||
|
Submodule Telegram/lib_base updated: c36d961eaf...a7c44bbf53
Reference in New Issue
Block a user