=== modified file 'po/pt_BR.po'
--- po/pt_BR.po	2014-07-05 05:59:02 +0000
+++ po/pt_BR.po	2014-07-15 21:22:20 +0000
@@ -307,7 +307,7 @@
 #. the supported values can be found in: https://www.iso.org/obp/ui/#search
 #: src/imports/ContactEdit/TextInputDetail.qml:73
 msgid "US"
-msgstr ""
+msgstr "BR"
 
 #: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117
 #: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96

=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactDelegate.qml	2014-07-09 15:30:13 +0000
+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml	2014-07-15 21:22:20 +0000
@@ -138,13 +138,16 @@
         id: pickerLoader
 
         source: {
+            if (!root.detailsShown) {
+                return "";
+            }
+
             switch(root.detailToPick) {
             case ContactDetail.PhoneNumber:
             default:
                 return Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")
             }
         }
-        active: contact && root.detailsShown
         asynchronous: true
         anchors {
             top: delegate.bottom
@@ -158,11 +161,21 @@
         }
 
         onStatusChanged: {
-            if ((status == Loader.Ready) && contact) {
+            if (status == Loader.Ready) {
                 pickerLoader.item.updateDetails(contact)
                 pickerLoader.item.detailClicked.connect(root._onDetailClicked)
             }
         }
+
+        // update delegate if contact update
+        Connections {
+            target: contact
+            onContactChanged: {
+                if (pickerLoader.item) {
+                    pickerLoader.item.updateDetails(contact)
+                }
+            }
+        }
     }
 
     Behavior on height {

=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml	2014-07-07 22:20:38 +0000
+++ src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml	2014-07-15 21:22:20 +0000
@@ -17,6 +17,7 @@
 import QtQuick 2.2
 import Ubuntu.Components.ListItems 0.1 as ListItem
 import Ubuntu.Components 0.1
+import QtContacts 5.0 as QtContacts
 
 Item {
     id: root
@@ -31,7 +32,9 @@
 
     function updateDetails(contact)
     {
-        phoneNumberEntries.model = contact.phoneNumbers
+        if (contact) {
+            phoneNumberEntries.model = contact.details(QtContacts.ContactDetail.PhoneNumber)
+        }
     }
 
     height: detailItems.height + units.gu(2)
@@ -56,7 +59,6 @@
         Repeater {
             id: phoneNumberEntries
 
-            model: contact.phoneNumbers
             ListItem.Subtitled {
                 anchors {
                     left: parent.left
@@ -66,7 +68,7 @@
                 showDivider: false
                 // TODO: change text font color to UbuntuColors.lightAubergine
                 // see bug #1324128
-                text: number
+                text: modelData.number
                 subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label
                 onClicked: root.detailClicked(modelData, "")
 

=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml	2014-07-09 22:24:55 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml	2014-07-15 21:22:20 +0000
@@ -401,6 +401,7 @@
                 var areaY = view.contentY
                 if (itemY < areaY) {
                     view.contentY = itemY
+                    view.returnToBounds()
                 }
             }
 
@@ -411,16 +412,22 @@
             height: visible ? childrenRect.height : 0
             visible: view.favouritesIsSelected && (callerRepeat.count > 0)
             onHeightChanged: {
-                // make selected item fully visible
                 if (calledModel.currentIndex != -1) {
                     mostCalledView.makeItemVisible(callerRepeat.itemAt(calledModel.currentIndex))
-                } else {
-                    // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
-                    // this should fix the Y position (630 is the header height)
-                    view.contentY = -630
                 }
             }
 
+            // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
+            // calling the positionViewAtBeginning after the list created fix that
+            Timer {
+                id: moveToBegining
+
+                interval: 100
+                running: false
+                repeat: false
+                onTriggered: view.positionViewAtBeginning()
+            }
+
             Rectangle {
                 color: Theme.palette.normal.background
                 anchors {
@@ -453,6 +460,7 @@
 
                     onVisibleChanged: {
                         // update the model every time that it became visible
+                        // in fact calling update only reloads the model data if it has changed
                         if (visible) {
                             model.update()
                         }
@@ -465,6 +473,10 @@
                             view.currentIndex = -1
                         }
                     }
+
+                    // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
+                    // calling the positionViewAtBeginning after the list created fix that
+                    onLoaded: moveToBegining.restart()
                 }
             }
 
@@ -624,8 +636,8 @@
         id: fastScroll
 
         listView: view
-        // only enable FastScroll if the we have more than 2 pages of content
-        enabled: view.contentHeight > (view.height * 2)
+        // only enable FastScroll if the we have more than 2 pages of content and sections is enabled
+        enabled: showSections && (view.contentHeight > (view.height * 2))
 
         anchors {
             top: view.top

=== modified file 'src/imports/Ubuntu/Contacts/ListItemWithActions.qml'
--- src/imports/Ubuntu/Contacts/ListItemWithActions.qml	2014-07-05 01:00:05 +0000
+++ src/imports/Ubuntu/Contacts/ListItemWithActions.qml	2014-07-15 21:22:20 +0000
@@ -31,6 +31,8 @@
     default property alias contents: main.children
 
     readonly property double actionWidth: units.gu(5)
+    readonly property double leftActionWidth: units.gu(10)
+    readonly property double actionThreshold: actionWidth * 0.4
     readonly property double threshold: 0.4
     readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
     readonly property alias swipping: mainItemMoving.running
@@ -40,27 +42,20 @@
 
     function returnToBoundsRTL()
     {
+        var actionFullWidth = actionWidth + units.gu(2)
         var xOffset = Math.abs(main.x)
-        var actionFullWidth = actionWidth + units.gu(1)
+        var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
 
-        if (xOffset < actionFullWidth) {
+        if (index < 1) {
             main.x = 0
-        } else if (xOffset > (actionFullWidth * rightActionsRepeater.count)) {
-            main.x = - (actionFullWidth * rightActionsRepeater.count)
         } else {
-            for (var i = rightActionsRepeater.count; i >= 2; i--) {
-                if (xOffset >= (actionFullWidth * i)) {
-                    main.x = -(actionWidth * i)
-                    return
-                }
-            }
-            main.x = -actionWidth
+            main.x = -(actionFullWidth * index)
         }
     }
 
     function returnToBoundsLTR()
     {
-        var finalX = leftActionView.width
+        var finalX = leftActionWidth
         if (main.x > (finalX * root.threshold))
             main.x = finalX
         else
@@ -99,16 +94,14 @@
 
     function updateActiveAction()
     {
-        var xOffset = Math.abs(main.x)
-        if (main.x < 0) {
-            for (var i = rightActionsRepeater.count - 1; i >= 0; i--) {
-                var child = rightActionsRepeater.itemAt(i)
-                var childOffset = rightActionsView.width - child.x
-                if (xOffset <= childOffset) {
-                    root.activeItem = child
-                    root.activeAction = root.rightSideActions[i]
-                    return
-                }
+        if (main.x <= -root.actionWidth) {
+            var actionFullWidth = actionWidth + units.gu(2)
+            var xOffset = Math.abs(main.x)
+            var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
+            index = index - 1
+            if (index > -1) {
+                root.activeItem = rightActionsRepeater.itemAt(index)
+                root.activeAction = root.rightSideActions[index]
             }
         } else {
             root.activeAction = null
@@ -129,14 +122,17 @@
         anchors {
             top: parent.top
             bottom: parent.bottom
-            left: parent.left
+            right: main.left
         }
-        width: height
+        width: root.leftActionWidth + actionThreshold
         visible: leftSideAction
         color: "red"
 
         Icon {
-            anchors.centerIn: parent
+            anchors {
+                centerIn: parent
+                horizontalCenterOffset: actionThreshold / 2
+            }
             name: leftSideAction ? leftSideAction.iconName : ""
             color: Theme.palette.selected.field
             height: units.gu(3)
@@ -149,13 +145,14 @@
 
        anchors {
            top: main.top
-           right: parent.right
+           left: main.right
+           leftMargin: units.gu(1)
            bottom: main.bottom
        }
-       width: rightActionsRepeater.count * (root.actionWidth + units.gu(1))
+       width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + actionThreshold : 0
        Row {
            anchors.fill: parent
-           spacing: units.gu(1)
+           spacing: units.gu(2)
            Repeater {
                id: rightActionsRepeater
 
@@ -227,11 +224,6 @@
                 easing {type: Easing.InOutBack; }
             }
         }
-        ScriptAction {
-            script: {
-                root.activeAction.triggered(root)
-            }
-        }
         PropertyAction {
             target: triggerAction.currentItem
             properties: "width, height"
@@ -249,6 +241,11 @@
             easing.type: Easing.OutElastic
             duration: UbuntuAnimation.SlowDuration
         }
+        ScriptAction {
+            script: {
+                root.activeAction.triggered(root)
+            }
+        }
     }
 
     MouseArea {

=== modified file 'src/imports/Ubuntu/Contacts/MostCalledModel.qml'
--- src/imports/Ubuntu/Contacts/MostCalledModel.qml	2014-07-03 19:35:30 +0000
+++ src/imports/Ubuntu/Contacts/MostCalledModel.qml	2014-07-15 21:22:20 +0000
@@ -25,14 +25,18 @@
 
     property var contactModel: null
     property int currentIndex: -1
+    property alias callAverage: mostCalledModel.callAverage
 
     signal clicked(int index, QtObject contact)
     signal detailClicked(QtObject contact, QtObject detail, string action)
     signal infoRequested(int index, QtObject contact)
     signal addContactClicked(string label)
+    signal loaded()
 
 
     model: MostCalledContactsModel {
+        id: mostCalledModel
+
         startInterval: new Date((new Date().getTime() - 2592000000)) // one month ago
         sourceModel: HistoryEventModel {
             type: HistoryThreadModel.EventTypeVoice
@@ -46,6 +50,7 @@
                 matchFlags: HistoryFilter.MatchCaseSensitive
             }
         }
+        onLoaded: root.loaded()
     }
 
     delegate: ContactDelegate {

=== modified file 'src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp'
--- src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp	2014-07-02 01:43:06 +0000
+++ src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp	2014-07-15 21:22:20 +0000
@@ -272,8 +272,7 @@
         qSort(data.begin(), data.end(), mostCalledContactsModelDataLessThan);
 
         // average
-        m_average = totalCalls / contactsData.size();
-
+        m_average = qRound(((qreal) (totalCalls)) / contactsData.size());
         Q_FOREACH(const MostCalledContactsModelData &d, data) {
             if (d.callCount >= m_average) {
                 m_data << d;
@@ -286,6 +285,8 @@
 
     Q_EMIT endResetModel();
     m_reloadingModel = false;
+    Q_EMIT callAverageChanged(m_average);
+    Q_EMIT loaded();
 }
 
 void MostCalledContactsModel::markAsOutdated()

=== modified file 'src/imports/Ubuntu/Contacts/mostcalledproxymodel.h'
--- src/imports/Ubuntu/Contacts/mostcalledproxymodel.h	2014-07-02 01:43:06 +0000
+++ src/imports/Ubuntu/Contacts/mostcalledproxymodel.h	2014-07-15 21:22:20 +0000
@@ -73,6 +73,7 @@
     void startIntervalChanged(const QDateTime &value);
     void sourceModelChanged(QAbstractItemModel *value);
     void outdatedChange(bool value);
+    void loaded();
 
 private Q_SLOTS:
     void markAsOutdated();

