×
Namespaces

Variants
Actions
(Difference between revisions)

Add contact with image using Qt Mobility API

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix language category)
hamishwillee (Talk | contribs)
m (Hamishwillee - Add ArticleMedaData template, remove incorrect language category)
Line 1: Line 1:
[[Category:Qt Mobility]][[Category:Lang-Portuguese]]
+
[[Category:Qt Mobility]]
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
+
{{ArticleMetaData
|-
+
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
|'''ID''' ||
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|'''Creation date''' || 27th Mar 2010
+
|devices=Nokia N97 Mini
|-
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|'''Platform''' || S60 5th Edition
+
|platform=S60 5th Edition
|'''Tested on devices''' || Nokia N97 Mini
+
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
|-
+
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
|'''Category''' || Qt for Symbian
+
|capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|'''Subcategory''' || Qt Mobility API
+
|keywords=QContactManager, QContact  
|-
+
|id= <!-- Article Id (Knowledge base articles only) -->
|}
+
|creationdate=27th Mar 2010
 
+
|author=[[User:Skumar rao|Skumar rao]]
 
+
}}
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
+
|-
+
|'''Keywords (APIs, classes, methods, functions)''': QContactManager, QContact  
+
|}
+
 
+
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
+
  
 
== Overview ==  
 
== Overview ==  
  
 
This article shows you how to add contact to device PhoneBook with an image using Qt Mobility API
 
This article shows you how to add contact to device PhoneBook with an image using Qt Mobility API
 
== Keywords ==
 
  
 
== Project configuration file (.Pro file) ==
 
== Project configuration file (.Pro file) ==
Line 85: Line 77:
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* SDK help
 
* SDK help
--[[User:Skumar rao|Skumar rao]] 15:03, 27 March 2010 (UTC)
 

Revision as of 10:35, 26 July 2011

Article Metadata
Tested with
Devices(s): Nokia N97 Mini
Compatibility
Platform(s): S60 5th Edition
Symbian
Article
Keywords: QContactManager, QContact
Created: skumar_rao (27 Mar 2010)
Last edited: hamishwillee (26 Jul 2011)

Contents

Overview

This article shows you how to add contact to device PhoneBook with an image using Qt Mobility API

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

// Following line will include "qtcontacts.h" file into the application.
 
#include "qtcontacts.h"
 
private:
QContactManager *contactManager;

Source File

// createing new instance of QContactManager
 
contactManager = new QContactManager("symbian");
    bool AddContact::createContact(QString firstName, QString secondName, QString mobileNumber, QString image) {
QContact contact;
 
QContactName name;
name.setFirstName(firstName);
name.setLastName(secondName);
contact.saveDetail(&name);
contactManager->synthesizeContactDisplayLabel(&contact);
 
QContactPhoneNumber phone;
phone.setContexts(QContactDetail::ContextHome);
phone.setSubTypes(QContactPhoneNumber::SubTypeMobile);
phone.setNumber(mobileNumber);
contact.saveDetail(&phone);
 
QContactAvatar avatar;
avatar.setImageUrl(image);
contact.saveDetail(&avatar);
 
return contactManager->saveContact(&contact);
}

Classes

  • QContactManager
  • QContact*

Reference links

78 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×