mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Merge pull request #3472 from nextcloud/feature/cacheQmlImages
directly send the icon url for activities to the qml component
This commit is contained in:
commit
d9a634223a
3 changed files with 4 additions and 21 deletions
|
@ -74,7 +74,6 @@ public:
|
|||
qint64 _expireAtMsecs = -1;
|
||||
QString _accName;
|
||||
QString _icon;
|
||||
QString _iconData;
|
||||
|
||||
// Stores information about the error
|
||||
int _status;
|
||||
|
|
|
@ -178,11 +178,11 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
} else {
|
||||
// We have an activity
|
||||
if (!a._iconData.isEmpty()) {
|
||||
const QString svgData = "data:image/svg+xml;utf8," + a._iconData;
|
||||
return svgData;
|
||||
if (a._icon.isEmpty()) {
|
||||
return "qrc:///client/theme/black/activity.svg";
|
||||
}
|
||||
return "qrc:///client/theme/black/activity.svg";
|
||||
|
||||
return a._icon;
|
||||
}
|
||||
}
|
||||
case ObjectTypeRole:
|
||||
|
@ -299,12 +299,6 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st
|
|||
a._dateTime = QDateTime::fromString(json.value("datetime").toString(), Qt::ISODate);
|
||||
a._icon = json.value("icon").toString();
|
||||
|
||||
if (!a._icon.isEmpty()) {
|
||||
auto *iconJob = new IconJob(QUrl(a._icon));
|
||||
iconJob->setProperty("activityId", a._id);
|
||||
connect(iconJob, &IconJob::jobFinished, this, &ActivityListModel::slotIconDownloaded);
|
||||
}
|
||||
|
||||
list.append(a);
|
||||
_currentItem = list.last()._id;
|
||||
|
||||
|
@ -325,15 +319,6 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st
|
|||
combineActivityLists();
|
||||
}
|
||||
|
||||
void ActivityListModel::slotIconDownloaded(QByteArray iconData)
|
||||
{
|
||||
for (auto i = 0; i < _activityLists.count(); i++) {
|
||||
if (_activityLists[i]._id == sender()->property("activityId").toLongLong()) {
|
||||
_activityLists[i]._iconData = iconData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActivityListModel::addErrorToActivityList(Activity activity)
|
||||
{
|
||||
qCInfo(lcActivity) << "Error successfully added to the notification list: " << activity._subject;
|
||||
|
|
|
@ -84,7 +84,6 @@ public slots:
|
|||
|
||||
private slots:
|
||||
void slotActivitiesReceived(const QJsonDocument &json, int statusCode);
|
||||
void slotIconDownloaded(QByteArray iconData);
|
||||
|
||||
signals:
|
||||
void activityJobStatusCode(int statusCode);
|
||||
|
|
Loading…
Reference in a new issue