Hi Chris.  This sounds like a regression in the (unfinished) qtpim module of Qt 
5, which reimplements the functions provided by QtContacts in QtMobility.

You can report bugs against this module here: 
https://bugreports.qt-project.org/browse/QTBUG/component/19726

Thanks,
Matt
________________________________________
From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
on behalf of christopher.l...@thurweb.ch [christopher.l...@thurweb.ch]
Sent: Thursday, February 27, 2014 8:09 PM
To: Sailfish OS Developers
Subject: [SailfishDevel] QtContacts: phoneNumbers.length attribute gets lost    
when copied to  ListModel

Hi All

I have come across some strangeness using QtContacts 5.0 on Sailfish.

For various reasons partially lost in the mists of time, I copy
contacts (or rather a subset of contract roles) from the ContactModel
to a a normal ListModel.

One of the roles copied is "phoneNumbers". This has a child property
"length" indicating the number of phoneNumbers available for the
contact.

phoneNumbers.length is available (defined) direct from the
ContactModel, but is undefined when I try to use it from the
ListModel. So the console.log in the function appendContact() gives a
valid result, but the console.log in populate() gives undefined.

Other properties, including the phone numbers in phoneNumbers are
defined when accessed from the ListModel.

Equivalent code works in Haramtatan / Qt 4.7.4 Mobility 1.2


        import QtContacts 5.0

        ContactModel {
         id: phoneContactsModelInternal
        }

        ListModel {
         id: localContactModelInternal
         function populate() {
             clear();
             for (var i = 0; i <
phoneContactsModelInternal.contacts.length; i ++) {
                 appendContact(phoneContactsModelInternal.contacts[i]);
                 console.log("checking number of phoneNumbers: " +
localContactModel.get(i).phoneNumbers.length);
             }
         }
         function appendContact(contact) {
             localContactModel.append({"contactId": contact.contactId,
                                   "displayLabel": contact.displayLabel.label,
                                   "phoneNumbers": contact.phoneNumbers,
                                   "phoneNumbersCount":
contact.phoneNumbers.length});
             console.log("appending: " + contact.displayLabel.label +
", numbers: " + contact.phoneNumbers.length)
         }
     }

Any ideas?

Chris

_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to