Commit 00e64bdb authored by Konrad Materka's avatar Konrad Materka
Browse files

[applets/systemtray] Show base icon when AttentionIcon not set

If status is set to NeedsAttention it tries to use Attention Icon. If Attention Icon is not set, empty/null QIcon is set. QML can't check if QIcon is null or not, as a result it tries to use empty icon and nothing is rendered.
Set null QVariant if AttentionIcon is not valid so that QML check will work correctly.

Test Plan:
* Set NeedsAttention as a status and with no Attention Icon
* Base Icon should render correctly

Reviewers: #plasma_workspaces, #plasma, ngraham, broulik, davidedmundson, mart

Reviewed By: #plasma_workspaces, #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent 65f06786
......@@ -327,6 +327,12 @@ void StatusNotifierModel::dataUpdated(const QString &sourceName, const Plasma::D
dataItem->setData(data.value("IconName"), Qt::DecorationRole);
dataItem->setData(QVariant(), static_cast<int>(Role::Icon));
QVariant attentionIcon = data.value("AttentionIcon");
if (attentionIcon.isValid() && attentionIcon.canConvert<QIcon>() && !attentionIcon.value<QIcon>().isNull()) {
dataItem->setData(attentionIcon, static_cast<int>(Role::AttentionIcon));
} else {
dataItem->setData(QVariant(), static_cast<int>(Role::AttentionIcon));
dataItem->setData(data.value("Id"), static_cast<int>(BaseModel::BaseRole::ItemId));
QVariant category = data.value("Category");
......@@ -342,7 +348,6 @@ void StatusNotifierModel::dataUpdated(const QString &sourceName, const Plasma::D
dataItem->setData(sourceName, static_cast<int>(Role::DataEngineSource));
updateItemData(dataItem, data, Role::AttentionIcon);
updateItemData(dataItem, data, Role::AttentionIconName);
updateItemData(dataItem, data, Role::AttentionMovieName);
updateItemData(dataItem, data, Role::Category);
Supports Markdown
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