diff --git a/Telegram/SourceFiles/platform/linux/integration_linux.cpp b/Telegram/SourceFiles/platform/linux/integration_linux.cpp index 05cf6be27..0303f5093 100644 --- a/Telegram/SourceFiles/platform/linux/integration_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/integration_linux.cpp @@ -114,8 +114,8 @@ LinuxIntegration::LinuxIntegration() XdpInhibit::InhibitProxy::new_for_bus_sync( Gio::BusType::SESSION_, Gio::DBusProxyFlags::DO_NOT_AUTO_START_AT_CONSTRUCTION_, - std::string(base::Platform::XDP::kService), - std::string(base::Platform::XDP::kObjectPath), + base::Platform::XDP::kService, + base::Platform::XDP::kObjectPath, nullptr)) , _darkModeWatcher([]( const Glib::ustring &group, diff --git a/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp b/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp index c37a123a3..9efcb0b68 100644 --- a/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp @@ -23,8 +23,8 @@ namespace File { namespace internal { namespace { -constexpr auto kXDPOpenURIInterface = "org.freedesktop.portal.OpenURI"_cs; -constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs; +constexpr auto kXDPOpenURIInterface = "org.freedesktop.portal.OpenURI"; +constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"; } // namespace @@ -34,15 +34,14 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { Gio::DBus::BusType::SESSION); const auto version = connection->call_sync( - std::string(base::Platform::XDP::kObjectPath), - std::string(kPropertiesInterface), + base::Platform::XDP::kObjectPath, + kPropertiesInterface, "Get", Glib::create_variant(std::tuple{ - Glib::ustring( - std::string(kXDPOpenURIInterface)), + Glib::ustring(kXDPOpenURIInterface), Glib::ustring("version"), }), - std::string(base::Platform::XDP::kService) + base::Platform::XDP::kService ).get_child(0).get_dynamic>().get(); if (version < 3) { @@ -107,8 +106,8 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { const Glib::VariantContainerBase ¶meters) { loop->quit(); }, - std::string(base::Platform::XDP::kService), - std::string(base::Platform::XDP::kRequestInterface), + base::Platform::XDP::kService, + base::Platform::XDP::kRequestInterface, "Response", requestPath); @@ -121,8 +120,8 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { auto outFdList = Glib::RefPtr(); connection->call_sync( - std::string(base::Platform::XDP::kObjectPath), - std::string(kXDPOpenURIInterface), + base::Platform::XDP::kObjectPath, + kXDPOpenURIInterface, "OpenFile", Glib::create_variant(std::tuple{ parentWindowId, @@ -144,7 +143,7 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { }), Gio::UnixFDList::create(std::vector{ fd }), outFdList, - std::string(base::Platform::XDP::kService)); + base::Platform::XDP::kService); if (signalId != 0) { QWidget window; diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 7b4f172a7..849af9f37 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -37,10 +37,10 @@ namespace Platform { namespace Notifications { namespace { -constexpr auto kService = "org.freedesktop.Notifications"_cs; -constexpr auto kObjectPath = "/org/freedesktop/Notifications"_cs; +constexpr auto kService = "org.freedesktop.Notifications"; +constexpr auto kObjectPath = "/org/freedesktop/Notifications"; constexpr auto kInterface = kService; -constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs; +constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"; struct ServerInformation { QString name; @@ -76,7 +76,7 @@ std::unique_ptr CreateServiceWatcher() { try { return ranges::contains( base::Platform::DBus::ListActivatableNames(connection), - std::string(kService), + kService, &Glib::ustring::raw); } catch (...) { // avoid service restart loop in sandboxed environments @@ -86,7 +86,7 @@ std::unique_ptr CreateServiceWatcher() { return std::make_unique( connection, - std::string(kService), + kService, [=]( const Glib::ustring &service, const Glib::ustring &oldOwner, @@ -115,7 +115,7 @@ void StartServiceAsync(Fn callback) { base::Platform::DBus::StartServiceByNameAsync( connection, - std::string(kService), + kService, [=](Fn result) { Noexcept([&] { try { @@ -155,7 +155,7 @@ bool GetServiceRegistered() { try { return base::Platform::DBus::NameHasOwner( connection, - std::string(kService)); + kService); } catch (...) { return false; } @@ -165,7 +165,7 @@ bool GetServiceRegistered() { try { return ranges::contains( base::Platform::DBus::ListActivatableNames(connection), - std::string(kService), + kService, &Glib::ustring::raw); } catch (...) { return false; @@ -186,8 +186,8 @@ void GetServerInformation( Gio::DBus::BusType::SESSION); connection->call( - std::string(kObjectPath), - std::string(kInterface), + kObjectPath, + kInterface, "GetServerInformation", {}, [=](const Glib::RefPtr &result) { @@ -224,7 +224,7 @@ void GetServerInformation( crl::on_main([=] { callback(std::nullopt); }); }); }, - std::string(kService)); + kService); }, [&] { crl::on_main([=] { callback(std::nullopt); }); }); @@ -236,8 +236,8 @@ void GetCapabilities(Fn callback) { Gio::DBus::BusType::SESSION); connection->call( - std::string(kObjectPath), - std::string(kInterface), + kObjectPath, + kInterface, "GetCapabilities", {}, [=](const Glib::RefPtr &result) { @@ -257,7 +257,7 @@ void GetCapabilities(Fn callback) { crl::on_main([=] { callback({}); }); }); }, - std::string(kService)); + kService); }, [&] { crl::on_main([=] { callback({}); }); }); @@ -269,11 +269,11 @@ void GetInhibited(Fn callback) { Gio::DBus::BusType::SESSION); connection->call( - std::string(kObjectPath), - std::string(kPropertiesInterface), + kObjectPath, + kPropertiesInterface, "Get", Glib::create_variant(std::tuple{ - Glib::ustring(std::string(kInterface)), + Glib::ustring(kInterface), Glib::ustring("Inhibited"), }), [=](const Glib::RefPtr &result) { @@ -290,7 +290,7 @@ void GetInhibited(Fn callback) { crl::on_main([=] { callback(false); }); }); }, - std::string(kService)); + kService); }, [&] { crl::on_main([=] { callback(false); }); }); @@ -545,25 +545,25 @@ bool NotificationData::init( _notificationRepliedSignalId = _dbusConnection->signal_subscribe( signalEmitted, - std::string(kService), - std::string(kInterface), + kService, + kInterface, "NotificationReplied", - std::string(kObjectPath)); + kObjectPath); } _actionInvokedSignalId = _dbusConnection->signal_subscribe( signalEmitted, - std::string(kService), - std::string(kInterface), + kService, + kInterface, "ActionInvoked", - std::string(kObjectPath)); + kObjectPath); _activationTokenSignalId = _dbusConnection->signal_subscribe( signalEmitted, - std::string(kService), - std::string(kInterface), + kService, + kInterface, "ActivationToken", - std::string(kObjectPath)); + kObjectPath); } if (capabilities.contains("action-icons")) { @@ -594,10 +594,10 @@ bool NotificationData::init( _notificationClosedSignalId = _dbusConnection->signal_subscribe( signalEmitted, - std::string(kService), - std::string(kInterface), + kService, + kInterface, "NotificationClosed", - std::string(kObjectPath)); + kObjectPath); return true; } @@ -643,8 +643,8 @@ void NotificationData::show() { const auto connection = _dbusConnection; connection->call( - std::string(kObjectPath), - std::string(kInterface), + kObjectPath, + kInterface, "Notify", Glib::create_variant(std::tuple{ Glib::ustring(std::string(AppName)), @@ -673,7 +673,7 @@ void NotificationData::show() { }); }); }, - std::string(kService)); + kService); })); } @@ -690,14 +690,14 @@ void NotificationData::close() { } _dbusConnection->call( - std::string(kObjectPath), - std::string(kInterface), + kObjectPath, + kInterface, "CloseNotification", Glib::create_variant(std::tuple{ _notificationId, }), {}, - std::string(kService), + kService, -1, Gio::DBus::CallFlags::NO_AUTO_START); _manager->clearNotification(_id); @@ -987,7 +987,7 @@ Manager::Private::Private(not_null manager) 0 ).get_dynamic(); - if (interface != kInterface.data()) { + if (interface != kInterface) { return; } @@ -1003,10 +1003,10 @@ Manager::Private::Private(not_null manager) }); }); }, - std::string(kService), - std::string(kPropertiesInterface), + kService, + kPropertiesInterface, "PropertiesChanged", - std::string(kObjectPath)); + kObjectPath); } } diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 7e20b946a..9fdb7a914 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -54,8 +54,6 @@ using Platform::internal::WaylandIntegration; namespace Platform { namespace { -constexpr auto kDesktopFile = ":/misc/org.telegram.desktop.desktop"_cs; - bool PortalAutostart(bool start, bool silent) { if (cExeName().isEmpty()) { return false; @@ -138,8 +136,8 @@ bool PortalAutostart(bool start, bool silent) { loop->quit(); }, - std::string(base::Platform::XDP::kService), - std::string(base::Platform::XDP::kRequestInterface), + base::Platform::XDP::kService, + base::Platform::XDP::kRequestInterface, "Response", requestPath); @@ -150,14 +148,14 @@ bool PortalAutostart(bool start, bool silent) { }); connection->call_sync( - std::string(base::Platform::XDP::kObjectPath), + base::Platform::XDP::kObjectPath, "org.freedesktop.portal.Background", "RequestBackground", Glib::create_variant(std::tuple{ parentWindowId, options, }), - std::string(base::Platform::XDP::kService)); + base::Platform::XDP::kService); if (signalId != 0) { QWidget window; @@ -190,7 +188,7 @@ bool GenerateDesktopFile( DEBUG_LOG(("App Info: placing .desktop file to %1").arg(targetPath)); if (!QDir(targetPath).exists()) QDir().mkpath(targetPath); - const auto sourceFile = kDesktopFile.utf16(); + const auto sourceFile = u":/misc/org.telegram.desktop.desktop"_q; const auto targetFile = targetPath + QGuiApplication::desktopFileName() + u".desktop"_q;