Commit fd67206c authored by Nicolas Fella's avatar Nicolas Fella

[notifications] Read appname from desktop file if no appname set

Summary: Some applications, e.g. pamac, don't send an app_name, which is legal according to the fd.o spec. In this case try to read it from the desktop file before falling back to the process name.

Test Plan: I get a better appname for pamac notifications now

Reviewers: #plasma, broulik, mart

Reviewed By: #plasma, mart

Subscribers: crossi, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27786
parent 7d0a7472
......@@ -328,12 +328,6 @@ void Notification::Private::setDesktopEntry(const QString &desktopEntry)
const QString iconName = globalGroup.readEntry("IconName");
// For default events we try to show the application name from the desktop entry if possible
// This will have us show e.g. "Dr Konqi" instead of generic "Plasma Desktop"
if (isDefaultEvent && !serviceName.isEmpty()) {
applicationName = serviceName;
}
// also only overwrite application icon name for non-default events (or if we don't have a service icon)
if (!iconName.isEmpty() && (!isDefaultEvent || applicationIconName.isEmpty())) {
applicationIconName = iconName;
......@@ -342,6 +336,13 @@ void Notification::Private::setDesktopEntry(const QString &desktopEntry)
const QRegularExpression regexp(QStringLiteral("^Event/([^/]*)$"));
configurableNotifyRc = !config.groupList().filter(regexp).isEmpty();
}
// For default events we try to show the application name from the desktop entry if possible
// This will have us show e.g. "Dr Konqi" instead of generic "Plasma Desktop"
// The application may not send an applicationName. Use the name from the desktop entry then
if ((isDefaultEvent || applicationName.isEmpty()) && !serviceName.isEmpty()) {
applicationName = serviceName;
}
}
void Notification::Private::processHints(const QVariantMap &hints)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment