Backport faf0e944008a8ce3182e11a2ee192b1589c5661a

libnotificationmanager: Return something of the correct type for most roles

from kde-distro-packagers@kde.org:

"we found a regression in Qt 6.11.1 that breaks the job tracker of
notifications, them not closing properly, among other things, which is a
quite high profile issue.

I would therefore suggest if you ship Qt 6.11.1 that you backport this
change for plasma-workspace [1] since Plasma 6.6.6 is still a couple of
weeks away. To our knowledge, Qt 6.11.0 and earlier are not affected. We
do not have a Qt fix yet afaik." -- Kai Uwe

See also https://bugs.kde.org/show_bug.cgi?id=520120
This commit is contained in:
rsadowski
2026-05-25 16:19:30 +00:00
parent 7bd02672e0
commit 77a7486043
2 changed files with 44 additions and 0 deletions
+1
View File
@@ -1,5 +1,6 @@
COMMENT = various components needed to run a Plasma-based environment
DISTNAME = plasma-workspace-${VERSION}
REVISION = 0
SHARED_LIBS += kfontinst 1.0 # 0.0
SHARED_LIBS += kfontinstui 2.0 # 0.0
@@ -0,0 +1,43 @@
https://invent.kde.org/plasma/plasma-workspace/-/commit/faf0e944008a8ce3182e11a2ee192b1589c5661a
Index: libnotificationmanager/jobsmodel.cpp
--- libnotificationmanager/jobsmodel.cpp.orig
+++ libnotificationmanager/jobsmodel.cpp
@@ -145,8 +145,37 @@ QVariant JobsModel::data(const QModelIndex &index, int
// There's hardly a reason why it should show up as "unread".
case Notifications::ReadRole:
return true;
+
+ // Qt doesn't like the model not returning anything, for example
+ // casting it to "undefined" as a string (when put in a required property string)
+ // blowing up in client code left and right.
+ case Notifications::NotifyRcNameRole:
+ case Notifications::OriginNameRole:
+ case Notifications::DefaultActionLabelRole:
+ case Notifications::ConfigureActionLabelRole:
+ case Notifications::ReplyActionLabelRole:
+ case Notifications::ReplyPlaceholderTextRole:
+ case Notifications::ReplySubmitButtonTextRole:
+ case Notifications::ReplySubmitButtonIconNameRole:
+ case Notifications::CategoryRole:
+ return QString();
+
+ case Notifications::ActionNamesRole:
case Notifications::ActionLabelsRole:
return QStringList();
+
+ case Notifications::HasDefaultActionRole:
+ case Notifications::ResidentRole:
+ case Notifications::TransientRole:
+ case Notifications::UserActionFeedbackRole:
+ case Notifications::HasReplyActionRole:
+ return false;
+
+ case Notifications::UrlsRole:
+ return QVariant::fromValue(QList<QUrl>());
+
+ case Notifications::UrgencyRole:
+ return Notifications::NormalUrgency;
}
return {};