From 4265c874638f695d2f5d29fbed42bfaae1cb5fb5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 21 Nov 2020 09:26:59 +0530 Subject: [PATCH] macOS: Fix calibre:// URLs not working from other documents --- src/calibre/gui2/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 6324320005..35629a5185 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1153,6 +1153,12 @@ class Application(QApplication): def event(self, e): if callable(self.file_event_hook) and e.type() == QEvent.FileOpen: + url = e.url().toString(QUrl.FullyEncoded) + if url and url.startswith('calibre://'): + with self._file_open_lock: + self._file_open_paths.append(url) + QTimer.singleShot(1000, self._send_file_open_events) + return True path = unicode_type(e.file()) if os.access(path, os.R_OK): with self._file_open_lock: