Merge lp:~fboucault/webbrowser-app/save_window_size into lp:webbrowser-app/staging

Proposed by Florian Boucault
Status: Merged
Merged at revision: 1620
Proposed branch: lp:~fboucault/webbrowser-app/save_window_size
Merge into: lp:webbrowser-app/staging
Diff against target: 34 lines (+10/-4)
1 file modified
src/app/webbrowser/webbrowser-app.qml (+10/-4)
To merge this branch: bzr merge lp:~fboucault/webbrowser-app/save_window_size
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
Review via email: mp+317467@code.launchpad.net

Commit message

Store and restore on startup the size of each window.

Description of the change

Store and restore on startup the size of each window.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Wouldn’t it be better to pass width and height as properties to windowFactory.createObject(…) in restoreWindowState(), instead of setting the properties after the window is created?

1610. By Florian Boucault

Merged from staging

1611. By Florian Boucault

Pass width/height at Window creation time.

Revision history for this message
Olivier Tilloy (osomon) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/webbrowser-app.qml'
2--- src/app/webbrowser/webbrowser-app.qml 2017-02-16 10:55:50 +0000
3+++ src/app/webbrowser/webbrowser-app.qml 2017-02-20 13:42:34 +0000
4@@ -306,8 +306,6 @@
5 property var session: SessionStorage {
6 dataFile: dataLocation + "/session.json"
7
8- // TODO: do we want to save/restore window positions too (https://launchpad.net/bugs/1312892)?
9-
10 function save() {
11 if (!locked || restoring) {
12 return
13@@ -366,11 +364,19 @@
14 for (var i = 0; i < window.tabsModel.count; ++i) {
15 tabs.push(window.serializeTabState(window.tabsModel.get(i)))
16 }
17- return {tabs: tabs, currentIndex: window.tabsModel.currentIndex}
18+ return {tabs: tabs, currentIndex: window.tabsModel.currentIndex,
19+ width: window.width, height: window.height}
20 }
21
22 function restoreWindowState(state) {
23- var window = windowFactory.createObject(null)
24+ var windowProperties = {}
25+ if (state.width) {
26+ windowProperties["width"] = state.width
27+ }
28+ if (state.height) {
29+ windowProperties["height"] = state.height
30+ }
31+ var window = windowFactory.createObject(null, windowProperties)
32 for (var i in state.tabs) {
33 window.tabsModel.add(window.restoreTabState(state.tabs[i]))
34 }

Subscribers

People subscribed via source and target branches