Qt6 topics merged with General

QContactManager bug?

  • I had problems to fetch contacts in my QML application, that I described here: "Contact model not working":http://developer.qt.nokia.com/forums/viewthread/7846

    But after further testing it seems like a bug in the ContactManager. I always get the QContactManager::InvalidDetailError if i try to fetch contacts (only from symbian backend, "symbiansim" or the simulator works fine).

    This code in my main.cpp:
    QContactManager cm;
    qDebug() << cm.availableManagers();
    qDebug() << cm.contacts();
    qDebug() << cm.managerName();
    qDebug() << cm.managerParameters();
    qDebug() << cm.managerUri();
    qDebug() << cm.managerVersion();
    qDebug() << cm.error();

    leads always to this console output:
    [Qt Message] ("symbian", "memory", "invalid", "symbiansim")
    [Qt Message] ()
    [Qt Message] "symbian"
    [Qt Message] QMap()
    [Qt Message] "qtcontacts:symbian:"
    [Qt Message] 1
    [Qt Message] 3

    After reading this: "QContactManager contact fetching broken on Symbian^3?":http://developer.qt.nokia.com/forums/viewthread/6078 I purged my complete contacts from my phone but it still gives me the same error, even if there are no contacts anymore.

    Maybe I still doing something wrong...

    Qt version: 4.7.3
    QtMobility version : 1.1.3

  • A couple of things: if the number of contacts in the device phonebook (not the sim phonebook) is zero, then a default constructed contact manager will return zero contacts (that's expected behaviour). A manager should never set the error to invalid detail error after a synchronous fetch operation, though, so that certainly sounds like a bug.

    Out of interest, what happens if you attempt to fetch contactIds() instead of contacts()? If that returns some list of ids, can you then call contacts(idList) overload, and then post what the errorMap is filled with?


  • Thanks for the reply. I tried what you said and called contactIds(), which returned a list of ids. I called the contacts() functions with this ids and voilĂ  all of the contacts are returned with no errors.

    So as a workaround I can assign that list to my QML context to display the contacts.

    Tahnks again, that hint helped me alot.

Log in to reply