Merge lp:~osomon/webbrowser-app/saveSessionPeriodically into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 989
Merged at revision: 996
Proposed branch: lp:~osomon/webbrowser-app/saveSessionPeriodically
Merge into: lp:webbrowser-app
Diff against target: 34 lines (+17/-0)
1 file modified
src/app/webbrowser/Browser.qml (+17/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/saveSessionPeriodically
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+257704@code.launchpad.net

Commit message

Save the session periodically to mitigate the situation where multiple new tabs had been created when the browser crashes.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
988. By Olivier Tilloy

Also save the current session when tabs are open/closed, and when the current tab changes.

989. By Olivier Tilloy

Delay session saving by 500 msecs to avoid writing the session file twice in a row when e.g. creating a new tab.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/Browser.qml'
2--- src/app/webbrowser/Browser.qml 2015-04-22 10:25:50 +0000
3+++ src/app/webbrowser/Browser.qml 2015-04-29 14:09:26 +0000
4@@ -915,6 +915,18 @@
5 return tabComponent.createObject(tabContainer, properties)
6 }
7 }
8+ Timer {
9+ id: delayedSessionSaver
10+ interval: 500
11+ onTriggered: session.save()
12+ }
13+ Timer {
14+ // Save session periodically to mitigate state loss when the application crashes
15+ interval: 60000 // every minute
16+ repeat: true
17+ running: true
18+ onTriggered: delayedSessionSaver.restart()
19+ }
20 Connections {
21 target: Qt.application
22 onStateChanged: {
23@@ -927,6 +939,11 @@
24 }
25 onAboutToQuit: session.save()
26 }
27+ Connections {
28+ target: tabsModel
29+ onCurrentTabChanged: delayedSessionSaver.restart()
30+ onCountChanged: delayedSessionSaver.restart()
31+ }
32
33 // Delay instantiation of the first webview by 1 msec to allow initial
34 // rendering to happen. Clumsy workaround for http://pad.lv/1359911.

Subscribers

People subscribed via source and target branches

to status/vote changes: