×
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 (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(3 intermediate revisions by one user not shown)
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) ==
 
* Add the Qt Mobility project configuration option in the .pro file as shown below
 
* Add the Qt Mobility project configuration option in the .pro file as shown below
  
<code cpp>
+
<code cpp-qt>
 
CONFIG += mobility
 
CONFIG += mobility
 
MOBILITY += contacts
 
MOBILITY += contacts
Line 36: Line 28:
  
 
== Header File ==
 
== Header File ==
<code cpp>
+
<code cpp-qt>
 
// Following line will include "qtcontacts.h" file into the application.
 
// Following line will include "qtcontacts.h" file into the application.
  
Line 46: Line 38:
  
 
== Source File ==
 
== Source File ==
<code cpp>
+
<code cpp-qt>
 
// createing new instance of QContactManager
 
// createing new instance of QContactManager
  
 
   contactManager = new QContactManager("symbian");
 
   contactManager = new QContactManager("symbian");
 
</code>
 
</code>
<code cpp>
+
<code cpp-qt>
  
 
     bool AddContact::createContact(QString firstName, QString secondName, QString mobileNumber, QString image) {
 
     bool AddContact::createContact(QString firstName, QString secondName, QString mobileNumber, QString image) {
Line 84: Line 76:
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [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[[Category:MeeGo Harmattan]] [[Category:Symbian]]
--[[User:Skumar rao|Skumar rao]] 15:03, 27 March 2010 (UTC)
+

Latest revision as of 04:23, 11 October 2012

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 (11 Oct 2012)

Contents

[edit] Overview

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

[edit] Project configuration file (.Pro file)

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

[edit] Header File

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

[edit] 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);
}

[edit] Classes

  • QContactManager
  • QContact*

[edit] Reference links

This page was last modified on 11 October 2012, at 04:23.
93 page views in the last 30 days.
×