[SystemTray] Support for AttentionIcon

Summary:
Adding support for Attention Icon to StatusNotifier tray icons.
Binding is working correctly only when "Status" is used, not derived "status".

BUG: 341255

Test Plan: As described in bug report, Konversation can be used for tests.

Reviewers: #plasma, broulik, #plasma_workspaces

Reviewed By: #plasma, broulik, #plasma_workspaces

Subscribers: lbeltrame, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24865
wilder-5.18
Konrad Materka 6 years ago
parent a1404ce293
commit 2d7b6c2324
  1. 18
      applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
  2. 4
      dataengines/statusnotifieritem/statusnotifieritemsource.cpp

@ -43,16 +43,22 @@ AbstractItem {
} }
} }
onStatusChanged: {
//binding is not working in PlasmaCore.IconItem
iconItem.source = status === PlasmaCore.Types.NeedsAttentionStatus ? (AttentionIcon ? AttentionIcon : AttentionIconName) : (Icon ? Icon : IconName)
}
iconItem: iconItem iconItem: iconItem
PlasmaCore.IconItem { PlasmaCore.IconItem {
id: iconItem id: iconItem
source: Icon ? Icon : IconName source: {
if (taskIcon.status === PlasmaCore.Types.NeedsAttentionStatus) {
if (AttentionIcon) {
return AttentionIcon
}
if (AttentionIconName) {
return AttentionIconName
}
}
return Icon ? Icon : IconName
}
width: Math.min(parent.width, parent.height) width: Math.min(parent.width, parent.height)
height: width height: width
active: taskIcon.containsMouse active: taskIcon.containsMouse

@ -303,7 +303,7 @@ void StatusNotifierItemSource::refreshCallback(QDBusPendingCallWatcher *call)
overlayIcon(&icon, &overlay); overlayIcon(&icon, &overlay);
} }
} }
setData(QStringLiteral("Icon"), icon); setData(QStringLiteral("Icon"), icon.isNull() ? QVariant() : icon);
setData(QStringLiteral("IconName"), iconName); setData(QStringLiteral("IconName"), iconName);
} }
@ -329,7 +329,7 @@ void StatusNotifierItemSource::refreshCallback(QDBusPendingCallWatcher *call)
overlayIcon(&attentionIcon, &overlay); overlayIcon(&attentionIcon, &overlay);
} }
} }
setData(QStringLiteral("AttentionIcon"), attentionIcon); setData(QStringLiteral("AttentionIcon"), attentionIcon.isNull() ? QVariant() : attentionIcon);
} }
//ToolTip //ToolTip

Loading…
Cancel
Save