From d7d4c232d04847f53243e8d2827bf8b136f75ceb Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Wed, 14 Oct 2015 13:10:24 -0500 Subject: [PATCH 1/4] 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/4] 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/4] 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/4] 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'),