diff --git a/TODO b/TODO index 6e9c2ead9..331a2d912 100644 --- a/TODO +++ b/TODO @@ -43,7 +43,6 @@ Improvements / minor features - Get rid of webkit config section http://paste.the-compiler.org/view/542f9b74 -- Add an option to configure if javascript may set statusbar - Reimplement tabbar to paint it by ourselves to look like dwb - Save cookies in Netscape format so it can be used by wget. http://www.cookiecentral.com/faq/#3.5 diff --git a/qutebrowser/app.py b/qutebrowser/app.py index f73daaa5a..1f0c55d47 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -388,7 +388,8 @@ class QuteBrowser(QApplication): # config self.config.style_changed.connect(style.invalidate_caches) for obj in [tabs, completion, self.mainwindow, self.cmd_history, - websettings, kp['normal'], self.modeman, status]: + websettings, kp['normal'], self.modeman, status, + status.txt]: self.config.changed.connect(obj.on_config_changed) # statusbar diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index dabc0b92c..467b15f41 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -218,6 +218,10 @@ DATA = OrderedDict([ ('confirm-quit', SettingValue(types.ConfirmQuit(), 'never'), "Whether to confirm quitting the application."), + + ('display-statusbar-messages', + SettingValue(types.Bool(), 'false'), + "Whether to display javascript statusbar messages."), )), ('network', sect.KeyValue( diff --git a/qutebrowser/widgets/statusbar/text.py b/qutebrowser/widgets/statusbar/text.py index 08a684217..4fd6bda14 100644 --- a/qutebrowser/widgets/statusbar/text.py +++ b/qutebrowser/widgets/statusbar/text.py @@ -19,6 +19,7 @@ from PyQt5.QtCore import pyqtSlot +import qutebrowser.config.config as config from qutebrowser.widgets.statusbar.textbase import TextBase @@ -79,10 +80,12 @@ class Text(TextBase): def _update_text(self): """Update QLabel text when needed.""" - for text in [self.temptext, self.jstext, self.normaltext]: - if text: - self.setText(text) - break + if self.temptext: + self.setText(self.temptext) + elif self.jstext and config.get('ui', 'display-statusbar-messages'): + self.setText(self.jstext) + elif self.normaltext: + self.setText(self.normaltext) else: self.setText('') @@ -101,3 +104,9 @@ class Text(TextBase): """Set the correct jstext when the current tab changed.""" tab = self.sender().widget(idx) self.jstext = tab.statusbar_message + + @pyqtSlot(str, str) + def on_config_changed(self, section, option): + """Update text if display-statusbar-messages option changed.""" + if (section, option) == ('ui', 'display-statusbar-messages'): + self._update_text()