diff options
Diffstat (limited to 'src/translators/onixexporter.cpp')
-rw-r--r-- | src/translators/onixexporter.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/translators/onixexporter.cpp b/src/translators/onixexporter.cpp index 4479b2f..d58e9fe 100644 --- a/src/translators/onixexporter.cpp +++ b/src/translators/onixexporter.cpp @@ -29,27 +29,27 @@ #include <kconfig.h> #include <klocale.h> -#include <qdom.h> -#include <qfile.h> -#include <qdatetime.h> -#include <qbuffer.h> -#include <qlayout.h> -#include <qwhatsthis.h> -#include <qcheckbox.h> -#include <qgroupbox.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqdatetime.h> +#include <tqbuffer.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> +#include <tqgroupbox.h> using Tellico::Export::ONIXExporter; ONIXExporter::ONIXExporter() : Tellico::Export::Exporter(), m_handler(0), - m_xsltFile(QString::fromLatin1("tellico2onix.xsl")), + m_xsltFile(TQString::tqfromLatin1("tellico2onix.xsl")), m_includeImages(true), m_widget(0) { } ONIXExporter::ONIXExporter(Data::CollPtr coll_) : Tellico::Export::Exporter(coll_), m_handler(0), - m_xsltFile(QString::fromLatin1("tellico2onix.xsl")), + m_xsltFile(TQString::tqfromLatin1("tellico2onix.xsl")), m_includeImages(true), m_widget(0) { } @@ -59,12 +59,12 @@ ONIXExporter::~ONIXExporter() { m_handler = 0; } -QString ONIXExporter::formatString() const { +TQString ONIXExporter::formatString() const { return i18n("ONIX Archive"); } -QString ONIXExporter::fileFilter() const { - return i18n("*.zip|Zip Files (*.zip)") + QChar('\n') + i18n("*|All Files"); +TQString ONIXExporter::fileFilter() const { + return i18n("*.zip|Zip Files (*.zip)") + TQChar('\n') + i18n("*|All Files"); } bool ONIXExporter::exec() { @@ -73,26 +73,26 @@ bool ONIXExporter::exec() { return false; } - QCString xml = text().utf8(); // encoded in utf-8 + TQCString xml = text().utf8(); // encoded in utf-8 - QByteArray data; - QBuffer buf(data); + TQByteArray data; + TQBuffer buf(data); - KZip zip(&buf); + KZip zip(TQT_TQIODEVICE(&buf)); zip.open(IO_WriteOnly); - zip.writeFile(QString::fromLatin1("onix.xml"), QString::null, QString::null, xml.length(), xml); + zip.writeFile(TQString::tqfromLatin1("onix.xml"), TQString(), TQString(), xml.length(), xml); // use a dict for fast random access to keep track of which images were written to the file if(m_includeImages) { // for now, we're ignoring (options() & Export::ExportImages) - const QString cover = QString::fromLatin1("cover"); + const TQString cover = TQString::tqfromLatin1("cover"); StringSet imageSet; for(Data::EntryVec::ConstIterator it = entries().begin(); it != entries().end(); ++it) { const Data::Image& img = ImageFactory::imageById(it->field(cover)); if(!img.isNull() && !imageSet.has(img.id()) && (img.format() == "JPEG" || img.format() == "JPG" || img.format() == "GIF")) { /// onix only understands jpeg and gif - QByteArray ba = img.byteArray(); - zip.writeFile(QString::fromLatin1("images/") + it->field(cover), - QString::null, QString::null, ba.size(), ba); + TQByteArray ba = img.byteArray(); + zip.writeFile(TQString::tqfromLatin1("images/") + it->field(cover), + TQString(), TQString(), ba.size(), ba); imageSet.add(img.id()); } } @@ -103,17 +103,17 @@ bool ONIXExporter::exec() { // return FileHandler::writeTextURL(url(), text(), options() & Export::ExportUTF8, options() & Export::ExportForce); } -QString ONIXExporter::text() { - QString xsltfile = locate("appdata", m_xsltFile); +TQString ONIXExporter::text() { + TQString xsltfile = locate("appdata", m_xsltFile); if(xsltfile.isNull()) { myDebug() << "ONIXExporter::text() - no xslt file for " << m_xsltFile << endl; - return QString::null; + return TQString(); } Data::CollPtr coll = collection(); if(!coll) { myDebug() << "ONIXExporter::text() - no collection pointer!" << endl; - return QString::null; + return TQString(); } // notes about utf-8 encoding: @@ -123,12 +123,12 @@ QString ONIXExporter::text() { KURL u; u.setPath(xsltfile); // do NOT do namespace processing, it messes up the XSL declaration since - // QDom thinks there are no elements in the Tellico namespace and as a result + // TQDom thinks there are no elements in the Tellico namespace and as a result // removes the namespace declaration - QDomDocument dom = FileHandler::readXMLFile(u, false); + TQDomDocument dom = FileHandler::readXMLFile(u, false); if(dom.isNull()) { myDebug() << "ONIXExporter::text() - error loading xslt file: " << xsltfile << endl; - return QString::null; + return TQString(); } // the stylesheet prints utf-8 by default, if using locale encoding, need @@ -138,14 +138,14 @@ QString ONIXExporter::text() { } delete m_handler; - m_handler = new XSLTHandler(dom, QFile::encodeName(xsltfile)); + m_handler = new XSLTHandler(dom, TQFile::encodeName(xsltfile)); - QDateTime now = QDateTime::currentDateTime(); - m_handler->addStringParam("sentDate", now.toString(QString::fromLatin1("yyyyMMddhhmm")).utf8()); + TQDateTime now = TQDateTime::tqcurrentDateTime(); + m_handler->addStringParam("sentDate", now.toString(TQString::tqfromLatin1("yyyyMMddhhmm")).utf8()); m_handler->addStringParam("version", VERSION); - GUI::CursorSaver cs(Qt::waitCursor); + GUI::CursorSaver cs(TQt::waitCursor); // now grab the XML TellicoXMLExporter exporter(coll); @@ -153,11 +153,11 @@ QString ONIXExporter::text() { exporter.setIncludeImages(false); // do not include images in XML // yes, this should be in utf8, always exporter.setOptions(options() | Export::ExportUTF8); - QDomDocument output = exporter.exportXML(); + TQDomDocument output = exporter.exportXML(); #if 0 - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); + TQTextStream t(&f); t << output.toString(); } f.close(); @@ -165,34 +165,34 @@ QString ONIXExporter::text() { return m_handler->applyStylesheet(output.toString()); } -QWidget* ONIXExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* ONIXExporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) { + if(m_widget && TQT_BASE_OBJECT(m_widget->tqparent()) == TQT_BASE_OBJECT(tqparent_)) { return m_widget; } - m_widget = new QWidget(parent_, name_); - QVBoxLayout* l = new QVBoxLayout(m_widget); + m_widget = new TQWidget(tqparent_, name_); + TQVBoxLayout* l = new TQVBoxLayout(m_widget); - QGroupBox* box = new QGroupBox(1, Qt::Horizontal, i18n("ONIX Archive Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("ONIX Archive Options"), m_widget); l->addWidget(box); - m_checkIncludeImages = new QCheckBox(i18n("Include images in archive"), box); + m_checkIncludeImages = new TQCheckBox(i18n("Include images in archive"), box); m_checkIncludeImages->setChecked(m_includeImages); - QWhatsThis::add(m_checkIncludeImages, i18n("If checked, the images in the document will be included " + TQWhatsThis::add(m_checkIncludeImages, i18n("If checked, the images in the document will be included " "in the zipped ONIX archive.")); return m_widget; } void ONIXExporter::readOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_includeImages = group.readBoolEntry("Include Images", m_includeImages); } void ONIXExporter::saveOptions(KConfig* config_) { m_includeImages = m_checkIncludeImages->isChecked(); - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); group.writeEntry("Include Images", m_includeImages); } |