Hey,
I am on Nokia 5800, Qt 4.7.3, Qt mobility 1.1.3.
I need to fetch contacts. When I do – QContactmanager cm; or QContactmanager *cm =new QContactManager(); or QContactmanager::AvailableManagers(); my app crashes with the debugger showing a Segmentation Fault at these lines.
Here is what I m doing:
void Contacts::FetchContacts()
{
qDebug()<<"here1";
/* QStringList strlist = QContactManager::availableManagers();
qDebug()<<strlist.count();
for(int i=0;i<strlist.count();i++)
{
qDebug()<<strlist.at(i);
}*/
QContactManager cm; // or QContactManager cm("symbian");
qDebug()<<"here2";
QList<QContactLocalId> contactIds = cm.contactIds();
QContact currContact;
qDebug()<<contactIds.count();
foreach (const QContactLocalId& id, contactIds)
{
currContact = cm.contact(id);
QString nameAndNumber
(currContact.
displayLabel() + ": " + currContact.
detail(QContactPhoneNumber
::DefinitionName).
value(QContactPhoneNumber
::FieldNumber));
ui->listWidget->addItem(nameAndNumber);
}
}
void Contacts::FetchContacts()
{
qDebug()<<"here1";
/* QStringList strlist = QContactManager::availableManagers();
qDebug()<<strlist.count();
for(int i=0;i<strlist.count();i++)
{
qDebug()<<strlist.at(i);
}*/
QContactManager cm; // or QContactManager cm("symbian");
qDebug()<<"here2";
QList<QContactLocalId> contactIds = cm.contactIds();
QContact currContact;
qDebug()<<contactIds.count();
foreach (const QContactLocalId& id, contactIds)
{
currContact = cm.contact(id);
QString nameAndNumber(currContact.displayLabel() + ": " + currContact.detail(QContactPhoneNumber::DefinitionName).value(QContactPhoneNumber::FieldNumber));
ui->listWidget->addItem(nameAndNumber);
}
}
To copy to clipboard, switch view to plain text mode
In Application output I receive “here1†and then a segmentation fault occurs and app crashes before printing “here2â€.
Any help in this regard would be apreciated.
Thanks
Bookmarks