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
=== added file 'EditToolbar.qml'
--- EditToolbar.qml 1970-01-01 00:00:00 +0000
+++ EditToolbar.qml 2014-04-29 17:34:52 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItem
20
21Rectangle {
22 id: root
23
24 signal reject()
25 signal accept()
26
27 property alias acceptAction: accept.action
28 property alias rejectAction: reject.action
29
30 color: "gray"
31
32 Button {
33 id: reject
34 objectName: "reject"
35
36 action: Action {
37 text: i18n.tr("Cancel")
38 }
39 anchors {
40 left: parent.left
41 leftMargin: units.gu(1)
42 verticalCenter: parent.verticalCenter
43 }
44 onClicked: root.reject()
45 }
46
47 Button {
48 id: accept
49 objectName: "accept"
50
51 action: Action {
52 text: i18n.tr("Done")
53 }
54 anchors {
55 right: parent.right
56 rightMargin: units.gu(1)
57 verticalCenter: parent.verticalCenter
58 }
59 onClicked: root.accept()
60 }
61}
062
=== added file 'KeyboardRectangle.qml'
--- KeyboardRectangle.qml 1970-01-01 00:00:00 +0000
+++ KeyboardRectangle.qml 2014-04-29 17:34:52 +0000
@@ -0,0 +1,77 @@
1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Item {
20 id: keyboardRect
21 anchors.left: parent.left
22 anchors.right: parent.right
23 anchors.bottom: parent.bottom
24 height: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
25
26 Behavior on height {
27 NumberAnimation {
28 duration: 300
29 easing.type: Easing.InOutQuad
30 }
31 }
32
33 states: [
34 State {
35 name: "hidden"
36 when: keyboardRect.height == 0
37 },
38 State {
39 name: "shown"
40 when: keyboardRect.height == Qt.inputMethod.keyboardRectangle.height
41 }
42 ]
43
44 function recursiveFindFocusedItem(parent) {
45 if (parent.activeFocus) {
46 return parent;
47 }
48
49 for (var i in parent.children) {
50 var child = parent.children[i];
51 if (child.activeFocus) {
52 return child;
53 }
54
55 var item = recursiveFindFocusedItem(child);
56
57 if (item != null) {
58 return item;
59 }
60 }
61
62 return null;
63 }
64
65 Connections {
66 target: Qt.inputMethod
67
68 onVisibleChanged: {
69 if (!Qt.inputMethod.visible) {
70 var focusedItem = recursiveFindFocusedItem(keyboardRect.parent);
71 if (focusedItem != null) {
72 focusedItem.focus = false;
73 }
74 }
75 }
76 }
77}
078
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2014-04-25 00:17:55 +0000
+++ NewEvent.qml 2014-04-29 17:34:52 +0000
@@ -181,33 +181,10 @@
181 pageStack.pop();181 pageStack.pop();
182 }182 }
183183
184 // we use a custom toolbar in this view
184 tools: ToolbarItems {185 tools: ToolbarItems {
185 //keeping toolbar always open
186 opened: true
187 locked: true186 locked: true
188187 opened: false
189 //FIXME: set the icons for toolbar buttons
190 back: ToolbarButton {
191 objectName: "eventCancelButton"
192 action: Action {
193 text: i18n.tr("Cancel");
194 iconSource: Qt.resolvedUrl("cancel.svg");
195 onTriggered: {
196 pageStack.pop();
197 }
198 }
199 }
200
201 ToolbarButton {
202 objectName: "eventSaveButton"
203 action: Action {
204 text: i18n.tr("Save");
205 iconSource: Qt.resolvedUrl("save.svg");
206 onTriggered: {
207 saveToQtPim();
208 }
209 }
210 }
211 }188 }
212189
213 Component{190 Component{
@@ -228,12 +205,51 @@
228 }205 }
229 }206 }
230207
208 Rectangle {
209 id: availableArea
210
211 width: parent.width
212 color: "red"
213 opacity: 0.5
214 z: 100
215 }
216
217
231 Flickable{218 Flickable{
232 id: flickable219 id: flickable
220
221 property var activeItem: null
222
223 function makeMeVisible(item) {
224 if (!item) {
225 return
226 }
227
228 activeItem = item
229 var position = flickable.contentItem.mapFromItem(item, 0, 0);
230
231 // check if the item is already visible
232 var bottomY = flickable.contentY + flickable.height
233 var itemBottom = position.y + item.height
234 if (position.y >= flickable.contentY && itemBottom <= bottomY) {
235 return;
236 }
237
238 // if it is not, try to scroll and make it visible
239 var targetY = position.y + item.height - flickable.height
240 if (targetY >= 0 && position.y) {
241 flickable.contentY = targetY;
242 } else if (position.y < flickable.contentY) {
243 // if it is hidden at the top, also show it
244 flickable.contentY = position.y;
245 }
246 flickable.returnToBounds()
247 }
248
233 anchors {249 anchors {
234 top: parent.top250 top: parent.top
235 topMargin: units.gu(2)251 topMargin: units.gu(2)
236 bottom: parent.bottom252 bottom: toolbar.top
237 left: parent.left253 left: parent.left
238 right: parent.right254 right: parent.right
239 leftMargin: units.gu(2)255 leftMargin: units.gu(2)
@@ -432,6 +448,35 @@
432 }448 }
433 }449 }
434450
451 EditToolbar {
452 id: toolbar
453 anchors {
454 left: parent.left
455 right: parent.right
456 bottom: parent.bottom
457 }
458 height: units.gu(6)
459 acceptAction: Action {
460 text: i18n.tr("Save")
461 onTriggered: saveToQtPim();
462 }
463 rejectAction: Action {
464 text: i18n.tr("Cancel")
465 onTriggered: pageStack.pop();
466 }
467 }
468
469 // used to keep the field visible when the keyboard appear or dismiss
470 KeyboardRectangle {
471 id: keyboard
472
473 onHeightChanged: {
474 if (flickable.activeItem) {
475 flickable.makeMeVisible(flickable.activeItem)
476 }
477 }
478 }
479
435 QtObject {480 QtObject {
436 id: internal481 id: internal
437482
438483
=== modified file 'NewEventEntryField.qml'
--- NewEventEntryField.qml 2014-04-25 00:17:55 +0000
+++ NewEventEntryField.qml 2014-04-29 17:34:52 +0000
@@ -16,4 +16,10 @@
16 font {16 font {
17 pixelSize: focus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium")17 pixelSize: focus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium")
18 }18 }
19
20 onActiveFocusChanged: {
21 if (activeFocus) {
22 flickable.makeMeVisible(root)
23 }
24 }
19}25}
2026
=== modified file 'tests/autopilot/calendar_app/emulators.py'
--- tests/autopilot/calendar_app/emulators.py 2014-03-20 02:42:05 +0000
+++ tests/autopilot/calendar_app/emulators.py 2014-04-29 17:34:52 +0000
@@ -106,3 +106,13 @@
106106
107 def get_num_events(self):107 def get_num_events(self):
108 return len(self.select_many("EventBubble"))108 return len(self.select_many("EventBubble"))
109
110 def get_new_event_save_button(self):
111 new_event = self.get_new_event()
112 return new_event.wait_select_single("Button",
113 objectName="accept")
114
115 def get_new_event_cancel_button(self):
116 new_event = self.get_new_event()
117 return new_event.wait_select_single("Button",
118 objectName="cancel")
109119
=== modified file 'tests/autopilot/calendar_app/tests/test_calendar.py'
--- tests/autopilot/calendar_app/tests/test_calendar.py 2014-04-12 04:06:45 +0000
+++ tests/autopilot/calendar_app/tests/test_calendar.py 2014-04-29 17:34:52 +0000
@@ -88,7 +88,8 @@
88 self.assertThat(location_field.text, Eventually(Equals("My location")))88 self.assertThat(location_field.text, Eventually(Equals("My location")))
8989
90 #click save button90 #click save button
91 self.main_view.open_toolbar().click_button("eventSaveButton")91 save_button = self.main_view.get_new_event_save_button()
92 self.pointing_device.click_object(save_button)
9293
93 #verify that the event has been created in timeline94 #verify that the event has been created in timeline
94 self.main_view.open_toolbar().click_button("todaybutton")95 self.main_view.open_toolbar().click_button("todaybutton")

Subscribers

People subscribed via source and target branches

to status/vote changes: