Merge lp:~osomon/webbrowser-app/flickable-drawer into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Ugo Riboni
Approved revision: 1283
Merged at revision: 1287
Proposed branch: lp:~osomon/webbrowser-app/flickable-drawer
Merge into: lp:webbrowser-app
Diff against target: 183 lines (+62/-53)
3 files modified
src/app/webbrowser/Browser.qml (+2/-0)
src/app/webbrowser/Chrome.qml (+1/-0)
src/app/webbrowser/NavigationBar.qml (+59/-53)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/flickable-drawer
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+278692@code.launchpad.net

Commit message

Make the drawer menu flickable so that all its actions can be accessed even on a small mobile screen in landscape orientation.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ugo Riboni (uriboni) wrote :

Code looks good and works as expected.

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/Browser.qml'
2--- src/app/webbrowser/Browser.qml 2015-11-24 09:35:34 +0000
3+++ src/app/webbrowser/Browser.qml 2015-11-26 12:38:38 +0000
4@@ -449,6 +449,8 @@
5 showTabsBar: browser.wide
6 showFaviconInAddressBar: !browser.wide
7
8+ availableHeight: tabContainer.height - height - y
9+
10 property bool hidden: false
11 y: hidden ? -height : webview ? webview.locationBarController.offset : 0
12 Behavior on y {
13
14=== modified file 'src/app/webbrowser/Chrome.qml'
15--- src/app/webbrowser/Chrome.qml 2015-11-23 16:05:42 +0000
16+++ src/app/webbrowser/Chrome.qml 2015-11-26 12:38:38 +0000
17@@ -38,6 +38,7 @@
18 property alias incognito: navigationBar.incognito
19 property alias showTabsBar: tabsBar.active
20 property alias showFaviconInAddressBar: navigationBar.showFaviconInAddressBar
21+ property alias availableHeight: navigationBar.availableHeight
22 readonly property alias bookmarkTogglePlaceHolder: navigationBar.bookmarkTogglePlaceHolder
23
24 signal switchToTab(int index)
25
26=== modified file 'src/app/webbrowser/NavigationBar.qml'
27--- src/app/webbrowser/NavigationBar.qml 2015-11-23 16:05:42 +0000
28+++ src/app/webbrowser/NavigationBar.qml 2015-11-26 12:38:38 +0000
29@@ -38,6 +38,7 @@
30 property alias showFaviconInAddressBar: addressbar.showFavicon
31 readonly property alias bookmarkTogglePlaceHolder: addressbar.bookmarkTogglePlaceHolder
32 property color iconColor: UbuntuColors.darkGrey
33+ property real availableHeight
34
35 onFindInPageModeChanged: if (findInPageMode) addressbar.text = ""
36 onIncognitoChanged: findInPageMode = false
37@@ -246,8 +247,8 @@
38 right: parent.right
39 }
40 width: units.gu(22)
41- height: actionsColumn.height
42- clip: actionsColumn.y != 0
43+ height: actionsListView.height
44+ clip: actionsListView.y != 0
45
46 InverseMouseArea {
47 enabled: drawer.opened
48@@ -255,7 +256,7 @@
49 }
50
51 Rectangle {
52- anchors.fill: actionsColumn
53+ anchors.fill: actionsListView
54 color: Theme.palette.normal.background
55
56 Rectangle {
57@@ -279,13 +280,17 @@
58 }
59 }
60
61- Column {
62- id: actionsColumn
63+ ListView {
64+ id: actionsListView
65
66 anchors {
67 left: parent.left
68 right: parent.right
69 }
70+ height: Math.min(_contentHeight, availableHeight)
71+ // avoid a binding loop
72+ property real _contentHeight: 0
73+ onContentHeightChanged: _contentHeight = contentHeight
74
75 y: drawer.opened ? 0 : -height
76 Behavior on y { UbuntuNumberAnimation {} }
77@@ -295,57 +300,58 @@
78 }
79 }
80
81- Repeater {
82- model: drawerActions
83- delegate: AbstractButton {
84- objectName: action.objectName
85+ clip: true
86+
87+ model: drawerActions
88+
89+ delegate: AbstractButton {
90+ objectName: action.objectName
91+ anchors {
92+ left: parent.left
93+ right: parent.right
94+ }
95+ height: visible ? units.gu(6) : 0
96+ visible: action.enabled
97+
98+ action: modelData
99+ onClicked: drawer.opened = false
100+
101+ Rectangle {
102+ anchors.fill: parent
103+ color: Theme.palette.selected.background
104+ visible: parent.pressed
105+ }
106+
107+ Icon {
108+ id: actionIcon
109 anchors {
110 left: parent.left
111+ leftMargin: units.gu(2)
112+ verticalCenter: parent.verticalCenter
113+ }
114+ width: units.gu(2)
115+ height: width
116+
117+ name: model.iconName
118+ Binding on source {
119+ when: model.iconSource.toString()
120+ value: model.iconSource
121+ }
122+ color: UbuntuColors.darkGrey
123+ }
124+
125+ Label {
126+ anchors {
127+ left: actionIcon.right
128+ leftMargin: units.gu(2)
129+ verticalCenter: parent.verticalCenter
130 right: parent.right
131- }
132- height: units.gu(6)
133- visible: action.enabled
134-
135- action: modelData
136- onClicked: drawer.opened = false
137-
138- Rectangle {
139- anchors.fill: parent
140- color: Theme.palette.selected.background
141- visible: parent.pressed
142- }
143-
144- Icon {
145- id: actionIcon
146- anchors {
147- left: parent.left
148- leftMargin: units.gu(2)
149- verticalCenter: parent.verticalCenter
150- }
151- width: units.gu(2)
152- height: width
153-
154- name: model.iconName
155- Binding on source {
156- when: model.iconSource.toString()
157- value: model.iconSource
158- }
159- color: UbuntuColors.darkGrey
160- }
161-
162- Label {
163- anchors {
164- left: actionIcon.right
165- leftMargin: units.gu(2)
166- verticalCenter: parent.verticalCenter
167- right: parent.right
168- rightMargin: units.gu(1)
169- }
170- text: model.text
171- fontSize: "small"
172- color: UbuntuColors.darkGrey
173- elide: Text.ElideRight
174- }
175+ rightMargin: units.gu(1)
176+ }
177+ text: model.text
178+ fontSize: "small"
179+ color: UbuntuColors.darkGrey
180+ elide: Text.ElideRight
181 }
182 }
183 }

Subscribers

People subscribed via source and target branches

to status/vote changes: