Add contact with image using Qt Mobility API
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:Qt Mobility]] |
| − | + | {{ArticleMetaData | |
| − | + | |sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | |
| − | + | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | |
| − | + | |devices=Nokia N97 Mini | |
| − | + | |sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | |
| − | | | + | |platform=S60 5th Edition |
| − | + | |devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) --> | |
| − | |- | + | |signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer --> |
| − | + | |capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | |
| − | + | |keywords=QContactManager, QContact | |
| − | + | |id= <!-- Article Id (Knowledge base articles only) --> | |
| − | | | + | |creationdate=27th Mar 2010 |
| − | + | |author=[[User:Skumar rao|Skumar rao]] | |
| − | + | }} | |
| − | + | ||
| − | |- | + | |
| − | | | + | |
| − | | | + | |
| − | + | ||
| − | + | ||
== 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 | ||
| − | |||
| − | |||
== 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 | ||
| − | |||
Revision as of 10:35, 26 July 2011
Article Metadata
Tested with
Devices(s): Nokia N97 Mini
Compatibility
Platform(s): S60 5th Edition
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*

