![]() |
Home · All Classes · All Functions · | ![]() |
The QVersitContactExporter class converts QContacts into QVersitDocuments. More...
#include <QVersitContactExporter>
This class is under development and is subject to change.
| QVersitContactExporter () | |
| ~QVersitContactExporter () | |
| QVersitContactExporterDetailHandler * | detailHandler () const |
| QList<QVersitDocument> | exportContacts ( const QList<QContact> & contacts, QVersitDocument::VersitType versitType = QVersitDocument::VCard30Type ) |
| QVersitResourceHandler * | resourceHandler () const |
| void | setDetailHandler ( QVersitContactExporterDetailHandler * handler ) |
| void | setResourceHandler ( QVersitResourceHandler * handler ) |
The QVersitContactExporter class converts QContacts into QVersitDocuments.
A QVersitResourceHandler is associated with the exporter to supply the behaviour for loading files from persistent storage. By default, this is set to a QVersitDefaultResourceHandler, which supports basic resource loading from the file system. An alternative resource handler can be specified with setResourceHandler().
By associating a QVersitContactExporterDetailHandler with the exporter using setDetailHandler(), the client can pass in a handler to override the processing of details and/or handle details that QVersitContactExporter doesn't support.
An example detail handler that logs unknown properties:
class MyDetailHandler : public QVersitContactExporterDetailHandler {
public:
bool preProcessDetail(const QContact& contact, const QContactDetail& detail,
QVersitDocument* document) {
return false;
}
bool postProcessDetail(const QContact& contact, const QContactDetail& detail,
bool alreadyProcessed, QVersitDocument* document) {
if (!alreadyProcessed)
mUnknownDetails.append(detail);
return false;
}
QList<QContactDetail> mUnknownDetails;
};
An example usage of QVersitContactExporter
QVersitContactExporter contactExporter;
MyDetailHandler detailHandler;
contactExporter.setDetailHandler(&detailHandler);
QContact contact;
// Create a name
QContactName name;
name.setFirstName(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);
QList<QContact> contactList;
contactList.append(contact);
QList<QVersitDocument> versitDocuments = contactExporter.exportContacts(contactList);
// detailHandler.mUnknownDetails now contains the list of unknown details
See also QVersitDocument, QVersitProperty, QVersitContactExporterDetailHandler, and QVersitResourceHandler.
Constructs a new contact exporter
Frees any memory in use by this contact exporter.
Gets the handler for processing QContactDetails.
See also setDetailHandler().
Converts contacts into a list of corresponding QVersitDocuments, using the format given by versitType.
Returns the associated resource handler.
See also setResourceHandler().
Sets handler to be the handler for processing QContactDetails, or 0 to have no handler.
See also detailHandler().
Sets handler to be the handler to load files with, or 0 to have no handler.
See also resourceHandler().
| Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Mobility Project 1.0.0 |