← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Riccardo Padovani has proposed merging lp:~rpadovani/ubuntu-calculator-app/improveFavouriteTextfield into lp:ubuntu-calculator-app/reboot.

Commit message:
Improve favourite textfield management

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1435878 in Ubuntu Calculator App: "[reboot] Favourite tab still visible in favourites view"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1435878

For more details, see:
https://code.launchpad.net/~rpadovani/ubuntu-calculator-app/improveFavouriteTextfield/+merge/254001

Improve favourite textfield management
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~rpadovani/ubuntu-calculator-app/improveFavouriteTextfield into lp:ubuntu-calculator-app/reboot.
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml	2015-03-06 21:15:52 +0000
+++ app/ubuntu-calculator-app.qml	2015-03-24 20:40:08 +0000
@@ -217,6 +217,8 @@
                 title: i18n.tr("Favorite")
             }
 
+            bottomEdgeEnabled: textInputField.visible
+
             state: visualModel.isInSelectionMode ? "selection" : "default"
             states: [
                 State {
@@ -348,8 +350,8 @@
                         visualModel.selectItem(visualDelegate);
                     }
 
-                    rightSideActions: [ screenDelegateCopyAction.item, 
-                                        screenDelegateEditAction.item, 
+                    rightSideActions: [ screenDelegateCopyAction.item,
+                                        screenDelegateEditAction.item,
                                         screenDelegateFavouriteAction.item ]
                     leftSideAction: screenDelegateDeleteAction.item
 
@@ -385,10 +387,10 @@
                         id: screenDelegateFavouriteAction
                         sourceComponent: Action {
                             iconName: (editedCalculationIndex == model.index || model.isFavourite) ? "starred" : "non-starred"
-                            
+
                             text: i18n.tr("Add to favorites")
                             onTriggered: {
-                                
+
                                 if (model.isFavourite) {
                                     calculationHistory.updateCalculationInDatabase(model.index, model.dbId, !model.isFavourite, "");
                                     editedCalculationIndex = -1;
@@ -400,7 +402,7 @@
                                     favouriteTextField.forceActiveFocus();
                                     scrollableView.scrollToBottom();
                                 }
-   
+
                                 model.isFavourite = !model.isFavourite;
                             }
                         }
@@ -525,10 +527,10 @@
                         id: favouriteTextField
 
                         anchors {
-                            right: confirmFavourite.left
+                            right: parent.right
                             rightMargin: units.gu(1)
                         }
-                        width: parent.width - confirmFavourite.width - units.gu(3)
+                        width: parent.width - units.gu(3)
                         height: parent.height
                         visible: !textInputField.visible
 
@@ -547,40 +549,18 @@
                             }
                         }
 
-                        
-                    }
-
-                    Icon {
-                        id: confirmFavourite
-                        visible: favouriteTextField.visible
-
-                        name: "keyboard-enter"
-
-                        anchors {
-                            right: parent.right
-                            rightMargin: units.gu(1)
-                            top: parent.top
-                            topMargin: units.gu(1)
-                        }
-
-                        MouseArea {
-                            anchors.fill: parent
-
-                            onReleased: {
-                                textInputField.visible = true;
-                                textInputField.forceActiveFocus();
-                                if (editedCalculationIndex >= 0) {
-                                    calculationHistory.updateCalculationInDatabase(editedCalculationIndex,
-                                                                                   calculationHistory.getContents().get(editedCalculationIndex).dbId,
-                                                                                   true,
-                                                                                   favouriteTextField.text);
-                                    favouriteTextField.text = "";
-                                    editedCalculationIndex = -1;
-                                }
+                        onAccepted: {
+                            textInputField.visible = true;
+                            textInputField.forceActiveFocus();
+                            if (editedCalculationIndex >= 0) {
+                                calculationHistory.updateCalculationInDatabase(editedCalculationIndex,
+                                 calculationHistory.getContents().get(editedCalculationIndex).dbId,
+                                 true,
+                                 favouriteTextField.text);
+                                favouriteTextField.text = "";
+                                editedCalculationIndex = -1;
                             }
                         }
-                        height: parent.height - units.gu(2)
-                        width: height
                     }
 
                     TextField {


Follow ups