diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2015-01-22 08:13:08 +0100 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2015-04-10 08:29:12 +0000 |
commit | 72aa34dc2aebbea715a5915f26cb6f0f67e164d1 (patch) | |
tree | 4c54e020a510b9a590acaceeaee97f576b62c566 | |
parent | edd339d2b38e504a1e288bbd1cf352d1ae009247 (diff) |
Remove .desktop suffix to appId
The appId is the desktop entry identifier.
According to the desktop entry specifications [1], for applications the
part of the name should follow the reverse DNS convention (see [2]).
To do this we use the application domain if available, otherwise for
lack of information we fall back to the executable base name like other
toolkits such as Gtk+ do.
[1] http://standards.freedesktop.org/desktop-entry-spec/latest/
[2] http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html
Change-Id: I181ad23a9736844e07e8060d78e756a943c27f67
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
-rw-r--r-- | src/client/qwaylandwindow.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index ca0fa5139..83c44c25d 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -107,10 +107,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window) // Set initial surface title mShellSurface->setTitle(window->title()); - // Set surface class to the .desktop file name (obtained from executable name) - QFileInfo exeFileInfo(qApp->applicationFilePath()); - QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->setAppId(className); + // 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), + // use the application domain if available, otherwise the executable base name. + // According to xdg-shell the appId is only the name, without the .desktop suffix. + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } if (QPlatformWindow::parent() && mSubSurfaceWindow) { |