diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2015-08-13 16:37:07 +0200 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2015-08-27 11:00:39 +0000 |
commit | 61ad604ad41607be97efea5a18cd4d9fb7ddca73 (patch) | |
tree | 4f6d3612490205281309d6fa474ee403448dd32f /tests | |
parent | 3b1cbc4753bcd30c6eec37728e531405d0aee30d (diff) |
Add QGuiApplication::setDesktopFileName()
This property might be set by applications whose desktop entry file name
cannot be determined by heuristics already in place.
It is particularly useful for QtWayland as it can be used to determine
the app_id simply by stripping the ".desktop" suffix from this property.
Without a correct app_id, Wayland compositors won't be able to e.g.
show the application icon on task managers.
This property is also very interesting for X11 as there are various
desktop environments trying to map windows to launchers.
It will be possible to export desktopFileName as a xproperty, making
such mapping less error prone.
Change-Id: I0fef23f28f383639e625379ab46e36aecb338ac4
Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 2ddfdad7e4..5cade82b6b 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -62,6 +62,7 @@ class tst_QGuiApplication: public tst_QCoreApplication private slots: void cleanup(); void displayName(); + void desktopFileName(); void firstWindowTitle(); void windowIcon(); void focusObject(); @@ -101,6 +102,21 @@ void tst_QGuiApplication::displayName() QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application")); } +void tst_QGuiApplication::desktopFileName() +{ + int argc = 1; + char *argv[] = { const_cast<char*>("tst_qguiapplication") }; + QGuiApplication app(argc, argv); + + QCOMPARE(QGuiApplication::desktopFileName(), QString()); + + QGuiApplication::setDesktopFileName("io.qt.QGuiApplication.desktop"); + QCOMPARE(QGuiApplication::desktopFileName(), QString::fromLatin1("io.qt.QGuiApplication.desktop")); + + QGuiApplication::setDesktopFileName(QString()); + QCOMPARE(QGuiApplication::desktopFileName(), QString()); +} + void tst_QGuiApplication::firstWindowTitle() { int argc = 3; |