G'day team, Qt 4.5 offers us an easy way to write an ODF text file from a QTextDocument. A few of our generators have such a thing. So here is the easy patch....
This only applies to those deriving from Okular::TextDocumentGenerator. It could be applied to Plucker generator, but I don't have any samples that work. Thoughts / comments? Brad =================================================================== --- textdocumentgenerator.cpp (revision 850712) +++ textdocumentgenerator.cpp (working copy) @@ -19,6 +19,9 @@ #include <QtGui/QImage> #include <QtGui/QPainter> #include <QtGui/QPrinter> +#if QT_VERSION >= 0x040500 +#include <QtGui/QTextDocumentWriter> +#endif #include <okular/core/action.h> #include <okular/core/annotations.h> @@ -425,6 +428,11 @@ if ( formats.isEmpty() ) { formats.append( Okular::ExportFormat::standardFormat( Okular::ExportFormat::PlainText ) ); formats.append( Okular::ExportFormat::standardFormat( Okular::ExportFormat::PDF ) ); +#if QT_VERSION >= 0x040500 + if ( QTextDocumentWriter::supportedDocumentFormats().contains( "ODF" ) ) { + formats.append( Okular::ExportFormat::standardFormat( Okular::ExportFormat::OpenDocumentText ) ); + } +#endif } return formats; @@ -456,8 +464,13 @@ out << d->mDocument->toPlainText(); return true; - } +#if QT_VERSION >= 0x040500 + } else if ( format.mimeType()->name() == QLatin1String( "application/vnd.oasis.opendocument.text" ) ) { + QTextDocumentWriter odfWriter( fileName, "odf" ); + return odfWriter.write( d->mDocument ); + } +#endif return false; } _______________________________________________ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel