From dbd0d591cf7982baa566a750009c9750f9e317f8 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Wed, 19 Apr 2023 21:43:25 +0100 Subject: [PATCH] In the Sort by tool, use a combo box when saving to make it easier to replace an existing sort. --- src/calibre/gui2/dialogs/multisort.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/dialogs/multisort.py b/src/calibre/gui2/dialogs/multisort.py index 0cae89eb75..aa938fbd05 100644 --- a/src/calibre/gui2/dialogs/multisort.py +++ b/src/calibre/gui2/dialogs/multisort.py @@ -143,9 +143,13 @@ class ChooseMultiSort(Dialog): spec = self.current_sort_spec if not spec: return self.no_column_selected_error() - name, ok = QInputDialog.getText(self, _('Choose name'), - _('Choose a name for these settings')) - if ok: + d = QInputDialog(self) + d.setComboBoxEditable(True) + d.setComboBoxItems(self.saved_specs.keys()) + d.setWindowTitle(_('Choose name')) + d.setLabelText(_('Choose a name for these settings')) + if d.exec(): + name = d.textValue() q = self.saved_specs q[name] = spec self.saved_specs = q