Verified Commit 6346ca1e authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Merge remote-tracking branch 'schmeisser/fix_history'

parents 9f132c58 5b0fb1a6
......@@ -172,7 +172,7 @@ bool UrlModel::save()
QJsonArray urls;
Q_FOREACH (const auto &url, m_data) {
for (const auto &url : m_data) {
urls << url;
}
......@@ -211,10 +211,16 @@ QString UrlModel::key(int role) const
void UrlModel::add(const QJsonObject &data)
{
foreach (const auto &urldata, m_data) {
size_t i = 0;
for(const auto &urldata : m_data) {
if (urldata == data) {
beginMoveRows(QModelIndex(), i, i, QModelIndex(), m_data.size());
m_data.removeAt(i);
m_data.append(data);
endMoveRows();
return;
}
++i;
}
beginInsertRows(QModelIndex(), m_data.size(), m_data.size());
m_data.append(data);
......
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