diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 2f7b223b3..e57b3a816 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -19,7 +19,7 @@ """Completer attached to a CompletionView.""" -from PyQt5.QtCore import pyqtSlot, QObject, QTimer +from PyQt5.QtCore import pyqtSlot, QObject, QTimer, Qt from qutebrowser.config import config, configdata from qutebrowser.commands import cmdutils, runners @@ -86,7 +86,8 @@ class Completer(QObject): self._models[usertypes.Completion.helptopic] = CFM( models.HelpCompletionModel(self), self) self._models[usertypes.Completion.url_history_and_quickmarks] = CFM( - models.UrlCompletionModel('url', self), self) + models.UrlCompletionModel('url', self), self, + dumb_sort=Qt.DescendingOrder) def _init_setting_completions(self): """Initialize setting completion models.""" diff --git a/qutebrowser/completion/models/completion.py b/qutebrowser/completion/models/completion.py index cdfce4858..c562f591d 100644 --- a/qutebrowser/completion/models/completion.py +++ b/qutebrowser/completion/models/completion.py @@ -234,12 +234,6 @@ class UrlCompletionModel(base.BaseCompletionModel): WebHistoryCompletionModel.history_changed( self, e, self._histcat)) - def sort(self, column, order=Qt.AscendingOrder): - # sort on atime, descending - # Ignoring the arguments because they are hardcoded in the CFM - # anyway. - self._histcat.sortChildren(2, Qt.DescendingOrder) - class WebHistoryCompletionModel(base.BaseCompletionModel): @@ -266,11 +260,14 @@ class WebHistoryCompletionModel(base.BaseCompletionModel): cat = model.new_category("History") for entry in histstore: - model.new_item(cat, entry.url, "", entry.atime) + atime = int(entry.atime) + model.new_item(cat, entry.url, "", str(atime), sort=atime) def history_changed(self, entry, cat): if entry.url: - self.new_item(cat, entry.url, "", str(entry.atime)) + atime = int(entry.atime) + self.new_item(cat, entry.url, "", str(atime), sort=atime) + class QuickmarkCompletionModel(base.BaseCompletionModel):