File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414#include < QCursor>
1515#include < QDBusInterface>
1616#include < QDBusReply>
17+ #include < QFileInfo>
1718#include < QIcon>
1819#include < QMenu>
1920#include < QSystemTrayIcon>
21+ #include < QUrl>
2022#include < QVariantMap>
2123
2224namespace {
@@ -164,7 +166,14 @@ extern "C" {
164166 if (!text.isEmpty ()) {
165167 const QString title = tray->notification_title != nullptr ? QString::fromUtf8 (tray->notification_title ) : QString ();
166168 const char *icon_path = tray->notification_icon != nullptr ? tray->notification_icon : tray->icon ;
167- const QString icon = icon_path != nullptr ? QString::fromUtf8 (icon_path) : QString ();
169+ QString icon;
170+ if (icon_path != nullptr ) {
171+ icon = QUrl::fromLocalFile (QFileInfo (QString::fromUtf8 (icon_path)).absoluteFilePath ()).toString ();
172+ }
173+ QVariantMap hints;
174+ if (!icon.isEmpty ()) {
175+ hints[QStringLiteral (" image-path" )] = icon;
176+ }
168177 if (tray->notification_cb != nullptr ) {
169178 void (*cb)() = tray->notification_cb ;
170179 QObject::connect (g_tray_icon, &QSystemTrayIcon::messageClicked, [cb]() {
@@ -185,7 +194,7 @@ extern "C" {
185194 title,
186195 text,
187196 QStringList (),
188- QVariantMap () ,
197+ hints ,
189198 5000
190199 );
191200 if (reply.isValid ()) {
You can’t perform that action at this time.
0 commit comments