Merge branch 'Carpetsmoker-modal-js-dialogs'

This commit is contained in:
Florian Bruhin 2015-05-31 21:43:16 +02:00
commit 0ddf1316f7
5 changed files with 26 additions and 3 deletions

View File

@ -36,6 +36,7 @@ Added
- New arguments `--top-navigate` and `--bottom-navigate` (`-t`/`-b`) for `:scroll-page` to specify a navigation action (e.g. automatically go to the next page when arriving at the bottom).
- New flag `-d`/`--detach` for `:spawn` to detach the spawned process so it's not closed when qutebrowser is.
- New (hidden) command `:follow-selected` (bound to `Enter`/`Ctrl-Enter` by default) to follow the link which is currently selected (e.g. after searching via `/`).
- New setting `ui -> modal-js-dialog` to use the standard modal dialogs for javascript questions instead of using the statusbar.
Changed
~~~~~~~

View File

@ -141,8 +141,8 @@ Contributors, sorted by the number of commits in descending order:
* Artur Shaik
* Antoni Boucher
* ZDarian
* Peter Vilim
* Martin Tournoij
* Peter Vilim
* John ShaggyTwoDope Jenkins
* Jimmy
* Zach-Button

View File

@ -45,6 +45,7 @@
|<<ui-hide-statusbar,hide-statusbar>>|Whether to hide the statusbar unless a message is shown.
|<<ui-window-title-format,window-title-format>>|The format to use for the window title. The following placeholders are defined:
|<<ui-hide-mouse-cursor,hide-mouse-cursor>>|Whether to hide the mouse cursor.
|<<ui-modal-js-dialog,modal-js-dialog>>|Use standard JavaScript modal dialog for alert() and confirm()
|==============
.Quick reference for section ``network''
@ -594,6 +595,17 @@ Valid values:
Default: +pass:[false]+
[[ui-modal-js-dialog]]
=== modal-js-dialog
Use standard JavaScript modal dialog for alert() and confirm()
Valid values:
* +true+
* +false+
Default: +pass:[false]+
== network
Settings related to the network.

View File

@ -478,17 +478,23 @@ class BrowserPage(QWebPage):
return super().extension(ext, opt, out)
return handler(opt, out)
def javaScriptAlert(self, _frame, msg):
def javaScriptAlert(self, frame, msg):
"""Override javaScriptAlert to use the statusbar."""
log.js.debug("alert: {}".format(msg))
if config.get('ui', 'modal-js-dialog'):
return super().javaScriptAlert(frame, msg)
if (self._is_shutting_down or
config.get('content', 'ignore-javascript-alert')):
return
self._ask("[js alert] {}".format(msg), usertypes.PromptMode.alert)
def javaScriptConfirm(self, _frame, msg):
def javaScriptConfirm(self, frame, msg):
"""Override javaScriptConfirm to use the statusbar."""
log.js.debug("confirm: {}".format(msg))
if config.get('ui', 'modal-js-dialog'):
return super().javaScriptConfirm(frame, msg)
if self._is_shutting_down:
return False
ans = self._ask("[js confirm] {}".format(msg),

View File

@ -305,6 +305,10 @@ def data(readonly=False):
SettingValue(typ.Bool(), 'false'),
"Whether to hide the mouse cursor."),
('modal-js-dialog',
SettingValue(typ.Bool(), 'false'),
"Use standard JavaScript modal dialog for alert() and confirm()"),
readonly=readonly
)),