When reviewing downloaded metadata, add a button to view the book being reviewed. Fixes #1184546 (View the eBook when reviewing download metadata)

This commit is contained in:
Kovid Goyal 2013-05-27 16:51:55 +05:30
parent 20f476c6fb
commit 1595268b09
2 changed files with 11 additions and 1 deletions

View File

@ -229,7 +229,8 @@ class EditMetadataAction(InterfaceAction):
revert_tooltip=_('Discard the downloaded value for: %s'),
intro_msg=_('The downloaded metadata is on the left and the original metadata'
' is on the right. If a downloaded value is blank or unknown,'
' the original value is used.')
' the original value is used.'),
action_button=(_('&View Book'), I('view.png'), self.gui.iactions['View'].view_historical),
)
if d.exec_() == d.Accepted:
nid_map = {}

View File

@ -440,6 +440,7 @@ class CompareMany(QDialog):
reject_all_tooltip=None,
revert_tooltip=None,
intro_msg=None,
action_button=None,
**kwargs):
QDialog.__init__(self, parent)
self.l = l = QVBoxLayout()
@ -480,6 +481,11 @@ class CompareMany(QDialog):
b.setIcon(QIcon(I('minus.png')))
if reject_button_tooltip:
b.setToolTip(reject_button_tooltip)
if action_button is not None:
self.acb = b = bb.addButton(action_button[0], bb.ActionRole)
b.setIcon(QIcon(action_button[1]))
self.action_button_action = action_button[2]
b.clicked.connect(self.action_button_clicked)
self.nb = b = bb.addButton(_('&Next') if self.total > 1 else _('&OK'), bb.ActionRole)
b.setIcon(QIcon(I('forward.png' if self.total > 1 else 'ok.png')))
b.clicked.connect(partial(self.next_item, True))
@ -498,6 +504,9 @@ class CompareMany(QDialog):
self.restoreGeometry(geom)
b.setFocus(Qt.OtherFocusReason)
def action_button_clicked(self):
self.action_button_action(self.ids[0])
def accept(self):
gprefs.set('diff_dialog_geom', bytearray(self.saveGeometry()))
super(CompareMany, self).accept()