When re-applying the current sort, preserve sub-sorts

This commit is contained in:
Kovid Goyal 2020-09-23 14:37:54 +05:30
parent 69d44f9e00
commit 6c0d3efca7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 7 deletions

View File

@ -57,13 +57,7 @@ class SortByAction(InterfaceAction):
lv.sort_by_named_field(sort_col, not order)
def reapply_sort(self):
lv = self.gui.library_view
m = lv.model()
try:
sort_col, order = m.sorted_on
except TypeError:
sort_col, order = 'date', True
lv.sort_by_named_field(sort_col, order)
self.gui.library_view.resort()
def location_selected(self, loc):
enabled = loc == 'library'

View File

@ -600,6 +600,10 @@ class BooksView(QTableView): # {{{
except Exception:
idx = -1
self.set_sort_indicator(idx, ascending)
def resort(self):
with self.preserve_state(preserve_vpos=False, require_selected_ids=False):
self._model.resort(reset=True)
# }}}
# Ondevice column {{{