I have made the following changes intended for :
  CE:Apps / qmlcontacts

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/6596

Thank You,
Robin Burchell

[This message was auto-generated]

---

Request # 6596:

Messages from BOSS:

State: review at 2012-09-03T12:48:00 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:w00t:branches:CE:Apps / qmlcontacts -> CE:Apps / qmlcontacts
  
changes files:
--------------
--- qmlcontacts.changes
+++ qmlcontacts.changes
@@ -0,0 +1,8 @@
+* Mon Sep 3 2012 Robin Burchell <[email protected]> - 0.3.15
+- Fixes NEMO#394: Import contacts dialog shows always "Imported 0 contacts" 
(by Robin)
+- Fixes NEMO#392: reset sheet state when reopening it (by Robin)
+- Fixes NEMO#394: reset sheet state when reopening it (by Robin)
+- Fixes NEMO#267: On edit page "save" button is enabled even when nothing has 
changed (by Tero Siironen)
+- Fixes NEMO#253: Avatar picker should not default-select an image unless the 
contact already has one (by Tero Siironen)
+- Various performance enhancements/decreasing memory usage (by Robin)
+

old:
----
  qmlcontacts-0.3.14.tar.bz2

new:
----
  qmlcontacts-0.3.15.tar.bz2

spec files:
-----------
--- qmlcontacts.spec
+++ qmlcontacts.spec
@@ -1,6 +1,6 @@
 # 
 # Do NOT Edit the Auto-generated Part!
-# Generated by: spectacle version 0.25
+# Generated by: spectacle version 0.24.1
 # 
 
 Name:       qmlcontacts
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    Contacts application for nemo
-Version:    0.3.14
+Version:    0.3.15
 Release:    1
 Group:      Applications/System
 License:    GPLv2

other changes:
--------------

