diff --git a/src/calibre/gui2/preferences/columns.py b/src/calibre/gui2/preferences/columns.py index 6c2eff781c27..a145b6e6a552 100644 --- a/src/calibre/gui2/preferences/columns.py +++ b/src/calibre/gui2/preferences/columns.py @@ -44,6 +44,8 @@ def genesis(self, gui): for signal in ('Activated', 'Changed', 'DoubleClicked', 'Clicked'): signal = getattr(self.opt_columns, 'item'+signal) signal.connect(self.columns_changed) + self.show_all_button.clicked.connect(self.show_all) + self.hide_all_button.clicked.connect(self.hide_all) def initialize(self): ConfigWidgetBase.initialize(self) @@ -137,6 +139,20 @@ def restore_geometry(self): return self.opt_columns.resizeColumnsToContents() + def hide_all(self): + for row in range(self.opt_columns.rowCount()): + item = self.opt_columns.item(row, 0) + if item.checkState() != Qt.CheckState.PartiallyChecked: + item.setCheckState(Qt.CheckState.Unchecked) + self.changed_signal.emit() + + def show_all(self): + for row in range(self.opt_columns.rowCount()): + item = self.opt_columns.item(row, 0) + if item.checkState() != Qt.CheckState.PartiallyChecked: + item.setCheckState(Qt.CheckState.Checked) + self.changed_signal.emit() + def setup_row(self, row, key, order, force_checked_to=None): flags = Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable diff --git a/src/calibre/gui2/preferences/columns.ui b/src/calibre/gui2/preferences/columns.ui index 32996814dd22..0672464e85c8 100644 --- a/src/calibre/gui2/preferences/columns.ui +++ b/src/calibre/gui2/preferences/columns.ui @@ -6,8 +6,8 @@ 0 0 - 504 - 399 + 611 + 482 @@ -191,15 +191,46 @@ - - - Add &custom column - - - - :/images/plus.png:/images/plus.png - - + + + + + Add &custom column + + + + :/images/plus.png:/images/plus.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Show all + + + + + + + &Hide all + + + +