Home · All Classes · All Functions ·

QVersitContactExporter Class Reference

The QVersitContactExporter class exports QContact(s) into QVersitDocument(s). More...

    #include <QVersitContactExporter>

Inherits QObject.


Public Functions

QVersitContactExporter ()
~QVersitContactExporter ()
QVersitDocument exportContact ( const QContact & contact, QVersitDocument::VersitType versitType = QVersitDocument::VCard21 )
QList<QContactDetail> unknownContactDetails ()

Signals

void scale ( const QString & imageFileName, QByteArray & imageData )

Additional Inherited Members


Detailed Description

The QVersitContactExporter class exports QContact(s) into QVersitDocument(s).

If the exported QContact has some detail with an image as its value, signal QVersitContactExporter::scale() is emitted and the client can scale the image's data to the size it wishes. The client may retrieve the list contact details which were not exported using QVersitContactExporter::unknownContactDetails().

    // An example of exporting a QContact:
     QVersitContactExporter contactExporter;
     QContact contact;

     // Create a name
     QContactName name;
     name.setFirst(QString::fromAscii("John"));
     contact.saveDetail(&name);

     // Create an avatar type which is not supported by the exporter
     QContactAvatar contactAvatar;
     contactAvatar.setAvatar(QString::fromAscii("/my/image/avatar_path/texture.type"));
     contactAvatar.setSubType(QContactAvatar::SubTypeTexturedMesh);
     contact.saveDetail(&contactAvatar);

     // Create an organization detail with a title and a logo
     QContactOrganization organization;
     organization.setTitle(QString::fromAscii("Developer"));
     organization.setLogo(QString::fromAscii("/my/image/logo_path/logo.jpg"));
     contact.saveDetail(&organization);

     QVersitDocument versitDocument = contactExporter.exportContact(contact);
     // Client will receive the signal "scale" with the logo image path

     QList<QContactDetail> unknownDetails = contactExporter.unknownContactDetails();

     // The returned unknownDetails can be processed by the client and
     // the client can append details directly into QVersitDocument if needed.
     // (In this example QContactAvatar::SubTypeTexturedMesh.
     //  Currently for QContactAvatar details,
     //  only exporting subtypes QContactAvatar::SubTypeImage and
     //  QContactAvatar::SubTypeAudioRingtone is supported.)

See also QVersitDocument and QVersitProperty.


Member Function Documentation

QVersitContactExporter::QVersitContactExporter ()

Constructs a new contact exporter

QVersitContactExporter::~QVersitContactExporter ()

Frees any memory in use by this contact exporter.

QVersitDocument QVersitContactExporter::exportContact ( const QContact & contact, QVersitDocument::VersitType versitType = QVersitDocument::VCard21 )

Returns the versit document corresponding to the contact and versitType.

void QVersitContactExporter::scale ( const QString & imageFileName, QByteArray & imageData )   [signal]

This signal is emitted by QVersitContactExporter::exportContact(), when a contact detail containing an image is found in a QContact. The input for the client is the path of the image in imageFileName. When the client has performed the scaling, it should write the result to imageData. Image scaling can be done for example by using class QImage.

QList<QContactDetail> QVersitContactExporter::unknownContactDetails ()

Returns the list of contact details, which were not exported by the most recent call of QVersitContactExporter::exportContact().


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Mobility Project 1.0.0 (Technology Preview)