Commit 072f4394 authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

It's now possible to remove entries from the history.

svn path=/trunk/KDE/kdegraphics/gwenview/; revision=956373
parent 6c11b01b
......@@ -190,7 +190,7 @@ void StartPage::showRecentFoldersViewContextMenu(const QPoint& pos) {
}
d->mBookmarksModel->addPlace(text, url);
} else if (action == removeAction) {
//d->mGvCore->recentFoldersModel()->removeUrl(url);
d->mGvCore->recentFoldersModel()->removeRow(index.row());
}
}
......
......@@ -236,4 +236,17 @@ void HistoryModel::addUrl(const KUrl& url) {
}
bool HistoryModel::removeRows(int start, int count, const QModelIndex& parent) {
Q_ASSERT(!parent.isValid());
for (int row=start; row < start + count; ++row) {
HistoryItem* historyItem = d->mHistoryItemList.takeAt(row);
Q_ASSERT(historyItem);
d->mHistoryItemForUrl.remove(historyItem->url());
historyItem->unlink();
delete historyItem;
}
return QStandardItemModel::removeRows(start, count, parent);
}
} // namespace
......@@ -48,6 +48,8 @@ public:
void addUrl(const KUrl&);
virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
private:
HistoryModelPrivate* const d;
};
......
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