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
1=== modified file 'src/imports/ContactList/CMakeLists.txt'
2--- src/imports/ContactList/CMakeLists.txt 2013-07-12 00:13:01 +0000
3+++ src/imports/ContactList/CMakeLists.txt 2013-07-12 23:49:26 +0000
4@@ -1,5 +1,4 @@
5 set(CONTACT_LIST_QMLS
6- ContactList.js
7 ContactList.qml
8 )
9
10
11=== removed file 'src/imports/ContactList/ContactList.js'
12--- src/imports/ContactList/ContactList.js 2013-07-12 00:13:01 +0000
13+++ src/imports/ContactList/ContactList.js 1970-01-01 00:00:00 +0000
14@@ -1,45 +0,0 @@
15-/*
16- * Copyright (C) 2012-2013 Canonical, Ltd.
17- *
18- * This program is free software; you can redistribute it and/or modify
19- * it under the terms of the GNU General Public License as published by
20- * the Free Software Foundation; version 3.
21- *
22- * This program is distributed in the hope that it will be useful,
23- * but WITHOUT ANY WARRANTY; without even the implied warranty of
24- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25- * GNU General Public License for more details.
26- *
27- * You should have received a copy of the GNU General Public License
28- * along with this program. If not, see <http://www.gnu.org/licenses/>.
29- */
30-
31-var sectionData = [];
32-var _sections = [];
33-
34-function initSectionData(list) {
35- if (!list || !list.model) {
36- return;
37- }
38-
39- sectionData = [];
40- _sections = [];
41-
42- var current = "",
43- prop = list.section.property,
44- item;
45-
46- for (var i = 0, count = list.model.contacts.length; i < count; i++) {
47- item = list.sectionValueForContact(list.model.contacts[i])
48- if (item !== current) {
49- current = item;
50- _sections.push(current);
51- sectionData.push({ index: i, header: current });
52- }
53- }
54-}
55-
56-function getIndexFor(sectionName) {
57- var val = sectionData[_sections.indexOf(sectionName)].index;
58- return val === 0 || val > 0 ? val : -1;
59-}
60
61=== modified file 'src/imports/ContactList/ContactList.qml'
62--- src/imports/ContactList/ContactList.qml 2013-07-12 22:06:54 +0000
63+++ src/imports/ContactList/ContactList.qml 2013-07-12 23:49:26 +0000
64@@ -20,8 +20,6 @@
65 import Ubuntu.Components.ListItems 0.1 as ListItem
66 import Ubuntu.Components.Popups 0.1 as Popups
67
68-import "ContactList.js" as Sections
69-
70 Page {
71 id: mainPage
72
73@@ -115,41 +113,15 @@
74 }
75
76 delegate: ListItem.Subtitled {
77- property variant contactObject: contact
78- property string contactId: contact.contactId
79- property string sectionName: ListView.section
80-
81 icon: contact && contact.avatar && (contact.avatar.imageUrl != "") ? Qt.resolvedUrl(contact.avatar.imageUrl) : "artwork:/avatar-default.png"
82- text: contactListView.formatNameToDisplay(contactObject)
83+ text: contactListView.formatNameToDisplay(contact)
84 subText: contact && contact.phoneNumber ? contact.phoneNumber.number : ""
85- selected: contactListView.currentIndex === index
86-
87- MouseArea {
88- anchors.fill: parent
89- onClicked: {
90- contactListView.currentIndex = index
91- }
92- onDoubleClicked: {
93- pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
94- {model: contactsModel, contactId: contactListView.currentItem.contactObject.contactId})
95- }
96- }
97- }
98-
99- UbuntuNumberAnimation { id: scroolToSectionAnimation; target: contactListView; property: "contentY"; }
100- function scroolToSection(targetSection) {
101- scroolToSectionAnimation.from = contactListView.contentY
102- contactListView.positionViewAtIndex(Sections.getIndexFor(targetSection), ListView.Beginning)
103- scroolToSectionAnimation.to = contactListView.contentY
104- scroolToSectionAnimation.running = true
105- }
106-
107- // function used to build the section cache by "ContactList.js"
108- function sectionValueForContact(contact) {
109- if (contact) {
110- return contact.name && contact.name.firstName ? contact.name.firstName[0] : ""
111- } else {
112- return null
113+
114+ onClicked: {
115+ contactListView.currentIndex = index
116+ pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
117+ {model: contactsModel, contactId: contact.contactId})
118+
119 }
120 }
121 }

Subscribers

People subscribed via source and target branches