Merge lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-edit-history into lp:ubuntu-calculator-app

Proposed by Bartosz Kosiorek
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 101
Merged at revision: 104
Proposed branch: lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-edit-history
Merge into: lp:ubuntu-calculator-app
Diff against target: 213 lines (+45/-21)
4 files modified
app/ubuntu-calculator-app.qml (+16/-2)
app/ui/KeyboardPage.qml (+6/-0)
app/ui/ScrollableView.qml (+8/-8)
po/com.ubuntu.calculator.pot (+15/-11)
To merge this branch: bzr merge lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-edit-history
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+249730@code.launchpad.net

Commit message

Add possibility of editing calculation from history, by swiping left and select "Edit" option.

Description of the change

Add possibility of editing calculation from history, by swiping left and select "Edit" option.

To post a comment you must log in.
101. By Bartosz Kosiorek

Add semicolons

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
Riccardo Padovani (rpadovani) wrote :

Are we sure this is what designers want?

Looking to design document seems they want a special window where you can edit the old calc, then when you save it the old calc is updated, and it isn't create a new one...

Implementation is good, anyway :-)

review: Needs Information
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

This is really nice to use. Tested on my krillin and it works really well.

review: Approve
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

With popey approvation all is better, so here we go :-)

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-02-10 22:12:55 +0000
3+++ app/ubuntu-calculator-app.qml 2015-02-13 22:24:19 +0000
4@@ -209,7 +209,6 @@
5 if (!isFavourite) {
6 favouriteTextField.text = "";
7 }
8-
9 calculationHistory.addCalculationToScreen(longFormula, result, isFavourite, favouriteTextField.text);
10 longFormula = result;
11 shortFormula = result;
12@@ -357,7 +356,7 @@
13 visualModel.selectItem(visualDelegate);
14 }
15
16- rightSideActions: [ screenDelegateCopyAction.item ]
17+ rightSideActions: [ screenDelegateCopyAction.item, screenDelegateEditAction.item ]
18 leftSideAction: screenDelegateDeleteAction.item
19
20 Loader {
21@@ -374,6 +373,21 @@
22 }
23
24 Loader {
25+ id: screenDelegateEditAction
26+ sourceComponent: Action {
27+ iconName: "edit"
28+ text: i18n.tr("Edit")
29+ onTriggered: {
30+ longFormula = model.formula;
31+ shortFormula = model.result;
32+ displayedInputText = model.formula;
33+ isLastCalculate = false;
34+ previousVisual = "";
35+ scrollableView.scrollToBottom();
36+ }
37+ }
38+ }
39+ Loader {
40 id: screenDelegateDeleteAction
41 sourceComponent: Action {
42 iconName: "delete"
43
44=== modified file 'app/ui/KeyboardPage.qml'
45--- app/ui/KeyboardPage.qml 2015-02-10 22:12:55 +0000
46+++ app/ui/KeyboardPage.qml 2015-02-13 22:24:19 +0000
47@@ -121,19 +121,25 @@
48 objectName: model.objectName
49 baseSize: repeater.height
50 onClicked: {
51+ //If key pressed then scroll down
52+
53 switch (model.action) {
54 case "push":
55 formulaPush(model.pushText);
56+ scrollableView.scrollToBottom();
57 break;
58 case "delete":
59 deleteLastFormulaElement();
60+ scrollableView.scrollToBottom();
61 break;
62 case "calculate":
63 calculate();
64+ scrollableView.scrollToBottom();
65 break;
66 }
67 }
68 onPressAndHold: {
69+ //If key pressed then scroll down
70 switch (model.secondaryAction) {
71 case "clearFormula":
72 clearFormula();
73
74=== modified file 'app/ui/ScrollableView.qml'
75--- app/ui/ScrollableView.qml 2015-01-15 22:26:48 +0000
76+++ app/ui/ScrollableView.qml 2015-02-13 22:24:19 +0000
77@@ -18,11 +18,11 @@
78 import QtQuick 2.3
79
80 Flickable {
81- id: flickable
82+ id: flickableHistory
83
84 default property alias data: column.children
85 property double oldContentHeight: 0
86- contentHeight: flickable.height > column.height ? flickable.height : column.height
87+ contentHeight: flickableHistory.height > column.height ? flickableHistory.height : column.height
88 boundsBehavior: Flickable.DragOverBounds
89 property bool snap: true
90
91@@ -30,19 +30,19 @@
92 if (contentY <= 0 || !snap) {
93 return;
94 }
95- var posy = flickable.height + flickable.visibleArea.yPosition * flickable.contentHeight
96+ var posy = flickableHistory.height + flickableHistory.visibleArea.yPosition * flickableHistory.contentHeight
97 // FIXME see ubuntu-calculator-app:269:
98 // It's column.width - units.gu(2) because of the weird alignment of TextField
99 var obj = column.childAt(column.width - units.gu(2), posy)
100 if (Math.abs(posy - obj.y) < obj.height / 2) {
101 // scroll up
102- var destY = obj.y - flickable.height;
103+ var destY = obj.y - flickableHistory.height;
104 // don't go out of bound
105 if (destY < 0) destY = 0;
106 scrollingAnimation.to = destY;
107 } else {
108 // scroll down
109- scrollingAnimation.to = obj.y + obj.height - flickable.height;
110+ scrollingAnimation.to = obj.y + obj.height - flickableHistory.height;
111 }
112 scrollingAnimation.start()
113 }
114@@ -60,8 +60,8 @@
115 }
116
117 function scrollToBottom() {
118- if (column.height > flickable.height) {
119- flickable.contentY = flickable.contentHeight - flickable.height;
120+ if (column.height > flickableHistory.height) {
121+ flickableHistory.contentY = flickableHistory.contentHeight - flickableHistory.height;
122 }
123 }
124
125@@ -70,7 +70,7 @@
126 onHeightChanged: {
127 // scroll to bottom only when something is inserted.
128 if (oldContentHeight < contentHeight) {
129- flickable.scrollToBottom();
130+ flickableHistory.scrollToBottom();
131 }
132 oldContentHeight = contentHeight;
133 }
134
135=== modified file 'po/com.ubuntu.calculator.pot'
136--- po/com.ubuntu.calculator.pot 2015-01-30 21:36:04 +0000
137+++ po/com.ubuntu.calculator.pot 2015-02-13 22:24:19 +0000
138@@ -8,7 +8,7 @@
139 msgstr ""
140 "Project-Id-Version: \n"
141 "Report-Msgid-Bugs-To: \n"
142-"POT-Creation-Date: 2015-01-30 22:35+0100\n"
143+"POT-Creation-Date: 2015-02-13 23:19+0100\n"
144 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
145 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
146 "Language-Team: LANGUAGE <LL@li.org>\n"
147@@ -17,37 +17,41 @@
148 "Content-Type: text/plain; charset=CHARSET\n"
149 "Content-Transfer-Encoding: 8bit\n"
150
151-#: ../app/engine/formula.js:145
152+#: ../app/engine/formula.js:141
153 msgid "NaN"
154 msgstr ""
155
156-#: ../app/ubuntu-calculator-app.qml:214 ../app/ubuntu-calculator-app.qml:219
157+#: ../app/ubuntu-calculator-app.qml:228 ../app/ubuntu-calculator-app.qml:233
158 msgid "Favorite"
159 msgstr ""
160
161-#: ../app/ubuntu-calculator-app.qml:270
162+#: ../app/ubuntu-calculator-app.qml:284
163 msgid "Cancel"
164 msgstr ""
165
166-#: ../app/ubuntu-calculator-app.qml:278
167+#: ../app/ubuntu-calculator-app.qml:292
168 msgid "Select All"
169 msgstr ""
170
171-#: ../app/ubuntu-calculator-app.qml:285 ../app/ubuntu-calculator-app.qml:352
172+#: ../app/ubuntu-calculator-app.qml:299 ../app/ubuntu-calculator-app.qml:366
173 msgid "Copy"
174 msgstr ""
175
176-#: ../app/ubuntu-calculator-app.qml:292 ../app/ubuntu-calculator-app.qml:365
177+#: ../app/ubuntu-calculator-app.qml:306 ../app/ubuntu-calculator-app.qml:394
178 msgid "Delete"
179 msgstr ""
180
181+#: ../app/ubuntu-calculator-app.qml:379
182+msgid "Edit"
183+msgstr ""
184+
185 #. TRANSLATORS: this is a time formatting string, see
186 #. http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for
187 #. valid expressions
188 #. TRANSLATORS: this is a time formatting string, see
189 #. http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid
190 #. expressions
191-#: ../app/ubuntu-calculator-app.qml:525 ../app/ui/Screen.qml:50
192+#: ../app/ubuntu-calculator-app.qml:554 ../app/ui/Screen.qml:50
193 msgid "dd MMM yyyy"
194 msgstr ""
195
196@@ -78,14 +82,14 @@
197 msgid "Yesterday"
198 msgstr ""
199
200-#: /tmp/tmp.OLyVDpDzrv/po/ubuntu-calculator-app.desktop.in.in.h:1
201+#: /tmp/tmp.RkXdmNBKKn/po/ubuntu-calculator-app.desktop.in.in.h:1
202 msgid "Calculator"
203 msgstr ""
204
205-#: /tmp/tmp.OLyVDpDzrv/po/ubuntu-calculator-app.desktop.in.in.h:2
206+#: /tmp/tmp.RkXdmNBKKn/po/ubuntu-calculator-app.desktop.in.in.h:2
207 msgid "A calculator for Ubuntu."
208 msgstr ""
209
210-#: /tmp/tmp.OLyVDpDzrv/po/ubuntu-calculator-app.desktop.in.in.h:3
211+#: /tmp/tmp.RkXdmNBKKn/po/ubuntu-calculator-app.desktop.in.in.h:3
212 msgid "math;addition;subtraction;multiplication;division;"
213 msgstr ""

Subscribers

People subscribed via source and target branches