Merge lp:~rpadovani/ubuntu-calculator-app/improveFavouriteTextfield into lp:ubuntu-calculator-app

Proposed by Riccardo Padovani on 2015-03-24
Status: Merged
Approved by: Bartosz Kosiorek on 2015-03-30
Approved revision: 143
Merged at revision: 145
Proposed branch: lp:~rpadovani/ubuntu-calculator-app/improveFavouriteTextfield
Merge into: lp:ubuntu-calculator-app
Diff against target: 171 lines (+31/-46)
2 files modified
app/ubuntu-calculator-app.qml (+29/-45)
app/ui/KeyboardButton.qml (+2/-1)
To merge this branch: bzr merge lp:~rpadovani/ubuntu-calculator-app/improveFavouriteTextfield
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-03-30
Bartosz Kosiorek 2015-03-24 Approve on 2015-03-30
Alan Pope 🍺🐧🐱 πŸ¦„ Approve on 2015-03-30
Review via email: mp+254001@code.launchpad.net

Commit Message

Improve favourite textfield management

Description of the Change

Improve favourite textfield management

To post a comment you must log in.

This is certainly an improvement.

Added bug 1436792 which is related.

After adding the favourite, the screen seems to get stuck like this for a couple of seconds.

http://people.canonical.com/~alan/screenshots/device-2015-03-26-105328.png

140. By Riccardo Padovani on 2015-03-26

Hide favourite tip

Riccardo Padovani (rpadovani) wrote :

> Added bug 1436792 which is related.

I improved the behavior of the tip, let me know what do you think

> After adding the favourite, the screen seems to get stuck like this for a
> couple of seconds.

Uh, this is tricky, I have an idea on how to fix it, but I need to do some experiments

Bartosz Kosiorek (gang65) wrote :

Regarding to bug 1435881
The "enter key" icon should be displayed only on Desktop, because without OSK you don't have possibility to confirm Favourite caption.

Bartosz Kosiorek (gang65) wrote :

The distinguish between Calculator and Webbrowser is already implemented in Browser.

There is formFactor == "Mobile", "Tablet" and "Desktop".
    readonly property string _formFactor: (Screen.width >= units.gu(60)) ? "Tablet" : "Mobile"

http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/webbrowser-app/vivid/view/head:/src/Ubuntu/Components/Extras/Browser/UbuntuWebView01.qml

Maybe we should do in similar way but we could distinguish between "Mobile" and "Desktop"?

review: Needs Information
Bartosz Kosiorek (gang65) wrote :

Hi.

Checking formFactor is wrong idea.

We should check if OSK is enabled there:
1. If OSK is enabled, then do not display favourite's confirmation button,
2. If OSK is disabled, then display favourite's confirmation button

For now let's just delete confirmaation button. We will reintroduce it later.

141. By Riccardo Padovani on 2015-03-30

Fix wrong keyboard management

Riccardo Padovani (rpadovani) wrote :

@popey: I think I fixed it, let me know

@gang65: since we want to land this asap and our focus isn't desktop, let's fix this in another branch :-)

142. By Riccardo Padovani on 2015-03-30

Fix wrong position of a component

Add a favourite, then go to Favourites and untap the star. Close favourites and then open it again.. you get this:-

http://people.canonical.com/~alan/screenshots/device-2015-03-30-103948.png

Which is confusing and wrong.

review: Needs Fixing
143. By Riccardo Padovani on 2015-03-30

Merge from trunk

Seems I had some crap on my device. It's working fine now!

review: Approve
Bartosz Kosiorek (gang65) wrote :

