Initial shot at issue #691

This commit is contained in:
Nathan Isom 2015-10-14 13:10:24 -05:00
parent d0be9256b5
commit d7d4c232d0
3 changed files with 25 additions and 8 deletions

View File

@ -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:

View File

@ -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'),

View File

@ -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