From a5a3ef3b02b5b801de3ca992c3c455903c95306a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Jan 2015 09:52:01 +0530 Subject: [PATCH] Book Details panel: Fix author links with URL schemes other than http or file preventing context menu from working. Fixes #1408174 [[glitch] evernote link nullifies author context menu](https://bugs.launchpad.net/calibre/+bug/1408174) --- src/calibre/gui2/book_details.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 74878e4c00..099f56e7de 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -374,21 +374,6 @@ class BookInfo(QWebView): if action is not ca: menu.removeAction(action) if not r.isNull(): - if url.startswith('http') or url.startswith('file:'): - el = r.linkElement() - author = el.toPlainText() if unicode(el.attribute('calibre-data')) == u'authors' else None - for a, t in [('copy', _('&Copy Link')), - ]: - ac = getattr(self, '%s_link_action'%a) - ac.current_url = url - ac.setText(t) - menu.addAction(ac) - if author is not None: - ac = self.manage_author_action - ac.current_fmt = author - ac.setText(_('Manage %s') % author) - menu.addAction(ac) - if url.startswith('format:'): parts = url.split(':') try: @@ -420,6 +405,23 @@ class BookInfo(QWebView): ac.current_fmt = (book_id, fmt) ac.setText(t) menu.addAction(ac) + + else: + el = r.linkElement() + author = el.toPlainText() if unicode(el.attribute('calibre-data')) == u'authors' else None + if not url.startswith('search:'): + for a, t in [('copy', _('&Copy Link')), + ]: + ac = getattr(self, '%s_link_action'%a) + ac.current_url = url + ac.setText(t) + menu.addAction(ac) + if author is not None: + ac = self.manage_author_action + ac.current_fmt = author + ac.setText(_('Manage %s') % author) + menu.addAction(ac) + if len(menu.actions()) > 0: menu.exec_(ev.globalPos())