PDA

View Full Version : Read Contact - Symbian ^3



fuoco66
9th July 2011, 11:49
Hi everybody, some days ago i completed an app that could print all the contact of a device on the screen,and then call one of them.
But yersterday i add only a text box in the ui file, and from that moment the app doesn't work anymore. It works fine on the simulator(printing the name of the contact in the debug window, or in a label), but on the device it returns:



[Qt Message] ASSERT failure in QList<T>::operator[]: "index out of range", file C:/QtSDK/Symbian/SDKs/Symbian3Qt473/include/QtCore/qlist.h, line 464
Thread has crashed: Thread 0x876 has panicked. Category: ASSERT failure i; Reason: 0
Thread has crashed: Thread 0x877 has panicked. Category: ASSERT failure i; Reason: 0



this is the method i use:



void MainWindow::list_contact()
{
m_contactManager = new QContactManager("symbian");
QList<QContact> contacts = m_contactManager->contacts();

QContactName name = contacts[0].detail<QContactName>();

ui->label->setText("name: " + name.firstName() + " " + name.lastName());
}


Help?

stampede
9th July 2011, 11:58
If this is the only place where you use QList:: operator [] , then looks like contacts.count() == 0. Try to print it:


void MainWindow::list_contact()
{
m_contactManager = new QContactManager("symbian");
QList<QContact> contacts = m_contactManager->contacts();
if( contacts.count() ){
QContactName name = contacts[0].detail<QContactName>();
ui->label->setText("name: " + name.firstName() + " " + name.lastName());
} else{
ui->label->setText("contact list empty");
}
}

fuoco66
9th July 2011, 16:22
Ok it works fine, and the app does'n crash anymore. But it always returns the contact list as empty. I don't understand...

cuteatul
11th July 2011, 15:15
jshu koto roko Qt skini juin Qt 4.7 massage....sheiki......... kkk

fuoco66
12th July 2011, 01:14
Please english... I didn't understand...

MrBlueSky
11th September 2011, 15:47
I don't know if this late answer helps now, but maybe some one who search for the same problem find this usefull.

I had he same problem with the contact list on symbian, seems like a bug in the symbian contacts backend. Here is my thread in the qt developer forum, with some sort of workaround:
http://developer.qt.nokia.com/forums/viewthread/8060/

I switched to Symbian Belle lately on my Nokia N8 with Mobility 1.2 and this bug seems to be solved, i can retrieve all contacts as excpected.