mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Fix #8080 - Sort in library doesn't work after bulk metadata edit. In fact it has nothing to do with metadata edit, but instead comes from mixing int and bool flags for ascending and descending.
This commit is contained in:
parent
2b699deac6
commit
3d102d6ad8
@ -252,7 +252,7 @@ class BooksModel(QAbstractTableModel): # {{{
|
||||
self.db.sort(label, ascending)
|
||||
if reset:
|
||||
self.reset()
|
||||
self.sorted_on = (label, order)
|
||||
self.sorted_on = (label, order == Qt.AscendingOrder)
|
||||
self.sort_history.insert(0, self.sorted_on)
|
||||
self.sorting_done.emit(self.db.index)
|
||||
|
||||
|
@ -284,15 +284,19 @@ class BooksView(QTableView): # {{{
|
||||
for col, order in sort_history:
|
||||
if col == 'date':
|
||||
col = 'timestamp'
|
||||
if col in self.column_map and (not history or history[0][0] != col):
|
||||
history.append([col, order])
|
||||
if col in self.column_map:
|
||||
if (not history or history[0][0] != col):
|
||||
history.append([col, order])
|
||||
elif isinstance(order, bool) and history[0][1] != order:
|
||||
history[0][1] = order
|
||||
return history
|
||||
|
||||
def apply_sort_history(self, saved_history):
|
||||
if not saved_history:
|
||||
return
|
||||
for col, order in reversed(self.cleanup_sort_history(saved_history)[:3]):
|
||||
self.sortByColumn(self.column_map.index(col), order)
|
||||
self.sortByColumn(self.column_map.index(col),
|
||||
Qt.AscendingOrder if order else Qt.DescendingOrder)
|
||||
|
||||
def apply_state(self, state):
|
||||
h = self.column_header
|
||||
|
Loading…
x
Reference in New Issue
Block a user