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)

This commit is contained in:
Kovid Goyal 2018-05-06 16:18:58 +05:30
parent 68d82f681f
commit 9dbd6fa65a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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()