++++++ qmlcontacts-0.3.14.tar.bz2 -> qmlcontacts-0.3.15.tar.bz2
--- src/qml/AvatarPickerSheet.qml
+++ src/qml/AvatarPickerSheet.qml
@@ -6,8 +6,11 @@
 
 Sheet {
     id: avatarPickerSheet
-    acceptButtonText: "Select"
-    rejectButtonText: "Cancel"
+
+    acceptButtonText: qsTr("Select")
+    rejectButtonText: qsTr("Cancel")
+
+    acceptButtonEnabled: avatarGridView.itemSelected
 
     property Person contact
     signal avatarPicked(string pathToAvatar)
@@ -20,12 +23,14 @@
         GalleryView {
         id: avatarGridView
         property string filePath
+        property bool itemSelected: false
         model: GalleryModel { }
         delegate: GalleryDelegate {
             id: delegateInstance
             MouseArea {
                 anchors.fill: parent
                 onClicked: {
+                    avatarGridView.itemSelected = true
                     avatarGridView.currentIndex = index
                     avatarGridView.filePath = url
                 }
@@ -33,7 +38,7 @@
             Rectangle {
                 color: "blue"
                 opacity: 0.3
-                visible: delegateInstance.GridView.isCurrentItem
+                visible: delegateInstance.GridView.isCurrentItem && 
avatarGridView.itemSelected
                 anchors.fill: parent
             }
         }
@@ -42,6 +47,11 @@
 
     onAccepted: {
         avatarPicked(avatarGridView.filePath)
+        avatarGridView.itemSelected = false
+    }
+
+    onRejected: {
+        avatarGridView.itemSelected = false
     }
 }
 
--- src/qml/ContactCardContentWidget.qml
+++ src/qml/ContactCardContentWidget.qml
@@ -27,16 +27,13 @@
             model: contact.phoneNumbers
             interactive: false
             height: childrenRect.height
-            delegate: Item {
+            delegate: Label {
                 anchors.left: parent.left
                 anchors.right: parent.right
                 height: UiConstants.ListItemHeightDefault
+                text: model.modelData
+                verticalAlignment: Text.AlignVCenter
 
-                Label {
-                    text: model.modelData
-                    anchors.left: parent.left
-                    anchors.verticalCenter: parent.verticalCenter
-                }
                 ButtonRow {
                     width: 220
                     anchors.right: parent.right
@@ -66,16 +63,13 @@
             model: contact.emailAddresses
             interactive: false
             height: childrenRect.height
-            delegate: Item {
+            delegate: Label {
                 anchors.left: parent.left
                 anchors.right: parent.right
                 height: UiConstants.ListItemHeightDefault
+                text: model.modelData
+                verticalAlignment: Text.AlignVCenter
 
-                Label {
-                    text: model.modelData
-                    anchors.left: parent.left
-                    anchors.verticalCenter: parent.verticalCenter
-                }
                 Button {
                     width: 110
                     anchors.right: parent.right
--- src/qml/ContactEditorSheet.qml
+++ src/qml/ContactEditorSheet.qml
@@ -6,8 +6,13 @@
 
 Sheet {
     id: newContactViewPage
-    acceptButtonText: "Save"
-    rejectButtonText: "Cancel"
+
+    acceptButtonText: qsTr("Save")
+    rejectButtonText: qsTr("Cancel")
+
+    acceptButtonEnabled: data_first.edited || data_last.edited ||
+                                 data_avatar.edited || phoneRepeater.edited ||
+                                 emailRepeater.edited
 
     property Person contact
 
@@ -23,6 +28,10 @@
         data_first.text = contact.firstName
         data_last.text = contact.lastName
         data_avatar.contact = contact
+        if (contact.avatarPath != 
"image://theme/icon-m-telephony-contact-avatar" )
+            data_avatar.originalSource = "image://nemothumbnail/" + 
contact.avatarPath
+        else
+            data_avatar.originalSource = contact.avatarPath
 
         phoneRepeater.setModelData(contact.phoneNumbers)
         emailRepeater.setModelData(contact.emailAddresses)
@@ -56,6 +65,8 @@
                 }
                 ContactAvatarImage {
                     id: data_avatar
+                    property string originalSource
+                    property bool edited: source != originalSource
                     width: parent.width - UiConstants.DefaultMargin
                     height: parent.height - UiConstants.DefaultMargin
                     anchors.centerIn: parent
@@ -65,11 +76,13 @@
             TextField {
                 id: data_first
                 placeholderText: qsTr("First name")
+                property bool edited: text != contact.firstName
                 anchors { top: avatarRect.top; right: parent.right; left: 
avatarRect.right; leftMargin: UiConstants.DefaultMargin }
             }
             TextField {
                 id: data_last
                 placeholderText: qsTr("Last name")
+                property bool edited: text != contact.lastName
                 anchors { top: data_first.bottom;
                     topMargin: UiConstants.DefaultMargin;
                     right: parent.right; left: data_first.left
--- src/qml/ContactImportSheet.qml
+++ src/qml/ContactImportSheet.qml
@@ -10,29 +10,30 @@
     acceptButtonText: "Import"
     rejectButtonText: "Cancel"
 
-    content: Item {
+    onStatusChanged: {
+        if (status == DialogStatus.Opening) {
+            sheetContent.fileName = ""
+            folderListModel.refresh()
+        }
+    }
+
+    content: ListView {
         id: sheetContent
-        anchors.leftMargin: UiConstants.DefaultMargin
-        anchors.rightMargin: UiConstants.DefaultMargin
         anchors.fill: parent
         property string fileName
 
-        ListView {
-            anchors.fill: parent
-
-            model: FolderListModel {
-                id: folderListModel
-                path: DocumentsLocation
-                showDirectories: false
-                nameFilters: [ "*.vcf" ]
-            }
+        model: FolderListModel {
+            id: folderListModel
+            path: DocumentsLocation
+            showDirectories: false
+            nameFilters: [ "*.vcf" ]
+        }
 
-            delegate: FileListDelegate {
-                selected: sheetContent.fileName == model.fileName
-                onClicked: {
-                    sheetContent.fileName = model.fileName
-                    console.log(model.fileName)
-                }
+        delegate: FileListDelegate {
+            selected: sheetContent.fileName == model.fileName
+            onClicked: {
+                sheetContent.fileName = model.fileName
+                console.log(model.fileName)
             }
         }
     }
@@ -42,11 +43,9 @@
     function doImport() {
         // TODO: would be nice if folderlistmodel had a role for the full
         // resolved path
-        var count = app.contactListModel.count
         console.log("Importing " + sheetContent.fileName)
-        app.contactListModel.importContacts(folderListModel.path + "/" + 
sheetContent.fileName)
-        var newCount = app.contactListModel.count
-        importCompletedDialog.contactCount = newCount - count
+        var count = app.contactListModel.importContacts(folderListModel.path + 
"/" + sheetContent.fileName)
+        importCompletedDialog.contactCount = count
         importCompletedDialog.open()
     }
 
--- src/qml/ContactListPage.qml
+++ src/qml/ContactListPage.qml
@@ -24,6 +24,7 @@
         anchors.left: parent.left
         anchors.right: parent.right
         anchors.bottom: parent.bottom
+        clip: true
         onAddNewContact: {
             Constants.loadSingleton("ContactEditorSheet.qml", groupedViewPage,
             function(editor) {
--- src/qml/EditableList.qml
+++ src/qml/EditableList.qml
@@ -5,6 +5,8 @@
 Repeater {
     id: root
     property string placeholderText
+    property bool edited : false
+    property variant originalData
     model: ListModel {
     }
     property bool isSetup: false
@@ -18,6 +20,7 @@
         }
 
         model.append({ data: "" })
+        originalData = modelData
         isSetup = true
     }
 
@@ -47,6 +50,14 @@
             } else if (text == "" && index != (root.model.count - 1)) {
                 root.model.remove(index)
             }
+            if (!root.originalData[index] && text != "") {
+                edited = true
+            } else if(root.originalData[index] && root.originalData[index] != 
text) {
+                edited = true
+            }
+            else {
+                edited = false
+            }
         }
     }
 }
--- src/qml/api/ContactListDelegate.qml
+++ src/qml/api/ContactListDelegate.qml
@@ -1,23 +1,44 @@
 /*
- * Copyright 2011 Intel Corporation.
+ * Copyright (C) 2011-2012 Robin Burchell <[email protected]>
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at     
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * "Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *   * Neither the name of Nemo Mobile nor the names of its contributors
+ *     may be used to endorse or promote products derived from this
+ *     software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  */
 
 import QtQuick 1.1
 import com.nokia.meego 1.0
 
-Item {
-    id: contactCardPortrait
+MouseArea {
+    id: listDelegate
 
     height: UiConstants.ListItemHeightDefault
     anchors.right: parent.right
     anchors.left: parent.left
 
-    signal clicked
-
     ContactAvatarImage {
         id: photo
         contact: model.person
@@ -50,17 +71,9 @@
         anchors.verticalCenter: parent.verticalCenter
     }
 
-    MouseArea {
-        id: mouseArea
-        anchors.fill: contactCardPortrait
-        onClicked: {
-            contactCardPortrait.clicked();
-        }
-    }
-
     states: State {
-        name: "pressed"; when: mouseArea.pressed == true
-        PropertyChanges { target: contactCardPortrait; opacity: .7}
+        name: "pressed"; when: pressed == true
+        PropertyChanges { target: listDelegate; opacity: .7}
     }
 
 }
--- src/qml/api/ContactListWidget.qml
+++ src/qml/api/ContactListWidget.qml
@@ -1,47 +1,76 @@
 /*
- * Copyright 2011 Intel Corporation.
+ * Copyright (C) 2011-2012 Robin Burchell <[email protected]>
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at     
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * "Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *   * Neither the name of Nemo Mobile nor the names of its contributors
+ *     may be used to endorse or promote products derived from this
+ *     software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  */
 
 import QtQuick 1.1
 import com.nokia.meego 1.0
 
-Item {
+ListView {
     id: groupedViewPortrait
-    property alias model: cardListView.model
-    property alias delegate: cardListView.delegate
-
-    width: parent.width
-    height: parent.height
 
     signal addNewContact
-    signal pressAndHold(int x, int y)
 
-    property alias cards: cardListView
+    cacheBuffer: height
+    section.property: "sectionBucket"
+    section.criteria: ViewSection.FirstCharacter
+    section.delegate: Component {
+        Rectangle {
+            width: parent.width
+            height: childrenRect.height
+            color: "lightsteelblue"
+
+            Text {
+                anchors.right: parent.right
+                anchors.rightMargin: UiConstants.DefaultMargin
+                text: section
+                font.bold: true
+            }
+        }
+    }
 
-    Item {
+    Label {
         // TODO: it would be nice if this was only instantiated
         // when needed, and destroyed after
         id: emptyListView
-        anchors.fill: parent
-
-        Label {
-            id: no_contacts
-            text: qsTr("You haven't added any contacts yet.")
-            anchors.centerIn: parent
-        }
+        visible: parent.count == 0
+        anchors.centerIn: parent
+        text: qsTr("You haven't added any contacts yet.")
 
         Button {
             id: button
             text: qsTr("Add a contact")
 
             anchors {
-                top: no_contacts.bottom;
+                top: parent.bottom;
                 topMargin: UiConstants.DefaultMargin;
-                horizontalCenter: no_contacts.horizontalCenter;
+                horizontalCenter: parent.horizontalCenter;
             }
             onClicked: {
                 groupedViewPortrait.addNewContact();
@@ -49,69 +78,11 @@
         }
     }
 
-    ListView {
-        id: cardListView
-        anchors.fill: parent
-        cacheBuffer: cardListView.height
-        clip: true
-        model: app.contactListModel
-        opacity: 0
-        section.property: "sectionBucket"
-        section.criteria: ViewSection.FirstCharacter
-        section.delegate: Component {
-         Rectangle {
-             width: parent.width
-             height: childrenRect.height
-             color: "lightsteelblue"
-
-             Text {
-                 anchors.right: parent.right
-                 anchors.rightMargin: UiConstants.DefaultMargin
-                 text: section
-                 font.bold: true
-             }
-         }
-        }
-
-/*
-        function customSectionScrollerDataHandler() {
-            var sections = []
-            var sectionsData = []
-            var curSection
-            for (var i = 0; i < model.length; ++i) {
-                var person = model.personByRow(i)
-                if (person.sectionCharacter != curSection) {
-                    sections.push(person.sectionCharacter)
-                    curSection = sections[sections.length - 1]
-                }
-            }
-            for (var i = 0; i < sections.length; ++i) {
-                sectionsData.push({ index: i })
-            }
-            return {
-                sectionData: sectionsData,
-                _sections: sections
-            }
-        }
-        */
-    }
-
     SectionScroller {
-        listView: cardListView
+        listView: parent
     }
 
     ScrollDecorator {
-        flickableItem: cardListView
-    }
-
-    Binding {
-        target: emptyListView;
-        property: "opacity";
-        value: ((cardListView.count == 0) ? 1 : 0);
-    }
-    Binding {
-        target: cardListView;
-        property: "opacity";
-        value: ((cardListView.count > 0) ? 1 : 0);
+        flickableItem: parent
     }
 }

++++++ qmlcontacts.yaml
--- qmlcontacts.yaml
+++ qmlcontacts.yaml
@@ -1,6 +1,6 @@
 Name:  qmlcontacts
 Summary: Contacts application for nemo
-Version: 0.3.14
+Version: 0.3.15
 Release: 1
 Group: Applications/System
 License: GPLv2



Reply via email to