diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index c35043807223d..2c3f368b79319 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -226,19 +226,17 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const }; const auto generateIconPath = [&]() { - auto colorIconPath = role == DarkIconRole ? QStringLiteral("image://svgimage-custom-color/white/") : QStringLiteral("image://svgimage-custom-color/black/"); + auto colorIconPath = role == DarkIconRole ? QStringLiteral("image://svgimage-custom-color/%1/white") : QStringLiteral("image://svgimage-custom-color/%1/black"); if (a._type == Activity::NotificationType && !a._talkNotificationData.userAvatar.isEmpty()) { return QStringLiteral("image://svgimage-custom-color/talk-bordered.svg"); } else if (a._type == Activity::SyncResultType) { - colorIconPath.append("state-error.svg"); - return colorIconPath; + return colorIconPath.arg("state-error.svg"); } else if (a._type == Activity::SyncFileItemType) { if (a._syncFileItemStatus == SyncFileItem::NormalError || a._syncFileItemStatus == SyncFileItem::FatalError || a._syncFileItemStatus == SyncFileItem::DetailError || a._syncFileItemStatus == SyncFileItem::BlacklistedError) { - colorIconPath.append("state-error.svg"); - return colorIconPath; + return colorIconPath.arg("state-error.svg");; } else if (a._syncFileItemStatus == SyncFileItem::SoftError || a._syncFileItemStatus == SyncFileItem::Conflict || a._syncFileItemStatus == SyncFileItem::Restoration @@ -246,29 +244,26 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const || a._syncFileItemStatus == SyncFileItem::FileNameInvalid || a._syncFileItemStatus == SyncFileItem::FileNameInvalidOnServer || a._syncFileItemStatus == SyncFileItem::FileNameClash) { - colorIconPath.append("state-warning.svg"); - return colorIconPath; + return colorIconPath.arg("state-warning.svg");; } else if (a._syncFileItemStatus == SyncFileItem::FileIgnored) { - colorIconPath.append("state-info.svg"); - return colorIconPath; + return colorIconPath.arg("state-info.svg"); } 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() ? QStringLiteral("image://svgimage-custom-color/add.svg/") + : QStringLiteral("image://svgimage-custom-color/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() ? QStringLiteral("image://svgimage-custom-color/delete.svg/") + : QStringLiteral("image://svgimage-custom-color/delete-bordered.svg/"); } else { - return a._previews.empty() ? colorIconPath % QStringLiteral("change.svg") - : QStringLiteral("image://svgimage-custom-color/change-bordered.svg"); + return a._previews.empty() ? colorIconPath.arg(QStringLiteral("change.svg")) + : QStringLiteral("image://svgimage-custom-color/change-bordered.svg/"); } } } else { // We have an activity if (a._icon.isEmpty()) { - colorIconPath.append("activity.svg"); - return colorIconPath; + return colorIconPath.arg("activity.svg");; } const QString basePath = QStringLiteral("image://tray-image-provider/") % a._icon % QStringLiteral("/"); @@ -302,8 +297,9 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const } case DarkIconRole: - case LightIconRole: + case LightIconRole: { return generateIconPath(); + } case ObjectTypeRole: return a._objectType; case ObjectIdRole: @@ -511,7 +507,7 @@ void ActivityListModel::insertOrRemoveDummyFetchingActivity() _dummyFetchingActivities._objectType = dummyFetchingActivityObjectType; _dummyFetchingActivities._subject = tr("Fetching activities …"); _dummyFetchingActivities._dateTime = QDateTime::currentDateTime(); - _dummyFetchingActivities._icon = QLatin1String("image://svgimage-custom-color/change-bordered.svg"); + _dummyFetchingActivities._icon = QLatin1String("image://svgimage-custom-color/change-bordered.svg/"); addEntriesToActivityList({_dummyFetchingActivities}); } else if (!_finalList.isEmpty() && _finalList.first()._objectType == dummyFetchingActivityObjectType) {