From 9dbd6fa65ac416877cd763100c43815c8a381122 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 6 May 2018 16:18:58 +0530 Subject: [PATCH] ToC Editor: Allow undo for renaming single items as well. Fixes #1769442 [TOC editor undo issue with renamed entries](https://bugs.launchpad.net/calibre/+bug/1769442) --- src/calibre/gui2/toc/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index 94aef6d9c2..b52796408d 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -355,8 +355,7 @@ class ItemView(QFrame): # {{{ # }}} -NODE_FLAGS = (Qt.ItemIsDragEnabled|Qt.ItemIsEditable|Qt.ItemIsEnabled| - Qt.ItemIsSelectable|Qt.ItemIsDropEnabled) +NODE_FLAGS = (Qt.ItemIsDragEnabled|Qt.ItemIsEditable|Qt.ItemIsEnabled|Qt.ItemIsSelectable|Qt.ItemIsDropEnabled) class TreeWidget(QTreeWidget): # {{{ @@ -394,6 +393,10 @@ class TreeWidget(QTreeWidget): # {{{ self.unserialize_tree(self.history.pop()) self.history_state_changed.emit() + def commitData(self, editor): + self.push_history() + return QTreeWidget.commitData(self, editor) + def iteritems(self, parent=None): if parent is None: parent = self.invisibleRootItem()