From d7d4c232d04847f53243e8d2827bf8b136f75ceb Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Wed, 14 Oct 2015 13:10:24 -0500 Subject: [PATCH 1/5] Initial shot at issue #691 --- qutebrowser/browser/webview.py | 8 ++++++-- qutebrowser/config/configdata.py | 15 ++++++++++++--- qutebrowser/mainwindow/statusbar/url.py | 10 +++++++--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webview.py index 4c50a0212..fea278211 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webview.py @@ -35,7 +35,7 @@ from qutebrowser.utils import message, log, usertypes, utils, qtutils, objreg from qutebrowser.browser import webpage, hints, webelem -LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'error', 'warn', +LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'success_https', 'error', 'warn', 'loading']) @@ -423,7 +423,11 @@ class WebView(QWebView): """ ok = not self.page().error_occurred if ok and not self._has_ssl_errors: - self._set_load_status(LoadStatus.success) + if self.cur_url.toDisplayString().startswith('https'): + self._set_load_status(LoadStatus.success_https) + else: + self._set_load_status(LoadStatus.success) + elif ok: self._set_load_status(LoadStatus.warn) else: diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 1517280a8..1d7de5b18 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -872,13 +872,17 @@ def data(readonly=False): SettingValue(typ.QssColor(), '#ff4444'), "Foreground color of the matched text in the completion."), + ('statusbar.fg.https', + SettingValue(typ.QssColor(), 'white'), + "Foreground color of the statusbar(https)."), + ('statusbar.fg', SettingValue(typ.QssColor(), 'white'), - "Foreground color of the statusbar."), + "Foreground color of the statusbar(http)."), ('statusbar.bg', SettingValue(typ.QssColor(), 'black'), - "Foreground color of the statusbar."), + "Background color of the statusbar(http)."), ('statusbar.fg.error', SettingValue(typ.QssColor(), '${statusbar.fg}'), @@ -947,9 +951,14 @@ def data(readonly=False): "Default foreground color of the URL in the statusbar."), ('statusbar.url.fg.success', + SettingValue(typ.QssColor(), 'white'), + "Foreground color of the URL in the statusbar on successful " + "load (http)."), + + ('statusbar.url.fg.success.https', SettingValue(typ.QssColor(), 'lime'), "Foreground color of the URL in the statusbar on successful " - "load."), + "load (https)."), ('statusbar.url.fg.error', SettingValue(typ.QssColor(), 'orange'), diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index d18816b00..dde4533d9 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -28,7 +28,7 @@ from qutebrowser.utils import usertypes # Note this has entries for success/error/warn from widgets.webview:LoadStatus -UrlType = usertypes.enum('UrlType', ['success', 'error', 'warn', 'hover', +UrlType = usertypes.enum('UrlType', ['success', 'success_https', ' error', 'warn', 'hover', 'normal']) @@ -61,6 +61,10 @@ class UrlText(textbase.TextBase): {{ color['statusbar.url.fg.success'] }} } + QLabel#UrlText[urltype="success_https"] { + {{ color['statusbar.url.fg.success.https'] }} + } + QLabel#UrlText[urltype="error"] { {{ color['statusbar.url.fg.error'] }} } @@ -116,8 +120,8 @@ class UrlText(textbase.TextBase): status_str: The LoadStatus as string. """ status = webview.LoadStatus[status_str] - if status in (webview.LoadStatus.success, webview.LoadStatus.error, - webview.LoadStatus.warn): + if status in (webview.LoadStatus.success, webview.LoadStatus.success_https, + webview.LoadStatus.error, webview.LoadStatus.warn): self._normal_url_type = UrlType[status_str] else: self._normal_url_type = UrlType.normal From e78b00cce2d5385c4ac0880cab4058386e81aca7 Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Wed, 14 Oct 2015 13:22:28 -0500 Subject: [PATCH 2/5] Fix configdata.py typos, use scheme from url. --- qutebrowser/browser/webview.py | 2 +- qutebrowser/config/configdata.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webview.py index fea278211..25f50d1e0 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webview.py @@ -423,7 +423,7 @@ class WebView(QWebView): """ ok = not self.page().error_occurred if ok and not self._has_ssl_errors: - if self.cur_url.toDisplayString().startswith('https'): + if self.cur_url.scheme() == 'https': self._set_load_status(LoadStatus.success_https) else: self._set_load_status(LoadStatus.success) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 1d7de5b18..a13363a08 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -872,17 +872,13 @@ def data(readonly=False): SettingValue(typ.QssColor(), '#ff4444'), "Foreground color of the matched text in the completion."), - ('statusbar.fg.https', - SettingValue(typ.QssColor(), 'white'), - "Foreground color of the statusbar(https)."), - ('statusbar.fg', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar(http)."), ('statusbar.bg', SettingValue(typ.QssColor(), 'black'), - "Background color of the statusbar(http)."), + "Background color of the statusbar."), ('statusbar.fg.error', SettingValue(typ.QssColor(), '${statusbar.fg}'), From 4876bdf7ce04ac405a24ec1f70221e6e05201527 Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Wed, 14 Oct 2015 13:34:41 -0500 Subject: [PATCH 3/5] style. --- qutebrowser/browser/webview.py | 4 ++-- qutebrowser/mainwindow/statusbar/url.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webview.py index 25f50d1e0..49661294f 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webview.py @@ -35,8 +35,8 @@ from qutebrowser.utils import message, log, usertypes, utils, qtutils, objreg from qutebrowser.browser import webpage, hints, webelem -LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'success_https', 'error', 'warn', - 'loading']) +LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'success_https', + 'error', 'warn', 'loading']) tab_id_gen = itertools.count(0) diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index dde4533d9..f903a15aa 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -28,8 +28,8 @@ from qutebrowser.utils import usertypes # Note this has entries for success/error/warn from widgets.webview:LoadStatus -UrlType = usertypes.enum('UrlType', ['success', 'success_https', ' error', 'warn', 'hover', - 'normal']) +UrlType = usertypes.enum('UrlType', ['success', 'success_https', ' error', + 'warn', 'hover', 'normal']) class UrlText(textbase.TextBase): @@ -120,8 +120,10 @@ class UrlText(textbase.TextBase): status_str: The LoadStatus as string. """ status = webview.LoadStatus[status_str] - if status in (webview.LoadStatus.success, webview.LoadStatus.success_https, - webview.LoadStatus.error, webview.LoadStatus.warn): + if status in (webview.LoadStatus.success, + webview.LoadStatus.success_https, + webview.LoadStatus.error, + webview.LoadStatus.warn): self._normal_url_type = UrlType[status_str] else: self._normal_url_type = UrlType.normal From 6843e9c413c7f0f58546c56944c1634140b40b64 Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Wed, 14 Oct 2015 13:37:24 -0500 Subject: [PATCH 4/5] typo in configdata.py. --- qutebrowser/config/configdata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index a13363a08..ec4b051ba 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -874,7 +874,7 @@ def data(readonly=False): ('statusbar.fg', SettingValue(typ.QssColor(), 'white'), - "Foreground color of the statusbar(http)."), + "Foreground color of the statusbar."), ('statusbar.bg', SettingValue(typ.QssColor(), 'black'), From 5c85dd22b46dc2191a930a2f8d678045c46ec0af Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 15 Oct 2015 18:34:56 +0200 Subject: [PATCH 5/5] Update docs and changelog. --- CHANGELOG.asciidoc | 2 ++ README.asciidoc | 1 + doc/help/settings.asciidoc | 15 +++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index ee59e0133..f4e5c29a0 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -33,6 +33,8 @@ Added the URL should be affected by `:navigate increment/decrement`. - New `--target` argument to specify how URLs should be opened in an existing instance. +- New setting `statusbar.url.fg.success.https` to set the foreground color for + the URL when a page was loaded via HTTPS. Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index 59363c9c5..4385ad1fb 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -155,6 +155,7 @@ Contributors, sorted by the number of commits in descending order: * Zach-Button * rikn00 * Patric Schmitz +* Nathan Isom * Martin Zimmermann * Error 800 * Brian Jackson diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index b0e757957..2a8502bdd 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -197,7 +197,7 @@ |<>|Bottom border color of the selected completion item. |<>|Foreground color of the matched text in the completion. |<>|Foreground color of the statusbar. -|<>|Foreground color of the statusbar. +|<>|Background color of the statusbar. |<>|Foreground color of the statusbar if there was an error. |<>|Background color of the statusbar if there was an error. |<>|Foreground color of the statusbar if there is a warning. @@ -214,7 +214,8 @@ |<>|Background color of the statusbar in caret mode with a selection |<>|Background color of the progress bar. |<>|Default foreground color of the URL in the statusbar. -|<>|Foreground color of the URL in the statusbar on successful load. +|<>|Foreground color of the URL in the statusbar on successful load (http). +|<>|Foreground color of the URL in the statusbar on successful load (https). |<>|Foreground color of the URL in the statusbar on error. |<>|Foreground color of the URL in the statusbar when there's a warning. |<>|Foreground color of the URL in the statusbar for hovered links. @@ -1662,7 +1663,7 @@ Default: +pass:[white]+ [[colors-statusbar.bg]] === statusbar.bg -Foreground color of the statusbar. +Background color of the statusbar. Default: +pass:[black]+ @@ -1764,7 +1765,13 @@ Default: +pass:[${statusbar.fg}]+ [[colors-statusbar.url.fg.success]] === statusbar.url.fg.success -Foreground color of the URL in the statusbar on successful load. +Foreground color of the URL in the statusbar on successful load (http). + +Default: +pass:[white]+ + +[[colors-statusbar.url.fg.success.https]] +=== statusbar.url.fg.success.https +Foreground color of the URL in the statusbar on successful load (https). Default: +pass:[lime]+