It is working correctly for me. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/ubuntu-calculator-app.qml'
2--- app/ubuntu-calculator-app.qml 2015-03-06 21:15:52 +0000
3+++ app/ubuntu-calculator-app.qml 2015-03-30 10:02:55 +0000
4@@ -73,6 +73,11 @@
5 // If it is set to false, then editing will be invoked
6 property bool deleteSelectedCalculation: true;
7
8+ Connections {
9+ id: oskKeyboard
10+ target: Qt.inputMethod
11+ }
12+
13 /**
14 * The function calls the Formula.deleteLastFormulaElement function and
15 * place the result in right vars
16@@ -204,7 +209,10 @@
17 PageStack {
18 id: mainStack
19
20- Component.onCompleted: push(calculatorPage)
21+ Component.onCompleted: {
22+ push(calculatorPage);
23+ calculatorPage.forceActiveFocus();
24+ }
25
26 PageWithBottomEdge {
27 id: calculatorPage
28@@ -217,6 +225,8 @@
29 title: i18n.tr("Favorite")
30 }
31
32+ bottomEdgeEnabled: textInputField.visible
33+
34 state: visualModel.isInSelectionMode ? "selection" : "default"
35 states: [
36 State {
37@@ -348,8 +358,8 @@
38 visualModel.selectItem(visualDelegate);
39 }
40
41- rightSideActions: [ screenDelegateCopyAction.item,
42- screenDelegateEditAction.item,
43+ rightSideActions: [ screenDelegateCopyAction.item,
44+ screenDelegateEditAction.item,
45 screenDelegateFavouriteAction.item ]
46 leftSideAction: screenDelegateDeleteAction.item
47
48@@ -385,10 +395,10 @@
49 id: screenDelegateFavouriteAction
50 sourceComponent: Action {
51 iconName: (editedCalculationIndex == model.index || model.isFavourite) ? "starred" : "non-starred"
52-
53+
54 text: i18n.tr("Add to favorites")
55 onTriggered: {
56-
57+
58 if (model.isFavourite) {
59 calculationHistory.updateCalculationInDatabase(model.index, model.dbId, !model.isFavourite, "");
60 editedCalculationIndex = -1;
61@@ -400,7 +410,7 @@
62 favouriteTextField.forceActiveFocus();
63 scrollableView.scrollToBottom();
64 }
65-
66+
67 model.isFavourite = !model.isFavourite;
68 }
69 }
70@@ -525,10 +535,10 @@
71 id: favouriteTextField
72
73 anchors {
74- right: confirmFavourite.left
75+ right: parent.right
76 rightMargin: units.gu(1)
77 }
78- width: parent.width - confirmFavourite.width - units.gu(3)
79+ width: parent.width - units.gu(3)
80 height: parent.height
81 visible: !textInputField.visible
82
83@@ -547,49 +557,23 @@
84 }
85 }
86
87-
88- }
89-
90- Icon {
91- id: confirmFavourite
92- visible: favouriteTextField.visible
93-
94- name: "keyboard-enter"
95-
96- anchors {
97- right: parent.right
98- rightMargin: units.gu(1)
99- top: parent.top
100- topMargin: units.gu(1)
101- }
102-
103- MouseArea {
104- anchors.fill: parent
105-
106- onReleased: {
107- textInputField.visible = true;
108- textInputField.forceActiveFocus();
109- if (editedCalculationIndex >= 0) {
110- calculationHistory.updateCalculationInDatabase(editedCalculationIndex,
111- calculationHistory.getContents().get(editedCalculationIndex).dbId,
112- true,
113- favouriteTextField.text);
114- favouriteTextField.text = "";
115- editedCalculationIndex = -1;
116- }
117+ onAccepted: {
118+ textInputField.visible = true;
119+ textInputField.forceActiveFocus();
120+ if (editedCalculationIndex >= 0) {
121+ calculationHistory.updateCalculationInDatabase(editedCalculationIndex,
122+ calculationHistory.getContents().get(editedCalculationIndex).dbId,
123+ true,
124+ favouriteTextField.text);
125+ favouriteTextField.text = "";
126+ editedCalculationIndex = -1;
127 }
128 }
129- height: parent.height - units.gu(2)
130- width: height
131 }
132
133 TextField {
134 id: textInputField
135 objectName: "textInputField"
136- // TODO: Make sure this bug gets fixed in SDK:
137- // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1320885
138- // It has been fixed in vivid - wait until it becomes the stable
139- // version before removing this
140 width: parent.width - units.gu(2)
141 height: parent.height
142
143@@ -651,7 +635,7 @@
144 Loader {
145 id: keyboardLoader
146 width: parent.width
147- visible: textInputField.visible
148+ visible: textInputField.visible && !oskKeyboard.visible
149 source: scrollableView.width > scrollableView.height ? "ui/LandscapeKeyboard.qml" : "ui/PortraitKeyboard.qml"
150 opacity: ((y + height) >= scrollableView.contentY) && (y <= (scrollableView.contentY + scrollableView.height)) ? 1 : 0
151 }
152
153=== modified file 'app/ui/KeyboardButton.qml'
154--- app/ui/KeyboardButton.qml 2015-03-06 21:13:52 +0000
155+++ app/ui/KeyboardButton.qml 2015-03-30 10:02:55 +0000
156@@ -22,7 +22,7 @@
157 AbstractButton {
158 id: buttonRect
159 objectName: modelname + "Button"
160- activeFocusOnPress: false
161+ activeFocusOnPress: true
162
163 property real baseSize: 1
164 property alias text: buttonText.text
165@@ -36,6 +36,7 @@
166 onKbdPressedChanged: {
167 if (!kbdPressed) {
168 buttonRect.clicked();
169+ buttonRect.forceActiveFocus();
170 }
171 }
172

Subscribers

People subscribed via source and target branches