Merge lp:~renatofilho/address-book-app/fix-1199109 into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Bill Filler
Approved revision: 13
Merged at revision: 13
Proposed branch: lp:~renatofilho/address-book-app/fix-1199109
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/fix-1199107
Diff against target: 121 lines (+7/-81)
3 files modified
src/imports/ContactList/CMakeLists.txt (+0/-1)
src/imports/ContactList/ContactList.js (+0/-45)
src/imports/ContactList/ContactList.qml (+7/-35)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1199109
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+174312@code.launchpad.net

Commit message

Use single click to show contact details.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

Not working right. Single click always opens the details of the first contact in the list no matter which one you click on. Looks like the first contact is shown in a selected state. Should not be any selected state at all.

review: Needs Fixing
11. By Renato Araujo Oliveira Filho

Removed missing files, and fixed one click to edit contacts.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
12. By Renato Araujo Oliveira Filho

Does not select any contact.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
13. By Renato Araujo Oliveira Filho

Merged mailine.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/imports/ContactList/CMakeLists.txt'
--- src/imports/ContactList/CMakeLists.txt 2013-07-12 00:13:01 +0000
+++ src/imports/ContactList/CMakeLists.txt 2013-07-12 23:49:26 +0000
@@ -1,5 +1,4 @@
1set(CONTACT_LIST_QMLS1set(CONTACT_LIST_QMLS
2 ContactList.js
3 ContactList.qml2 ContactList.qml
4)3)
54
65
=== removed file 'src/imports/ContactList/ContactList.js'
--- src/imports/ContactList/ContactList.js 2013-07-12 00:13:01 +0000
+++ src/imports/ContactList/ContactList.js 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17var sectionData = [];
18var _sections = [];
19
20function initSectionData(list) {
21 if (!list || !list.model) {
22 return;
23 }
24
25 sectionData = [];
26 _sections = [];
27
28 var current = "",
29 prop = list.section.property,
30 item;
31
32 for (var i = 0, count = list.model.contacts.length; i < count; i++) {
33 item = list.sectionValueForContact(list.model.contacts[i])
34 if (item !== current) {
35 current = item;
36 _sections.push(current);
37 sectionData.push({ index: i, header: current });
38 }
39 }
40}
41
42function getIndexFor(sectionName) {
43 var val = sectionData[_sections.indexOf(sectionName)].index;
44 return val === 0 || val > 0 ? val : -1;
45}
460
=== modified file 'src/imports/ContactList/ContactList.qml'
--- src/imports/ContactList/ContactList.qml 2013-07-12 22:06:54 +0000
+++ src/imports/ContactList/ContactList.qml 2013-07-12 23:49:26 +0000
@@ -20,8 +20,6 @@
20import Ubuntu.Components.ListItems 0.1 as ListItem20import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components.Popups 0.1 as Popups21import Ubuntu.Components.Popups 0.1 as Popups
2222
23import "ContactList.js" as Sections
24
25Page {23Page {
26 id: mainPage24 id: mainPage
2725
@@ -115,41 +113,15 @@
115 }113 }
116114
117 delegate: ListItem.Subtitled {115 delegate: ListItem.Subtitled {
118 property variant contactObject: contact
119 property string contactId: contact.contactId
120 property string sectionName: ListView.section
121
122 icon: contact && contact.avatar && (contact.avatar.imageUrl != "") ? Qt.resolvedUrl(contact.avatar.imageUrl) : "artwork:/avatar-default.png"116 icon: contact && contact.avatar && (contact.avatar.imageUrl != "") ? Qt.resolvedUrl(contact.avatar.imageUrl) : "artwork:/avatar-default.png"
123 text: contactListView.formatNameToDisplay(contactObject)117 text: contactListView.formatNameToDisplay(contact)
124 subText: contact && contact.phoneNumber ? contact.phoneNumber.number : ""118 subText: contact && contact.phoneNumber ? contact.phoneNumber.number : ""
125 selected: contactListView.currentIndex === index119
126120 onClicked: {
127 MouseArea {121 contactListView.currentIndex = index
128 anchors.fill: parent122 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
129 onClicked: {123 {model: contactsModel, contactId: contact.contactId})
130 contactListView.currentIndex = index124
131 }
132 onDoubleClicked: {
133 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
134 {model: contactsModel, contactId: contactListView.currentItem.contactObject.contactId})
135 }
136 }
137 }
138
139 UbuntuNumberAnimation { id: scroolToSectionAnimation; target: contactListView; property: "contentY"; }
140 function scroolToSection(targetSection) {
141 scroolToSectionAnimation.from = contactListView.contentY
142 contactListView.positionViewAtIndex(Sections.getIndexFor(targetSection), ListView.Beginning)
143 scroolToSectionAnimation.to = contactListView.contentY
144 scroolToSectionAnimation.running = true
145 }
146
147 // function used to build the section cache by "ContactList.js"
148 function sectionValueForContact(contact) {
149 if (contact) {
150 return contact.name && contact.name.firstName ? contact.name.firstName[0] : ""
151 } else {
152 return null
153 }125 }
154 }126 }
155 }127 }

Subscribers

People subscribed via source and target branches