The QVersitDefaultResourceHandler class provides a default implementation of a Versit resource handler. More...
#include <QVersitDefaultResourceHandler>
Inherits: QVersitResourceHandler.
QVersitDefaultResourceHandler () | |
virtual | ~QVersitDefaultResourceHandler () |
virtual bool | loadResource ( const QString & location, QByteArray * contents, QString * mimeType ) |
virtual bool | saveResource ( const QByteArray & contents, const QVersitProperty & property, QString * location ) |
The QVersitDefaultResourceHandler class provides a default implementation of a Versit resource handler.
An example resource handler implementation:
class MyResourceHandler : public QVersitDefaultResourceHandler { public: bool saveResource(const QByteArray& contents, const QVersitProperty& property, QString* location) { Q_UNUSED(property) *location = QString::number(qrand()); QFile file(*location); file.open(QIODevice::WriteOnly); file.write(contents); // In a real implementation, consider when this file will be deleted. return true; } bool loadResource(const QString& location, QByteArray* contents, QString* mimeType) { return QVersitDefaultResourceHandler::loadResource(location, contents, mimeType); } };
See also QVersitContactImporter, QVersitContactExporter, and QVersitResourceHandler.
Constructs a QVersitDefaultResourceHandler.
Frees any memory used by the resource handler.
Reimplemented from QVersitResourceHandler::loadResource().
Default resource loader. Loads file from given location into contents and returns true if successful. Sets the mimeType based on the file extension.
Reimplemented from QVersitResourceHandler::saveResource().
Default resource saver. Does nothing and returns false, ignoring contents, property and location. By default, resources aren't persisted because we don't know when it is safe to remove them.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.