diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml index 98ea3c2277f04..92d4ed5838b6f 100644 --- a/src/gui/tray/ActivityItemContent.qml +++ b/src/gui/tray/ActivityItemContent.qml @@ -104,7 +104,7 @@ RowLayout { cache: true fillMode: Image.PreserveAspectFit - source: Style.darkMode ? model.darkIcon : model.lightIcon + source: model.icon + "/" + palette.text sourceSize.height: 64 sourceSize.width: 64 mipmap: true // Addresses grainy downscale diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 47cc441f6c14f..65de2e91d7533 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -65,8 +65,7 @@ QHash ActivityListModel::roleNames() const roles[LinkRole] = "link"; roles[MessageRole] = "message"; roles[ActionRole] = "type"; - roles[DarkIconRole] = "darkIcon"; - roles[LightIconRole] = "lightIcon"; + roles[IconRole] = "icon"; roles[ActionTextRole] = "subject"; roles[ActionsLinksRole] = "links"; roles[ActionsLinksContextMenuRole] = "linksContextMenu"; @@ -226,7 +225,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const }; const auto generateIconPath = [&]() { - auto colorIconPath = role == DarkIconRole ? QStringLiteral("image://svgimage-custom-color/%1/white") : QStringLiteral("image://svgimage-custom-color/%1/black"); + auto colorIconPath = QStringLiteral("image://svgimage-custom-color/%1"); if (a._type == Activity::NotificationType && !a._talkNotificationData.userAvatar.isEmpty()) { return QStringLiteral("image://svgimage-custom-color/talk-bordered.svg"); } else if (a._type == Activity::SyncResultType) { @@ -250,24 +249,16 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const } else { // File sync successful if (a._fileAction == "file_created") { - return a._previews.empty() ? QStringLiteral("image://svgimage-custom-color/add.svg/") - : QStringLiteral("image://svgimage-custom-color/add-bordered.svg/"); + return a._previews.empty() ? colorIconPath.arg("add.svg") : colorIconPath.arg("add-bordered.svg"); } else if (a._fileAction == "file_deleted") { - return a._previews.empty() ? QStringLiteral("image://svgimage-custom-color/delete.svg/") - : QStringLiteral("image://svgimage-custom-color/delete-bordered.svg/"); + return a._previews.empty() ? colorIconPath.arg("delete.svg") : colorIconPath.arg("delete-bordered.svg"); } else { - return a._previews.empty() ? colorIconPath.arg(QStringLiteral("change.svg")) - : QStringLiteral("image://svgimage-custom-color/change-bordered.svg/"); + return a._previews.empty() ? colorIconPath.arg("change.svg") : colorIconPath.arg("change-bordered.svg"); } } } else { // We have an activity - if (a._icon.isEmpty()) { - return colorIconPath.arg("activity.svg"); - } - - const QString basePath = QStringLiteral("image://tray-image-provider/") % a._icon % QStringLiteral("/"); - return role == DarkIconRole ? QString(basePath + QStringLiteral("white")) : QString(basePath + QStringLiteral("black")); + return a._icon.isEmpty() ? colorIconPath.arg("activity.svg") : colorIconPath.arg(a._icon); } }; @@ -296,10 +287,8 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const return ActivityListModel::convertLinksToActionButtons(a); } - case DarkIconRole: - case LightIconRole: { + case IconRole: return generateIconPath(); - } case ObjectTypeRole: return a._objectType; case ObjectIdRole: diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index 6251a12e9a1ff..e8e4ed5bb93e0 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -51,8 +51,7 @@ class ActivityListModel : public QAbstractListModel public: enum DataRole { - DarkIconRole = Qt::UserRole + 1, - LightIconRole, + IconRole = Qt::UserRole + 1, AccountRole, ObjectTypeRole, ObjectIdRole, diff --git a/test/testactivitylistmodel.cpp b/test/testactivitylistmodel.cpp index 7b440dffa3201..84277356bcf12 100644 --- a/test/testactivitylistmodel.cpp +++ b/test/testactivitylistmodel.cpp @@ -225,8 +225,7 @@ private slots: QVERIFY(!index.data(OCC::ActivityListModel::AccountRole).toString().isEmpty()); QVERIFY(!index.data(OCC::ActivityListModel::ActionTextColorRole).toString().isEmpty()); - QVERIFY(!index.data(OCC::ActivityListModel::DarkIconRole).toString().isEmpty()); - QVERIFY(!index.data(OCC::ActivityListModel::LightIconRole).toString().isEmpty()); + QVERIFY(!index.data(OCC::ActivityListModel::IconRole).toString().isEmpty()); QVERIFY(!index.data(OCC::ActivityListModel::PointInTimeRole).toString().isEmpty()); QVERIFY(index.data(OCC::ActivityListModel::ObjectTypeRole).canConvert());