Add :prompt-open-download --pdfjs
This commit is contained in:
parent
bfa7d6a566
commit
36d7dc4853
@ -32,6 +32,8 @@ Added
|
|||||||
QtWebEngine.
|
QtWebEngine.
|
||||||
* Opening a PDF file now doesn't start a second request anymore.
|
* Opening a PDF file now doesn't start a second request anymore.
|
||||||
* Opening PDFs on https:// sites now works properly.
|
* Opening PDFs on https:// sites now works properly.
|
||||||
|
* New `--pdfjs` flag for `prompt-open-download`, so PDFs can be opened in
|
||||||
|
PDF.js with `<Ctrl-P>` in the download prompt.
|
||||||
- New `qt.process_model` setting which can be used to change Chromium's process
|
- New `qt.process_model` setting which can be used to change Chromium's process
|
||||||
model.
|
model.
|
||||||
- New `qt.low_end_device_mode` setting which turns on Chromium's low-end device
|
- New `qt.low_end_device_mode` setting which turns on Chromium's low-end device
|
||||||
|
@ -2610,6 +2610,7 @@ bindings.default:
|
|||||||
prompt:
|
prompt:
|
||||||
<Return>: prompt-accept
|
<Return>: prompt-accept
|
||||||
<Ctrl-X>: prompt-open-download
|
<Ctrl-X>: prompt-open-download
|
||||||
|
<Ctrl-P>: prompt-open-download --pdfjs
|
||||||
<Shift-Tab>: prompt-item-focus prev
|
<Shift-Tab>: prompt-item-focus prev
|
||||||
<Up>: prompt-item-focus prev
|
<Up>: prompt-item-focus prev
|
||||||
<Tab>: prompt-item-focus next
|
<Tab>: prompt-item-focus next
|
||||||
|
@ -391,7 +391,7 @@ class PromptContainer(QWidget):
|
|||||||
|
|
||||||
@cmdutils.register(instance='prompt-container', scope='window',
|
@cmdutils.register(instance='prompt-container', scope='window',
|
||||||
modes=[usertypes.KeyMode.prompt], maxsplit=0)
|
modes=[usertypes.KeyMode.prompt], maxsplit=0)
|
||||||
def prompt_open_download(self, cmdline: str = None):
|
def prompt_open_download(self, cmdline: str = None, pdfjs=False):
|
||||||
"""Immediately open a download.
|
"""Immediately open a download.
|
||||||
|
|
||||||
If no specific command is given, this will use the system's default
|
If no specific command is given, this will use the system's default
|
||||||
@ -402,9 +402,10 @@ class PromptContainer(QWidget):
|
|||||||
is expanded to the temporary file name. If no `{}` is
|
is expanded to the temporary file name. If no `{}` is
|
||||||
present, the filename is automatically appended to the
|
present, the filename is automatically appended to the
|
||||||
cmdline.
|
cmdline.
|
||||||
|
pdfjs: Open the download via PDF.js.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self._prompt.download_open(cmdline)
|
self._prompt.download_open(cmdline, pdfjs=pdfjs)
|
||||||
except UnsupportedOperationError:
|
except UnsupportedOperationError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -537,8 +538,10 @@ class _BasePrompt(QWidget):
|
|||||||
def accept(self, value=None):
|
def accept(self, value=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def download_open(self, _cmdline):
|
def download_open(self, cmdline, pdfjs):
|
||||||
"""Open the download directly if this is a download prompt."""
|
"""Open the download directly if this is a download prompt."""
|
||||||
|
utils.unused(cmdline)
|
||||||
|
utils.unused(pdfjs)
|
||||||
raise UnsupportedOperationError
|
raise UnsupportedOperationError
|
||||||
|
|
||||||
def item_focus(self, _which):
|
def item_focus(self, _which):
|
||||||
@ -757,8 +760,13 @@ class DownloadFilenamePrompt(FilenamePrompt):
|
|||||||
self.question.answer = downloads.FileDownloadTarget(answer)
|
self.question.answer = downloads.FileDownloadTarget(answer)
|
||||||
return done
|
return done
|
||||||
|
|
||||||
def download_open(self, cmdline):
|
def download_open(self, cmdline, pdfjs):
|
||||||
self.question.answer = downloads.OpenFileDownloadTarget(cmdline)
|
if pdfjs:
|
||||||
|
target = downloads.PDFJSDownloadTarget()
|
||||||
|
else:
|
||||||
|
target = downloads.OpenFileDownloadTarget(cmdline)
|
||||||
|
|
||||||
|
self.question.answer = target
|
||||||
self.question.done()
|
self.question.done()
|
||||||
message.global_bridge.prompt_done.emit(self.KEY_MODE)
|
message.global_bridge.prompt_done.emit(self.KEY_MODE)
|
||||||
|
|
||||||
@ -767,6 +775,7 @@ class DownloadFilenamePrompt(FilenamePrompt):
|
|||||||
('prompt-accept', 'Accept'),
|
('prompt-accept', 'Accept'),
|
||||||
('leave-mode', 'Abort'),
|
('leave-mode', 'Abort'),
|
||||||
('prompt-open-download', "Open download"),
|
('prompt-open-download', "Open download"),
|
||||||
|
('prompt-open-download --pdfjs', "Open download via PDF.js"),
|
||||||
('prompt-yank', "Yank URL"),
|
('prompt-yank', "Yank URL"),
|
||||||
]
|
]
|
||||||
return cmds
|
return cmds
|
||||||
|
Loading…
Reference in New Issue
Block a user