From d48c1d4eff7912a20bae63080cca25192ca487aa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 May 2017 21:55:46 +0530 Subject: [PATCH] Fix ToC editor undo button not present when used in the editor as opposed to a standalone tool --- src/calibre/gui2/tweak_book/toc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/toc.py b/src/calibre/gui2/tweak_book/toc.py index 108f5fd3be..722d0e7361 100644 --- a/src/calibre/gui2/tweak_book/toc.py +++ b/src/calibre/gui2/tweak_book/toc.py @@ -46,6 +46,10 @@ class TOCEditor(QDialog): l.addWidget(bb) bb.accepted.connect(self.accept) bb.rejected.connect(self.reject) + self.undo_button = b = bb.addButton(_('&Undo'), bb.ActionRole) + b.setToolTip(_('Undo the last action, if any')) + b.setIcon(QIcon(I('edit-undo.png'))) + b.clicked.connect(self.toc_view.undo) self.read_toc() @@ -100,6 +104,7 @@ class TOCEditor(QDialog): commit_toc(current_container(), toc, lang=self.toc_view.toc_lang, uid=self.toc_view.toc_uid) + DEST_ROLE = Qt.UserRole FRAG_ROLE = DEST_ROLE + 1 @@ -223,4 +228,3 @@ class TOCViewer(QWidget): def update_if_visible(self): if self.isVisible(): self.build() -