Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2010

    Retrieving contact avatar on N900

    I am using Qt Mobility 1.0.0 and attempting to read contacts' avatars from a N900 (Maemo 5). I successfully load all the contacts from the address book, their names and phone number. However, I am failing to get the url of the avatars. Here is the code I used:

    /* Contacts manager */
    QContactManager* myContactManager = new QContactManager();

    /* List with all contacts */
    contacts = myContactManager->contacts();

    for(int i = 0; i < contacts.count(); i++){
    QContactAvatar cAvatar = contacts.at(i).detail(QContactAvatar:efinitionName);
    if (cAvatar.imageUrl().isEmpty())
    /* load a Default Image */
    contactImage = QImage(":/defaultContact.jpg");
    /* load from the image's url */
    contactImage = QImage(cAvatar.imageUrl().toLocalFile());

    I used qDebug() to check the imageUrl but it is always empty (""). Any ideas why is that happening? Is there something else I can do to get access to the contacts' avatars on Maemo using Qt Mobility?

    Thank you and I appreciate any help,


  2. #2
    Nokia Developer Expert
    Join Date
    May 2010

    Re: Retrieving contact avatar on N900

    Hi Mirko,

    The QContactAvatar detail is not supported on the maemo5 platform currently (if you instantiate the "maemo5" manager and inspect the detailDefinitions() you should note that it does not report that definition). For most use cases, the QContactThumbnail detail is what you want to use, and this is supported on Maemo5 - however support for the detail only matured in the 1.0.2 patch release (thanks in large part to testing done by Felipe Crochik who has written a great contacts application for the N900).

    So, my suggestion would be to upgrade to the latest (1.0.2) patch release of Mobility, and to use the QContactThumbnail detail instead of QContactAvatar, if possible.


  3. #3
    Super Contributor
    Join Date
    Oct 2009

    Re: Retrieving contact avatar on N900

    Should be something like this:
    #include <QtCore>
    #include <QContactManager>
    #include <QContactThumbnail>
    using namespace QtMobility;
    int main (int argc, char **argv)
        QCoreApplication app(argc, argv);
        QContactManager manager("maemo5");
        QList<QContactLocalId> contacts = manager.contactIds();
        foreach (QContactLocalId id, contacts) {
            QContact contact = manager.contact(id);
            QList<QContactDetail> details = contact.details(QContactThumbnail::DefinitionName);
            foreach (QContactThumbnail detail, details) {
                qDebug() << contact.displayLabel() << detail.thumbnail().size();

  4. #4
    Registered User
    Join Date
    Jul 2010

    Re: Retrieving contact avatar on N900

    QContactThumbnail worked. Thanks for the fast reply guys

Similar Threads

  1. Replies: 15
    Last Post: 2010-09-28, 07:58
  2. N900 - Contact Database search utility
    By JEREMYHODGSKIN in forum General Development Questions
    Replies: 2
    Last Post: 2010-01-30, 07:25
  3. How got get Avatar pictures using contact framework?
    By axeljaeger in forum [Archived] Qt Mobility Project
    Replies: 14
    Last Post: 2010-01-27, 18:36
  4. Contact Avatar.
    By Sick Spider in forum Symbian
    Replies: 2
    Last Post: 2008-09-19, 17:02
  5. Retrieving contact in 6210 Navigator
    By deepu28 in forum Mobile Java General
    Replies: 6
    Last Post: 2008-09-01, 11:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts