Merge remote-tracking branch 'origin/pr/3370'

This commit is contained in:
Florian Bruhin 2017-12-11 07:09:49 +01:00
commit 6c7b8ce895
3 changed files with 16 additions and 9 deletions

View File

@ -1300,6 +1300,7 @@ tabs.title.format:
- host
- private
- current_url
- protocol
none_ok: true
desc: |
Format to use for the tab title.
@ -1314,8 +1315,9 @@ tabs.title.format:
* `{scroll_pos}`: Page scroll position.
* `{host}`: Host of the current web page.
* `{backend}`: Either ''webkit'' or ''webengine''
* `{private}` : Indicates when private mode is enabled.
* `{current_url}` : URL of the current web page.
* `{private}`: Indicates when private mode is enabled.
* `{current_url}`: URL of the current web page.
* `{protocol}`: Protocol (http/https/...) of the current web page
tabs.title.format_pinned:
default: '{index}'
@ -1332,6 +1334,7 @@ tabs.title.format_pinned:
- host
- private
- current_url
- protocol
none_ok: true
desc: Format to use for the tab title for pinned tabs. The same placeholders
like for `tabs.title.format` are defined.
@ -1475,6 +1478,7 @@ window.title_format:
- backend
- private
- current_url
- protocol
default: '{perc}{title}{title_sep}qutebrowser'
desc: |
Format to use for the window title. The same placeholders like for

View File

@ -172,14 +172,15 @@ class TabWidget(QTabWidget):
fields['perc'] = ''
try:
fields['host'] = self.tab_url(idx).host()
url = self.tab_url(idx)
except qtutils.QtValueError:
fields['host'] = ''
try:
fields['current_url'] = self.tab_url(idx).url()
except qtutils.QtValueError:
fields['current_url'] = ''
fields['protocol'] = ''
else:
fields['host'] = url.host()
fields['current_url'] = url.toDisplayString()
fields['protocol'] = url.scheme()
y = tab.scroller.pos_perc()[1]
if y is None:

View File

@ -131,11 +131,13 @@ class FakeUrl:
"""QUrl stub which provides .path(), isValid() and host()."""
def __init__(self, path=None, valid=True, host=None, url=None):
def __init__(self, path=None, valid=True, host=None, url=None,
scheme=None):
self.path = mock.Mock(return_value=path)
self.isValid = mock.Mock(returl_value=valid)
self.host = mock.Mock(returl_value=host)
self.url = mock.Mock(return_value=url)
self.toDisplayString = mock.Mock(return_value=url)
self.scheme = mock.Mock(return_value=scheme)
class FakeNetworkReply: