lazy sessions, improved version
This commit is contained in:
parent
51dea053f4
commit
c4bb134313
@ -323,6 +323,18 @@ class SessionManager(QObject):
|
|||||||
def _load_tab(self, new_tab, data):
|
def _load_tab(self, new_tab, data):
|
||||||
"""Load yaml data into a newly opened tab."""
|
"""Load yaml data into a newly opened tab."""
|
||||||
entries = []
|
entries = []
|
||||||
|
|
||||||
|
if config.val.session_lazy_restore and data['history']:
|
||||||
|
last = data['history'][-1]
|
||||||
|
|
||||||
|
if not last['url'].startswith('qute://'):
|
||||||
|
data['history'].append({
|
||||||
|
'title': last['title'],
|
||||||
|
'url': 'qute://back#' + last['title'],
|
||||||
|
'active': last.get('active', False)
|
||||||
|
})
|
||||||
|
last['active'] = False
|
||||||
|
|
||||||
for histentry in data['history']:
|
for histentry in data['history']:
|
||||||
user_data = {}
|
user_data = {}
|
||||||
|
|
||||||
@ -347,9 +359,7 @@ class SessionManager(QObject):
|
|||||||
if 'pinned' in histentry:
|
if 'pinned' in histentry:
|
||||||
new_tab.data.pinned = histentry['pinned']
|
new_tab.data.pinned = histentry['pinned']
|
||||||
|
|
||||||
active = (histentry.get('active', False) and
|
active = histentry.get('active', False)
|
||||||
(not config.val.session_lazy_restore or
|
|
||||||
histentry['url'].startswith('qute://')))
|
|
||||||
url = QUrl.fromEncoded(histentry['url'].encode('ascii'))
|
url = QUrl.fromEncoded(histentry['url'].encode('ascii'))
|
||||||
if 'original-url' in histentry:
|
if 'original-url' in histentry:
|
||||||
orig_url = QUrl.fromEncoded(
|
orig_url = QUrl.fromEncoded(
|
||||||
@ -363,20 +373,6 @@ class SessionManager(QObject):
|
|||||||
if active:
|
if active:
|
||||||
new_tab.title_changed.emit(histentry['title'])
|
new_tab.title_changed.emit(histentry['title'])
|
||||||
|
|
||||||
if config.val.session_lazy_restore and data['history']:
|
|
||||||
last = data['history'][-1]
|
|
||||||
title = last['title']
|
|
||||||
url = 'qute://back#' + title
|
|
||||||
active = last.get('active', False)
|
|
||||||
|
|
||||||
if not last['url'].startswith('qute://'):
|
|
||||||
entries.append(TabHistoryItem(
|
|
||||||
url=QUrl.fromEncoded(url.encode('ascii')),
|
|
||||||
title=title, active=active, user_data={}))
|
|
||||||
|
|
||||||
if active:
|
|
||||||
new_tab.title_changed.emit(title)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
new_tab.history.load_items(entries)
|
new_tab.history.load_items(entries)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user