Fix updating of existing items in hist-completion.

Before we limited the history items we could simply call WebHistory's
historyContains before iterating through all items in the history completion.

Now however it's possible an item is in the real WebHistory, but not actually
in the completion - so we always have to check the whole completion.
This commit is contained in:
Florian Bruhin 2015-03-16 09:20:09 +01:00
parent 806742abd3
commit 59bbca9b40

View File

@ -83,17 +83,13 @@ class UrlCompletionModel(base.BaseCompletionModel):
@pyqtSlot(object)
def on_history_item_added(self, entry):
"""Slot called when a new history item was added."""
if entry.url_string:
if self._history.historyContains(entry.url_string):
for i in range(self._history_cat.rowCount()):
name_item = self._history_cat.child(i, 0)
atime_item = self._history_cat.child(i, 2)
if not name_item:
continue
url = name_item.data(base.Role.userdata)
if url == entry.url:
atime_item.setText(self._fmt_atime(entry.atime))
name_item.setData(int(entry.atime), base.Role.sort)
break
else:
self._add_history_entry(entry)
for i in range(self._history_cat.rowCount()):
name_item = self._history_cat.child(i, 0)
atime_item = self._history_cat.child(i, 2)
url = name_item.data(base.Role.userdata)
if url == entry.url:
atime_item.setText(self._fmt_atime(entry.atime))
name_item.setData(int(entry.atime), base.Role.sort)
break
else:
self._add_history_entry(entry)