Commit 04bd86e1 authored by Konrad Materka's avatar Konrad Materka
Browse files

[applets/systemtray] Consistent name/icon in System Tray settings

Summary:
Icon and title of entries in System Tray settings should not change when status changes.
Use only plugin's meta-data for consistent title and icon.

BUG: 421561

FIXED-IN: 5.19.0

Test Plan:
1. Check Weather or Media Player applets
2. Enbable/disable/change status
3. Icon and title should remain the same
parent 2ce60f4e
......@@ -153,9 +153,7 @@ PlasmoidModel::PlasmoidModel(QObject *parent) : BaseModel(parent)
}
QString name = info.name();
const QString dbusactivation =
info.rawData().value(QStringLiteral("X-Plasma-DBusActivationService")).toString();
const QString dbusactivation = info.value(QStringLiteral("X-Plasma-DBusActivationService"));
if (!dbusactivation.isEmpty()) {
name += i18n(" (Automatic load)");
}
......@@ -192,19 +190,15 @@ void PlasmoidModel::addApplet(Plasma::Applet *applet)
}
if (!dataItem) {
dataItem = new QStandardItem();
QString name = pluginMetaData.name();
const QString dbusactivation = pluginMetaData.value(QStringLiteral("X-Plasma-DBusActivationService"));
if (!dbusactivation.isEmpty()) {
name += i18n(" (Automatic load)");
}
dataItem = new QStandardItem(QIcon::fromTheme(pluginMetaData.iconName()), name);
appendRow(dataItem);
}
dataItem->setData(applet->title(), Qt::DisplayRole);
connect(applet, &Plasma::Applet::titleChanged, this, [dataItem] (const QString &title) {
dataItem->setData(title, static_cast<int>(Qt::DisplayRole));
});
dataItem->setData(QIcon::fromTheme(applet->icon()), Qt::DecorationRole);
connect(applet, &Plasma::Applet::iconChanged, this, [dataItem] (const QString &icon) {
dataItem->setData(QIcon::fromTheme(icon), Qt::DecorationRole);
});
dataItem->setData(pluginMetaData.pluginId(), static_cast<int>(BaseModel::BaseRole::ItemId));
dataItem->setData(plasmoidCategoryForMetadata(pluginMetaData), static_cast<int>(BaseModel::BaseRole::Category));
dataItem->setData(applet->status(), static_cast<int>(BaseModel::BaseRole::Status));
......
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