Merge lp:~renatofilho/dialer-app/favorites-contacts into lp:dialer-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 219
Merged at revision: 222
Proposed branch: lp:~renatofilho/dialer-app/favorites-contacts
Merge into: lp:dialer-app
Diff against target: 180 lines (+141/-2)
2 files modified
src/qml/ContactsPage/ContactsPage.qml (+136/-2)
src/qml/dialer-app.qml (+5/-0)
To merge this branch: bzr merge lp:~renatofilho/dialer-app/favorites-contacts
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+230543@code.launchpad.net

Commit message

Add header section on ContactsPage to allow the user to switch between the "all" and "favorites" contacts.
Add an "Add new" button on contact list header.

To post a comment you must log in.
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Are there any related MPs required for this MP to build/function as expected? NO

Is your branch in sync with latest trunk? YES

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES

Did you successfully run all tests found in your component's Test Plan on device or emulator? YES

If you changed the UI, was the change specified/approved by design? YES

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP? NO PACKAGE

218. By Renato Araujo Oliveira Filho

use i18n.tr for strings on page header section.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

10 - property QtObject contact
11 + property QtObject contact

This change is not needed and breaks indentation.

review: Needs Fixing
219. By Renato Araujo Oliveira Filho

Fixed identation.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
No, but the failure is not related to this MR

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/ContactsPage/ContactsPage.qml'
2--- src/qml/ContactsPage/ContactsPage.qml 2014-08-01 14:59:45 +0000
3+++ src/qml/ContactsPage/ContactsPage.qml 2014-08-13 15:18:51 +0000
4@@ -26,10 +26,12 @@
5 Page {
6 id: contactsPage
7 objectName: "contactsPage"
8+
9+ property QtObject contact
10+
11 title: i18n.tr("Contacts")
12- property QtObject contact
13
14- __customHeaderContents: TextField {
15+ TextField {
16 id: searchField
17
18 anchors {
19@@ -44,6 +46,77 @@
20 onTextChanged: contactList.currentIndex = -1
21 inputMethodHints: Qt.ImhNoPredictiveText
22 placeholderText: i18n.tr("Search...")
23+ visible: false
24+ }
25+
26+ state: "default"
27+ states: [
28+ PageHeadState {
29+ id: defaultState
30+
31+ name: "default"
32+ actions: [
33+ Action {
34+ text: i18n.tr("Search")
35+ iconName: "search"
36+ onTriggered: {
37+ contactsPage.state = "searching"
38+ searchField.forceActiveFocus()
39+ }
40+ }
41+ ]
42+ PropertyChanges {
43+ target: contactsPage.head
44+ actions: defaultState.actions
45+ sections.model: [i18n.tr("All"), i18n.tr("Favorites")]
46+ }
47+ PropertyChanges {
48+ target: searchField
49+ text: ""
50+ visible: false
51+ }
52+ },
53+ PageHeadState {
54+ id: searchingState
55+
56+ name: "searching"
57+ backAction: Action {
58+ iconName: "close"
59+ text: i18n.tr("Cancel")
60+ onTriggered: {
61+ contactList.forceActiveFocus()
62+ contactsPage.state = "default"
63+ }
64+ }
65+
66+ PropertyChanges {
67+ target: contactsPage.head
68+ backAction: searchingState.backAction
69+ contents: searchField
70+ }
71+
72+ PropertyChanges {
73+ target: searchField
74+ text: ""
75+ visible: true
76+ }
77+ }
78+ ]
79+
80+ Connections {
81+ target: contactsPage.head.sections
82+ onSelectedIndexChanged: {
83+ switch (contactsPage.head.sections.selectedIndex) {
84+ case 0:
85+ contactList.showAllContacts()
86+ break;
87+ case 1:
88+ contactList.showFavoritesContacts()
89+ break;
90+ default:
91+ break;
92+ }
93+ }
94 }
95
96 // background
97@@ -61,6 +134,67 @@
98 right: parent.right
99 bottom: keyboardRect.top
100 }
101+
102+
103+ header: Item {
104+ id: addNewContactButton
105+ objectName: "addNewContact"
106+
107+ anchors {
108+ left: parent.left
109+ right: parent.right
110+ }
111+ height: units.gu(8)
112+
113+ Rectangle {
114+ anchors.fill: parent
115+ color: Theme.palette.selected.background
116+ opacity: addNewContactButtonArea.pressed ? 1.0 : 0.0
117+ }
118+
119+ UbuntuShape {
120+ id: addIcon
121+
122+ anchors {
123+ left: parent.left
124+ top: parent.top
125+ bottom: parent.bottom
126+ margins: units.gu(1)
127+ }
128+ width: height
129+ radius: "medium"
130+ color: Theme.palette.normal.overlay
131+ Image {
132+ anchors.centerIn: parent
133+ width: units.gu(2)
134+ height: units.gu(2)
135+ source: "image://theme/add"
136+ }
137+ }
138+
139+ Label {
140+ id: name
141+
142+ anchors {
143+ left: addIcon.right
144+ leftMargin: units.gu(2)
145+ verticalCenter: parent.verticalCenter
146+ right: parent.right
147+ rightMargin: units.gu(2)
148+ }
149+ color: UbuntuColors.lightAubergine
150+ text: i18n.tr("+ Create New")
151+ elide: Text.ElideRight
152+ }
153+
154+ MouseArea {
155+ id: addNewContactButtonArea
156+
157+ anchors.fill: parent
158+ onClicked: mainView.createNewContactForPhone(" ")
159+ }
160+ }
161+
162 onInfoRequested: {
163 mainView.viewContact(contact.contactId)
164 }
165
166=== modified file 'src/qml/dialer-app.qml'
167--- src/qml/dialer-app.qml 2014-08-01 14:59:45 +0000
168+++ src/qml/dialer-app.qml 2014-08-13 15:18:51 +0000
169@@ -84,6 +84,11 @@
170 return false;
171 }
172
173+ function createNewContactForPhone(phoneNumber)
174+ {
175+ Qt.openUrlExternally("addressbook:///create?callback=dialer-app.desktop&phone=" + encodeURIComponent(phoneNumber))
176+ }
177+
178 function viewContact(contactId) {
179 Qt.openUrlExternally("addressbook:///contact?callback=dialer-app.desktop&id=" + encodeURIComponent(contactId))
180 }

Subscribers

People subscribed via source and target branches