Merge lp:~renatofilho/ubuntu-calendar-app/fix-1311111 into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 257
Merged at revision: 260
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/fix-1311111
Merge into: lp:ubuntu-calendar-app
Diff against target: 323 lines (+227/-27)
6 files modified
EditToolbar.qml (+61/-0)
KeyboardRectangle.qml (+77/-0)
NewEvent.qml (+71/-26)
NewEventEntryField.qml (+6/-0)
tests/autopilot/calendar_app/emulators.py (+10/-0)
tests/autopilot/calendar_app/tests/test_calendar.py (+2/-1)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/fix-1311111
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+217286@code.launchpad.net

Commit message

Make sure that the field is always visible on NewEvent page.
Used a custom toolbar on NewEvent page.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

Renato,

Could you merge trunk into this branch so you get the fix for a bug that prevents the app from running correctly on the device [1]?

[1] https://bugs.launchpad.net/bugs/1312480

255. By Renato Araujo Oliveira Filho

Merged mainline.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Looks like the toolbar changed which broke the tests:-

old:- https://imgur.com/3JDJEfI
new:- https://imgur.com/alzy6Rr

review: Needs Fixing
256. By Renato Araujo Oliveira Filho

Fixed autopilot test.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
257. By Renato Araujo Oliveira Filho

