Merge lp:~timo-jyrinki/ubuntu/saucy/qtpim-opensource-src/new_snapshot into lp:ubuntu/saucy/qtpim-opensource-src

Proposed by Timo Jyrinki
Status: Merged
Merge reported by: Sebastien Bacher
Merged at revision: not available
Proposed branch: lp:~timo-jyrinki/ubuntu/saucy/qtpim-opensource-src/new_snapshot
Merge into: lp:ubuntu/saucy/qtpim-opensource-src
Diff against target: 1998 lines (+149/-1557)
23 files modified
.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/ContactEditor.qml (+0/-92)
.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/DetailEditWidget.qml (+0/-81)
.pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact.cpp (+0/-765)
.pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact_p.h (+0/-209)
.pc/applied-patches (+0/-1)
.tag (+1/-1)
debian/changelog (+8/-0)
debian/patches/added-support-to-preferreddetails-on-qml-contact.patch (+0/-359)
debian/patches/series (+0/-1)
src/contacts/details/qcontacttype.h (+1/-1)
src/contacts/qcontactabstractrequest.h (+1/-1)
src/contacts/qcontactactionfactory.h (+1/-1)
src/contacts/qcontactdetail.h (+10/-10)
src/contacts/qcontactfetchhint.h (+1/-1)
src/contacts/qcontactfilter.h (+1/-1)
src/contacts/qcontactid.h (+1/-1)
src/contacts/qcontactmanager.cpp (+4/-0)
src/contacts/qcontactmanager.h (+1/-1)
src/imports/contacts/qdeclarativecontact.cpp (+2/-2)
src/imports/contacts/qdeclarativecontact_p.h (+1/-1)
src/imports/contacts/qdeclarativecontactmodel.cpp (+113/-26)
src/imports/contacts/qdeclarativecontactmodel_p.h (+1/-0)
tests/auto/contacts/qcontact/tst_qcontact.cpp (+2/-2)
To merge this branch: bzr merge lp:~timo-jyrinki/ubuntu/saucy/qtpim-opensource-src/new_snapshot
Reviewer Review Type Date Requested Status
Ubuntu Development Team Pending
Review via email: mp+182874@code.launchpad.net

Commit message

* New upstream snapshot release
  * debian/patches/added-support-to-preferreddetails-on-qml-contact.patch:
    - Drop, merged upstream

Description of the change

* New upstream snapshot release
  * debian/patches/added-support-to-preferreddetails-on-qml-contact.patch:
    - Drop, merged upstream

From packaging branch lp:~kubuntu-packagers/kubuntu-packaging/qtpim-opensource-src

Test build at https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-proper/+sourcepub/3452535/+listing-archive-extra

