这段保存联系人的代码有什么问题吗?
我正在使用最新的诺基亚 Qt SDK。 我尝试添加联系人,但没有添加。这里缺少什么?
// Construct contact manager for default contact backend
QContactManager* cm = new QContactManager("simulator");
// QContactManager* cm = new QContactManager("memory"); // i tried this, its also not working
// Create example contact
QContact example;
// Add contact name
QContactName name;
name.setFirstName("John");
name.setLastName("Doe");
example.saveDetail(&name);
// Add contact email address
//QContactEmailAddress email;
// email.setContexts(QContactDetail::ContextHome);
//email.setEmailAddress(“[email protected]”);
// example.saveDetail(&email);
// Finally, save the contact details
cm->saveContact(&example);
delete cm;
谢谢
I am using the latest Nokia Qt SDK.
I have tried to add the contacts, it's not getting added.. what is missing here?
// Construct contact manager for default contact backend
QContactManager* cm = new QContactManager("simulator");
// QContactManager* cm = new QContactManager("memory"); // i tried this, its also not working
// Create example contact
QContact example;
// Add contact name
QContactName name;
name.setFirstName("John");
name.setLastName("Doe");
example.saveDetail(&name);
// Add contact email address
//QContactEmailAddress email;
// email.setContexts(QContactDetail::ContextHome);
//email.setEmailAddress(“[email protected]”);
// example.saveDetail(&email);
// Finally, save the contact details
cm->saveContact(&example);
delete cm;
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://doc.qt.nokia.com/qtmobility-1.0-tp/qcontactmanager.html#availableManagers
检查可用管理器列表,并使用其中之一。也许然后它会起作用http://doc.qt.nokia.com/qtmobility-1.0-tp/qcontactmanager.html#availableManagers
check list of available managers, and use one of them. Maybe then it will workcm->saveContact(&example)
返回QList
。这个列表中有返回值吗?-jk
cm->saveContact(&example)
returnsQList<QContactManager::Error>
. Are there any values return in this list?-jk