Fixed python code changes based on pep8 code style

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Great, thanks Renato.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'EditToolbar.qml'
2--- EditToolbar.qml 1970-01-01 00:00:00 +0000
3+++ EditToolbar.qml 2014-04-29 17:34:52 +0000
4@@ -0,0 +1,61 @@
5+/*
6+ * Copyright (C) 2012-2013 Canonical, Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Ubuntu.Components.ListItems 0.1 as ListItem
24+
25+Rectangle {
26+ id: root
27+
28+ signal reject()
29+ signal accept()
30+
31+ property alias acceptAction: accept.action
32+ property alias rejectAction: reject.action
33+
34+ color: "gray"
35+
36+ Button {
37+ id: reject
38+ objectName: "reject"
39+
40+ action: Action {
41+ text: i18n.tr("Cancel")
42+ }
43+ anchors {
44+ left: parent.left
45+ leftMargin: units.gu(1)
46+ verticalCenter: parent.verticalCenter
47+ }
48+ onClicked: root.reject()
49+ }
50+
51+ Button {
52+ id: accept
53+ objectName: "accept"
54+
55+ action: Action {
56+ text: i18n.tr("Done")
57+ }
58+ anchors {
59+ right: parent.right
60+ rightMargin: units.gu(1)
61+ verticalCenter: parent.verticalCenter
62+ }
63+ onClicked: root.accept()
64+ }
65+}
66
67=== added file 'KeyboardRectangle.qml'
68--- KeyboardRectangle.qml 1970-01-01 00:00:00 +0000
69+++ KeyboardRectangle.qml 2014-04-29 17:34:52 +0000
70@@ -0,0 +1,77 @@
71+/*
72+ * Copyright (C) 2012-2013 Canonical, Ltd.
73+ *
74+ * This program is free software; you can redistribute it and/or modify
75+ * it under the terms of the GNU General Public License as published by
76+ * the Free Software Foundation; version 3.
77+ *
78+ * This program is distributed in the hope that it will be useful,
79+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
80+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81+ * GNU General Public License for more details.
82+ *
83+ * You should have received a copy of the GNU General Public License
84+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
85+ */
86+
87+import QtQuick 2.0
88+
89+Item {
90+ id: keyboardRect
91+ anchors.left: parent.left
92+ anchors.right: parent.right
93+ anchors.bottom: parent.bottom
94+ height: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
95+
96+ Behavior on height {
97+ NumberAnimation {
98+ duration: 300
99+ easing.type: Easing.InOutQuad
100+ }
101+ }
102+
103+ states: [
104+ State {
105+ name: "hidden"
106+ when: keyboardRect.height == 0
107+ },
108+ State {
109+ name: "shown"
110+ when: keyboardRect.height == Qt.inputMethod.keyboardRectangle.height
111+ }
112+ ]
113+
114+ function recursiveFindFocusedItem(parent) {
115+ if (parent.activeFocus) {
116+ return parent;
117+ }
118+
119+ for (var i in parent.children) {
120+ var child = parent.children[i];
121+ if (child.activeFocus) {
122+ return child;
123+ }
124+
125+ var item = recursiveFindFocusedItem(child);
126+
127+ if (item != null) {
128+ return item;
129+ }
130+ }
131+
132+ return null;
133+ }
134+
135+ Connections {
136+ target: Qt.inputMethod
137+
138+ onVisibleChanged: {
139+ if (!Qt.inputMethod.visible) {
140+ var focusedItem = recursiveFindFocusedItem(keyboardRect.parent);
141+ if (focusedItem != null) {
142+ focusedItem.focus = false;
143+ }
144+ }
145+ }
146+ }
147+}
148
149=== modified file 'NewEvent.qml'
150--- NewEvent.qml 2014-04-25 00:17:55 +0000
151+++ NewEvent.qml 2014-04-29 17:34:52 +0000
152@@ -181,33 +181,10 @@
153 pageStack.pop();
154 }
155
156+ // we use a custom toolbar in this view
157 tools: ToolbarItems {
158- //keeping toolbar always open
159- opened: true
160 locked: true
161-
162- //FIXME: set the icons for toolbar buttons
163- back: ToolbarButton {
164- objectName: "eventCancelButton"
165- action: Action {
166- text: i18n.tr("Cancel");
167- iconSource: Qt.resolvedUrl("cancel.svg");
168- onTriggered: {
169- pageStack.pop();
170- }
171- }
172- }
173-
174- ToolbarButton {
175- objectName: "eventSaveButton"
176- action: Action {
177- text: i18n.tr("Save");
178- iconSource: Qt.resolvedUrl("save.svg");
179- onTriggered: {
180- saveToQtPim();
181- }
182- }
183- }
184+ opened: false
185 }
186
187 Component{
188@@ -228,12 +205,51 @@
189 }
190 }
191
192+ Rectangle {
193+ id: availableArea
194+
195+ width: parent.width
196+ color: "red"
197+ opacity: 0.5
198+ z: 100
199+ }
200+
201+
202 Flickable{
203 id: flickable
204+
205+ property var activeItem: null
206+
207+ function makeMeVisible(item) {
208+ if (!item) {
209+ return
210+ }
211+
212+ activeItem = item
213+ var position = flickable.contentItem.mapFromItem(item, 0, 0);
214+
215+ // check if the item is already visible
216+ var bottomY = flickable.contentY + flickable.height
217+ var itemBottom = position.y + item.height
218+ if (position.y >= flickable.contentY && itemBottom <= bottomY) {
219+ return;
220+ }
221+
222+ // if it is not, try to scroll and make it visible
223+ var targetY = position.y + item.height - flickable.height
224+ if (targetY >= 0 && position.y) {
225+ flickable.contentY = targetY;
226+ } else if (position.y < flickable.contentY) {
227+ // if it is hidden at the top, also show it
228+ flickable.contentY = position.y;
229+ }
230+ flickable.returnToBounds()
231+ }
232+
233 anchors {
234 top: parent.top
235 topMargin: units.gu(2)
236- bottom: parent.bottom
237+ bottom: toolbar.top
238 left: parent.left
239 right: parent.right
240 leftMargin: units.gu(2)
241@@ -432,6 +448,35 @@
242 }
243 }
244
245+ EditToolbar {
246+ id: toolbar
247+ anchors {
248+ left: parent.left
249+ right: parent.right
250+ bottom: parent.bottom
251+ }
252+ height: units.gu(6)
253+ acceptAction: Action {
254+ text: i18n.tr("Save")
255+ onTriggered: saveToQtPim();
256+ }
257+ rejectAction: Action {
258+ text: i18n.tr("Cancel")
259+ onTriggered: pageStack.pop();
260+ }
261+ }
262+
263+ // used to keep the field visible when the keyboard appear or dismiss
264+ KeyboardRectangle {
265+ id: keyboard
266+
267+ onHeightChanged: {
268+ if (flickable.activeItem) {
269+ flickable.makeMeVisible(flickable.activeItem)
270+ }
271+ }
272+ }
273+
274 QtObject {
275 id: internal
276
277
278=== modified file 'NewEventEntryField.qml'
279--- NewEventEntryField.qml 2014-04-25 00:17:55 +0000
280+++ NewEventEntryField.qml 2014-04-29 17:34:52 +0000
281@@ -16,4 +16,10 @@
282 font {
283 pixelSize: focus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium")
284 }
285+
286+ onActiveFocusChanged: {
287+ if (activeFocus) {
288+ flickable.makeMeVisible(root)
289+ }
290+ }
291 }
292
293=== modified file 'tests/autopilot/calendar_app/emulators.py'
294--- tests/autopilot/calendar_app/emulators.py 2014-03-20 02:42:05 +0000
295+++ tests/autopilot/calendar_app/emulators.py 2014-04-29 17:34:52 +0000
296@@ -106,3 +106,13 @@
297
298 def get_num_events(self):
299 return len(self.select_many("EventBubble"))
300+
301+ def get_new_event_save_button(self):
302+ new_event = self.get_new_event()
303+ return new_event.wait_select_single("Button",
304+ objectName="accept")
305+
306+ def get_new_event_cancel_button(self):
307+ new_event = self.get_new_event()
308+ return new_event.wait_select_single("Button",
309+ objectName="cancel")
310
311=== modified file 'tests/autopilot/calendar_app/tests/test_calendar.py'
312--- tests/autopilot/calendar_app/tests/test_calendar.py 2014-04-12 04:06:45 +0000
313+++ tests/autopilot/calendar_app/tests/test_calendar.py 2014-04-29 17:34:52 +0000
314@@ -88,7 +88,8 @@
315 self.assertThat(location_field.text, Eventually(Equals("My location")))
316
317 #click save button
318- self.main_view.open_toolbar().click_button("eventSaveButton")
319+ save_button = self.main_view.get_new_event_save_button()
320+ self.pointing_device.click_object(save_button)
321
322 #verify that the event has been created in timeline
323 self.main_view.open_toolbar().click_button("todaybutton")

Subscribers

People subscribed via source and target branches

to status/vote changes: