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

Proposed by Renato Araujo Oliveira Filho
Status: Rejected
Rejected by: Bill Filler
Proposed branch: lp:~renatofilho/address-book-app/fix-1207772
Merge into: lp:address-book-app
Diff against target: 212 lines (+144/-1)
7 files modified
src/imports/ContactEdit/CMakeLists.txt (+1/-0)
src/imports/ContactEdit/ContactDetailDateOfBirthEditor.qml (+72/-0)
src/imports/ContactEdit/ContactEditor.qml (+9/-0)
src/imports/ContactEdit/TextInputDetail.qml (+7/-1)
src/imports/ContactView/CMakeLists.txt (+1/-0)
src/imports/ContactView/ContactDetailDateOfBirthView.qml (+45/-0)
src/imports/ContactView/ContactView.qml (+9/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1207772
Reviewer Review Type Date Requested Status
Bartosz Kosiorek (community) Needs Information
Bill Filler (community) Needs Fixing
PS Jenkins bot continuous-integration Approve
Review via email: mp+185955@code.launchpad.net

Commit message

Added DateOfBirth field into contact edit/view pages.

To post a comment you must log in.
70. By Renato Araujo Oliveira Filho

Added missing files.

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

problems:
1) no section headers displayed anymore after installing this
2) no label on field
3) the field is confusing what to enter
4) the input method hint should be set on the field to only display numbers

review: Needs Fixing
Revision history for this message
Bill Filler (bfiller) wrote :

I think we should not consider merging this until sdk bug https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1226329 is fixed

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Hi Bill.

It seems that the issue was resolved from SDK side.
Could you please continue work on that feature, as it is very important for end users?

review: Needs Information

Unmerged revisions

70. By Renato Araujo Oliveira Filho

Added missing files.

69. By Renato Araujo Oliveira Filho

