×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    138

    Question Application crash when saving contacts to tracker manager!!

    hi , i am trying to save a new contact in the N9 device
    the problem is when i try to save to tracker manager the application crash!!!
    the available manager are:
    tracker
    social
    memory
    invalid
    telepathy
    simcard
    if i use anything else than tracker the contact doesnt save,( only memory save the contact but i cannot see it on the contact list)
    i am using the following to save the contact:
    /* contactManager = new QContactManager(QContactManager::fromUri(QString("qtcontacts:tracker:")));*/
    contactManager = new QContactManager("tracker");

    QContact curr;
    QContactName name = curr.detail(QContactName:efinitionName);
    QContactPhoneNumber phone = curr.detail(QContactPhoneNumber:efinitionName);

    phone.setContexts(QContactDetail::ContextHome);
    phone.setSubTypes(QContactPhoneNumber::SubTypeMobile);

    phone.setNumber("12345678");
    name.setFirstName("Georges");

    /* save details to contact object */
    curr.saveDetail(&name);
    curr.saveDetail(&phone);

    /* save contact detail to contact manager */
    bool success = contactManager->saveContact(&curr); //the application is crashing here
    contactManager->synthesizeContactDisplayLabel(&curr);

    if (success)
    {
    qDebug() << "saved successfully!";
    }
    else
    {
    qDebug() << "Error" << contactManager->error() << "occurred whilst saving contact!";
    }

    Note that if i run the application from my laptop with cable , the contact is saved successfully without any error..but this problem occured when running the application from the device!!!

    any help about this problem????
    thanks for any help
    Last edited by zzizz; 2011-11-22 at 20:19.

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    138

    Re: Application crash when saving contacts to tracker manager!!

    Hi,
    Problem solved thx to this thread
    http://www.developer.nokia.com/Commu...bBjWQWTJJrH-20

    I installed the latest SDK 1.1.4 and thats it!! the problem was solved and i can now add new contacts to tracker backend

    maybe this will be helpfull for others
    Regards

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    138

    Re: Application crash when saving contacts to tracker manager!!

    Now i get another error!!
    i am unable to read the simcard contacts

    i am using the following

    contactManager = new QContactManager("simcard");

    QList<QContactLocalId> contactIds = contactManager->contactIds();
    QContact currContact;

    /* appens it to list widget to display on screen*/
    foreach (const QContactLocalId& id, contactIds)
    {
    currContact = contactManager->contact(id);
    if(!(currContact.displayLabel()== "" &&currContact.detail(QContactPhoneNumber:efinitionName).value(QContactPhoneNumber::FieldNumber)== "" ))
    {
    names = nameandnumber;//both are string and cleared at startup
    QString nameAndNumber(currContact.displayLabel() + + "] " + currContact.detail(QContactPhoneNumber:efinitionName).value(QContactPhoneNumber::FieldNumber)+ "] ");
    nameandnumber = nameAndNumber + names;
    }
    }
    the result is empty and no contacts are returned notice that i have contacts in my simcard
    the same function for "tracker" return the contacts correctly
    so what is wrong here?
    Any help

  4. #4
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Application crash when saving contacts to tracker manager!!

    Does this code print out any error message? I guess it something related to the security framework..

  5. #5
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    228

    Re: Application crash when saving contacts to tracker manager!!

    securty famework problem
    Last edited by Rondo23; 2011-11-23 at 17:39.

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    138

    Re: Application crash when saving contacts to tracker manager!!

    Quote Originally Posted by gnuton View Post
    Does this code print out any error message? I guess it something related to the security framework..
    No , i am not getting any error, i just getting warning about using the fetch by id:
    libqtcontacts-tracker: initializing libqtcontacts-tracker 4.14.19-1+0m6 for /opt/Myapp/bin/Myapp[14060]
    libqtcontacts-tracker: engine.cpp:959:
    =============================================================================
    WARNING /!\ - AVOID CALLING THIS FUNCTION FROM PRODUCTION CODE!!!
    =============================================================================
    QContactManager::contact() is blocking on D-Bus roundtrip while accessing
    tracker. Please consider using batch API (QContactManager::contacts()),
    or even better use the asynchronous QContactFetchRequest API, instead of
    fetching contacts one by one.

    Please note that reading 100 ids and 100 contact by ids is ~100 times
    slower than reading 100 contacts at once with QContactFetchRequest.

    Offending application is /opt/Myapp/bin/Myapp[14060].
    =============================================================================
    "from phone: Rtu Y] 255896635] Maurice] 03467823] " //qdebug returning the phone contacts with their numbers
    "All Sim: " //qdebug returning the sim contacts which is empty

  7. #7
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Application crash when saving contacts to tracker manager!!

    Hi,
    Tried on my device and contactManager("simcard").contactIds() doesn't return and IDs.
    I think you can file a bug.
    I don't see any error message.

  8. #8
    Registered User
    Join Date
    Mar 2010
    Posts
    138

    Re: Application crash when saving contacts to tracker manager!!

    Hi , sorry for bothering you again
    i used the qtmobility.contacts in the qml to display all the phone contacts
    the list is displayed using the code below

    ListView {
    id: listofcontact
    anchors.fill: parent; anchors.margins: 5
    anchors.top: parent.top
    anchors.bottom: parent.bottom

    model:ContactModel {}
    delegate: NewsDelegatecon{}
    focus: true
    }
    the news delegatecon.qml is the following:
    Component {
    Item {
    id: wrapper; width: wrapper.ListView.view.width; height: 86


    Item {
    id: moveMe
    Rectangle { color: "gray"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
    Rectangle {
    x: 6; y: 4; width: 77; height: 77; color: "transparent"; smooth: true//lsoura

    Image { source: imagePath; x: 1; y: 1 }
    Image { source: "image://theme/icon-l-contacts" }
    }

    Column {
    x: 92; width: wrapper.ListView.view.width - 95; y: 25; spacing: 2
    Text { text: model.contact.name.firstName + " " + model.contact.name.lastName ; color: "black"; width: parent.width; font.pixelSize: 23; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
    Text { text: model.contact.phoneNumber.number; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; color: "blue"; style: Text.Raised; styleColor: "black" }
    }
    }
    MouseArea {
    anchors.fill: parent
    }
    }
    }
    the problem is that i always get the first item empty (name null and number null)
    and the last name is empty(unless i scroll it down below the screen size then the last item empty is disappearing and i have 3 items left )

    my question is how to prevent adding the contact in the list if the name and number are empty..(note that in the native contact listi see only 2 names in the phone ..and if i use qml or even if i use the c++ code to retrieve the contacts i get 3 names one of them is empty..i dont know if it is a problem from my device or common between N9 to have an empty contact)
    so how to not add an empty element?
    Thank you
    Last edited by zzizz; 2011-11-25 at 07:57.

  9. #9
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Application crash when saving contacts to tracker manager!!

    Hi,
    The empty items you see at bottom are there because of the wrong size of your listView.
    anchors.fill: parent; is enough.

    You have to remove the rest, because they broke the layout.
    anchors.top: parent.top
    anchors.bottom: parent.bottom

    In case the model returns empty items you can hide the correspondent delegates by using the "visible" property
    eg: visible: model.contact.name.firstName.length && otherStrings

  10. #10
    Registered User
    Join Date
    Mar 2010
    Posts
    138

    Re: Application crash when saving contacts to tracker manager!!

    Quote Originally Posted by gnuton View Post
    Hi,
    The empty items you see at bottom are there because of the wrong size of your listView.
    anchors.fill: parent; is enough.

    You have to remove the rest, because they broke the layout.
    anchors.top: parent.top
    anchors.bottom: parent.bottom

    In case the model returns empty items you can hide the correspondent delegates by using the "visible" property
    eg: visible: model.contact.name.firstName.length && otherStrings

    Hi again,
    i tried to use what u told me and did anchors.fill: parent; only but still get 1 item which is the last item empty

    also i used the visible :
    visible: model.contact.name.firstName.length && model.contact.name.lastName.length && model.contact.phoneNumber.number.length
    but this hide the first empty item from the list but kept the dimension of the item...so the second item will not start in place of the first item since the geometry of the first item still exist!!
    how can i remove this item ??
    thank you

  11. #11
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Application crash when saving contacts to tracker manager!!

    Hi,
    to remove completely the item from the model you can put this in the delegate
    Components.onCompleted: if (model.contact.name.firstName.length && ...) model.remove(index);

    To be honest this is not a very elegant solution, but I think it will make its job done.

    http://doc.qt.nokia.com/4.7-snapshot...#remove-method

Similar Threads

  1. saving contacts info in text file
    By tatt0005 in forum Symbian
    Replies: 3
    Last Post: 2010-03-19, 16:15
  2. Replies: 10
    Last Post: 2009-06-11, 04:56
  3. [anounce] Tracker.py GPS mapping application
    By hurenkam in forum Symbian
    Replies: 85
    Last Post: 2009-05-13, 10:38
  4. Problem in mobile tracker application
    By vikasdeshpande in forum Mobile Java General
    Replies: 3
    Last Post: 2009-03-17, 14:11
  5. Contacts crash
    By romulovitor in forum Symbian
    Replies: 0
    Last Post: 2009-03-09, 21:46

Posting Permissions

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