Merge lp:~rsalveti/kubuntu-packaging/qtpim-opensource-src-upstream-snapshot into lp:~kubuntu-packagers/kubuntu-packaging/qtpim-opensource-src

Proposed by Ricardo Salveti
Status: Merged
Merged at revision: 21
Proposed branch: lp:~rsalveti/kubuntu-packaging/qtpim-opensource-src-upstream-snapshot
Merge into: lp:~kubuntu-packagers/kubuntu-packaging/qtpim-opensource-src
Diff against target: 387 lines (+369/-0)
3 files modified
debian/changelog (+9/-0)
debian/patches/added-support-to-preferreddetails-on-qml-contact.patch (+359/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~rsalveti/kubuntu-packaging/qtpim-opensource-src-upstream-snapshot
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
Kubuntu Packagers Pending
Review via email: mp+177059@code.launchpad.net

Commit message

New upstream snapshot, bringing a few important fixes from Renato.

Also adding patch https://codereview.qt-project.org/#change,61289, required by the addressbook (patch still in review by upstream).

To post a comment you must log in.
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Source package at http://people.canonical.com/~rsalveti/qtpim/, in case bzr merge can't see the imported upstream tarball.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

this last patch is on the way to get merged. But since wee need this for the next week. I am fine with that.
Thanks.

review: Approve
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Thank you :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-07-11 06:56:01 +0000
3+++ debian/changelog 2013-07-25 22:18:33 +0000
4@@ -1,3 +1,12 @@
5+qtpim-opensource-src (5.0~git20130723-0ubuntu1) UNRELEASED; urgency=low
6+
7+ * New upstream snapshot release
8+ - Fixes QTBUG-32142, QTBUG-32324 and QTBUG-32561
9+ * debian/patches/added-support-to-preferreddetails-on-qml-contact.patch:
10+ - Added support to preferredDetails on QML Contact.
11+
12+ -- Ricardo Salveti de Araujo <ricardo.salveti@canonical.com> Thu, 25 Jul 2013 18:41:12 -0300
13+
14 qtpim-opensource-src (5.0~git20130701-0ubuntu1) saucy; urgency=low
15
16 * New upstream snapshot release.
17
18=== added file 'debian/patches/added-support-to-preferreddetails-on-qml-contact.patch'
19--- debian/patches/added-support-to-preferreddetails-on-qml-contact.patch 1970-01-01 00:00:00 +0000
20+++ debian/patches/added-support-to-preferreddetails-on-qml-contact.patch 2013-07-25 22:18:33 +0000
21@@ -0,0 +1,359 @@
22+From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
23+Date: Fri, 19 Jul 2013 15:23:01 -0300
24+Subject: Added support to preferredDetails on QML Contact.
25+
26+Expose all functions related with preferredDetails
27+into QML contacts.
28+
29+Task-number: QTBUG-32515
30+
31+Review: https://codereview.qt-project.org/#change,61289
32+---
33+ .../contacts/qmlcontactslistview/ContactEditor.qml | 39 +++++--
34+ .../qmlcontactslistview/DetailEditWidget.qml | 35 +++++++
35+ src/imports/contacts/qdeclarativecontact.cpp | 114 +++++++++++++++++++++
36+ src/imports/contacts/qdeclarativecontact_p.h | 9 ++
37+ 4 files changed, 191 insertions(+), 6 deletions(-)
38+
39+diff --git a/examples/contacts/qmlcontactslistview/ContactEditor.qml b/examples/contacts/qmlcontactslistview/ContactEditor.qml
40+index 81e5f97..9cce579 100644
41+--- a/examples/contacts/qmlcontactslistview/ContactEditor.qml
42++++ b/examples/contacts/qmlcontactslistview/ContactEditor.qml
43+@@ -39,9 +39,25 @@ Rectangle {
44+ leftMargin: 10
45+ topMargin: 10
46+ }
47+- DetailEditWidget { id: nameField; label: "Name "; value: contact ? contact.name.firstName : " "}
48+- DetailEditWidget { id: emailField; label: "Email Address "; value: contact ? contact.email.emailAddress : " "}
49+- DetailEditWidget { id: phoneField; label: "Phone Number "; value: contact ? contact.phoneNumber.number : " "}
50++ DetailEditWidget {
51++ id: nameField
52++ label: "Name "
53++ value: contact ? contact.name.firstName : " "
54++ }
55++ DetailEditWidget {
56++ id: emailField
57++ label: "Email Address "
58++ value: contact ? contact.email.emailAddress : " "
59++ showPreferredField: true
60++ isPreferred: contact ? contact.isPreferredDetail("MESSAGE", contact.email) : false
61++ }
62++ DetailEditWidget {
63++ id: phoneField
64++ label: "Phone Number "
65++ value: contact ? contact.phoneNumber.number : " "
66++ showPreferredField: true
67++ isPreferred: contact ? contact.isPreferredDetail("CALL", contact.phoneNumber) : false
68++ }
69+ }
70+ // ![Widgets for manipulating contact details]
71+
72+@@ -52,7 +68,9 @@ Rectangle {
73+
74+ function updateContact() {
75+ // read in values from the input fields
76+- var values = [nameField.value, emailField.value, phoneField.value]
77++ var values = [nameField.value,
78++ emailField.value, emailField.requestPreferred || emailField.isPreferred,
79++ phoneField.value, phoneField.requestPreferred || phoneField.isPreferred]
80+ if (!contact) { // create new contact
81+ var newContact = Qt.createQmlObject("import QtContacts 5.0; Contact{ }", contactEditor)
82+ setDetailValues(newContact, values)
83+@@ -60,8 +78,8 @@ Rectangle {
84+ contactsModel.saveContact(newContact)
85+ statusBar.updateMsg("new contact successfully created")
86+ } else { // update existing contact
87++ setDetailValues(contact, values)
88+ if (contact.modified) {
89+- setDetailValues(contact, values)
90+ contact.save()
91+ statusBar.updateMsg("contact successfully updated")
92+ } else {
93+@@ -73,7 +91,14 @@ Rectangle {
94+ function setDetailValues(c, values) {
95+ c.name.firstName = values[0]
96+ c.email.emailAddress = values[1]
97+- c.phoneNumber.number = values[2]
98++ c.phoneNumber.number = values[3]
99++ if (values[2]) {
100++ c.setPreferredDetail("MESSAGE", c.email)
101++ }
102++
103++ if (values[4]) {
104++ c.setPreferredDetail("CALL", c.phoneNumber)
105++ }
106+ }
107+
108+ function cancel() {
109+@@ -84,6 +109,8 @@ Rectangle {
110+ nameField.inputFocus = false
111+ emailField.inputFocus = false
112+ phoneField.inputFocus = false
113++ emailField.requestPreferred = false
114++ phoneField.requestPreferred = false
115+ nameField.color = "black"
116+ emailField.color = "black"
117+ phoneField.color = "black"
118+diff --git a/examples/contacts/qmlcontactslistview/DetailEditWidget.qml b/examples/contacts/qmlcontactslistview/DetailEditWidget.qml
119+index e481941..4f490e2 100644
120+--- a/examples/contacts/qmlcontactslistview/DetailEditWidget.qml
121++++ b/examples/contacts/qmlcontactslistview/DetailEditWidget.qml
122+@@ -34,6 +34,9 @@ Item {
123+ property alias value: valueText.text
124+ property alias color: valueText.color
125+ property alias inputFocus: valueText.focus
126++ property bool isPreferred: false
127++ property bool requestPreferred: false
128++ property bool showPreferredField: false
129+
130+ property string old
131+
132+@@ -48,6 +51,7 @@ Item {
133+ }
134+
135+ Rectangle {
136++ id: inputField
137+ width: 180
138+ height: 20
139+ anchors.left: label.right
140+@@ -77,5 +81,36 @@ Item {
141+ }
142+ }
143+ }
144++
145++ Text {
146++ id: labelFav
147++
148++ anchors.left: inputField.right
149++ anchors.leftMargin: 5
150++
151++ font {
152++ family: "Helvetica"
153++ pixelSize: 15
154++ bold: true
155++ italic: true
156++ }
157++ text: "favorite:"
158++ visible: showPreferredField
159++ }
160++
161++ Rectangle {
162++ anchors.left: labelFav.right
163++ anchors.leftMargin: 5
164++ anchors.verticalCenter: labelFav.verticalCenter
165++ width: 10
166++ height: 10
167++ color: isPreferred || requestPreferred ? "black" : "white"
168++ visible: showPreferredField
169++
170++ MouseArea {
171++ anchors.fill: parent
172++ onClicked: requestPreferred = !requestPreferred
173++ }
174++ }
175+ }
176+ // ![Custom DetailsEditWidget is used for entering new or modifying existing contact detlais]
177+diff --git a/src/imports/contacts/qdeclarativecontact.cpp b/src/imports/contacts/qdeclarativecontact.cpp
178+index 1346b46..2e08969 100644
179+--- a/src/imports/contacts/qdeclarativecontact.cpp
180++++ b/src/imports/contacts/qdeclarativecontact.cpp
181+@@ -127,6 +127,8 @@ void QDeclarativeContact::setContact(const QContact& contact)
182+ foreach (QDeclarativeContactDetail *detail, m_details)
183+ delete detail;
184+ m_details.clear();
185++ m_preferredDetails.clear();
186++
187+ QList<QContactDetail> details(contact.details());
188+ foreach (const QContactDetail &detail, details) {
189+ QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(static_cast<QDeclarativeContactDetail::DetailType>(detail.type()));
190+@@ -135,6 +137,13 @@ void QDeclarativeContact::setContact(const QContact& contact)
191+ m_details.append(contactDetail);
192+ }
193+
194++ QMap<QString, QContactDetail> prefDetails(contact.preferredDetails());
195++ QMap<QString, QContactDetail>::const_iterator it = prefDetails.begin();
196++ while (it != prefDetails.end()) {
197++ m_preferredDetails.insert(it.key(), it.value().key());
198++ it++;
199++ }
200++
201+ m_modified = false;
202+ emit contactChanged();
203+ }
204+@@ -145,6 +154,13 @@ QContact QDeclarativeContact::contact() const
205+ contact.setId(m_id);
206+ foreach (QDeclarativeContactDetail *detail, m_details)
207+ contact.saveDetail(&detail->detail());
208++
209++ QVariantMap prefDetails = preferredDetails();
210++ QVariantMap::const_iterator it = prefDetails.begin();
211++ while (it != prefDetails.end()) {
212++ contact.setPreferredDetail(it.key(), it.value().value<QDeclarativeContactDetail *>()->detail());
213++ it++;
214++ }
215+ return contact;
216+ }
217+
218+@@ -198,6 +214,7 @@ bool QDeclarativeContact::removeDetail(QDeclarativeContactDetail* detail)
219+ int i = 0;
220+ foreach (QDeclarativeContactDetail *contactDetail, m_details) {
221+ if (key == contactDetail->detail().key()) {
222++ removePrefferedDetail(detail);
223+ delete contactDetail;
224+ m_details.removeAt(i);
225+ emit contactChanged();
226+@@ -209,6 +226,16 @@ bool QDeclarativeContact::removeDetail(QDeclarativeContactDetail* detail)
227+ return false;
228+ }
229+
230++void QDeclarativeContact::removePrefferedDetail(QDeclarativeContactDetail* detail)
231++{
232++ QMap<QString, int> cpy = m_preferredDetails;
233++ QMap<QString, int>::const_iterator it = cpy.begin();
234++ while (it != cpy.end()) {
235++ if (it.value() == detail->detail().key())
236++ m_preferredDetails.remove(it.key());
237++ }
238++}
239++
240+ /*!
241+ \qmlmethod Contact::addDetail(detail)
242+
243+@@ -233,6 +260,93 @@ bool QDeclarativeContact::addDetail(QDeclarativeContactDetail* detail)
244+ }
245+
246+ /*!
247++ \qmlmethod Contact::setPreferredDetail(actionName, detail)
248++
249++ Set a particular detail (\a preferredDetail) as the preferred detail for any actions with the given \a actionName.
250++
251++ The \a preferredDetail object must exist in this object, and the \a actionName cannot be empty.
252++
253++ Returns true if the preference could be recorded, and false otherwise.
254++
255++ \sa preferredDetail()
256++ */
257++bool QDeclarativeContact::setPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail)
258++{
259++ if (actionName.isEmpty() || !detail || !m_details.contains(detail))
260++ return false;
261++
262++ if (m_preferredDetails.contains(actionName) && m_preferredDetails[actionName] == detail->detail().key())
263++ return false;
264++
265++ m_preferredDetails.insert(actionName, detail->detail().key());
266++ m_modified = true;
267++ emit contactChanged();
268++ return true;
269++}
270++
271++/*!
272++ \qmlmethod Contact::isPreferredDetail(actionName, detail)
273++
274++ Returns true if the given \a detail is a preferred detail for the given \a actionName,
275++ or for any action if the \a actionName is empty.
276++
277++ \sa preferredDetail()
278++ */
279++bool QDeclarativeContact::isPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail) const
280++{
281++ if (actionName.isEmpty() || !detail || !m_details.contains(detail))
282++ return false;
283++
284++ if (!m_preferredDetails.contains(actionName))
285++ return false;
286++
287++ return (m_preferredDetails[actionName] == detail->detail().key());
288++}
289++
290++/*!
291++ \qmlmethod Contact::preferredDetail(actionName, detail)
292++
293++ Returns the preferred detail for a given \a actionName.
294++
295++ If the \a actionName is empty, or there is no preference recorded for
296++ the supplied \a actionName, returns null.
297++
298++ \sa preferredDetails()
299++ */
300++QDeclarativeContactDetail* QDeclarativeContact::preferredDetail(const QString& actionName) const
301++{
302++ int id = m_preferredDetails.value(actionName, -1);
303++ if (id == -1)
304++ return 0;
305++
306++ foreach (QDeclarativeContactDetail* detail, m_details) {
307++ if (detail->detail().key() == id)
308++ return detail;
309++ }
310++ return 0;
311++}
312++
313++
314++/*!
315++ \qmlproperty map<string, ContactDetail> Contact::preferredDetails
316++
317++ This property holds the recorded detail preferences for action names.
318++
319++ Each entry in the map has the action name as the key, and the corresponding
320++ preferred detail as the value.
321++ */
322++QVariantMap QDeclarativeContact::preferredDetails() const
323++{
324++ QVariantMap result;
325++ QMap<QString, int>::const_iterator it = m_preferredDetails.begin();
326++ while (it != m_preferredDetails.end()) {
327++ result.insert(it.key(), QVariant::fromValue<QDeclarativeContactDetail*>(preferredDetail(it.key())));
328++ it++;
329++ }
330++ return result;
331++}
332++
333++/*!
334+ \qmlproperty list<ContactDetail> Contact::contactDetails
335+
336+ This property holds the list of all the details that the contact has.
337+diff --git a/src/imports/contacts/qdeclarativecontact_p.h b/src/imports/contacts/qdeclarativecontact_p.h
338+index 9abf0d4..21a8879 100644
339+--- a/src/imports/contacts/qdeclarativecontact_p.h
340++++ b/src/imports/contacts/qdeclarativecontact_p.h
341+@@ -95,6 +95,7 @@ class QDeclarativeContact : public QObject
342+ Q_PROPERTY (QDeclarativeContactUrl* url READ url NOTIFY contactChanged)
343+ Q_PROPERTY (QQmlListProperty<QDeclarativeContactUrl> urls READ urls NOTIFY contactChanged)
344+ Q_PROPERTY (QDeclarativeContactVersion* version READ version NOTIFY contactChanged)
345++ Q_PROPERTY (QVariantMap preferredDetails READ preferredDetails NOTIFY contactChanged)
346+ Q_CLASSINFO("DefaultProperty", "contactDetails")
347+
348+ public:
349+@@ -119,6 +120,11 @@ public:
350+ Q_INVOKABLE bool removeDetail(QDeclarativeContactDetail* detail);
351+ Q_INVOKABLE bool addDetail(QDeclarativeContactDetail* detail);
352+
353++ Q_INVOKABLE bool setPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail);
354++ Q_INVOKABLE bool isPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail) const;
355++ Q_INVOKABLE QDeclarativeContactDetail* preferredDetail(const QString& actionName) const;
356++ QVariantMap preferredDetails() const;
357++
358+ QDeclarativeContactAddress* address();
359+ QQmlListProperty<QDeclarativeContactAddress> addresses();
360+ QDeclarativeContactAnniversary* anniversary();
361+@@ -160,6 +166,7 @@ protected:
362+ // always create a copy of the detail for QML
363+ // however, seems the garbage collection can't delete all of them (QTBUG-20377)
364+ QList<QDeclarativeContactDetail *> m_details;
365++ QMap<QString, int> m_preferredDetails;
366+
367+ public slots:
368+ void clearDetails();
369+@@ -193,6 +200,8 @@ private:
370+ return 0;
371+ }
372+
373++ void removePrefferedDetail(QDeclarativeContactDetail *detail);
374++
375+ // call-back functions for list property
376+ static void _q_detail_append(QQmlListProperty<QDeclarativeContactDetail> *property, QDeclarativeContactDetail *value);
377+ static QDeclarativeContactDetail *_q_detail_at(QQmlListProperty<QDeclarativeContactDetail> *property, int index);
378+--
379+1.8.3.2
380+
381
382=== modified file 'debian/patches/series'
383--- debian/patches/series 2013-07-01 13:17:25 +0000
384+++ debian/patches/series 2013-07-25 22:18:33 +0000
385@@ -1,1 +1,2 @@
386 revert_module_version.patch
387+added-support-to-preferreddetails-on-qml-contact.patch

Subscribers

People subscribed via source and target branches