23 Commits

Author SHA1 Message Date
Thiago Macieira
381dca29ff Replace qgetenv() calls converted to QString with qEnvironmentVariable()
It's slightly more efficient.

Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit db34e27f7f6ade54bfae59e5eed14c05ac508a49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-01 19:55:21 +00:00
David Edmundson
efdb5d16df xcb: Report location of DBus menubar on window properties
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>
2024-10-10 21:14:40 +00:00
Christian Ehrlicher
de609d84b9 QGenericUnixServices: properly disconnect signals in dtor
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>
2024-08-30 23:56:26 +02:00
Liang Qi
f07d8309d6 QGenericUnixServices: make sure the picker returns a color
This amends b646c7b76c7787cff57bca0fde04d9f58abdfbb8 .

Pick-to: 6.7 6.6 6.5
Change-Id: Ic7183c06a93085d65b31c86380889b78c714548b
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2024-02-03 21:40:13 +01:00
David Redondo
a2ff329d2e Introduce a configure feature for Wayland
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>
2023-12-07 23:04:59 +01:00
Ilya Fedin
d524f0a756 QGenericUnixServices: ensure xdg activation token callback is called
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>
2023-09-05 00:57:47 +04:00
David Edmundson
d0a5866f6f qgenericunixservices: Move x11 specific code to the Xcb backend
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>
2023-07-05 14:09:31 +01:00
Jan Grulich
03cbcba7b2 OpenFile portal: do not use O_PATH fds
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>
2023-05-03 07:22:52 +02:00
Carl Schwan
ac973cb74f Implement setBadgeNumber for xcb backend
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>
2023-04-04 23:53:37 +02:00
Ilya Fedin
5c4a94ba85 Make flatpak check more backward compatible
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>
2023-04-04 01:21:51 +04:00
Nicolas Fella
fbfaf5d38b Add xdg-activation support to QGenericUnixServices
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>
2022-12-13 11:49:50 +01:00
Harald Sitter
a7bd656cf4 offer an opt out of automatic xdg-desktop-portal use
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>
2022-10-22 17:35:49 +02:00
Harald Sitter
b646c7b76c add color picking support on wayland using the XDG desktop portal
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>
2022-08-26 13:33:15 +02:00
David Redondo
c142fd8f68 Send parent_window handle to desktop portal
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>
2022-07-25 18:29:49 +02:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
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>
2022-05-16 16:37:38 +02:00
Sona Kurazyan
9a55c695c7 QtGui: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-28 05:58:52 +02:00
Sona Kurazyan
7b6b133746 QtGui: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-28 05:58:52 +02:00
Sona Kurazyan
a5b9600356 QtGui: stop using QLatin1Char constructor for creating char literals
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>
2022-04-13 18:34:15 +02:00
Ilya Fedin
62a81bddfa Always fallback opening URLs to the regular way if portal fails
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>
2021-10-07 01:54:36 +04:00
Nicolas Fella
74a91773af [qgenericunixservices] Consider kde-open5 for opening URLs
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>
2021-07-28 16:37:10 +02:00
Jan Grulich
3e09ac369d OpenFile portal: use "writable" option to specify our FD is writable
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>
2020-10-21 08:38:15 +02:00
Lars Schmertmann
6ce2f3f26b Add ; to Q_UNUSED
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>
2020-07-07 11:51:48 +02:00
Friedemann Kleint
7e83f09ead Move UNIX services into QtGui
Task-number: QTBUG-83255
Change-Id: I95cd25c6e18ffb46955acc76d6cab551d1c8f5ae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-18 12:02:26 +02:00