Client: Don't sanitize desktop file name

This doesn't work well if the app id ends with ".desktop".

Pick-to: 6.5
Change-Id: I33d7c92f87595251f0da90277d12b2a2bb286a30
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Vlad Zahorodnii 2023-05-15 12:30:26 +03:00
parent 36ea56dae8
commit 5b2524c57d

View File

@ -153,19 +153,15 @@ void QWaylandWindow::initWindow()
setWindowTitle(window()->title()); setWindowTitle(window()->title());
// The appId is the desktop entry identifier that should follow the // The appId is the desktop entry identifier that should follow the
// reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). // reverse DNS convention (see
// According to xdg-shell the appId is only the name, without // http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). According
// the .desktop suffix. // to xdg-shell the appId is only the name, without the .desktop suffix.
// //
// If the application specifies the desktop file name use that // If the application specifies the desktop file name use that,
// removing the ".desktop" suffix, otherwise fall back to the // otherwise fall back to the executable name and prepend the
// executable name and prepend the reversed organization domain // reversed organization domain when available.
// when available.
if (!QGuiApplication::desktopFileName().isEmpty()) { if (!QGuiApplication::desktopFileName().isEmpty()) {
QString name = QGuiApplication::desktopFileName(); mShellSurface->setAppId(QGuiApplication::desktopFileName());
if (name.endsWith(QLatin1String(".desktop")))
name.chop(8);
mShellSurface->setAppId(name);
} else { } else {
QFileInfo fi = QFileInfo(QCoreApplication::instance()->applicationFilePath()); QFileInfo fi = QFileInfo(QCoreApplication::instance()->applicationFilePath());
QStringList domainName = QStringList domainName =