qtmobility/src/versit/qversitwriter_p.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    48 
    48 
    49 #include <QStringList>
    49 #include <QStringList>
    50 #include <QMutexLocker>
    50 #include <QMutexLocker>
    51 #include <QScopedPointer>
    51 #include <QScopedPointer>
    52 #include <QTextCodec>
    52 #include <QTextCodec>
       
    53 #include <QBuffer>
    53 
    54 
    54 QTM_USE_NAMESPACE
    55 QTM_USE_NAMESPACE
    55 
    56 
    56 /*! Constructs a writer. */
    57 /*! Constructs a writer. */
    57 QVersitWriterPrivate::QVersitWriterPrivate()
    58 QVersitWriterPrivate::QVersitWriterPrivate()
    66 /*! Destroys a writer. */
    67 /*! Destroys a writer. */
    67 QVersitWriterPrivate::~QVersitWriterPrivate()
    68 QVersitWriterPrivate::~QVersitWriterPrivate()
    68 {
    69 {
    69 }
    70 }
    70 
    71 
       
    72 /*! Links the signals from this to the signals of \a writer. */
       
    73 void QVersitWriterPrivate::init(QVersitWriter* writer)
       
    74 {
       
    75     qRegisterMetaType<QVersitWriter::State>("QVersitWriter::State");
       
    76     connect(this, SIGNAL(stateChanged(QVersitWriter::State)),
       
    77             writer, SIGNAL(stateChanged(QVersitWriter::State)), Qt::DirectConnection);
       
    78 }
       
    79 
    71 /*!
    80 /*!
    72  * Do the actual writing and set the error and state appropriately.
    81  * Do the actual writing and set the error and state appropriately.
    73  */
    82  */
    74 void QVersitWriterPrivate::write()
    83 void QVersitWriterPrivate::write()
    75 {
    84 {
    76     bool canceled = false;
    85     bool canceled = false;
    77     foreach (QVersitDocument document, mInput) {
    86     foreach (const QVersitDocument& document, mInput) {
    78         if (isCanceling()) {
    87         if (isCanceling()) {
    79             canceled = true;
    88             canceled = true;
    80             break;
    89             break;
    81         }
    90         }
    82         QScopedPointer<QVersitDocumentWriter> writer(writerForType(document.type()));
    91         QScopedPointer<QVersitDocumentWriter> writer(writerForType(document.type()));