Fix #1927537 [Clicking Copy in the Auto merged window copies explanation text](https://bugs.launchpad.net/calibre/+bug/1927537)

This commit is contained in:
Kovid Goyal 2021-05-07 07:33:01 +05:30
parent 88ba140db9
commit fabf0e621f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 9 deletions

View File

@ -456,10 +456,10 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=False,
def info_dialog(parent, title, msg, det_msg='', show=False,
show_copy_button=True):
show_copy_button=True, only_copy_details=False):
from calibre.gui2.dialogs.message_box import MessageBox
d = MessageBox(MessageBox.INFO, title, msg, det_msg, parent=parent,
show_copy_button=show_copy_button)
show_copy_button=show_copy_button, only_copy_details=only_copy_details)
if show:
return d.exec_()

View File

@ -585,7 +585,7 @@ class AddAction(InterfaceAction):
_('Incoming book formats were processed and merged into your '
'calibre database according to your auto-merge '
'settings. Click "Show details" to see the list of merged books.'),
det_msg='\n'.join(lines), show=True)
det_msg='\n'.join(lines), show=True, only_copy_details=True)
if adder.number_of_books_added > 0 or adder.merged_books:
# The formats of the current book could have changed if

View File

@ -83,9 +83,11 @@ class MessageBox(QDialog): # {{{
show_copy_button=True,
parent=None, default_yes=True,
yes_text=None, no_text=None, yes_icon=None, no_icon=None,
add_abort_button=False
add_abort_button=False,
only_copy_details=False
):
QDialog.__init__(self, parent)
self.only_copy_details = only_copy_details
self.aborted = False
if q_icon is None:
icon = {
@ -170,11 +172,10 @@ class MessageBox(QDialog): # {{{
self.resize(self.sizeHint())
def copy_to_clipboard(self, *args):
QApplication.clipboard().setText(
'calibre, version %s\n%s: %s\n\n%s' %
(__version__, unicode_type(self.windowTitle()),
unicode_type(self.msg.text()),
unicode_type(self.det_msg.toPlainText())))
text = self.det_msg.toPlainText()
if not self.only_copy_details:
text = f'calibre, version {__version__}\n{self.windowTitle()}: {self.msg.text()}\n\n{text}'
QApplication.clipboard().setText(text)
if hasattr(self, 'ctc_button'):
self.ctc_button.setText(_('Copied'))