Edit metadata dialog: When pasting into the identifiers field if the clipboard contains a URL paste it directly as a URL identifier. Fixes #1938752 [Pasting url identifiers results in Invalid ISBN dialog](https://bugs.launchpad.net/calibre/+bug/1938752)

This commit is contained in:
Kovid Goyal 2021-08-09 11:56:45 +05:30
parent eb91289242
commit e208909664
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 1 deletions

View File

@ -1642,6 +1642,9 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin):
identifier_found = self.parse_clipboard_for_identifier()
if identifier_found:
return
text = unicode_type(QApplication.clipboard().text()).strip()
if text.startswith('http://') or text.startswith('https://'):
return self.paste_prefix('url')
try:
prefix = gprefs['paste_isbn_prefixes'][0]
except IndexError:

View File

@ -251,7 +251,7 @@ class MetadataSingleDialogBase(QDialog):
self.paste_isbn_button = b = RightClickButton(self)
b.setToolTip('<p>' +
_('Paste the contents of the clipboard into the '
'identifiers prefixed with isbn:. Or right click, '
'identifiers prefixed with isbn: or url:. Or right click, '
'to choose a different prefix.') + '</p>')
b.setIcon(QIcon(I('edit-paste.png')))
b.clicked.connect(self.identifiers.paste_identifier)