Commit bc2c0d4e authored by Nate Graham's avatar Nate Graham
Browse files

Merge branch 'Plasma/5.17'

parents 1206c9db d7579e8d
......@@ -152,6 +152,9 @@ Flickable {
height: parent.height
fillMode: Image.PreserveAspectFit
smooth: true
onStatusChanged: if (status === Image.Error) {
screenshotsModel.remove(small_image_url)
}
}
}
}
......
......@@ -99,3 +99,17 @@ int ScreenshotsModel::count() const
{
return m_screenshots.count();
}
void ScreenshotsModel::remove(const QUrl& url)
{
int idxRemove = m_thumbnails.indexOf(url);
if (idxRemove>=0) {
beginRemoveRows({}, idxRemove, idxRemove);
m_thumbnails.removeAt(idxRemove);
m_screenshots.removeAt(idxRemove);
endRemoveRows();
emit countChanged();
qDebug() << "screenshot removed" << url;
}
}
......@@ -46,6 +46,8 @@ class DISCOVERCOMMON_EXPORT ScreenshotsModel : public QAbstractListModel
Q_SCRIPTABLE QUrl screenshotAt(int row) const;
int count() const;
Q_INVOKABLE void remove(const QUrl &url);
private Q_SLOTS:
void screenshotsFetched(const QList<QUrl>& thumbnails, const QList<QUrl>& screenshots);
......
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