summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/unix/qgenericunixservices.cpp
Commit message (Collapse)AuthorAgeFilesLines
* platforms: rename QGenericUnixServices to QDesktopUnixServicesLiang Qi2025-01-211-639/+0
| | | | | | | | | | The implementation follows XDG Desktop Portal mostly, and is for desktop, not generic unix. Task-number: QTBUG-130884 Pick-to: 6.9 Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QGenericUnixServices: avoid dbus calls on non xdg envsLiang Qi2025-01-211-0/+3
| | | | | | | Fixes: QTBUG-130884 Pick-to: 6.9 6.8 6.5 Change-Id: I2525293f776676cda63e61c3c5093045dbafcf38 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace qgetenv() calls converted to QString with qEnvironmentVariable()Thiago Macieira2025-01-011-3/+3
| | | | | | | | It's slightly more efficient. Pick-to: 6.9 Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* xcb: Report location of DBus menubar on window propertiesDavid Edmundson2024-10-101-0/+14
| | | | | | | | | | | | | | | KDE extended the DBus menubar protocol to report the DBus service and path on the window itself, this makes looking it up easier than going through a broker. On Qt5 this worked because we handled the entire DBus menu from scratch in KDE's own platformtheme, but given Qt now has direct dbusmenu bar support it makes sense to have the remaining reporting side all in one place. Change-Id: I78044992fa1840c40a66384033ed790ce0cd7f96 Task-number: QTBUG-116352 Reviewed-by: Liang Qi <liang.qi@qt.io>
* QGenericUnixServices: properly disconnect signals in dtorChristian Ehrlicher2024-08-301-1/+10
| | | | | | | | | | | | Since QGenericUnixServices does not derive from QObject, the connection to QDBusPendingCallWatcher made in the ctor might outlive the lifetime of QGenericUnixServices. Fix it by explicitly disconnecting it in the dtor. Fixes: QTBUG-125239 Pick-to: 6.8 6.7 6.5 Change-Id: I5fac4fd5831b2dde16b3d7b479a8ee616bfb7e3a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QGenericUnixServices: make sure the picker returns a colorLiang Qi2024-02-031-3/+7
| | | | | | | | This amends b646c7b76c7787cff57bca0fde04d9f58abdfbb8 . Pick-to: 6.7 6.6 6.5 Change-Id: Ic7183c06a93085d65b31c86380889b78c714548b Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Introduce a configure feature for WaylandDavid Redondo2023-12-071-0/+4
| | | | | | | | Using the presence of the wayland-client lib as a condition. Fixes: QTBUG-117386 Change-Id: If4336965ea06e3f4b06e9af661efdec38ba46136 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QGenericUnixServices: ensure xdg activation token callback is calledIlya Fedin2023-09-051-1/+3
| | | | | | | | | | | The callback doesn't get called if the signal is emitted immediately or if hitting the early returns Fixes: QTBUG-113995 Pick-to: 6.6 6.5 Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8 Reviewed-by: David Redondo <qt@david-redondo.de> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* qgenericunixservices: Move x11 specific code to the Xcb backendDavid Edmundson2023-07-051-3/+1
| | | | | | | | | | QGenericUnixServices is an abstract class subclassed by the wayland backend for wayland specific functionality. This moves to a consistent pattern where X11 code is also the X11 backend rather than guarded with if statements. Change-Id: I1cc7ebac811463451d744fdc034f5ad5fd022bc6 Reviewed-by: Liang Qi <liang.qi@qt.io>
* OpenFile portal: do not use O_PATH fdsJan Grulich2023-05-031-8/+2
| | | | | | | | | | | | | Using O_PATH requires correctly specifying whether the fd is writable or not. Stating that the fd is writable without it actually being writable results into rejection on xdg-desktop-portal side. Other implementations like xdg-open or gtk have also moved away from O_PATH fds so this will make a matching implementation and avoid possible rejections from xdp. Fixes: QTBUG-113143 Pick-to: 6.5 5.15 Change-Id: Icc171752d73ee091282b7c655f71da3cb59179b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement setBadgeNumber for xcb backendCarl Schwan2023-04-041-0/+31
| | | | | | | | | | | | This use the unity launcher specification which is defined here https://wiki.ubuntu.com/Unity/LauncherAPI This spec is used by Plasma and Unity. On other Linux desktop platform where the unity DBus interface is not detected this is no-op. Change-Id: I81a9b95fe4886ad597bb4e775641926b161c49a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Make flatpak check more backward compatibleIlya Fedin2023-04-041-1/+1
| | | | | | | | | | Since 68de00e0d4f2c574162a6e033d41786e3757d25d, the check doesn't work with flatpak versions lesser than 1.13.1. Checking the file in the root directory works since flatpak 0.6.10. Pick-to: 6.5 6.2 Change-Id: Icc83ea5de4a962b52a737c9842248df3b60b1331 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add xdg-activation support to QGenericUnixServicesNicolas Fella2022-12-131-41/+121
| | | | | | | | | | | | | | | This is needed to transfer focus to the receiving application if that is already running It uses the new native interface for QWaylandWindow to access the existing xdg-activation support of QtWayland. The received token is passed in the options map for portal calls (as defined in the portal spec) or passed via env variable when launching the relevant helpers Change-Id: I524bc58d88033af914e8af2c6db26b1a86afb863 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* offer an opt out of automatic xdg-desktop-portal useHarald Sitter2022-10-221-0/+3
| | | | | | | | this allows users to skip over the portal invocation if it is undesirable (e.g. during early stages of session setup on KDE's Plasma) Change-Id: I43e3c3a59b9bb71c77012f8f0ec7ad7ba904a050 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* add color picking support on wayland using the XDG desktop portalHarald Sitter2022-08-261-0/+143
| | | | | | | | | | | | | | | | | | On wayland applications are not trusted to perform screen grabs by default, it is however possible to let the user specifically pick the color of a pixel using the XDG desktop portal (otherwise used for sandboxing etc.). Try to use this portal on unix systems by default. To support this use case some extra abstraction is necessary as this constitutes a platformservice rather than a platform feature. To that end the QPlatformService has gained a capability system and a pure virtual helper class to facilitate asynchronous color picking. When supported the color picking capability takes precedence over the custom picking code in QColorDialog. Fixes: QTBUG-81538 Change-Id: I4acb3af11d459e9d5ebefe5abbb41e50e3ccf7f0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Send parent_window handle to desktop portalDavid Redondo2022-07-251-11/+29
| | | | | | | | | | | | | Sending parent_window to the portal allows it/the window manager to better place portal dialogs in respect to the application window, for example on top of it instead of a random position. For this use the focusWindow() (if available) since the API in QDesktopServices does not take a QWindow parameter. The file dialog has an explicit parent that can be used. The introduced virtual is provided as a hook for the wayland platform that already includes a class that inherits from QGenericUnixServices. Change-Id: I5571f08d07e5a4e3ae32efd1f09e2727cec9e7c5 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtGui: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-281-2/+2
| | | | | | Task-number: QTBUG-98434 Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-281-22/+24
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-131-1/+1
| | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Always fallback opening URLs to the regular way if portal failsIlya Fedin2021-10-071-14/+6
| | | | | | | | | | | Even if the code fails, the runtime will have a xdg-open binary that supports the required API (portals in flatpak and userd launcher in snap) Task-number: QTBUG-83939 Change-Id: I8527cfe20411c535686b7171ff9ef285ab9e10aa Reviewed-by: Jan Grulich <jgrulich@redhat.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* [qgenericunixservices] Consider kde-open5 for opening URLsNicolas Fella2021-07-281-0/+2
| | | | | | | | | | | | | When xdg-open is not found the KDE-specific kfmclient is considered. That however is part of Konqueror and may not be present as well. Plasma offers another option, kde-open5, which should be considered before falling back to webbrowsers. This is particularly for non-http URLs like tel: where opening in a webbrowser is not wanted. Pick-to: 6.2 6.1 5.15 Change-Id: I2b606562e21568fbe43f4593de67a1d467918cc4 Reviewed-by: David Faure <david.faure@kdab.com>
* OpenFile portal: use "writable" option to specify our FD is writableJan Grulich2020-10-211-2/+4
| | | | | | | | | | | | | When using OpenFile portal and passing a file descriptor, we open the file with qt_safe_open() which by defaults make the file descriptor writable. However we didn't specify in options that the FD is writable which leads into rejection on xdg-desktop-portal side as there is a mismatch between writable FD and read-only request. Pick-to: 5.15 Change-Id: I7a430339a9615f0a054e777e0f3de56e219d1706 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-3/+3
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Move UNIX services into QtGuiFriedemann Kleint2020-06-181-0/+374
Task-number: QTBUG-83255 Change-Id: I95cd25c6e18ffb46955acc76d6cab551d1c8f5ae Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>