Use CompletionFilterModel's sort implementation.
This commit is contained in:
parent
834832e3ba
commit
fe4f32606d
@ -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."""
|
||||
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user