Tested by upgrading from the PPA, compiling and running examples from the source code.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch'
2=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples'
3=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts'
4=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview'
5=== removed file '.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/ContactEditor.qml'
6--- .pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/ContactEditor.qml 2013-07-25 18:41:12 +0000
7+++ .pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/ContactEditor.qml 1970-01-01 00:00:00 +0000
8@@ -1,92 +0,0 @@
9-/****************************************************************************
10-**
11-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
12-** Contact: http://www.qt-project.org/legal
13-**
14-** This file is part of the documentation of the Qt Pim Module.
15-**
16-** $QT_BEGIN_LICENSE:FDL$
17-** Commercial License Usage
18-** Licensees holding valid commercial Qt licenses may use this file in
19-** accordance with the commercial license agreement provided with the
20-** Software or, alternatively, in accordance with the terms contained in
21-** a written agreement between you and Digia. For licensing terms and
22-** conditions see http://qt.digia.com/licensing. For further information
23-** use the contact form at http://qt.digia.com/contact-us.
24-**
25-** GNU Free Documentation License Usage
26-** Alternatively, this file may be used under the terms of the GNU Free
27-** Documentation License version 1.3 as published by the Free Software
28-** Foundation and appearing in the file included in the packaging of
29-** this file. Please review the following information to ensure
30-** the GNU Free Documentation License version 1.3 requirements
31-** will be met: http://www.gnu.org/copyleft/fdl.html.
32-** $QT_END_LICENSE$
33-**
34-****************************************************************************/
35-import QtQuick 2.0
36-
37-Rectangle {
38- width: parent.width
39- color: "pink"
40- property variant contact // contact that is shown in editView
41-
42- // ![Widgets for manipulating contact details]
43- Column {
44- spacing: 8
45- anchors {
46- fill: parent
47- leftMargin: 10
48- topMargin: 10
49- }
50- DetailEditWidget { id: nameField; label: "Name "; value: contact ? contact.name.firstName : " "}
51- DetailEditWidget { id: emailField; label: "Email Address "; value: contact ? contact.email.emailAddress : " "}
52- DetailEditWidget { id: phoneField; label: "Phone Number "; value: contact ? contact.phoneNumber.number : " "}
53- }
54- // ![Widgets for manipulating contact details]
55-
56- function deleteContact() {
57- contactsModel.removeContact(contactEditor.contact.contactId)
58- statusBar.updateMsg("contact successfully deleted")
59- }
60-
61- function updateContact() {
62- // read in values from the input fields
63- var values = [nameField.value, emailField.value, phoneField.value]
64- if (!contact) { // create new contact
65- var newContact = Qt.createQmlObject("import QtContacts 5.0; Contact{ }", contactEditor)
66- setDetailValues(newContact, values)
67- newContact.save()
68- contactsModel.saveContact(newContact)
69- statusBar.updateMsg("new contact successfully created")
70- } else { // update existing contact
71- if (contact.modified) {
72- setDetailValues(contact, values)
73- contact.save()
74- statusBar.updateMsg("contact successfully updated")
75- } else {
76- statusBar.updateMsg("nothing to update, contact already is up-to-date")
77- }
78- }
79- }
80-
81- function setDetailValues(c, values) {
82- c.name.firstName = values[0]
83- c.email.emailAddress = values[1]
84- c.phoneNumber.number = values[2]
85- }
86-
87- function cancel() {
88- contact = ""
89- }
90-
91- function resetToDefaults() {
92- nameField.inputFocus = false
93- emailField.inputFocus = false
94- phoneField.inputFocus = false
95- nameField.color = "black"
96- emailField.color = "black"
97- phoneField.color = "black"
98- }
99-}
100-
101
102=== removed file '.pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/DetailEditWidget.qml'
103--- .pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/DetailEditWidget.qml 2013-07-25 18:41:12 +0000
104+++ .pc/added-support-to-preferreddetails-on-qml-contact.patch/examples/contacts/qmlcontactslistview/DetailEditWidget.qml 1970-01-01 00:00:00 +0000
105@@ -1,81 +0,0 @@
106-/****************************************************************************
107-**
108-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
109-** Contact: http://www.qt-project.org/legal
110-**
111-** This file is part of the documentation of the Qt Pim Module.
112-**
113-** $QT_BEGIN_LICENSE:FDL$
114-** Commercial License Usage
115-** Licensees holding valid commercial Qt licenses may use this file in
116-** accordance with the commercial license agreement provided with the
117-** Software or, alternatively, in accordance with the terms contained in
118-** a written agreement between you and Digia. For licensing terms and
119-** conditions see http://qt.digia.com/licensing. For further information
120-** use the contact form at http://qt.digia.com/contact-us.
121-**
122-** GNU Free Documentation License Usage
123-** Alternatively, this file may be used under the terms of the GNU Free
124-** Documentation License version 1.3 as published by the Free Software
125-** Foundation and appearing in the file included in the packaging of
126-** this file. Please review the following information to ensure
127-** the GNU Free Documentation License version 1.3 requirements
128-** will be met: http://www.gnu.org/copyleft/fdl.html.
129-** $QT_END_LICENSE$
130-**
131-****************************************************************************/
132-import QtQuick 2.0
133-// ![Custom DetailsEditWidget is used for entering new or modifying existing contact detlais]
134-Item {
135- width: parent.width - 30
136- height: 20
137-
138- property alias label: label.text
139- property alias value: valueText.text
140- property alias color: valueText.color
141- property alias inputFocus: valueText.focus
142-
143- property string old
144-
145- Text {
146- id: label
147- font {
148- family: "Helvetica"
149- pixelSize: 15
150- bold: true
151- italic: true
152- }
153- }
154-
155- Rectangle {
156- width: 180
157- height: 20
158- anchors.left: label.right
159- anchors.leftMargin: 6
160- color: "white"
161- border {
162- width: 2
163- color: "darkgreen"
164- }
165-
166- TextInput {
167- id: valueText
168- anchors.fill: parent
169- anchors.leftMargin: 5
170- font {
171- pixelSize: 16
172- family: "Helvetica"
173- }
174- onFocusChanged: {
175- if (focus === true) { // when entering text field
176- old = valueText.text
177- } else { // when exiting text field
178- if (valueText.text !== old) {
179- valueText.color = "red"
180- }
181- }
182- }
183- }
184- }
185-}
186-// ![Custom DetailsEditWidget is used for entering new or modifying existing contact detlais]
187
188=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch/src'
189=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports'
190=== removed directory '.pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts'
191=== removed file '.pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact.cpp'
192--- .pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact.cpp 2013-07-25 18:41:12 +0000
193+++ .pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact.cpp 1970-01-01 00:00:00 +0000
194@@ -1,765 +0,0 @@
195-/****************************************************************************
196-**
197-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
198-** Contact: http://www.qt-project.org/legal
199-**
200-** This file is part of the QtQml module of the Qt Toolkit.
201-**
202-** $QT_BEGIN_LICENSE:LGPL$
203-** Commercial License Usage
204-** Licensees holding valid commercial Qt licenses may use this file in
205-** accordance with the commercial license agreement provided with the
206-** Software or, alternatively, in accordance with the terms contained in
207-** a written agreement between you and Digia. For licensing terms and
208-** conditions see http://qt.digia.com/licensing. For further information
209-** use the contact form at http://qt.digia.com/contact-us.
210-**
211-** GNU Lesser General Public License Usage
212-** Alternatively, this file may be used under the terms of the GNU Lesser
213-** General Public License version 2.1 as published by the Free Software
214-** Foundation and appearing in the file LICENSE.LGPL included in the
215-** packaging of this file. Please review the following information to
216-** ensure the GNU Lesser General Public License version 2.1 requirements
217-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
218-**
219-** In addition, as a special exception, Digia gives you certain additional
220-** rights. These rights are described in the Digia Qt LGPL Exception
221-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
222-**
223-** GNU General Public License Usage
224-** Alternatively, this file may be used under the terms of the GNU
225-** General Public License version 3.0 as published by the Free Software
226-** Foundation and appearing in the file LICENSE.GPL included in the
227-** packaging of this file. Please review the following information to
228-** ensure the GNU General Public License version 3.0 requirements will be
229-** met: http://www.gnu.org/copyleft/gpl.html.
230-**
231-**
232-** $QT_END_LICENSE$
233-**
234-****************************************************************************/
235-
236-#include <qcontactdetails.h>
237-#include <qcontactmanager.h>
238-#include "qdeclarativecontact_p.h"
239-#include "qdeclarativecontactmodel_p.h"
240-
241-#include <QtQml/qqmlengine.h>
242-
243-#include <QUrl>
244-#include <QQmlListProperty>
245-
246-/*!
247- \qmltype Contact
248- \instantiates QDeclarativeContact
249- \brief The Contact element represents an addressbook contact.
250- \ingroup qml-contacts-main
251- \inqmlmodule QtContacts 5.0
252-
253- The Contact element is part of the \b{QtContacts} module.
254-
255- A Contact object has a collection of details (like a name, phone numbers and
256- email addresses). Each detail (which can have multiple fields) is stored
257- in an appropriate subclass of ContactDetail, and the Contact allows
258- retrieving these details in various ways.
259-
260- If some of the contact details are not unique details, all of this type of detail values
261- can be accessed by the property with the name in plural. For example, if there are 3 phone numbers stored in
262- a contact, they can be accessed by contact.phoneNumbers property, which holds a list of
263- all PhoneNumber details. If a contact does not contain a detail of particular type,
264- the value of the corresponding singular property (e.g. phoneNumber) in undefined and the
265- plural (e.g. phoneNumbers) is empty. The list of properties which support multiple detail
266- instances depends on the contact engine implementations.
267-
268- \sa QContact
269-*/
270-
271-
272-QT_BEGIN_NAMESPACE_CONTACTS
273-
274-
275-// call-back function templates for list properties
276-template <typename T, QDeclarativeContactDetail::DetailType detailType>
277-static void list_property_append(QQmlListProperty<T> *, T *)
278-{
279-}
280-
281-template <typename T, QDeclarativeContactDetail::DetailType detailType>
282-static int list_property_count(QQmlListProperty<T> *property)
283-{
284- QDeclarativeContact *object = qobject_cast<QDeclarativeContact *>(property->object);
285- if (object)
286- return object->details(detailType).size();
287- else
288- return 0;
289-}
290-
291-template <typename T, QDeclarativeContactDetail::DetailType detailType>
292-static T *list_property_at(QQmlListProperty<T> *property, int index)
293-{
294- QDeclarativeContact *object = qobject_cast<QDeclarativeContact *>(property->object);
295- if (object)
296- return qobject_cast<T *>(qvariant_cast<QObject*>(object->details(detailType).at(index)));
297- else
298- return 0;
299-}
300-
301-template <typename T, QDeclarativeContactDetail::DetailType detailType>
302-static void list_property_clear(QQmlListProperty<T> *)
303-{
304-}
305-
306-QDeclarativeContact::QDeclarativeContact(QObject *parent)
307- :QObject(parent)
308- , m_modified(false)
309-{
310- connect(this, SIGNAL(contactChanged()), SLOT(setModified()));
311-}
312-
313-QDeclarativeContact::~QDeclarativeContact()
314-{
315- clearDetails();
316-}
317-
318-void QDeclarativeContact::setContact(const QContact& contact)
319-{
320- m_id = contact.id();
321- foreach (QDeclarativeContactDetail *detail, m_details)
322- delete detail;
323- m_details.clear();
324- QList<QContactDetail> details(contact.details());
325- foreach (const QContactDetail &detail, details) {
326- QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(static_cast<QDeclarativeContactDetail::DetailType>(detail.type()));
327- contactDetail->setDetail(detail);
328- connect(contactDetail, SIGNAL(detailChanged()), this, SIGNAL(contactChanged()));
329- m_details.append(contactDetail);
330- }
331-
332- m_modified = false;
333- emit contactChanged();
334-}
335-
336-QContact QDeclarativeContact::contact() const
337-{
338- QContact contact;
339- contact.setId(m_id);
340- foreach (QDeclarativeContactDetail *detail, m_details)
341- contact.saveDetail(&detail->detail());
342- return contact;
343-}
344-
345-/*!
346- \qmlproperty bool Contact::modified
347-
348- This property holds the dirty flag of the Contact object.
349- If the Contact has been changed, returns true, otherwise returns false.
350-*/
351-bool QDeclarativeContact::modified() const
352-{
353- return m_modified;
354-}
355-
356-void QDeclarativeContact::setModified()
357-{
358- m_modified = true;
359-}
360-
361-/*!
362- \qmlproperty enumeration Contact::type
363-
364- This property holds type of the Contact, the value can be one of:
365-
366- \list
367- \li Contact.Contact
368- \li Contact.Group
369- \endlist
370-*/
371-QDeclarativeContactType::ContactType QDeclarativeContact::type() const
372-{
373- foreach (QDeclarativeContactDetail *detail, m_details) {
374- if (QDeclarativeContactDetail::Type == detail->detailType())
375- return static_cast<QDeclarativeContactType *>(detail)->type();
376- }
377- return QDeclarativeContactType::Contact;
378-}
379-
380-/*!
381- \qmlmethod Contact::removeDetail(detail)
382-
383- Removes the given contact \a detail from the contact, returns true if successful, otherwise returns false.
384-*/
385-
386-bool QDeclarativeContact::removeDetail(QDeclarativeContactDetail* detail)
387-{
388- if (detail) {
389- if (!detail->removable())
390- return false;
391- int key = detail->detail().key();
392- int i = 0;
393- foreach (QDeclarativeContactDetail *contactDetail, m_details) {
394- if (key == contactDetail->detail().key()) {
395- delete contactDetail;
396- m_details.removeAt(i);
397- emit contactChanged();
398- return true;
399- }
400- ++i;
401- }
402- }
403- return false;
404-}
405-
406-/*!
407- \qmlmethod Contact::addDetail(detail)
408-
409- Adds the given contact \a detail to the contact, returns true if successful, otherwise returns false.
410-
411- Note: If the \a detail has been added into the same contact before, this operation will be ignored,
412- so if you want to add a \a detail multiple times, the \a detail should be copied before calling this function.
413-*/
414-bool QDeclarativeContact::addDetail(QDeclarativeContactDetail* detail)
415-{
416- if (!detail || m_details.contains(detail))
417- return false;
418-
419- QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(detail->detailType());
420- contactDetail->setDetail(detail->detail());
421- connect(contactDetail, SIGNAL(detailChanged()), this, SIGNAL(contactChanged()));
422- m_details.append(contactDetail);
423-
424- m_modified = true;
425- emit contactChanged();
426- return true;
427-}
428-
429-/*!
430- \qmlproperty list<ContactDetail> Contact::contactDetails
431-
432- This property holds the list of all the details that the contact has.
433-*/
434-QQmlListProperty<QDeclarativeContactDetail> QDeclarativeContact::contactDetails()
435-{
436- return QQmlListProperty<QDeclarativeContactDetail>(this, 0,
437- &QDeclarativeContact::_q_detail_append,
438- &QDeclarativeContact::_q_detail_count,
439- &QDeclarativeContact::_q_detail_at,
440- &QDeclarativeContact::_q_detail_clear);
441-}
442-
443-/*!
444- \qmlproperty int Contact::contactId
445-
446- This property holds the id of the Contact object.
447- This property is read only.
448-*/
449-QString QDeclarativeContact::contactId() const
450-{
451- return m_id.toString();
452-}
453-
454-/*!
455- \qmlproperty string Contact::manager
456-
457- This property holds the manager name which the Contact object comes from.
458-*/
459-QString QDeclarativeContact::manager() const
460-{
461- return m_id.managerUri();
462-}
463-
464-/*!
465- \qmlmethod QDeclarativeContactDetail* QDeclarativeContact::detail(int type)
466-
467- Returns contactDetail object which detail name or detail type is \a name.
468-*/
469-QDeclarativeContactDetail* QDeclarativeContact::detail(int type)
470-{
471- foreach (QDeclarativeContactDetail *detail, m_details) {
472- if (type == detail->detailType()) {
473- return detail;
474- }
475- }
476- return 0;
477-}
478-
479-/*!
480- \qmlmethod QVariantList QDeclarativeContact::details(int type)
481-
482- Returns a list of ContactDetail objects which detail name or detail type is \a name.
483-*/
484-QVariantList QDeclarativeContact::details(int type)
485-{
486- QVariantList list;
487- foreach (QDeclarativeContactDetail *detail, m_details) {
488- if (type == detail->detailType()) {
489- list.append(QVariant::fromValue((QObject*)detail));
490- }
491- }
492- return list;
493-}
494-
495-/*!
496- \qmlmethod Contact::clearDetails()
497-
498- Remove all detail objects in this contact.
499-*/
500-void QDeclarativeContact::clearDetails()
501-{
502- if (m_details.isEmpty())
503- return;
504-
505- foreach (QDeclarativeContactDetail *detail, m_details)
506- delete detail;
507- m_details.clear();
508- m_modified = true;
509- emit contactChanged();
510-}
511-
512-
513-/*!
514- \qmlmethod Contact::save()
515-
516- Saves this Contact if the contact has been modified.
517-
518- \sa Contact::modified
519-*/
520-void QDeclarativeContact::save()
521-{
522- if (modified()) {
523- QDeclarativeContactModel* model = qobject_cast<QDeclarativeContactModel*>(parent());
524- if (model) {
525- model->saveContact(this);
526- m_modified = false;
527- }
528- }
529-}
530-
531-// convenient access to most frequently used details
532-/*!
533- \qmlproperty Address Contact::address
534-
535- This property holds the address detail of the Contact object. In case a contact has several addresses then
536- the first one is returned.
537-*/
538-QDeclarativeContactAddress* QDeclarativeContact::address()
539-{
540- return getDetail<QDeclarativeContactAddress>(QDeclarativeContactDetail::Address);
541-}
542-
543-/*!
544- \qmlproperty list<Address> Contact::addresses
545-
546- This property holds the address details of the Contact object.
547-*/
548-QQmlListProperty<QDeclarativeContactAddress> QDeclarativeContact::addresses()
549-{
550- return QQmlListProperty<QDeclarativeContactAddress>(
551- this,
552- 0,
553- &list_property_append<QDeclarativeContactAddress, QDeclarativeContactDetail::Address>,
554- &list_property_count<QDeclarativeContactAddress, QDeclarativeContactDetail::Address>,
555- &list_property_at<QDeclarativeContactAddress, QDeclarativeContactDetail::Address>,
556- &list_property_clear<QDeclarativeContactAddress, QDeclarativeContactDetail::Address>);
557-}
558-
559-/*!
560- \qmlproperty Anniversary Contact::anniversary
561-
562- This property holds the anniversary detail of the Contact object.
563-*/
564-QDeclarativeContactAnniversary* QDeclarativeContact::anniversary()
565-{
566- return getDetail<QDeclarativeContactAnniversary>(QDeclarativeContactDetail::Anniversary);
567-}
568-
569-/*!
570- \qmlproperty Avatar Contact::avatar
571-
572- This property holds the avatar detail of the Contact object.
573-*/
574-QDeclarativeContactAvatar* QDeclarativeContact::avatar()
575-{
576- return getDetail<QDeclarativeContactAvatar>(QDeclarativeContactDetail::Avatar);
577-}
578-
579-/*!
580- \qmlproperty Birthday Contact::birthday
581-
582- This property holds the birthday detail of the Contact object.
583-*/
584-QDeclarativeContactBirthday* QDeclarativeContact::birthday()
585-{
586- return getDetail<QDeclarativeContactBirthday>(QDeclarativeContactDetail::Birthday);
587-}
588-
589-/*!
590- \qmlproperty DisplayLabel Contact::displayLabel
591-
592- This property holds the displayLabel detail of the Contact object.
593- display label is the one which gets displayed when a contact is created as per versit doc specs this is a "FN" property
594-*/
595-QDeclarativeContactDisplayLabel* QDeclarativeContact::displayLabel()
596-{
597- return getDetail<QDeclarativeContactDisplayLabel>(QDeclarativeContactDetail::DisplayLabel);
598-}
599-
600-/*!
601- \qmlproperty EmailAddress Contact::email
602-
603- This property holds the email address detail of the Contact object. In case a contact has several email addresses then
604- the first one is returned.
605-*/
606-QDeclarativeContactEmailAddress* QDeclarativeContact::email()
607-{
608- return getDetail<QDeclarativeContactEmailAddress>(QDeclarativeContactDetail::Email);
609-}
610-
611-/*!
612- \qmlproperty list<EmailAddress> Contact::emails
613-
614- This property holds the email address details of the Contact object.
615-*/
616-QQmlListProperty<QDeclarativeContactEmailAddress> QDeclarativeContact::emails()
617-{
618- return QQmlListProperty<QDeclarativeContactEmailAddress>(
619- this,
620- 0,
621- &list_property_append<QDeclarativeContactEmailAddress, QDeclarativeContactDetail::Email>,
622- &list_property_count<QDeclarativeContactEmailAddress, QDeclarativeContactDetail::Email>,
623- &list_property_at<QDeclarativeContactEmailAddress, QDeclarativeContactDetail::Email>,
624- &list_property_clear<QDeclarativeContactEmailAddress, QDeclarativeContactDetail::Email>);
625-}
626-
627-/*!
628- \qmlproperty ExtendedDetail Contact::extendedDetail
629-
630- This property holds the extended detail of the Contact object. In case a contact has several extended
631- details then the first one is returned.
632-*/
633-QDeclarativeContactExtendedDetail* QDeclarativeContact::extendedDetail()
634-{
635- return getDetail<QDeclarativeContactExtendedDetail>(QDeclarativeContactDetail::ExtendedDetail);
636-}
637-
638-/*!
639- \qmlproperty list<ExtendedDetail> Contact::extendedDetails
640-
641- This property holds the extended details of the Contact object.
642-*/
643-QQmlListProperty<QDeclarativeContactExtendedDetail> QDeclarativeContact::extendedDetails()
644-{
645- return QQmlListProperty<QDeclarativeContactExtendedDetail>(
646- this,
647- 0,
648- &list_property_append<QDeclarativeContactExtendedDetail, QDeclarativeContactDetail::ExtendedDetail>,
649- &list_property_count<QDeclarativeContactExtendedDetail, QDeclarativeContactDetail::ExtendedDetail>,
650- &list_property_at<QDeclarativeContactExtendedDetail, QDeclarativeContactDetail::ExtendedDetail>,
651- &list_property_clear<QDeclarativeContactExtendedDetail, QDeclarativeContactDetail::ExtendedDetail>);
652-}
653-
654-/*!
655- \qmlproperty Family Contact::family
656-
657- This property holds the family detail of the Contact object.
658-*/
659-QDeclarativeContactFamily* QDeclarativeContact::family()
660-{
661- return getDetail<QDeclarativeContactFamily>(QDeclarativeContactDetail::Family);
662-}
663-
664-/*!
665- \qmlproperty Favorite Contact::favorite
666-
667- This property holds the favorite detail of the Contact object.
668-*/
669-QDeclarativeContactFavorite* QDeclarativeContact::favorite()
670-{
671- return getDetail<QDeclarativeContactFavorite>(QDeclarativeContactDetail::Favorite);
672-}
673-
674-/*!
675- \qmlproperty Gender Contact::gender
676-
677- This property holds the gender detail of the Contact object.
678-*/
679-QDeclarativeContactGender* QDeclarativeContact::gender()
680-{
681- return getDetail<QDeclarativeContactGender>(QDeclarativeContactDetail::Gender);
682-}
683-
684-/*!
685- \qmlproperty GeoLocation Contact::geolocation
686-
687- This property holds the geolocation detail of the Contact object.
688-*/
689-QDeclarativeContactGeoLocation* QDeclarativeContact::geolocation()
690-{
691- return getDetail<QDeclarativeContactGeoLocation>(QDeclarativeContactDetail::Geolocation);
692-}
693-
694-/*!
695- \qmlproperty GlobalPresence Contact::globalPresence
696-
697- This property holds the globalPresence detail of the Contact object.
698-*/
699-QDeclarativeContactGlobalPresence* QDeclarativeContact::globalPresence()
700-{
701- return getDetail<QDeclarativeContactGlobalPresence>(QDeclarativeContactDetail::GlobalPresence);
702-}
703-
704-/*!
705- \qmlproperty Guid Contact::guid
706-
707- This property holds the guid detail of the Contact object.
708-*/
709-QDeclarativeContactGuid* QDeclarativeContact::guid()
710-{
711- return getDetail<QDeclarativeContactGuid>(QDeclarativeContactDetail::Guid);
712-}
713-
714-/*!
715- \qmlproperty Hobby Contact::hobby
716-
717- This property holds the hobby detail of the Contact object.
718-*/
719-QDeclarativeContactHobby* QDeclarativeContact::hobby()
720-{
721- return getDetail<QDeclarativeContactHobby>(QDeclarativeContactDetail::Hobby);
722-}
723-
724-/*!
725- \qmlproperty Name Contact::name
726-
727- This property holds the name detail of the Contact object.
728-*/
729-QDeclarativeContactName* QDeclarativeContact::name()
730-{
731- return getDetail<QDeclarativeContactName>(QDeclarativeContactDetail::Name);
732-}
733-
734-/*!
735- \qmlproperty Nickname Contact::nickname
736-
737- This property holds the nickname detail of the Contact object.
738-*/
739-QDeclarativeContactNickname* QDeclarativeContact::nickname()
740-{
741- return getDetail<QDeclarativeContactNickname>(QDeclarativeContactDetail::NickName);
742-}
743-
744-/*!
745- \qmlproperty Note Contact::note
746-
747- This property holds the note detail of the Contact object.
748-*/
749-QDeclarativeContactNote* QDeclarativeContact::note()
750-{
751- return getDetail<QDeclarativeContactNote>(QDeclarativeContactDetail::Note);
752-}
753-
754-/*!
755- \qmlproperty OnlineAccount Contact::onlineAccount
756-
757- This property holds the onlineAccount detail of the Contact object. In case a contact has several accounts then
758- the first one is returned.
759-*/
760-QDeclarativeContactOnlineAccount* QDeclarativeContact::onlineAccount()
761-{
762- return getDetail<QDeclarativeContactOnlineAccount>(QDeclarativeContactDetail::OnlineAccount);
763-}
764-
765-/*!
766- \qmlproperty Organization Contact::organization
767-
768- This property holds the organization detail of the Contact object.
769-*/
770-QDeclarativeContactOrganization* QDeclarativeContact::organization()
771-{
772- return getDetail<QDeclarativeContactOrganization>(QDeclarativeContactDetail::Organization);
773-}
774-
775-/*!
776- \qmlproperty list<Organization> Contact::organizations
777-
778- This property holds the organization details of the Contact object.
779-*/
780-QQmlListProperty<QDeclarativeContactOrganization> QDeclarativeContact::organizations()
781-{
782- return QQmlListProperty<QDeclarativeContactOrganization>(
783- this,
784- 0,
785- &list_property_append<QDeclarativeContactOrganization, QDeclarativeContactDetail::Organization>,
786- &list_property_count<QDeclarativeContactOrganization, QDeclarativeContactDetail::Organization>,
787- &list_property_at<QDeclarativeContactOrganization, QDeclarativeContactDetail::Organization>,
788- &list_property_clear<QDeclarativeContactOrganization, QDeclarativeContactDetail::Organization>);
789-}
790-
791-/*!
792- \qmlproperty PhoneNumber Contact::phoneNumber
793-
794- This property holds the phone number detail of the Contact object. In case a contact has several numbers then
795- the first one is returned.
796-*/
797-QDeclarativeContactPhoneNumber* QDeclarativeContact::phoneNumber()
798-{
799- return getDetail<QDeclarativeContactPhoneNumber>(QDeclarativeContactDetail::PhoneNumber);
800-}
801-
802-/*!
803- \qmlproperty list<PhoneNumber> Contact::phoneNumbers
804-
805- This property holds the phone number details of the Contact object.
806-*/
807-QQmlListProperty<QDeclarativeContactPhoneNumber> QDeclarativeContact::phoneNumbers()
808-{
809- return QQmlListProperty<QDeclarativeContactPhoneNumber>(
810- this,
811- 0,
812- &list_property_append<QDeclarativeContactPhoneNumber, QDeclarativeContactDetail::PhoneNumber>,
813- &list_property_count<QDeclarativeContactPhoneNumber, QDeclarativeContactDetail::PhoneNumber>,
814- &list_property_at<QDeclarativeContactPhoneNumber, QDeclarativeContactDetail::PhoneNumber>,
815- &list_property_clear<QDeclarativeContactPhoneNumber, QDeclarativeContactDetail::PhoneNumber>);
816-}
817-
818-/*!
819- \qmlproperty Presence Contact::presence
820-
821- This property holds the presence detail of the Contact object.
822-*/
823-QDeclarativeContactPresence* QDeclarativeContact::presence()
824-{
825- return getDetail<QDeclarativeContactPresence>(QDeclarativeContactDetail::Presence);
826-}
827-
828-/*!
829- \qmlproperty Ringtone Contact::ringtone
830-
831- This property holds the ringtone detail of the Contact object.
832-*/
833-QDeclarativeContactRingtone* QDeclarativeContact::ringtone()
834-{
835- return getDetail<QDeclarativeContactRingtone>(QDeclarativeContactDetail::Ringtone);
836-}
837-
838-/*!
839- \qmlproperty SyncTarget Contact::syncTarget
840-
841- This property holds the syncTarget detail of the Contact object.
842-*/
843-QDeclarativeContactSyncTarget* QDeclarativeContact::syncTarget()
844-{
845- return getDetail<QDeclarativeContactSyncTarget>(QDeclarativeContactDetail::SyncTarget);
846-}
847-
848-/*!
849- \qmlproperty Tag Contact::tag
850-
851- This property holds the tag detail of the Contact object.
852-*/
853-QDeclarativeContactTag* QDeclarativeContact::tag()
854-{
855- return getDetail<QDeclarativeContactTag>(QDeclarativeContactDetail::Tag);
856-}
857-
858-/*!
859- \qmlproperty Timestamp Contact::timestamp
860-
861- This property holds the timestamp detail of the Contact object.
862-*/
863-QDeclarativeContactTimestamp* QDeclarativeContact::timestamp()
864-{
865- return getDetail<QDeclarativeContactTimestamp>(QDeclarativeContactDetail::Timestamp);
866-}
867-
868-/*!
869- \qmlproperty Url Contact::url
870-
871- This property holds the url detail of the Contact object.
872-*/
873-QDeclarativeContactUrl* QDeclarativeContact::url()
874-{
875- return getDetail<QDeclarativeContactUrl>(QDeclarativeContactDetail::Url);
876-}
877-
878-/*!
879- \qmlproperty list<Url> Contact::urls
880-
881- This property holds the url details of the Contact object.
882-*/
883-QQmlListProperty<QDeclarativeContactUrl> QDeclarativeContact::urls()
884-{
885- return QQmlListProperty<QDeclarativeContactUrl>(
886- this,
887- 0,
888- &list_property_append<QDeclarativeContactUrl, QDeclarativeContactDetail::Url>,
889- &list_property_count<QDeclarativeContactUrl, QDeclarativeContactDetail::Url>,
890- &list_property_at<QDeclarativeContactUrl, QDeclarativeContactDetail::Url>,
891- &list_property_clear<QDeclarativeContactUrl, QDeclarativeContactDetail::Url>);
892-}
893-
894-/*!
895- \qmlproperty Version Contact::version
896-
897- This property holds the version detail of the Contact object.
898-*/
899-QDeclarativeContactVersion* QDeclarativeContact::version()
900-{
901- return getDetail<QDeclarativeContactVersion>(QDeclarativeContactDetail::Version);
902-}
903-
904-// call-back functions for list property
905-
906-/*!
907- \internal
908- */
909-void QDeclarativeContact::_q_detail_append(QQmlListProperty<QDeclarativeContactDetail> *property, QDeclarativeContactDetail *value)
910-{
911- QDeclarativeContact *object = qobject_cast<QDeclarativeContact *>(property->object);
912- if (object)
913- {
914- object->m_details.append(value);
915- value->connect(value, SIGNAL(valueChanged()), SIGNAL(detailChanged()), Qt::UniqueConnection);
916- value->connect(value, SIGNAL(detailChanged()), object, SIGNAL(contactChanged()), Qt::UniqueConnection);
917- }
918-}
919-
920-/*!
921- \internal
922- */
923-QDeclarativeContactDetail *QDeclarativeContact::_q_detail_at(QQmlListProperty<QDeclarativeContactDetail> *property, int index)
924-{
925- QDeclarativeContact *object = qobject_cast<QDeclarativeContact *>(property->object);
926- if (object)
927- return object->m_details.at(index);
928- else
929- return 0;
930-}
931-
932-/*!
933- \internal
934- */
935-void QDeclarativeContact::_q_detail_clear(QQmlListProperty<QDeclarativeContactDetail> *property)
936-{
937- QDeclarativeContact *object = qobject_cast<QDeclarativeContact *>(property->object);
938- if (object) {
939- foreach (QDeclarativeContactDetail *obj, object->m_details)
940- delete obj;
941- object->m_details.clear();
942- }
943-}
944-
945-/*!
946- \internal
947- */
948-int QDeclarativeContact::_q_detail_count(QQmlListProperty<QDeclarativeContactDetail> *property)
949-{
950- QDeclarativeContact *object = qobject_cast<QDeclarativeContact *>(property->object);
951- if (object)
952- return object->m_details.size();
953- else
954- return 0;
955-}
956-
957-#include "moc_qdeclarativecontact_p.cpp"
958-
959-QT_END_NAMESPACE_CONTACTS
960
961=== removed file '.pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact_p.h'
962--- .pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact_p.h 2013-07-25 18:41:12 +0000
963+++ .pc/added-support-to-preferreddetails-on-qml-contact.patch/src/imports/contacts/qdeclarativecontact_p.h 1970-01-01 00:00:00 +0000
964@@ -1,209 +0,0 @@
965-/****************************************************************************
966-**
967-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
968-** Contact: http://www.qt-project.org/legal
969-**
970-** This file is part of the QtQml module of the Qt Toolkit.
971-**
972-** $QT_BEGIN_LICENSE:LGPL$
973-** Commercial License Usage
974-** Licensees holding valid commercial Qt licenses may use this file in
975-** accordance with the commercial license agreement provided with the
976-** Software or, alternatively, in accordance with the terms contained in
977-** a written agreement between you and Digia. For licensing terms and
978-** conditions see http://qt.digia.com/licensing. For further information
979-** use the contact form at http://qt.digia.com/contact-us.
980-**
981-** GNU Lesser General Public License Usage
982-** Alternatively, this file may be used under the terms of the GNU Lesser
983-** General Public License version 2.1 as published by the Free Software
984-** Foundation and appearing in the file LICENSE.LGPL included in the
985-** packaging of this file. Please review the following information to
986-** ensure the GNU Lesser General Public License version 2.1 requirements
987-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
988-**
989-** In addition, as a special exception, Digia gives you certain additional
990-** rights. These rights are described in the Digia Qt LGPL Exception
991-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
992-**
993-** GNU General Public License Usage
994-** Alternatively, this file may be used under the terms of the GNU
995-** General Public License version 3.0 as published by the Free Software
996-** Foundation and appearing in the file LICENSE.GPL included in the
997-** packaging of this file. Please review the following information to
998-** ensure the GNU General Public License version 3.0 requirements will be
999-** met: http://www.gnu.org/copyleft/gpl.html.
1000-**
1001-**
1002-** $QT_END_LICENSE$
1003-**
1004-****************************************************************************/
1005-#ifndef QDECLARATIVECONTACT_P_H
1006-#define QDECLARATIVECONTACT_P_H
1007-
1008-#include <qcontact.h>
1009-#include <qcontactid.h>
1010-#include "qdeclarativecontactdetails_p.h"
1011-#include "qdeclarativecontacturl_p.h"
1012-#include "qdeclarativecontacthobby_p.h"
1013-#include "qdeclarativecontactdetail_p.h"
1014-#include <QtQml/qqmllist.h>
1015-
1016-QT_BEGIN_NAMESPACE_CONTACTS
1017-
1018-class QDeclarativeContact : public QObject
1019-{
1020- Q_OBJECT
1021-
1022- // basic information
1023- Q_PROPERTY (bool modified READ modified)
1024-
1025- Q_PROPERTY (QDeclarativeContactType::ContactType type READ type NOTIFY contactChanged)
1026- Q_PROPERTY (QString contactId READ contactId NOTIFY contactIdChanged)
1027- Q_PROPERTY (QString manager READ manager NOTIFY managerChanged)
1028- Q_PROPERTY (QQmlListProperty<QDeclarativeContactDetail> contactDetails READ contactDetails NOTIFY contactChanged)
1029- Q_PROPERTY (QDeclarativeContactAddress* address READ address NOTIFY contactChanged)
1030- Q_PROPERTY (QQmlListProperty<QDeclarativeContactAddress> addresses READ addresses NOTIFY contactChanged)
1031- Q_PROPERTY (QDeclarativeContactAnniversary* anniversary READ anniversary NOTIFY contactChanged)
1032- Q_PROPERTY (QDeclarativeContactAvatar* avatar READ avatar NOTIFY contactChanged)
1033- Q_PROPERTY (QDeclarativeContactBirthday* birthday READ birthday NOTIFY contactChanged)
1034- Q_PROPERTY (QDeclarativeContactDisplayLabel* displayLabel READ displayLabel NOTIFY contactChanged)
1035- Q_PROPERTY (QDeclarativeContactEmailAddress* email READ email NOTIFY contactChanged)
1036- Q_PROPERTY (QQmlListProperty<QDeclarativeContactEmailAddress> emails READ emails NOTIFY contactChanged)
1037- Q_PROPERTY (QDeclarativeContactExtendedDetail* extendedDetail READ extendedDetail NOTIFY contactChanged)
1038- Q_PROPERTY (QQmlListProperty<QDeclarativeContactExtendedDetail> extendedDetails READ extendedDetails NOTIFY contactChanged)
1039- Q_PROPERTY (QDeclarativeContactFamily* family READ family NOTIFY contactChanged)
1040- Q_PROPERTY (QDeclarativeContactFavorite* favorite READ favorite NOTIFY contactChanged)
1041- Q_PROPERTY (QDeclarativeContactGender* gender READ gender NOTIFY contactChanged)
1042- Q_PROPERTY (QDeclarativeContactGeoLocation* geolocation READ geolocation NOTIFY contactChanged)
1043- Q_PROPERTY (QDeclarativeContactGlobalPresence* globalPresence READ globalPresence NOTIFY contactChanged)
1044- Q_PROPERTY (QDeclarativeContactGuid* guid READ guid NOTIFY contactChanged)
1045- Q_PROPERTY (QDeclarativeContactHobby* hobby READ hobby NOTIFY contactChanged)
1046- Q_PROPERTY (QDeclarativeContactName* name READ name NOTIFY contactChanged)
1047- Q_PROPERTY (QDeclarativeContactNickname* nickname READ nickname NOTIFY contactChanged)
1048- Q_PROPERTY (QDeclarativeContactNote* note READ note NOTIFY contactChanged)
1049- Q_PROPERTY (QDeclarativeContactOnlineAccount* onlineAccount READ onlineAccount NOTIFY contactChanged)
1050- Q_PROPERTY (QDeclarativeContactOrganization* organization READ organization NOTIFY contactChanged)
1051- Q_PROPERTY (QQmlListProperty<QDeclarativeContactOrganization> organizations READ organizations NOTIFY contactChanged)
1052- Q_PROPERTY (QDeclarativeContactPhoneNumber* phoneNumber READ phoneNumber NOTIFY contactChanged)
1053- Q_PROPERTY (QQmlListProperty<QDeclarativeContactPhoneNumber> phoneNumbers READ phoneNumbers NOTIFY contactChanged)
1054- Q_PROPERTY (QDeclarativeContactPresence* presence READ presence NOTIFY contactChanged)
1055- Q_PROPERTY (QDeclarativeContactRingtone* ringtone READ ringtone NOTIFY contactChanged)
1056- Q_PROPERTY (QDeclarativeContactSyncTarget* syncTarget READ syncTarget NOTIFY contactChanged)
1057- Q_PROPERTY (QDeclarativeContactTag* tag READ tag NOTIFY contactChanged)
1058- Q_PROPERTY (QDeclarativeContactTimestamp* timestamp READ timestamp NOTIFY contactChanged)
1059- Q_PROPERTY (QDeclarativeContactUrl* url READ url NOTIFY contactChanged)
1060- Q_PROPERTY (QQmlListProperty<QDeclarativeContactUrl> urls READ urls NOTIFY contactChanged)
1061- Q_PROPERTY (QDeclarativeContactVersion* version READ version NOTIFY contactChanged)
1062- Q_CLASSINFO("DefaultProperty", "contactDetails")
1063-
1064-public:
1065-
1066- explicit QDeclarativeContact(QObject *parent = 0);
1067- ~QDeclarativeContact();
1068-
1069- void setContact(const QContact& c);
1070- QContact contact() const;
1071- bool modified() const;
1072-
1073- QDeclarativeContactType::ContactType type() const;
1074-
1075- QString contactId() const;
1076- QString manager() const;
1077- QQmlListProperty<QDeclarativeContactDetail> contactDetails();
1078-
1079- // use int instead of QDeclarativeContactDetail::ContactType as a work-around for QTBUG-20639
1080- Q_INVOKABLE QDeclarativeContactDetail* detail(int type);
1081- Q_INVOKABLE QVariantList details(int type);
1082-
1083- Q_INVOKABLE bool removeDetail(QDeclarativeContactDetail* detail);
1084- Q_INVOKABLE bool addDetail(QDeclarativeContactDetail* detail);
1085-
1086- QDeclarativeContactAddress* address();
1087- QQmlListProperty<QDeclarativeContactAddress> addresses();
1088- QDeclarativeContactAnniversary* anniversary();
1089- QDeclarativeContactAvatar* avatar();
1090- QDeclarativeContactBirthday* birthday();
1091- QDeclarativeContactDisplayLabel* displayLabel();
1092- QDeclarativeContactEmailAddress* email();
1093- QQmlListProperty<QDeclarativeContactEmailAddress> emails();
1094- QDeclarativeContactExtendedDetail* extendedDetail();
1095- QQmlListProperty<QDeclarativeContactExtendedDetail> extendedDetails();
1096- QDeclarativeContactFamily* family();
1097- QDeclarativeContactFavorite* favorite();
1098- QDeclarativeContactGender* gender();
1099- QDeclarativeContactGeoLocation* geolocation();
1100- QDeclarativeContactGlobalPresence* globalPresence();
1101- QDeclarativeContactGuid* guid();
1102- QDeclarativeContactHobby* hobby();
1103- QDeclarativeContactName* name();
1104- QDeclarativeContactNickname* nickname();
1105- QDeclarativeContactNote* note();
1106- QDeclarativeContactOnlineAccount* onlineAccount();
1107- QDeclarativeContactOrganization* organization();
1108- QQmlListProperty<QDeclarativeContactOrganization> organizations();
1109- QDeclarativeContactPhoneNumber* phoneNumber();
1110- QQmlListProperty<QDeclarativeContactPhoneNumber> phoneNumbers();
1111- QDeclarativeContactPresence* presence();
1112- QDeclarativeContactRingtone* ringtone();
1113- QDeclarativeContactSyncTarget* syncTarget();
1114- QDeclarativeContactTag* tag();
1115- QDeclarativeContactTimestamp* timestamp();
1116- QDeclarativeContactUrl* url();
1117- QQmlListProperty<QDeclarativeContactUrl> urls();
1118- QDeclarativeContactVersion* version();
1119-
1120-protected:
1121- bool m_modified;
1122- QContactId m_id;
1123-
1124- // always create a copy of the detail for QML
1125- // however, seems the garbage collection can't delete all of them (QTBUG-20377)
1126- QList<QDeclarativeContactDetail *> m_details;
1127-
1128-public slots:
1129- void clearDetails();
1130- void save();
1131-Q_SIGNALS:
1132- void contactIdChanged();
1133- void managerChanged();
1134- void contactChanged();
1135-
1136-private slots:
1137- void setModified();
1138-
1139-private:
1140- Q_DISABLE_COPY(QDeclarativeContact)
1141-
1142- template<typename T> T* getDetail(const QDeclarativeContactDetail::DetailType &type)
1143- {
1144- foreach (QDeclarativeContactDetail *detail, m_details) {
1145- if (type == detail->detailType())
1146- {
1147- T* tempDetail = static_cast<T *>(detail);
1148- return tempDetail;
1149- }
1150- }
1151- T* detail = new T;
1152- if (detail) {
1153- m_details.append(detail);
1154- emit contactChanged();
1155- return detail;
1156- }
1157- return 0;
1158- }
1159-
1160- // call-back functions for list property
1161- static void _q_detail_append(QQmlListProperty<QDeclarativeContactDetail> *property, QDeclarativeContactDetail *value);
1162- static QDeclarativeContactDetail *_q_detail_at(QQmlListProperty<QDeclarativeContactDetail> *property, int index);
1163- static void _q_detail_clear(QQmlListProperty<QDeclarativeContactDetail> *property);
1164- static int _q_detail_count(QQmlListProperty<QDeclarativeContactDetail> *property);
1165-};
1166-
1167-QT_END_NAMESPACE_CONTACTS
1168-
1169-QTCONTACTS_USE_NAMESPACE
1170-
1171-QML_DECLARE_TYPE(QDeclarativeContact)
1172-
1173-#endif // QDECLARATIVECONTACT_P_H
1174
1175=== modified file '.pc/applied-patches'
1176--- .pc/applied-patches 2013-07-25 18:41:12 +0000
1177+++ .pc/applied-patches 2013-08-29 11:23:11 +0000
1178@@ -1,2 +1,1 @@
1179 revert_module_version.patch
1180-added-support-to-preferreddetails-on-qml-contact.patch
1181
1182=== modified file '.tag'
1183--- .tag 2013-07-25 18:41:12 +0000
1184+++ .tag 2013-08-29 11:23:11 +0000
1185@@ -1,1 +1,1 @@
1186-103993321e86b7e7698b5e6953991af1bb7f430e
1187+7bd0f9ad742558cf4b33aa7e372713fdb680d2ad
1188
1189=== modified file 'debian/changelog'
1190--- debian/changelog 2013-07-25 18:41:12 +0000
1191+++ debian/changelog 2013-08-29 11:23:11 +0000
1192@@ -1,3 +1,11 @@
1193+qtpim-opensource-src (5.0~git20130828-0ubuntu1) sauc; urgency=low
1194+
1195+ * New upstream snapshot release
1196+ * debian/patches/added-support-to-preferreddetails-on-qml-contact.patch:
1197+ - Drop, merged upstream
1198+
1199+ -- Timo Jyrinki <timo-jyrinki@ubuntu.com> Thu, 29 Aug 2013 12:26:09 +0300
1200+
1201 qtpim-opensource-src (5.0~git20130723-0ubuntu1) saucy; urgency=low
1202
1203 * New upstream snapshot release
1204
1205=== removed file 'debian/patches/added-support-to-preferreddetails-on-qml-contact.patch'
1206--- debian/patches/added-support-to-preferreddetails-on-qml-contact.patch 2013-07-25 18:41:12 +0000
1207+++ debian/patches/added-support-to-preferreddetails-on-qml-contact.patch 1970-01-01 00:00:00 +0000
1208@@ -1,359 +0,0 @@
1209-From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
1210-Date: Fri, 19 Jul 2013 15:23:01 -0300
1211-Subject: Added support to preferredDetails on QML Contact.
1212-
1213-Expose all functions related with preferredDetails
1214-into QML contacts.
1215-
1216-Task-number: QTBUG-32515
1217-
1218-Review: https://codereview.qt-project.org/#change,61289
1219----
1220- .../contacts/qmlcontactslistview/ContactEditor.qml | 39 +++++--
1221- .../qmlcontactslistview/DetailEditWidget.qml | 35 +++++++
1222- src/imports/contacts/qdeclarativecontact.cpp | 114 +++++++++++++++++++++
1223- src/imports/contacts/qdeclarativecontact_p.h | 9 ++
1224- 4 files changed, 191 insertions(+), 6 deletions(-)
1225-
1226-diff --git a/examples/contacts/qmlcontactslistview/ContactEditor.qml b/examples/contacts/qmlcontactslistview/ContactEditor.qml
1227-index 81e5f97..9cce579 100644
1228---- a/examples/contacts/qmlcontactslistview/ContactEditor.qml
1229-+++ b/examples/contacts/qmlcontactslistview/ContactEditor.qml
1230-@@ -39,9 +39,25 @@ Rectangle {
1231- leftMargin: 10
1232- topMargin: 10
1233- }
1234-- DetailEditWidget { id: nameField; label: "Name "; value: contact ? contact.name.firstName : " "}
1235-- DetailEditWidget { id: emailField; label: "Email Address "; value: contact ? contact.email.emailAddress : " "}
1236-- DetailEditWidget { id: phoneField; label: "Phone Number "; value: contact ? contact.phoneNumber.number : " "}
1237-+ DetailEditWidget {
1238-+ id: nameField
1239-+ label: "Name "
1240-+ value: contact ? contact.name.firstName : " "
1241-+ }
1242-+ DetailEditWidget {
1243-+ id: emailField
1244-+ label: "Email Address "
1245-+ value: contact ? contact.email.emailAddress : " "
1246-+ showPreferredField: true
1247-+ isPreferred: contact ? contact.isPreferredDetail("MESSAGE", contact.email) : false
1248-+ }
1249-+ DetailEditWidget {
1250-+ id: phoneField
1251-+ label: "Phone Number "
1252-+ value: contact ? contact.phoneNumber.number : " "
1253-+ showPreferredField: true
1254-+ isPreferred: contact ? contact.isPreferredDetail("CALL", contact.phoneNumber) : false
1255-+ }
1256- }
1257- // ![Widgets for manipulating contact details]
1258-
1259-@@ -52,7 +68,9 @@ Rectangle {
1260-
1261- function updateContact() {
1262- // read in values from the input fields
1263-- var values = [nameField.value, emailField.value, phoneField.value]
1264-+ var values = [nameField.value,
1265-+ emailField.value, emailField.requestPreferred || emailField.isPreferred,
1266-+ phoneField.value, phoneField.requestPreferred || phoneField.isPreferred]
1267- if (!contact) { // create new contact
1268- var newContact = Qt.createQmlObject("import QtContacts 5.0; Contact{ }", contactEditor)
1269- setDetailValues(newContact, values)
1270-@@ -60,8 +78,8 @@ Rectangle {
1271- contactsModel.saveContact(newContact)
1272- statusBar.updateMsg("new contact successfully created")
1273- } else { // update existing contact
1274-+ setDetailValues(contact, values)
1275- if (contact.modified) {
1276-- setDetailValues(contact, values)
1277- contact.save()
1278- statusBar.updateMsg("contact successfully updated")
1279- } else {
1280-@@ -73,7 +91,14 @@ Rectangle {
1281- function setDetailValues(c, values) {
1282- c.name.firstName = values[0]
1283- c.email.emailAddress = values[1]
1284-- c.phoneNumber.number = values[2]
1285-+ c.phoneNumber.number = values[3]
1286-+ if (values[2]) {
1287-+ c.setPreferredDetail("MESSAGE", c.email)
1288-+ }
1289-+
1290-+ if (values[4]) {
1291-+ c.setPreferredDetail("CALL", c.phoneNumber)
1292-+ }
1293- }
1294-
1295- function cancel() {
1296-@@ -84,6 +109,8 @@ Rectangle {
1297- nameField.inputFocus = false
1298- emailField.inputFocus = false
1299- phoneField.inputFocus = false
1300-+ emailField.requestPreferred = false
1301-+ phoneField.requestPreferred = false
1302- nameField.color = "black"
1303- emailField.color = "black"
1304- phoneField.color = "black"
1305-diff --git a/examples/contacts/qmlcontactslistview/DetailEditWidget.qml b/examples/contacts/qmlcontactslistview/DetailEditWidget.qml
1306-index e481941..4f490e2 100644
1307---- a/examples/contacts/qmlcontactslistview/DetailEditWidget.qml
1308-+++ b/examples/contacts/qmlcontactslistview/DetailEditWidget.qml
1309-@@ -34,6 +34,9 @@ Item {
1310- property alias value: valueText.text
1311- property alias color: valueText.color
1312- property alias inputFocus: valueText.focus
1313-+ property bool isPreferred: false
1314-+ property bool requestPreferred: false
1315-+ property bool showPreferredField: false
1316-
1317- property string old
1318-
1319-@@ -48,6 +51,7 @@ Item {
1320- }
1321-
1322- Rectangle {
1323-+ id: inputField
1324- width: 180
1325- height: 20
1326- anchors.left: label.right
1327-@@ -77,5 +81,36 @@ Item {
1328- }
1329- }
1330- }
1331-+
1332-+ Text {
1333-+ id: labelFav
1334-+
1335-+ anchors.left: inputField.right
1336-+ anchors.leftMargin: 5
1337-+
1338-+ font {
1339-+ family: "Helvetica"
1340-+ pixelSize: 15
1341-+ bold: true
1342-+ italic: true
1343-+ }
1344-+ text: "favorite:"
1345-+ visible: showPreferredField
1346-+ }
1347-+
1348-+ Rectangle {
1349-+ anchors.left: labelFav.right
1350-+ anchors.leftMargin: 5
1351-+ anchors.verticalCenter: labelFav.verticalCenter
1352-+ width: 10
1353-+ height: 10
1354-+ color: isPreferred || requestPreferred ? "black" : "white"
1355-+ visible: showPreferredField
1356-+
1357-+ MouseArea {
1358-+ anchors.fill: parent
1359-+ onClicked: requestPreferred = !requestPreferred
1360-+ }
1361-+ }
1362- }
1363- // ![Custom DetailsEditWidget is used for entering new or modifying existing contact detlais]
1364-diff --git a/src/imports/contacts/qdeclarativecontact.cpp b/src/imports/contacts/qdeclarativecontact.cpp
1365-index 1346b46..2e08969 100644
1366---- a/src/imports/contacts/qdeclarativecontact.cpp
1367-+++ b/src/imports/contacts/qdeclarativecontact.cpp
1368-@@ -127,6 +127,8 @@ void QDeclarativeContact::setContact(const QContact& contact)
1369- foreach (QDeclarativeContactDetail *detail, m_details)
1370- delete detail;
1371- m_details.clear();
1372-+ m_preferredDetails.clear();
1373-+
1374- QList<QContactDetail> details(contact.details());
1375- foreach (const QContactDetail &detail, details) {
1376- QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(static_cast<QDeclarativeContactDetail::DetailType>(detail.type()));
1377-@@ -135,6 +137,13 @@ void QDeclarativeContact::setContact(const QContact& contact)
1378- m_details.append(contactDetail);
1379- }
1380-
1381-+ QMap<QString, QContactDetail> prefDetails(contact.preferredDetails());
1382-+ QMap<QString, QContactDetail>::const_iterator it = prefDetails.begin();
1383-+ while (it != prefDetails.end()) {
1384-+ m_preferredDetails.insert(it.key(), it.value().key());
1385-+ it++;
1386-+ }
1387-+
1388- m_modified = false;
1389- emit contactChanged();
1390- }
1391-@@ -145,6 +154,13 @@ QContact QDeclarativeContact::contact() const
1392- contact.setId(m_id);
1393- foreach (QDeclarativeContactDetail *detail, m_details)
1394- contact.saveDetail(&detail->detail());
1395-+
1396-+ QVariantMap prefDetails = preferredDetails();
1397-+ QVariantMap::const_iterator it = prefDetails.begin();
1398-+ while (it != prefDetails.end()) {
1399-+ contact.setPreferredDetail(it.key(), it.value().value<QDeclarativeContactDetail *>()->detail());
1400-+ it++;
1401-+ }
1402- return contact;
1403- }
1404-
1405-@@ -198,6 +214,7 @@ bool QDeclarativeContact::removeDetail(QDeclarativeContactDetail* detail)
1406- int i = 0;
1407- foreach (QDeclarativeContactDetail *contactDetail, m_details) {
1408- if (key == contactDetail->detail().key()) {
1409-+ removePrefferedDetail(detail);
1410- delete contactDetail;
1411- m_details.removeAt(i);
1412- emit contactChanged();
1413-@@ -209,6 +226,16 @@ bool QDeclarativeContact::removeDetail(QDeclarativeContactDetail* detail)
1414- return false;
1415- }
1416-
1417-+void QDeclarativeContact::removePrefferedDetail(QDeclarativeContactDetail* detail)
1418-+{
1419-+ QMap<QString, int> cpy = m_preferredDetails;
1420-+ QMap<QString, int>::const_iterator it = cpy.begin();
1421-+ while (it != cpy.end()) {
1422-+ if (it.value() == detail->detail().key())
1423-+ m_preferredDetails.remove(it.key());
1424-+ }
1425-+}
1426-+
1427- /*!
1428- \qmlmethod Contact::addDetail(detail)
1429-
1430-@@ -233,6 +260,93 @@ bool QDeclarativeContact::addDetail(QDeclarativeContactDetail* detail)
1431- }
1432-
1433- /*!
1434-+ \qmlmethod Contact::setPreferredDetail(actionName, detail)
1435-+
1436-+ Set a particular detail (\a preferredDetail) as the preferred detail for any actions with the given \a actionName.
1437-+
1438-+ The \a preferredDetail object must exist in this object, and the \a actionName cannot be empty.
1439-+
1440-+ Returns true if the preference could be recorded, and false otherwise.
1441-+
1442-+ \sa preferredDetail()
1443-+ */
1444-+bool QDeclarativeContact::setPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail)
1445-+{
1446-+ if (actionName.isEmpty() || !detail || !m_details.contains(detail))
1447-+ return false;
1448-+
1449-+ if (m_preferredDetails.contains(actionName) && m_preferredDetails[actionName] == detail->detail().key())
1450-+ return false;
1451-+
1452-+ m_preferredDetails.insert(actionName, detail->detail().key());
1453-+ m_modified = true;
1454-+ emit contactChanged();
1455-+ return true;
1456-+}
1457-+
1458-+/*!
1459-+ \qmlmethod Contact::isPreferredDetail(actionName, detail)
1460-+
1461-+ Returns true if the given \a detail is a preferred detail for the given \a actionName,
1462-+ or for any action if the \a actionName is empty.
1463-+
1464-+ \sa preferredDetail()
1465-+ */
1466-+bool QDeclarativeContact::isPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail) const
1467-+{
1468-+ if (actionName.isEmpty() || !detail || !m_details.contains(detail))
1469-+ return false;
1470-+
1471-+ if (!m_preferredDetails.contains(actionName))
1472-+ return false;
1473-+
1474-+ return (m_preferredDetails[actionName] == detail->detail().key());
1475-+}
1476-+
1477-+/*!
1478-+ \qmlmethod Contact::preferredDetail(actionName, detail)
1479-+
1480-+ Returns the preferred detail for a given \a actionName.
1481-+
1482-+ If the \a actionName is empty, or there is no preference recorded for
1483-+ the supplied \a actionName, returns null.
1484-+
1485-+ \sa preferredDetails()
1486-+ */
1487-+QDeclarativeContactDetail* QDeclarativeContact::preferredDetail(const QString& actionName) const
1488-+{
1489-+ int id = m_preferredDetails.value(actionName, -1);
1490-+ if (id == -1)
1491-+ return 0;
1492-+
1493-+ foreach (QDeclarativeContactDetail* detail, m_details) {
1494-+ if (detail->detail().key() == id)
1495-+ return detail;
1496-+ }
1497-+ return 0;
1498-+}
1499-+
1500-+
1501-+/*!
1502-+ \qmlproperty map<string, ContactDetail> Contact::preferredDetails
1503-+
1504-+ This property holds the recorded detail preferences for action names.
1505-+
1506-+ Each entry in the map has the action name as the key, and the corresponding
1507-+ preferred detail as the value.
1508-+ */
1509-+QVariantMap QDeclarativeContact::preferredDetails() const
1510-+{
1511-+ QVariantMap result;
1512-+ QMap<QString, int>::const_iterator it = m_preferredDetails.begin();
1513-+ while (it != m_preferredDetails.end()) {
1514-+ result.insert(it.key(), QVariant::fromValue<QDeclarativeContactDetail*>(preferredDetail(it.key())));
1515-+ it++;
1516-+ }
1517-+ return result;
1518-+}
1519-+
1520-+/*!
1521- \qmlproperty list<ContactDetail> Contact::contactDetails
1522-
1523- This property holds the list of all the details that the contact has.
1524-diff --git a/src/imports/contacts/qdeclarativecontact_p.h b/src/imports/contacts/qdeclarativecontact_p.h
1525-index 9abf0d4..21a8879 100644
1526---- a/src/imports/contacts/qdeclarativecontact_p.h
1527-+++ b/src/imports/contacts/qdeclarativecontact_p.h
1528-@@ -95,6 +95,7 @@ class QDeclarativeContact : public QObject
1529- Q_PROPERTY (QDeclarativeContactUrl* url READ url NOTIFY contactChanged)
1530- Q_PROPERTY (QQmlListProperty<QDeclarativeContactUrl> urls READ urls NOTIFY contactChanged)
1531- Q_PROPERTY (QDeclarativeContactVersion* version READ version NOTIFY contactChanged)
1532-+ Q_PROPERTY (QVariantMap preferredDetails READ preferredDetails NOTIFY contactChanged)
1533- Q_CLASSINFO("DefaultProperty", "contactDetails")
1534-
1535- public:
1536-@@ -119,6 +120,11 @@ public:
1537- Q_INVOKABLE bool removeDetail(QDeclarativeContactDetail* detail);
1538- Q_INVOKABLE bool addDetail(QDeclarativeContactDetail* detail);
1539-
1540-+ Q_INVOKABLE bool setPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail);
1541-+ Q_INVOKABLE bool isPreferredDetail(const QString& actionName, QDeclarativeContactDetail* detail) const;
1542-+ Q_INVOKABLE QDeclarativeContactDetail* preferredDetail(const QString& actionName) const;
1543-+ QVariantMap preferredDetails() const;
1544-+
1545- QDeclarativeContactAddress* address();
1546- QQmlListProperty<QDeclarativeContactAddress> addresses();
1547- QDeclarativeContactAnniversary* anniversary();
1548-@@ -160,6 +166,7 @@ protected:
1549- // always create a copy of the detail for QML
1550- // however, seems the garbage collection can't delete all of them (QTBUG-20377)
1551- QList<QDeclarativeContactDetail *> m_details;
1552-+ QMap<QString, int> m_preferredDetails;
1553-
1554- public slots:
1555- void clearDetails();
1556-@@ -193,6 +200,8 @@ private:
1557- return 0;
1558- }
1559-
1560-+ void removePrefferedDetail(QDeclarativeContactDetail *detail);
1561-+
1562- // call-back functions for list property
1563- static void _q_detail_append(QQmlListProperty<QDeclarativeContactDetail> *property, QDeclarativeContactDetail *value);
1564- static QDeclarativeContactDetail *_q_detail_at(QQmlListProperty<QDeclarativeContactDetail> *property, int index);
1565---
1566-1.8.3.2
1567-
1568
1569=== modified file 'debian/patches/series'
1570--- debian/patches/series 2013-07-25 18:41:12 +0000
1571+++ debian/patches/series 2013-08-29 11:23:11 +0000
1572@@ -1,2 +1,1 @@
1573 revert_module_version.patch
1574-added-support-to-preferreddetails-on-qml-contact.patch
1575
1576=== modified file 'src/contacts/details/qcontacttype.h'
1577--- src/contacts/details/qcontacttype.h 2013-05-10 14:15:23 +0000
1578+++ src/contacts/details/qcontacttype.h 2013-08-29 11:23:11 +0000
1579@@ -67,7 +67,7 @@
1580 TypeGroup
1581 };
1582
1583- void setType(const TypeValues type) {setValue(FieldType, type);}
1584+ void setType(const TypeValues newType) {setValue(FieldType, newType);}
1585 TypeValues type() const {return static_cast<TypeValues>(value<int>(FieldType));}
1586 };
1587
1588
1589=== modified file 'src/contacts/qcontactabstractrequest.h'
1590--- src/contacts/qcontactabstractrequest.h 2013-05-10 14:15:23 +0000
1591+++ src/contacts/qcontactabstractrequest.h 2013-08-29 11:23:11 +0000
1592@@ -113,7 +113,7 @@
1593 QContactAbstractRequestPrivate* d_ptr;
1594
1595 private:
1596- QContactAbstractRequest(QObject* parent = 0) : QObject(parent), d_ptr(0) {}
1597+ QContactAbstractRequest(QObject* parent_ = 0) : QObject(parent_), d_ptr(0) {}
1598 Q_DISABLE_COPY(QContactAbstractRequest)
1599 friend class QContactManagerEngine;
1600 friend class QContactAbstractRequestPrivate;
1601
1602=== modified file 'src/contacts/qcontactactionfactory.h'
1603--- src/contacts/qcontactactionfactory.h 2013-05-10 14:15:23 +0000
1604+++ src/contacts/qcontactactionfactory.h 2013-08-29 11:23:11 +0000
1605@@ -63,7 +63,7 @@
1606 Q_OBJECT
1607
1608 public:
1609- QContactActionFactory(QObject *parent = 0) : QObject(parent) {}
1610+ QContactActionFactory(QObject *parent_ = 0) : QObject(parent_) {}
1611 virtual ~QContactActionFactory();
1612 virtual QList<QContactActionDescriptor> actionDescriptors() const = 0;
1613 virtual QContactAction* create(const QContactActionDescriptor& which) const = 0;
1614
1615=== modified file 'src/contacts/qcontactdetail.h'
1616--- src/contacts/qcontactdetail.h 2013-05-10 14:15:23 +0000
1617+++ src/contacts/qcontactdetail.h 2013-08-29 11:23:11 +0000
1618@@ -148,16 +148,16 @@
1619 return value(field).value<T>();
1620 }
1621
1622- void setContexts(int context)
1623+ void setContexts(int newContext)
1624 {
1625- QList<int> contexts;
1626- contexts << context;
1627- setValue(FieldContext, QVariant::fromValue(contexts));
1628+ QList<int> newContexts;
1629+ newContexts << newContext;
1630+ setValue(FieldContext, QVariant::fromValue(newContexts));
1631 }
1632
1633- void setContexts(const QList<int>& contexts)
1634+ void setContexts(const QList<int>& newContexts)
1635 {
1636- setValue(FieldContext, QVariant::fromValue(contexts));
1637+ setValue(FieldContext, QVariant::fromValue(newContexts));
1638 }
1639
1640 QList<int> contexts() const
1641@@ -165,9 +165,9 @@
1642 return value< QList<int> >(FieldContext);
1643 }
1644
1645- void setDetailUri(const QString& detailUri)
1646+ void setDetailUri(const QString& newDetailUri)
1647 {
1648- setValue(FieldDetailUri, detailUri);
1649+ setValue(FieldDetailUri, newDetailUri);
1650 }
1651
1652 QString detailUri() const
1653@@ -175,9 +175,9 @@
1654 return value(FieldDetailUri).toString();
1655 }
1656
1657- void setLinkedDetailUris(const QStringList& linkedDetailUris)
1658+ void setLinkedDetailUris(const QStringList& newLinkedDetailUris)
1659 {
1660- setValue(FieldLinkedDetailUris, linkedDetailUris);
1661+ setValue(FieldLinkedDetailUris, newLinkedDetailUris);
1662 }
1663
1664 void setLinkedDetailUris(const QString& linkedDetailUri)
1665
1666=== modified file 'src/contacts/qcontactfetchhint.h'
1667--- src/contacts/qcontactfetchhint.h 2013-05-10 14:15:23 +0000
1668+++ src/contacts/qcontactfetchhint.h 2013-08-29 11:23:11 +0000
1669@@ -97,7 +97,7 @@
1670 Q_CONTACTS_EXPORT QDebug operator<<(QDebug dbg, const QContactFetchHint& hint);
1671 #endif
1672
1673-Q_DECLARE_OPERATORS_FOR_FLAGS(QContactFetchHint::OptimizationHints);
1674+Q_DECLARE_OPERATORS_FOR_FLAGS(QContactFetchHint::OptimizationHints)
1675
1676 QT_END_NAMESPACE_CONTACTS
1677
1678
1679=== modified file 'src/contacts/qcontactfilter.h'
1680--- src/contacts/qcontactfilter.h 2013-05-10 14:15:23 +0000
1681+++ src/contacts/qcontactfilter.h 2013-08-29 11:23:11 +0000
1682@@ -120,7 +120,7 @@
1683 QSharedDataPointer<QContactFilterPrivate> d_ptr;
1684 };
1685
1686-Q_DECLARE_OPERATORS_FOR_FLAGS(QContactFilter::MatchFlags);
1687+Q_DECLARE_OPERATORS_FOR_FLAGS(QContactFilter::MatchFlags)
1688
1689 const Q_CONTACTS_EXPORT QContactFilter operator&(const QContactFilter& left, const QContactFilter& right);
1690 const Q_CONTACTS_EXPORT QContactFilter operator|(const QContactFilter& left, const QContactFilter& right);
1691
1692=== modified file 'src/contacts/qcontactid.h'
1693--- src/contacts/qcontactid.h 2013-05-10 14:15:23 +0000
1694+++ src/contacts/qcontactid.h 2013-08-29 11:23:11 +0000
1695@@ -112,7 +112,7 @@
1696 Q_DECLARE_TYPEINFO(QTCONTACTS_PREPEND_NAMESPACE(QContactId), Q_MOVABLE_TYPE);
1697 QT_END_NAMESPACE
1698
1699-Q_DECLARE_METATYPE(QTCONTACTS_PREPEND_NAMESPACE(QContactId));
1700+Q_DECLARE_METATYPE(QTCONTACTS_PREPEND_NAMESPACE(QContactId))
1701
1702
1703 #endif
1704
1705=== modified file 'src/contacts/qcontactmanager.cpp'
1706--- src/contacts/qcontactmanager.cpp 2013-06-05 15:45:28 +0000
1707+++ src/contacts/qcontactmanager.cpp 2013-08-29 11:23:11 +0000
1708@@ -151,6 +151,10 @@
1709 ret.prepend(overrideManagerName);
1710 }
1711
1712+ // bump memory to the end of the list
1713+ if (ret.removeAll(QStringLiteral("memory")))
1714+ ret.append(QStringLiteral("memory"));
1715+
1716 return ret;
1717 }
1718
1719
1720=== modified file 'src/contacts/qcontactmanager.h'
1721--- src/contacts/qcontactmanager.h 2013-05-10 14:15:23 +0000
1722+++ src/contacts/qcontactmanager.h 2013-08-29 11:23:11 +0000
1723@@ -69,7 +69,7 @@
1724 Q_OBJECT
1725
1726 public:
1727-#if Q_QDOC // qdoc's parser fails to recognise the default map argument
1728+#ifdef Q_QDOC // qdoc's parser fails to recognise the default map argument
1729 explicit QContactManager(const QString& managerName = QString(), const QMap<QString, QString>& parameters = 0, QObject* parent = 0);
1730 QContactManager(const QString& managerName, int implementationVersion, const QMap<QString, QString>& parameters = 0, QObject* parent = 0);
1731 #else
1732
1733=== modified file 'src/imports/contacts/qdeclarativecontact.cpp'
1734--- src/imports/contacts/qdeclarativecontact.cpp 2013-07-25 18:41:12 +0000
1735+++ src/imports/contacts/qdeclarativecontact.cpp 2013-08-29 11:23:11 +0000
1736@@ -214,7 +214,7 @@
1737 int i = 0;
1738 foreach (QDeclarativeContactDetail *contactDetail, m_details) {
1739 if (key == contactDetail->detail().key()) {
1740- removePrefferedDetail(detail);
1741+ removePreferredDetail(detail);
1742 delete contactDetail;
1743 m_details.removeAt(i);
1744 emit contactChanged();
1745@@ -226,7 +226,7 @@
1746 return false;
1747 }
1748
1749-void QDeclarativeContact::removePrefferedDetail(QDeclarativeContactDetail* detail)
1750+void QDeclarativeContact::removePreferredDetail(QDeclarativeContactDetail* detail)
1751 {
1752 QMap<QString, int> cpy = m_preferredDetails;
1753 QMap<QString, int>::const_iterator it = cpy.begin();
1754
1755=== modified file 'src/imports/contacts/qdeclarativecontact_p.h'
1756--- src/imports/contacts/qdeclarativecontact_p.h 2013-07-25 18:41:12 +0000
1757+++ src/imports/contacts/qdeclarativecontact_p.h 2013-08-29 11:23:11 +0000
1758@@ -200,7 +200,7 @@
1759 return 0;
1760 }
1761
1762- void removePrefferedDetail(QDeclarativeContactDetail *detail);
1763+ void removePreferredDetail(QDeclarativeContactDetail *detail);
1764
1765 // call-back functions for list property
1766 static void _q_detail_append(QQmlListProperty<QDeclarativeContactDetail> *property, QDeclarativeContactDetail *value);
1767
1768=== modified file 'src/imports/contacts/qdeclarativecontactmodel.cpp'
1769--- src/imports/contacts/qdeclarativecontactmodel.cpp 2013-07-25 18:41:12 +0000
1770+++ src/imports/contacts/qdeclarativecontactmodel.cpp 2013-08-29 11:23:11 +0000
1771@@ -97,7 +97,8 @@
1772 m_filter(0),
1773 m_error(QContactManager::NoError),
1774 m_autoUpdate(true),
1775- m_componentCompleted(false)
1776+ m_componentCompleted(false),
1777+ m_progressiveLoading(true)
1778 {
1779 }
1780 ~QDeclarativeContactModelPrivate()
1781@@ -126,6 +127,9 @@
1782 QUrl m_lastImportUrl;
1783 QAtomicInt m_lastRequestId;
1784 QHash<QContactAbstractRequest *, int> m_requestIdHash;
1785+ QList<QContactFetchRequest*> m_pendingRequests;
1786+ QList<QContact> m_pendingContacts;
1787+ bool m_progressiveLoading;
1788 };
1789
1790 QDeclarativeContactModel::QDeclarativeContactModel(QObject *parent) :
1791@@ -712,42 +716,116 @@
1792 fetchRequest->setFetchHint(d->m_fetchHint ? d->m_fetchHint->fetchHint() : QContactFetchHint());
1793
1794 connect(fetchRequest, SIGNAL(resultsAvailable()), this, SLOT(requestUpdated()));
1795+ connect(fetchRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)),
1796+ this, SLOT(fetchRequestStateChanged(QContactAbstractRequest::State)));
1797+
1798+ // cancel all previous requests
1799+ foreach (QContactFetchRequest *req, d->m_pendingRequests) {
1800+ req->cancel();
1801+ req->deleteLater();
1802+ }
1803+
1804+ d->m_pendingContacts.clear();
1805+ d->m_pendingRequests.clear();
1806+ d->m_pendingRequests.append(fetchRequest);
1807+
1808+ // if we have no contacts yet, we can display results as soon as they arrive
1809+ // but if we are updating the model after a sort or filter change, we have to
1810+ // wait for all contacts before processing the update
1811+ d->m_progressiveLoading = d->m_contacts.isEmpty();
1812
1813 fetchRequest->start();
1814 }
1815
1816 void QDeclarativeContactModel::requestUpdated()
1817 {
1818+
1819 QContactFetchRequest* req = qobject_cast<QContactFetchRequest*>(QObject::sender());
1820 if (req) {
1821 QList<QContact> contacts = req->contacts();
1822- QList<QDeclarativeContact*> dcs;
1823- foreach (const QContact &c, contacts) {
1824- if (d->m_contactMap.contains(c.id())) {
1825- QDeclarativeContact* dc = d->m_contactMap.value(c.id());
1826- dc->setContact(c);
1827- } else {
1828- QDeclarativeContact* dc = new QDeclarativeContact(this);
1829- if (dc) {
1830- d->m_contactMap.insert(c.id(), dc);
1831+
1832+ // if we are starting from scratch, we can show contact results as they arrive
1833+ if (d->m_progressiveLoading) {
1834+ QList<QDeclarativeContact*> dcs;
1835+ foreach (const QContact &c, contacts) {
1836+ if (d->m_contactMap.contains(c.id())) {
1837+ QDeclarativeContact* dc = d->m_contactMap.value(c.id());
1838 dc->setContact(c);
1839- dcs.append(dc);
1840+ } else {
1841+ QDeclarativeContact* dc = new QDeclarativeContact(this);
1842+ if (dc) {
1843+ d->m_contactMap.insert(c.id(), dc);
1844+ dc->setContact(c);
1845+ dcs.append(dc);
1846+ }
1847 }
1848 }
1849- }
1850-
1851- if (dcs.count() > 0) {
1852- beginInsertRows(QModelIndex(), d->m_contacts.count(), d->m_contacts.count() + dcs.count() - 1);
1853- // At this point we need to relay on the backend and assume that the partial results are following the fetch sorting property
1854- d->m_contacts += dcs;
1855- endInsertRows();
1856-
1857- emit contactsChanged();
1858+
1859+ if (dcs.count() > 0) {
1860+ beginInsertRows(QModelIndex(), d->m_contacts.count(), d->m_contacts.count() + dcs.count() - 1);
1861+ // At this point we need to relay on the backend and assume that the partial results are following the fetch sorting property
1862+ d->m_contacts += dcs;
1863+ endInsertRows();
1864+
1865+ emit contactsChanged();
1866+ }
1867+ } else {
1868+ d->m_pendingContacts << contacts;
1869 }
1870
1871 checkError(req);
1872- if (req->isFinished())
1873- req->deleteLater();
1874+ }
1875+}
1876+
1877+void QDeclarativeContactModel::fetchRequestStateChanged(QContactAbstractRequest::State newState)
1878+{
1879+ if (newState != QContactAbstractRequest::FinishedState)
1880+ return;
1881+
1882+ QContactFetchRequest* req = qobject_cast<QContactFetchRequest*>(QObject::sender());
1883+ if (req) {
1884+ // if we were not processing contacts as soon as they arrive, we need to process them here.
1885+ if (!d->m_progressiveLoading) {
1886+ // start by removing the contacts that don't belong to this result set anymore
1887+ for (int i = d->m_contacts.count()-1; i >= 0; --i) {
1888+ QDeclarativeContact *contact = d->m_contacts[i];
1889+ if (!d->m_pendingContacts.contains(contact->contact())) {
1890+ beginRemoveRows(QModelIndex(), i, i);
1891+ d->m_contacts.removeAt(i);
1892+ d->m_contactMap.remove(contact->contact().id());
1893+ endRemoveRows();
1894+ }
1895+ }
1896+
1897+ // now insert new contacts and move existing ones to their final positions
1898+ int count = d->m_pendingContacts.count();
1899+ for (int i = 0; i < count; ++i) {
1900+ QContact c = d->m_pendingContacts[i];
1901+ if (!d->m_contactMap.contains(c.id())) {
1902+ QDeclarativeContact* dc = new QDeclarativeContact(this);
1903+ dc->setContact(c);
1904+ beginInsertRows(QModelIndex(), i, i);
1905+ d->m_contacts.insert(i, dc);
1906+ d->m_contactMap.insert(c.id(),dc);
1907+ endInsertRows();
1908+ } else {
1909+ QDeclarativeContact *contact = d->m_contactMap[c.id()];
1910+
1911+ int pos = d->m_contacts.indexOf(contact);
1912+ if (pos != i) {
1913+ beginMoveRows(QModelIndex(), pos, pos, QModelIndex(), i);
1914+ d->m_contacts.move(pos, i);
1915+ endMoveRows();
1916+ }
1917+ }
1918+ }
1919+ emit contactsChanged();
1920+ }
1921+
1922+ // and now clear the pending contact list as the model is up-to-date
1923+ d->m_pendingContacts.clear();
1924+ d->m_pendingRequests.removeOne(req);
1925+ req->deleteLater();
1926 }
1927 }
1928
1929@@ -1103,14 +1181,24 @@
1930 if (d->m_contacts.at(i)->contactId() == contactIdString) {
1931 QDeclarativeContact* dc = d->m_contacts.at(i);
1932 dc->setContact(fetchedContact);
1933+
1934+ // Since the contact can change the position due the sort order we need take care of it
1935+ // First we need to remove it from previous position and notify the model about that
1936+ beginRemoveRows(QModelIndex(), i, i);
1937+ d->m_contactMap.remove(fetchedContact.id());
1938+ d->m_contacts.removeAt(i);
1939+ endRemoveRows();
1940+
1941+ // Calculate the new position
1942 int index = contactIndex(dc);
1943- d->m_contactMap.remove(fetchedContact.id());
1944- d->m_contacts.removeAt(i);
1945+ // Notify the model about the new item position
1946+ beginInsertRows(QModelIndex(), index, index);
1947 d->m_contacts.insert(index, dc);
1948 d->m_contactMap.insert(fetchedContact.id(),dc);
1949 if (!contactsUpdated)
1950 contactsUpdated = true;
1951- emit dataChanged(this->index(index), this->index(index), QVector<int>() << ContactRole);
1952+ endInsertRows();
1953+
1954 fetchedContactFound = true;
1955 break;
1956 }
1957@@ -1156,7 +1244,6 @@
1958 return d->m_contacts.size();
1959 }
1960
1961-
1962 #include "moc_qdeclarativecontactmodel_p.cpp"
1963
1964 QT_END_NAMESPACE_CONTACTS
1965
1966=== modified file 'src/imports/contacts/qdeclarativecontactmodel_p.h'
1967--- src/imports/contacts/qdeclarativecontactmodel_p.h 2013-06-05 15:45:28 +0000
1968+++ src/imports/contacts/qdeclarativecontactmodel_p.h 2013-08-29 11:23:11 +0000
1969@@ -178,6 +178,7 @@
1970 void clearContacts();
1971 void fetchAgain();
1972 void requestUpdated();
1973+ void fetchRequestStateChanged(QContactAbstractRequest::State newState);
1974 void doUpdate();
1975 void onRequestStateChanged(QContactAbstractRequest::State newState);
1976 void onContactsAdded(const QList<QContactId>& ids);
1977
1978=== modified file 'tests/auto/contacts/qcontact/tst_qcontact.cpp'
1979--- tests/auto/contacts/qcontact/tst_qcontact.cpp 2013-07-25 18:41:12 +0000
1980+++ tests/auto/contacts/qcontact/tst_qcontact.cpp 2013-08-29 11:23:11 +0000
1981@@ -71,7 +71,7 @@
1982 void idTraits();
1983 void equality();
1984 void inequality();
1985- void prefferedDetails();
1986+ void preferredDetails();
1987 };
1988
1989 tst_QContact::tst_QContact()
1990@@ -708,7 +708,7 @@
1991 QVERIFY(one != two);
1992 }
1993
1994-void tst_QContact::prefferedDetails()
1995+void tst_QContact::preferredDetails()
1996 {
1997 QContactPhoneNumber number;
1998 number.setNumber("7654321");

Subscribers

People subscribed via source and target branches

to all changes: