on xenial help sign in
merge ~lukas-kde/unity8/dynamicLauncherIcons as prereq
2fe0e67Michael Zanetti
plugins/Unity/Launcher/launchermodel.cpp+13−4
@@ -103,7 +103,7 @@ void LauncherModel::setAlerting(const QString &appId, bool alerting) {
103 LauncherItem *item = m_list.at(index);
103 LauncherItem *item = m_list.at(index);
104 if (!item->focused()) {
104 if (!item->focused()) {
105 item->setAlerting(alerting);
105 item->setAlerting(alerting);
106− Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RoleAlerting);
106+ Q_EMIT dataChanged(modelIndex, modelIndex, {RoleAlerting});
107 }
107 }
108 }
108 }
109}
109}
@@ -415,10 +415,19 @@ void LauncherModel::refresh()
415 } else {
415 } else {
416 int idx = m_list.indexOf(item);
416 int idx = m_list.indexOf(item);
417 item->setName(desktopFile.displayName());
417 item->setName(desktopFile.displayName());
418− item->setIcon(desktopFile.icon());
419 item->setPinned(item->pinned()); // update pinned text if needed
418 item->setPinned(item->pinned()); // update pinned text if needed
420 item->setRunning(item->running());
419 item->setRunning(item->running());
421− Q_EMIT dataChanged(index(idx), index(idx), {RoleName, RoleIcon, RoleRunning});
420+ Q_EMIT dataChanged(index(idx), index(idx), {RoleName, RoleRunning});
421+
422+ const QString oldIcon = item->icon();
423+ if (oldIcon == desktopFile.icon()) { // same icon file, perhaps different contents, simulate changing the icon name to force reload
424+ item->setIcon(QString());
425+ Q_EMIT dataChanged(index(idx), index(idx), {RoleIcon});
426+ }
427+
428+ // now set the icon for real
429+ item->setIcon(desktopFile.icon());
430+ Q_EMIT dataChanged(index(idx), index(idx), {RoleIcon});
422 }
431 }
423 }
432 }
424
433
@@ -490,7 +499,7 @@ void LauncherModel::alert(const QString &appId)
490 if (idx >= 0) {
499 if (idx >= 0) {
491 LauncherItem *item = m_list.at(idx);
500 LauncherItem *item = m_list.at(idx);
492 setAlerting(item->appId(), true);
501 setAlerting(item->appId(), true);
493− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleAlerting);
502+ Q_EMIT dataChanged(index(idx), index(idx), {RoleAlerting});
494 }
503 }
495}
504}
496
505
plugins/Unity/Launcher/launchermodel.h+1−1
@@ -38,7 +38,7 @@ class LauncherModel: public LauncherModelInterface
38 Q_OBJECT
38 Q_OBJECT
39
39
40public:
40public:
41− LauncherModel(QObject *parent = 0);
41+ LauncherModel(QObject *parent = nullptr);
42 ~LauncherModel();
42 ~LauncherModel();
43
43
44 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
44 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
qml/Launcher/LauncherDelegate.qml+1
@@ -135,6 +135,7 @@ Item {
135 sourceSize.width: iconShape.width
135 sourceSize.width: iconShape.width
136 sourceSize.height: iconShape.height
136 sourceSize.height: iconShape.height
137 source: root.iconName
137 source: root.iconName
138+ cache: false // see lpbug#1543290 why no cache
138 }
139 }
139 }
140 }
140
141