Added DateOfBirth field into contact edit/view pages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/ContactEdit/CMakeLists.txt'
2--- src/imports/ContactEdit/CMakeLists.txt 2013-08-02 17:40:44 +0000
3+++ src/imports/ContactEdit/CMakeLists.txt 2013-09-17 01:30:24 +0000
4@@ -1,6 +1,7 @@
5 set(CONTACT_EDIT_QMLS
6 ContactDetailAddressesEditor.qml
7 ContactDetailAvatarEditor.qml
8+ ContactDetailDateOfBirthEditor.qml
9 ContactDetailEmailsEditor.qml
10 ContactDetailGroupWithTypeEditor.qml
11 ContactDetailNameEditor.qml
12
13=== added file 'src/imports/ContactEdit/ContactDetailDateOfBirthEditor.qml'
14--- src/imports/ContactEdit/ContactDetailDateOfBirthEditor.qml 1970-01-01 00:00:00 +0000
15+++ src/imports/ContactEdit/ContactDetailDateOfBirthEditor.qml 2013-09-17 01:30:24 +0000
16@@ -0,0 +1,72 @@
17+/*
18+ * Copyright (C) 2012-2013 Canonical, Ltd.
19+ *
20+ * This program is free software; you can redistribute it and/or modify
21+ * it under the terms of the GNU General Public License as published by
22+ * the Free Software Foundation; version 3.
23+ *
24+ * This program is distributed in the hope that it will be useful,
25+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+ * GNU General Public License for more details.
28+ *
29+ * You should have received a copy of the GNU General Public License
30+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31+ */
32+
33+import QtQuick 2.0
34+import Ubuntu.Components 0.1
35+import QtContacts 5.0 as QtContacts
36+
37+import "../Common"
38+
39+ContactDetailItem {
40+ id: root
41+
42+ function save() {
43+ var changed = false;
44+
45+ for(var i=0; i < fieldDelegates.length; i++) {
46+ var delegate = fieldDelegates[i]
47+
48+ // Get item from Loader
49+ if (delegate.item) {
50+ delegate = delegate.item
51+ }
52+
53+ if (delegate.detail && (delegate.field >= 0)) {
54+ var date = new Date(delegate.text)
55+ if ( date != delegate.detail.value(delegate.field)) {
56+ delegate.detail.setValue(delegate.field, date)
57+ changed = true
58+ }
59+ }
60+ }
61+
62+ return changed
63+ }
64+
65+
66+ detail: root.contact ? root.contact.birthday : null
67+ fields: [ QtContacts.Birthday.Birthday ]
68+
69+ fieldDelegate: TextInputDetail {
70+ function formatDetail(value)
71+ {
72+ if (value)
73+ return Qt.formatDateTime(value, i18n.tr("MM/dd/yyyy"))
74+ else
75+ return ""
76+ }
77+
78+ width: root.width - units.gu(4)
79+ x: units.gu(2)
80+ detail: root.detail
81+ height: units.gu(4)
82+ placeholderText: i18n.tr("Date of birth")
83+ //The inputMaks will make the placeholderText never appears
84+ //BUG #1226329
85+ inputMask: i18n.tr("09/09/9999")
86+ inputMethodHints: Qt.ImhDate
87+ }
88+}
89
90=== modified file 'src/imports/ContactEdit/ContactEditor.qml'
91--- src/imports/ContactEdit/ContactEditor.qml 2013-09-12 23:22:06 +0000
92+++ src/imports/ContactEdit/ContactEditor.qml 2013-09-17 01:30:24 +0000
93@@ -142,6 +142,15 @@
94 height: implicitHeight
95 }
96
97+ ContactDetailDateOfBirthEditor {
98+ contact: contactEditor.contact
99+ anchors {
100+ left: parent.left
101+ right: parent.right
102+ }
103+ height: implicitHeight
104+ }
105+
106 ContactDetailPhoneNumbersEditor {
107 contact: contactEditor.contact
108 anchors {
109
110=== modified file 'src/imports/ContactEdit/TextInputDetail.qml'
111--- src/imports/ContactEdit/TextInputDetail.qml 2013-09-12 23:26:39 +0000
112+++ src/imports/ContactEdit/TextInputDetail.qml 2013-09-17 01:30:24 +0000
113@@ -25,10 +25,16 @@
114
115 property QtObject detail
116 property int field: -1
117- property variant originalValue: root.detail && (root.field >= 0) ? root.detail.value(root.field) : null
118+ property variant originalValue: root.detail && (root.field >= 0) ? formatDetail(root.detail.value(root.field)) : null
119
120 signal removeClicked()
121
122+ // rewrite this function to format specific fields into text format. Ex: Date
123+ function formatDetail(value)
124+ {
125+ return value
126+ }
127+
128 Component.onCompleted: makeMeVisible(root)
129
130 focus: true
131
132=== modified file 'src/imports/ContactView/CMakeLists.txt'
133--- src/imports/ContactView/CMakeLists.txt 2013-07-16 21:13:34 +0000
134+++ src/imports/ContactView/CMakeLists.txt 2013-09-17 01:30:24 +0000
135@@ -3,6 +3,7 @@
136 BasicFieldView.qml
137 ContactDetailAddressesView.qml
138 ContactDetailAvatarView.qml
139+ ContactDetailDateOfBirthView.qml
140 ContactDetailEmailsView.qml
141 ContactDetailFavoriteView.qml
142 ContactDetailGroupWithTypeView.qml
143
144=== added file 'src/imports/ContactView/ContactDetailDateOfBirthView.qml'
145--- src/imports/ContactView/ContactDetailDateOfBirthView.qml 1970-01-01 00:00:00 +0000
146+++ src/imports/ContactView/ContactDetailDateOfBirthView.qml 2013-09-17 01:30:24 +0000
147@@ -0,0 +1,45 @@
148+/*
149+ * Copyright (C) 2012-2013 Canonical, Ltd.
150+ *
151+ * This program is free software; you can redistribute it and/or modify
152+ * it under the terms of the GNU General Public License as published by
153+ * the Free Software Foundation; version 3.
154+ *
155+ * This program is distributed in the hope that it will be useful,
156+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
157+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158+ * GNU General Public License for more details.
159+ *
160+ * You should have received a copy of the GNU General Public License
161+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
162+ */
163+
164+import QtQuick 2.0
165+import Ubuntu.Components 0.1
166+import QtContacts 5.0
167+
168+import "../Common"
169+
170+ContactDetailBase {
171+ id: root
172+
173+ // use formatDateTime to check if the date is valid
174+ property bool isEmpty: !(detail && Qt.formatDateTime(detail.birthday) != "")
175+
176+ detail: root.contact ? root.contact.birthday : null
177+ implicitHeight: label.paintedHeight + (label.anchors.margins * 2)
178+
179+ Label {
180+ id: label
181+
182+ anchors {
183+ fill: parent
184+ margins: units.gu(2)
185+ }
186+ text: detail ? Qt.formatDateTime(detail.birthday, i18n.tr("MM/dd/yyyy")) : ""
187+
188+ // style
189+ fontSize: "medium"
190+ color: "#f3f3e7"
191+ }
192+}
193
194=== modified file 'src/imports/ContactView/ContactView.qml'
195--- src/imports/ContactView/ContactView.qml 2013-08-28 17:06:38 +0000
196+++ src/imports/ContactView/ContactView.qml 2013-09-17 01:30:24 +0000
197@@ -81,6 +81,15 @@
198 height: implicitHeight
199 }
200
201+ ContactDetailDateOfBirthView {
202+ contact: root.contact
203+ anchors {
204+ left: parent.left
205+ right: parent.right
206+ }
207+ height: isEmpty ? 0 : implicitHeight
208+ }
209+
210 ContactDetailPhoneNumbersView {
211 contact: root.contact
212 anchors {

Subscribers

People subscribed via source and target branches