Namespaces
Variants
Actions
(Difference between revisions)

Add contact with image using Qt Mobility API

Jump to: navigation, search
m (corrected variable names to use correct spelling)
Line 46: Line 46:
 
</code>
 
</code>
 
<code cpp>
 
<code cpp>
bool AddContact::createContact(QString firstName, QString secoundName, QString mobileNumer, QString image) {
+
bool AddContact::createContact(QString firstName, QString secondName, QString mobileNumber, QString image) {
 
     QContact curr;
 
     QContact curr;
 
     QContactName name = curr.detail(QContactName::DefinitionName);
 
     QContactName name = curr.detail(QContactName::DefinitionName);
Line 54: Line 54:
 
     name.setFirst(firstName);
 
     name.setFirst(firstName);
  
     name.setLast(secoundName);
+
     name.setLast(secondName);
  
 
     phone.setContexts(QContactDetail::ContextHome);
 
     phone.setContexts(QContactDetail::ContextHome);
 
     phone.setSubTypes(QContactPhoneNumber::SubTypeMobile);
 
     phone.setSubTypes(QContactPhoneNumber::SubTypeMobile);
     phone.setNumber(mobileNumer);
+
     phone.setNumber(mobileNumber);
  
 
     avatar.setAvatar(image);
 
     avatar.setAvatar(image);

Revision as of 21:11, 10 April 2010

ID Creation date 27th Mar 2010
Platform S60 5th Edition Tested on devices Nokia N97 Mini
Category Qt for Symbian Subcategory Qt Mobility API


Keywords (APIs, classes, methods, functions): QContactManager, QContact
Tip.png
Tip: Read this article before moving forward: Setting up environment for Qt Mobility API

Contents

Overview

Add contact to device PhoneBook with image using Qt Mobility API

Keywords

Project configuration file (.Pro file)

  • Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += contacts

Header File

#include "qtcontacts.h"
 
private:
QContactManager *contactManager;

Source File

contactManager = new QContactManager("symbian");
bool AddContact::createContact(QString firstName, QString secondName, QString mobileNumber, QString image) {
QContact curr;
QContactName name = curr.detail(QContactName::DefinitionName);
QContactPhoneNumber phone = curr.detail(QContactPhoneNumber::DefinitionName);
QContactAvatar avatar = curr.detail(QContactAvatar::DefinitionName);
 
name.setFirst(firstName);
 
name.setLast(secondName);
 
phone.setContexts(QContactDetail::ContextHome);
phone.setSubTypes(QContactPhoneNumber::SubTypeMobile);
phone.setNumber(mobileNumber);
 
avatar.setAvatar(image);
 
curr.saveDetail(&name);
curr.saveDetail(&phone);
curr.saveDetail(&avatar);
 
return contactManager->saveContact(&curr);
}

Classes

  • QContactManager
  • QContact*

Reference links

--skumar_rao 15:03, 27 March 2010 (UTC)

262 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved