diff options
Diffstat (limited to 'src/translators')
92 files changed, 2158 insertions, 2126 deletions
diff --git a/src/translators/alexandriaexporter.cpp b/src/translators/alexandriaexporter.cpp index 186b866..c00b54b 100644 --- a/src/translators/alexandriaexporter.cpp +++ b/src/translators/alexandriaexporter.cpp @@ -25,7 +25,7 @@ #include <kmessagebox.h> #include <kapplication.h> -#include <qdir.h> +#include <tqdir.h> namespace { static const int ALEXANDRIA_MAX_SIZE_SMALL = 60; @@ -34,12 +34,12 @@ namespace { using Tellico::Export::AlexandriaExporter; -QString& AlexandriaExporter::escapeText(QString& str_) { - str_.replace('"', QString::fromLatin1("\\\"")); +TQString& AlexandriaExporter::escapeText(TQString& str_) { + str_.tqreplace('"', TQString::tqfromLatin1("\\\"")); return str_; } -QString AlexandriaExporter::formatString() const { +TQString AlexandriaExporter::formatString() const { return i18n("Alexandria"); } @@ -50,10 +50,10 @@ bool AlexandriaExporter::exec() { return false; } - const QString alexDirName = QString::fromLatin1(".alexandria"); + const TQString alexDirName = TQString::tqfromLatin1(".alexandria"); // create if necessary - QDir libraryDir = QDir::home(); + TQDir libraryDir = TQDir::home(); if(!libraryDir.cd(alexDirName)) { if(!libraryDir.mkdir(alexDirName) || !libraryDir.cd(alexDirName)) { myLog() << "AlexandriaExporter::exec() - can't locate directory" << endl; @@ -66,7 +66,7 @@ bool AlexandriaExporter::exec() { int ret = KMessageBox::warningContinueCancel(Kernel::self()->widget(), i18n("<qt>An Alexandria library called <i>%1</i> already exists. " "Any existing books in that library could be overwritten.</qt>") - .arg(coll->title())); + .tqarg(coll->title())); if(ret == KMessageBox::Cancel) { return false; } @@ -74,10 +74,10 @@ bool AlexandriaExporter::exec() { return false; // could not create and cd to the dir } - ProgressItem& item = ProgressManager::self()->newProgressItem(this, QString::null, false); + ProgressItem& item = ProgressManager::self()->newProgressItem(this, TQString(), false); item.setTotalSteps(entries().count()); ProgressItem::Done done(this); - const uint stepSize = QMIN(1, entries().count()/100); + const uint stepSize = TQMIN(1, entries().count()/100); const bool showProgress = options() & ExportProgress; GUI::CursorSaver cs; @@ -95,15 +95,15 @@ bool AlexandriaExporter::exec() { // this isn't true YAML export, of course // everything is put between quotes except for the rating, just to be sure it's interpreted as a string -bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_) { +bool AlexandriaExporter::writeFile(const TQDir& dir_, Data::ConstEntryPtr entry_) { // the filename is the isbn without dashes, followed by .yaml - QString isbn = entry_->field(QString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(isbn.isEmpty()) { return false; // can't write it since Alexandria uses isbn as name of file } isbn.remove('-'); // remove dashes - QFile file(dir_.absPath() + QDir::separator() + isbn + QString::fromLatin1(".yaml")); + TQFile file(dir_.absPath() + TQDir::separator() + isbn + TQString::tqfromLatin1(".yaml")); if(!file.open(IO_WriteOnly)) { return false; } @@ -111,13 +111,13 @@ bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_) // do we format? bool format = options() & Export::ExportFormatted; - QTextStream ts(&file); + TQTextStream ts(&file); // alexandria uses utf-8 all the time - ts.setEncoding(QTextStream::UnicodeUTF8); + ts.setEncoding(TQTextStream::UnicodeUTF8); ts << "--- !ruby/object:Alexandria::Book\n"; ts << "authors:\n"; - QStringList authors = entry_->fields(QString::fromLatin1("author"), format); - for(QStringList::Iterator it = authors.begin(); it != authors.end(); ++it) { + TQStringList authors = entry_->fields(TQString::tqfromLatin1("author"), format); + for(TQStringList::Iterator it = authors.begin(); it != authors.end(); ++it) { ts << " - " << escapeText(*it) << "\n"; } // Alexandria crashes when no authors, and uses n/a when none @@ -125,30 +125,30 @@ bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_) ts << " - n/a\n"; } - QString tmp = entry_->field(QString::fromLatin1("title"), format); + TQString tmp = entry_->field(TQString::tqfromLatin1("title"), format); ts << "title: \"" << escapeText(tmp) << "\"\n"; // Alexandria refers to the binding as the edition - tmp = entry_->field(QString::fromLatin1("binding"), format); + tmp = entry_->field(TQString::tqfromLatin1("binding"), format); ts << "edition: \"" << escapeText(tmp) << "\"\n"; // sometimes Alexandria interprets the isbn as a number instead of a string // I have no idea how to debug ruby, so err on safe side and add quotes ts << "isbn: \"" << isbn << "\"\n"; - tmp = entry_->field(QString::fromLatin1("comments"), format); + tmp = entry_->field(TQString::tqfromLatin1("comments"), format); ts << "notes: \"" << escapeText(tmp) << "\"\n"; - tmp = entry_->field(QString::fromLatin1("publisher"), format); + tmp = entry_->field(TQString::tqfromLatin1("publisher"), format); // publisher uses n/a when empty - ts << "publisher: \"" << (tmp.isEmpty() ? QString::fromLatin1("n/a") : escapeText(tmp)) << "\"\n"; + ts << "publisher: \"" << (tmp.isEmpty() ? TQString::tqfromLatin1("n/a") : escapeText(tmp)) << "\"\n"; - tmp = entry_->field(QString::fromLatin1("pub_year"), format); + tmp = entry_->field(TQString::tqfromLatin1("pub_year"), format); if(!tmp.isEmpty()) { ts << "publishing_year: \"" << escapeText(tmp) << "\"\n"; } - tmp = entry_->field(QString::fromLatin1("rating")); + tmp = entry_->field(TQString::tqfromLatin1("rating")); bool ok; int rating = Tellico::toUInt(tmp, &ok); if(ok) { @@ -157,24 +157,24 @@ bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_) file.close(); - QString cover = entry_->field(QString::fromLatin1("cover")); + TQString cover = entry_->field(TQString::tqfromLatin1("cover")); if(cover.isEmpty() || !(options() & Export::ExportImages)) { return true; // all done } - QImage img1(ImageFactory::imageById(cover)); - QImage img2; - QString filename = dir_.absPath() + QDir::separator() + isbn; + TQImage img1(ImageFactory::imageById(cover)); + TQImage img2; + TQString filename = dir_.absPath() + TQDir::separator() + isbn; if(img1.height() > ALEXANDRIA_MAX_SIZE_SMALL) { if(img1.height() > ALEXANDRIA_MAX_SIZE_MEDIUM) { // limit maximum size - img1 = img1.scale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, QImage::ScaleMin); + img1 = img1.scale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, TQ_ScaleMin); } - img2 = img1.scale(ALEXANDRIA_MAX_SIZE_SMALL, ALEXANDRIA_MAX_SIZE_SMALL, QImage::ScaleMin); + img2 = img1.scale(ALEXANDRIA_MAX_SIZE_SMALL, ALEXANDRIA_MAX_SIZE_SMALL, TQ_ScaleMin); } else { - img2 = img1.smoothScale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, QImage::ScaleMin); // scale up + img2 = img1.smoothScale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, TQ_ScaleMin); // scale up } - if(!img1.save(filename + QString::fromLatin1("_medium.jpg"), "JPEG") - || !img2.save(filename + QString::fromLatin1("_small.jpg"), "JPEG")) { + if(!img1.save(filename + TQString::tqfromLatin1("_medium.jpg"), "JPEG") + || !img2.save(filename + TQString::tqfromLatin1("_small.jpg"), "JPEG")) { return false; } return true; diff --git a/src/translators/alexandriaexporter.h b/src/translators/alexandriaexporter.h index 033bb14..cc2a368 100644 --- a/src/translators/alexandriaexporter.h +++ b/src/translators/alexandriaexporter.h @@ -14,7 +14,7 @@ #ifndef ALEXANDRIAEXPORTER_H #define ALEXANDRIAEXPORTER_H -class QDir; +class TQDir; #include "exporter.h" @@ -29,21 +29,22 @@ namespace Tellico { */ class AlexandriaExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: AlexandriaExporter() : Exporter() {} virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const { return QString::null; } // no need for this + virtual TQString formatString() const; + virtual TQString fileFilter() const { return TQString(); } // no need for this // no config options - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } private: - static QString& escapeText(QString& str); + static TQString& escapeText(TQString& str); - bool writeFile(const QDir& dir, Data::ConstEntryPtr entry); + bool writeFile(const TQDir& dir, Data::ConstEntryPtr entry); }; } // end namespace diff --git a/src/translators/alexandriaimporter.cpp b/src/translators/alexandriaimporter.cpp index 5e49e86..2c67408 100644 --- a/src/translators/alexandriaimporter.cpp +++ b/src/translators/alexandriaimporter.cpp @@ -25,9 +25,9 @@ #include <kapplication.h> #include <kstringhandler.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qgroupbox.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqgroupbox.h> using Tellico::Import::AlexandriaImporter; @@ -42,42 +42,42 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() { m_coll = new Data::BookCollection(true); - QDir dataDir = m_libraryDir; + TQDir dataDir = m_libraryDir; dataDir.cd(m_library->currentText()); - dataDir.setFilter(QDir::Files | QDir::Readable | QDir::NoSymLinks); - - const QString title = QString::fromLatin1("title"); - const QString author = QString::fromLatin1("author"); - const QString year = QString::fromLatin1("pub_year"); - const QString binding = QString::fromLatin1("binding"); - const QString isbn = QString::fromLatin1("isbn"); - const QString pub = QString::fromLatin1("publisher"); - const QString rating = QString::fromLatin1("rating"); - const QString cover = QString::fromLatin1("cover"); - const QString comments = QString::fromLatin1("comments"); + dataDir.setFilter(TQDir::Files | TQDir::Readable | TQDir::NoSymLinks); + + const TQString title = TQString::tqfromLatin1("title"); + const TQString author = TQString::tqfromLatin1("author"); + const TQString year = TQString::tqfromLatin1("pub_year"); + const TQString binding = TQString::tqfromLatin1("binding"); + const TQString isbn = TQString::tqfromLatin1("isbn"); + const TQString pub = TQString::tqfromLatin1("publisher"); + const TQString rating = TQString::tqfromLatin1("rating"); + const TQString cover = TQString::tqfromLatin1("cover"); + const TQString comments = TQString::tqfromLatin1("comments"); // start with yaml files - dataDir.setNameFilter(QString::fromLatin1("*.yaml")); - const QStringList files = dataDir.entryList(); + dataDir.setNameFilter(TQString::tqfromLatin1("*.yaml")); + const TQStringList files = dataDir.entryList(); const uint numFiles = files.count(); - const uint stepSize = QMAX(s_stepSize, numFiles/100); + const uint stepSize = TQMAX(s_stepSize, numFiles/100); const bool showProgress = options() & ImportProgress; ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(numFiles); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); - QStringList covers; - covers << QString::fromLatin1(".cover") - << QString::fromLatin1("_medium.jpg") - << QString::fromLatin1("_small.jpg"); + TQStringList covers; + covers << TQString::tqfromLatin1(".cover") + << TQString::tqfromLatin1("_medium.jpg") + << TQString::tqfromLatin1("_small.jpg"); - QTextStream ts; - ts.setEncoding(QTextStream::UnicodeUTF8); // YAML is always utf8? + TQTextStream ts; + ts.setEncoding(TQTextStream::UnicodeUTF8); // YAML is always utf8? uint j = 0; - for(QStringList::ConstIterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++j) { - QFile file(dataDir.absFilePath(*it)); + for(TQStringList::ConstIterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++j) { + TQFile file(dataDir.absFilePath(*it)); if(!file.open(IO_ReadOnly)) { continue; } @@ -86,8 +86,8 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() { bool readNextLine = true; ts.unsetDevice(); - ts.setDevice(&file); - QString line; + ts.setDevice(TQT_TQIODEVICE(&file)); + TQString line; while(!ts.atEnd()) { if(readNextLine) { line = ts.readLine(); @@ -95,17 +95,17 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() { readNextLine = true; } // skip the line that starts with --- - if(line.isEmpty() || line.startsWith(QString::fromLatin1("---"))) { + if(line.isEmpty() || line.startsWith(TQString::tqfromLatin1("---"))) { continue; } - if(line.endsWith(QChar('\\'))) { + if(line.endsWith(TQChar('\\'))) { line.truncate(line.length()-1); // remove last character line += ts.readLine(); } cleanLine(line); - QString alexField = line.section(':', 0, 0); - QString alexValue = line.section(':', 1).stripWhiteSpace(); + TQString alexField = line.section(':', 0, 0); + TQString alexValue = line.section(':', 1).stripWhiteSpace(); clean(alexValue); // Alexandria uses "n/a for empty values, and it is translated @@ -115,15 +115,15 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() { } if(alexField == Latin1Literal("authors")) { - QStringList authors; + TQStringList authors; line = ts.readLine(); - QRegExp begin(QString::fromLatin1("^\\s*-\\s+")); - while(!line.isNull() && line.find(begin) > -1) { + TQRegExp begin(TQString::tqfromLatin1("^\\s*-\\s+")); + while(!line.isNull() && line.tqfind(begin) > -1) { line.remove(begin); authors += clean(line); line = ts.readLine(); } - entry->setField(author, authors.join(QString::fromLatin1("; "))); + entry->setField(author, authors.join(TQString::tqfromLatin1("; "))); // the next line has already been read readNextLine = false; @@ -146,12 +146,12 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() { // now find cover image KURL u; alexValue.remove('-'); - for(QStringList::Iterator ext = covers.begin(); ext != covers.end(); ++ext) { + for(TQStringList::Iterator ext = covers.begin(); ext != covers.end(); ++ext) { u.setPath(dataDir.absFilePath(alexValue + *ext)); - if(!QFile::exists(u.path())) { + if(!TQFile::exists(u.path())) { continue; } - QString id = ImageFactory::addImage(u, true); + TQString id = ImageFactory::addImage(u, true); if(!id.isEmpty()) { entry->setField(cover, id); break; @@ -179,27 +179,27 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() { return m_coll; } -QWidget* AlexandriaImporter::widget(QWidget* parent_, const char* name_/*=0*/) { +TQWidget* AlexandriaImporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) { if(m_widget) { return m_widget; } - m_libraryDir = QDir::home(); - m_libraryDir.setFilter(QDir::Dirs | QDir::Readable | QDir::NoSymLinks); + m_libraryDir = TQDir::home(); + m_libraryDir.setFilter(TQDir::Dirs | TQDir::Readable | TQDir::NoSymLinks); - 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(2, Qt::Horizontal, i18n("Alexandria Options"), m_widget); - QLabel* label = new QLabel(i18n("&Library:"), box); + TQGroupBox* box = new TQGroupBox(2, Qt::Horizontal, i18n("Alexandria Options"), m_widget); + TQLabel* label = new TQLabel(i18n("&Library:"), box); m_library = new KComboBox(box); label->setBuddy(m_library); // .alexandria might not exist - if(m_libraryDir.cd(QString::fromLatin1(".alexandria"))) { - QStringList dirs = m_libraryDir.entryList(); - dirs.remove(QString::fromLatin1(".")); // why can't I tell QDir not to include these? QDir::Hidden doesn't work - dirs.remove(QString::fromLatin1("..")); + if(m_libraryDir.cd(TQString::tqfromLatin1(".alexandria"))) { + TQStringList dirs = m_libraryDir.entryList(); + dirs.remove(TQString::tqfromLatin1(".")); // why can't I tell TQDir not to include these? TQDir::Hidden doesn't work + dirs.remove(TQString::tqfromLatin1("..")); m_library->insertStringList(dirs); } @@ -208,44 +208,44 @@ QWidget* AlexandriaImporter::widget(QWidget* parent_, const char* name_/*=0*/) { return m_widget; } -QString& AlexandriaImporter::cleanLine(QString& str_) { - static QRegExp escRx(QString::fromLatin1("\\\\x(\\w\\w)"), false); - str_.remove(QString::fromLatin1("\\r")); - str_.replace(QString::fromLatin1("\\n"), QString::fromLatin1("\n")); - str_.replace(QString::fromLatin1("\\t"), QString::fromLatin1("\t")); +TQString& AlexandriaImporter::cleanLine(TQString& str_) { + static TQRegExp escRx(TQString::tqfromLatin1("\\\\x(\\w\\w)"), false); + str_.remove(TQString::tqfromLatin1("\\r")); + str_.tqreplace(TQString::tqfromLatin1("\\n"), TQString::tqfromLatin1("\n")); + str_.tqreplace(TQString::tqfromLatin1("\\t"), TQString::tqfromLatin1("\t")); // YAML uses escape sequences like \xC3 int pos = escRx.search(str_); int origPos = pos; - QCString bytes; + TQCString bytes; while(pos > -1) { bool ok; char c = escRx.cap(1).toInt(&ok, 16); if(ok) { bytes += c; } else { - bytes = QCString(); + bytes = TQCString(); break; } pos = escRx.search(str_, pos+1); } if(!bytes.isEmpty()) { - str_.replace(origPos, bytes.length()*4, QString::fromUtf8(bytes.data())); + str_.tqreplace(origPos, bytes.length()*4, TQString::fromUtf8(bytes.data())); } return str_; } -QString& AlexandriaImporter::clean(QString& str_) { - const QRegExp quote(QString::fromLatin1("\\\\\"")); // equals \" - if(str_.startsWith(QChar('\'')) || str_.startsWith(QChar('"'))) { +TQString AlexandriaImporter::clean(TQString& str_) { + const TQRegExp quote(TQString::tqfromLatin1("\\\\\"")); // equals \" + if(str_.startsWith(TQChar('\'')) || str_.startsWith(TQChar('"'))) { str_.remove(0, 1); } - if(str_.endsWith(QChar('\'')) || str_.endsWith(QChar('"'))) { + if(str_.endsWith(TQChar('\'')) || str_.endsWith(TQChar('"'))) { str_.truncate(str_.length()-1); } // we ignore YAML tags, this is not actually a good parser, but will do for now - str_.remove(QRegExp(QString::fromLatin1("^![^\\s]*\\s+"))); - return str_.replace(quote, QChar('"')); + str_.remove(TQRegExp(TQString::tqfromLatin1("^![^\\s]*\\s+"))); + return str_.tqreplace(quote, TQChar('"')); } void AlexandriaImporter::slotCancel() { diff --git a/src/translators/alexandriaimporter.h b/src/translators/alexandriaimporter.h index 2c12923..9bec25d 100644 --- a/src/translators/alexandriaimporter.h +++ b/src/translators/alexandriaimporter.h @@ -19,7 +19,7 @@ class KComboBox; #include "importer.h" #include "../datavectors.h" -#include <qdir.h> +#include <tqdir.h> namespace Tellico { namespace Import { @@ -35,6 +35,7 @@ namespace Tellico { */ class AlexandriaImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -49,21 +50,21 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual bool canImport(int type) const; public slots: void slotCancel(); private: - static QString& cleanLine(QString& str); - static QString& clean(QString& str); + static TQString& cleanLine(TQString& str); + static TQString clean(TQString& str); Data::CollPtr m_coll; - QWidget* m_widget; + TQWidget* m_widget; KComboBox* m_library; - QDir m_libraryDir; + TQDir m_libraryDir; bool m_cancelled : 1; }; diff --git a/src/translators/amcimporter.cpp b/src/translators/amcimporter.cpp index 8e45cb7..399d7a7 100644 --- a/src/translators/amcimporter.cpp +++ b/src/translators/amcimporter.cpp @@ -25,13 +25,13 @@ #include <kapplication.h> -#include <qfile.h> -#include <qimage.h> +#include <tqfile.h> +#include <tqimage.h> #include <limits.h> namespace { - static const QCString AMC_FILE_ID = " AMC_X.Y Ant Movie Catalog 3.5.x www.buypin.com www.antp.be "; + static const TQCString AMC_FILE_ID = " AMC_X.Y Ant Movie Catalog 3.5.x www.buypin.com www.antp.be "; } using Tellico::Import::AMCImporter; @@ -55,24 +55,24 @@ Tellico::Data::CollPtr AMCImporter::collection() { return 0; } - QIODevice* f = fileRef().file(); + TQIODevice* f = fileRef().file(); m_ds.setDevice(f); // AMC is always little-endian? can't confirm - m_ds.setByteOrder(QDataStream::LittleEndian); + m_ds.setByteOrder(TQDataStream::LittleEndian); const uint l = AMC_FILE_ID.length(); - QMemArray<char> buffer(l+1); + TQMemArray<char> buffer(l+1); m_ds.readRawBytes(buffer.data(), l); - QString version = QString::fromLocal8Bit(buffer, l); - QRegExp versionRx(QString::fromLatin1(".+AMC_(\\d+)\\.(\\d+).+")); - if(version.find(versionRx) == -1) { + TQString version = TQString::fromLocal8Bit(buffer, l); + TQRegExp versionRx(TQString::tqfromLatin1(".+AMC_(\\d+)\\.(\\d+).+")); + if(version.tqfind(versionRx) == -1) { myDebug() << "AMCImporter::collection() - no file id match" << endl; return 0; } ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(f->size()); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); m_coll = new Data::VideoCollection(true); @@ -103,13 +103,13 @@ Tellico::Data::CollPtr AMCImporter::collection() { } bool AMCImporter::readBool() { - Q_UINT8 b; + TQ_UINT8 b; m_ds >> b; return b; } -Q_UINT32 AMCImporter::readInt() { - Q_UINT32 i; +TQ_UINT32 AMCImporter::readInt() { + TQ_UINT32 i; m_ds >> i; if(i >= UINT_MAX) { i = 0; @@ -117,39 +117,39 @@ Q_UINT32 AMCImporter::readInt() { return i; } -QString AMCImporter::readString() { +TQString AMCImporter::readString() { // The serialization format is a length specifier first, then l bytes of data uint l = readInt(); if(l == 0) { - return QString(); + return TQString(); } - QMemArray<char> buffer(l+1); + TQMemArray<char> buffer(l+1); m_ds.readRawBytes(buffer.data(), l); - QString s = QString::fromLocal8Bit(buffer, l); + TQString s = TQString::fromLocal8Bit(buffer, l); // myDebug() << "string: " << s << endl; return s; } -QString AMCImporter::readImage(const QString& format_) { +TQString AMCImporter::readImage(const TQString& format_) { uint l = readInt(); if(l == 0) { - return QString(); + return TQString(); } - QMemArray<char> buffer(l+1); + TQMemArray<char> buffer(l+1); m_ds.readRawBytes(buffer.data(), l); - QByteArray bytes; + TQByteArray bytes; bytes.setRawData(buffer.data(), l); - QImage img(bytes); + TQImage img(bytes); bytes.resetRawData(buffer.data(), l); if(img.isNull()) { myDebug() << "AMCImporter::readImage() - null image" << endl; - return QString(); + return TQString(); } - QString format = QString::fromLatin1("PNG"); + TQString format = TQString::tqfromLatin1("PNG"); if(format_ == Latin1Literal(".jpg")) { - format = QString::fromLatin1("JPEG"); + format = TQString::tqfromLatin1("JPEG"); } else if(format_ == Latin1Literal(".gif")) { - format = QString::fromLatin1("GIF"); + format = TQString::tqfromLatin1("GIF"); } return ImageFactory::addImage(img, format); } @@ -167,14 +167,14 @@ void AMCImporter::readEntry() { if(m_majVersion >= 3 && m_minVersion >= 5) { rating /= 10; } - e->setField(QString::fromLatin1("rating"), QString::number(rating)); + e->setField(TQString::tqfromLatin1("rating"), TQString::number(rating)); int year = readInt(); if(year > 0) { - e->setField(QString::fromLatin1("year"), QString::number(year)); + e->setField(TQString::tqfromLatin1("year"), TQString::number(year)); } int time = readInt(); if(time > 0) { - e->setField(QString::fromLatin1("running-time"), QString::number(time)); + e->setField(TQString::tqfromLatin1("running-time"), TQString::number(time)); } readInt(); // video bitrate @@ -182,73 +182,73 @@ void AMCImporter::readEntry() { readInt(); // number of files readBool(); // checked readString(); // media label - e->setField(QString::fromLatin1("medium"), readString()); + e->setField(TQString::tqfromLatin1("medium"), readString()); readString(); // source readString(); // borrower - QString s = readString(); // title + TQString s = readString(); // title if(!s.isEmpty()) { - e->setField(QString::fromLatin1("title"), s); + e->setField(TQString::tqfromLatin1("title"), s); } - QString s2 = readString(); // translated title + TQString s2 = readString(); // translated title if(s.isEmpty()) { - e->setField(QString::fromLatin1("title"), s2); + e->setField(TQString::tqfromLatin1("title"), s2); } - e->setField(QString::fromLatin1("director"), readString()); + e->setField(TQString::tqfromLatin1("director"), readString()); s = readString(); - QRegExp roleRx(QString::fromLatin1("(.+) \\(([^(]+)\\)")); + TQRegExp roleRx(TQString::tqfromLatin1("(.+) \\(([^(]+)\\)")); roleRx.setMinimal(true); - if(s.find(roleRx) > -1) { - QString role = roleRx.cap(2).lower(); + if(s.tqfind(roleRx) > -1) { + TQString role = roleRx.cap(2).lower(); if(role == Latin1Literal("story") || role == Latin1Literal("written by")) { - e->setField(QString::fromLatin1("writer"), roleRx.cap(1)); + e->setField(TQString::tqfromLatin1("writer"), roleRx.cap(1)); } else { - e->setField(QString::fromLatin1("producer"), s); + e->setField(TQString::tqfromLatin1("producer"), s); } } else { - e->setField(QString::fromLatin1("producer"), s); + e->setField(TQString::tqfromLatin1("producer"), s); } - e->setField(QString::fromLatin1("nationality"), readString()); - e->setField(QString::fromLatin1("genre"), readString().replace(QString::fromLatin1(", "), QString::fromLatin1("; "))); + e->setField(TQString::tqfromLatin1("nationality"), readString()); + e->setField(TQString::tqfromLatin1("genre"), readString().tqreplace(TQString::tqfromLatin1(", "), TQString::tqfromLatin1("; "))); - e->setField(QString::fromLatin1("cast"), parseCast(readString()).join(QString::fromLatin1("; "))); + e->setField(TQString::tqfromLatin1("cast"), parseCast(readString()).join(TQString::tqfromLatin1("; "))); readString(); // url - e->setField(QString::fromLatin1("plot"), readString()); - e->setField(QString::fromLatin1("comments"), readString()); + e->setField(TQString::tqfromLatin1("plot"), readString()); + e->setField(TQString::tqfromLatin1("comments"), readString()); s = readString(); // video format - QRegExp regionRx(QString::fromLatin1("Region \\d")); - if(s.find(regionRx) > -1) { - e->setField(QString::fromLatin1("region"), regionRx.cap(0)); + TQRegExp regionRx(TQString::tqfromLatin1("Region \\d")); + if(s.tqfind(regionRx) > -1) { + e->setField(TQString::tqfromLatin1("region"), regionRx.cap(0)); } - e->setField(QString::fromLatin1("audio-track"), readString()); // audio format + e->setField(TQString::tqfromLatin1("audio-track"), readString()); // audio format readString(); // resolution readString(); // frame rate - e->setField(QString::fromLatin1("language"), readString()); // audio language - e->setField(QString::fromLatin1("subtitle"), readString()); // subtitle + e->setField(TQString::tqfromLatin1("language"), readString()); // audio language + e->setField(TQString::tqfromLatin1("subtitle"), readString()); // subtitle readString(); // file size s = readString(); // picture extension s = readImage(s); // picture if(!s.isEmpty()) { - e->setField(QString::fromLatin1("cover"), s); + e->setField(TQString::tqfromLatin1("cover"), s); } m_coll->addEntries(e); } -QStringList AMCImporter::parseCast(const QString& text_) { - QStringList cast; +TQStringList AMCImporter::parseCast(const TQString& text_) { + TQStringList cast; int nPar = 0; - QRegExp castRx(QString::fromLatin1("[,()]")); - QString person, role; + TQRegExp castRx(TQString::tqfromLatin1("[,()]")); + TQString person, role; int oldPos = 0; - for(int pos = text_.find(castRx); pos > -1; pos = text_.find(castRx, pos+1)) { + for(int pos = text_.tqfind(castRx); pos > -1; pos = text_.tqfind(castRx, pos+1)) { if(text_.at(pos) == ',' && nPar%2 == 0) { // we're done with this one person += text_.mid(oldPos, pos-oldPos).stripWhiteSpace(); - QString all = person; + TQString all = person; if(!role.isEmpty()) { - if(role.startsWith(QString::fromLatin1("as "))) { + if(role.startsWith(TQString::tqfromLatin1("as "))) { role = role.mid(3); } all += "::" + role; @@ -260,14 +260,14 @@ QStringList AMCImporter::parseCast(const QString& text_) { } else if(text_.at(pos) == '(') { if(nPar == 0) { person = text_.mid(oldPos, pos-oldPos).stripWhiteSpace(); - oldPos = pos+1; // add one to go past parenthesis + oldPos = pos+1; // add one to go past tqparenthesis } ++nPar; } else if(text_.at(pos) == ')') { --nPar; if(nPar == 0) { role = text_.mid(oldPos, pos-oldPos).stripWhiteSpace(); - oldPos = pos+1; // add one to go past parenthesis + oldPos = pos+1; // add one to go past tqparenthesis } } } @@ -275,9 +275,9 @@ QStringList AMCImporter::parseCast(const QString& text_) { if(nPar%2 == 0) { int pos = text_.length(); person += text_.mid(oldPos, pos-oldPos).stripWhiteSpace(); - QString all = person; + TQString all = person; if(!role.isEmpty()) { - if(role.startsWith(QString::fromLatin1("as "))) { + if(role.startsWith(TQString::tqfromLatin1("as "))) { role = role.mid(3); } all += "::" + role; diff --git a/src/translators/amcimporter.h b/src/translators/amcimporter.h index d1b9d1a..7151140 100644 --- a/src/translators/amcimporter.h +++ b/src/translators/amcimporter.h @@ -24,6 +24,7 @@ namespace Tellico { */ class AMCImporter : public DataImporter { Q_OBJECT + TQ_OBJECT public: AMCImporter(const KURL& url); virtual ~AMCImporter(); @@ -36,15 +37,15 @@ public slots: private: bool readBool(); - Q_UINT32 readInt(); - QString readString(); - QString readImage(const QString& format); + TQ_UINT32 readInt(); + TQString readString(); + TQString readImage(const TQString& format); void readEntry(); - QStringList parseCast(const QString& text); + TQStringList parseCast(const TQString& text); Data::CollPtr m_coll; bool m_cancelled : 1; - QDataStream m_ds; + TQDataStream m_ds; int m_majVersion; int m_minVersion; }; diff --git a/src/translators/audiofileimporter.cpp b/src/translators/audiofileimporter.cpp index f825964..0d23fa5 100644 --- a/src/translators/audiofileimporter.cpp +++ b/src/translators/audiofileimporter.cpp @@ -37,12 +37,12 @@ #include <klocale.h> #include <kapplication.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qvgroupbox.h> -#include <qcheckbox.h> -#include <qdir.h> -#include <qwhatsthis.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqvgroupbox.h> +#include <tqcheckbox.h> +#include <tqdir.h> +#include <tqwhatsthis.h> using Tellico::Import::AudioFileImporter; @@ -67,11 +67,11 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, i18n("Scanning audio files..."), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); // TODO: allow remote audio file importing - QStringList dirs = url().path(); + TQStringList dirs = url().path(); if(m_recursive->isChecked()) { dirs += Tellico::findAllSubDirs(dirs[0]); } @@ -82,16 +82,16 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { const bool showProgress = options() & ImportProgress; - QStringList files; - for(QStringList::ConstIterator it = dirs.begin(); !m_cancelled && it != dirs.end(); ++it) { + TQStringList files; + for(TQStringList::ConstIterator it = dirs.begin(); !m_cancelled && it != dirs.end(); ++it) { if((*it).isEmpty()) { continue; } - QDir dir(*it); - dir.setFilter(QDir::Files | QDir::Readable | QDir::Hidden); // hidden since I want directory files - const QStringList list = dir.entryList(); - for(QStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) { + TQDir dir(*it); + dir.setFilter(TQDir::Files | TQDir::Readable | TQDir::Hidden); // hidden since I want directory files + const TQStringList list = dir.entryList(); + for(TQStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) { files += dir.absFilePath(*it2); } // kapp->processEvents(); not needed ? @@ -102,13 +102,13 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } item.setTotalSteps(files.count()); - const QString title = QString::fromLatin1("title"); - const QString artist = QString::fromLatin1("artist"); - const QString year = QString::fromLatin1("year"); - const QString genre = QString::fromLatin1("genre"); - const QString track = QString::fromLatin1("track"); - const QString comments = QString::fromLatin1("comments"); - const QString file = QString::fromLatin1("file"); + const TQString title = TQString::tqfromLatin1("title"); + const TQString artist = TQString::tqfromLatin1("artist"); + const TQString year = TQString::tqfromLatin1("year"); + const TQString genre = TQString::tqfromLatin1("genre"); + const TQString track = TQString::tqfromLatin1("track"); + const TQString comments = TQString::tqfromLatin1("comments"); + const TQString file = TQString::tqfromLatin1("file"); m_coll = new Data::MusicCollection(true); @@ -122,52 +122,52 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { f = new Data::Field(file, i18n("Files"), Data::Field::Table); m_coll->addField(f); } - f->setProperty(QString::fromLatin1("column1"), i18n("Files")); + f->setProperty(TQString::tqfromLatin1("column1"), i18n("Files")); if(addBitrate) { - f->setProperty(QString::fromLatin1("columns"), QChar('2')); - f->setProperty(QString::fromLatin1("column2"), i18n("Bitrate")); + f->setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + f->setProperty(TQString::tqfromLatin1("column2"), i18n("Bitrate")); } else { - f->setProperty(QString::fromLatin1("columns"), QChar('1')); + f->setProperty(TQString::tqfromLatin1("columns"), TQChar('1')); } } - QMap<QString, Data::EntryPtr> albumMap; + TQMap<TQString, Data::EntryPtr> albumMap; - QStringList directoryFiles; - const uint stepSize = QMAX(static_cast<size_t>(1), files.count() / 100); + TQStringList directoryFiles; + const uint stepSize = TQMAX(static_cast<size_t>(1), files.count() / 100); bool changeTrackTitle = true; uint j = 0; - for(QStringList::ConstIterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++j) { - TagLib::FileRef f(QFile::encodeName(*it)); + for(TQStringList::ConstIterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++j) { + TagLib::FileRef f(TQFile::encodeName(*it)); if(f.isNull() || !f.tag()) { - if((*it).endsWith(QString::fromLatin1("/.directory"))) { + if((*it).endsWith(TQString::tqfromLatin1("/.directory"))) { directoryFiles += *it; } continue; } TagLib::Tag* tag = f.tag(); - QString album = TStringToQString(tag->album()).stripWhiteSpace(); + TQString album = TQString(TStringToQString(tag->album())).stripWhiteSpace(); if(album.isEmpty()) { // can't do anything since tellico entries are by album kdWarning() << "Skipping: no album listed for " << *it << endl; continue; } int disc = discNumber(f); - if(disc > 1 && !m_coll->hasField(QString::fromLatin1("track%1").arg(disc))) { - Data::FieldPtr f2 = new Data::Field(QString::fromLatin1("track%1").arg(disc), - i18n("Tracks (Disc %1)").arg(disc), + if(disc > 1 && !m_coll->hasField(TQString::tqfromLatin1("track%1").tqarg(disc))) { + Data::FieldPtr f2 = new Data::Field(TQString::tqfromLatin1("track%1").tqarg(disc), + i18n("Tracks (Disc %1)").tqarg(disc), Data::Field::Table); f2->setFormatFlag(Data::Field::FormatTitle); - f2->setProperty(QString::fromLatin1("columns"), QChar('3')); - f2->setProperty(QString::fromLatin1("column1"), i18n("Title")); - f2->setProperty(QString::fromLatin1("column2"), i18n("Artist")); - f2->setProperty(QString::fromLatin1("column3"), i18n("Length")); + f2->setProperty(TQString::tqfromLatin1("columns"), TQChar('3')); + f2->setProperty(TQString::tqfromLatin1("column1"), i18n("Title")); + f2->setProperty(TQString::tqfromLatin1("column2"), i18n("Artist")); + f2->setProperty(TQString::tqfromLatin1("column3"), i18n("Length")); m_coll->addField(f2); if(changeTrackTitle) { Data::FieldPtr newTrack = new Data::Field(*m_coll->fieldByName(track)); - newTrack->setTitle(i18n("Tracks (Disc %1)").arg(1)); + newTrack->setTitle(i18n("Tracks (Disc %1)").tqarg(1)); m_coll->modifyField(newTrack); changeTrackTitle = false; } @@ -182,7 +182,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } // album entries use the album name as the title entry->setField(title, album); - QString a = TStringToQString(tag->artist()).stripWhiteSpace(); + TQString a = TQString(TStringToQString(tag->artist())).stripWhiteSpace(); if(!a.isEmpty()) { if(exists && entry->field(artist).lower() != a.lower()) { various = true; @@ -192,18 +192,18 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } } if(tag->year() > 0) { - entry->setField(year, QString::number(tag->year())); + entry->setField(year, TQString::number(tag->year())); } if(!tag->genre().isEmpty()) { - entry->setField(genre, TStringToQString(tag->genre()).stripWhiteSpace()); + entry->setField(genre, TQString(TStringToQString(tag->genre())).stripWhiteSpace()); } if(!tag->title().isEmpty()) { int trackNum = tag->track(); if(trackNum <= 0) { // try to figure out track number from file name - QFileInfo f(*it); - QString fileName = f.baseName(); - QString numString; + TQFileInfo f(*it); + TQString fileName = f.baseName(); + TQString numString; int i = 0; const int len = fileName.length(); while(fileName[i].isNumber() && i < len) { @@ -228,18 +228,18 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } } if(trackNum > 0) { - QString t = TStringToQString(tag->title()).stripWhiteSpace(); + TQString t = TQString(TStringToQString(tag->title())).stripWhiteSpace(); t += "::" + a; const int len = f.audioProperties()->length(); if(len > 0) { t += "::" + Tellico::minutes(len); } - QString realTrack = disc > 1 ? track + QString::number(disc) : track; + TQString realTrack = disc > 1 ? track + TQString::number(disc) : track; entry->setField(realTrack, insertValue(entry->field(realTrack), t, trackNum)); if(addFile) { - QString fileValue = *it; + TQString fileValue = *it; if(addBitrate) { - fileValue += "::" + QString::number(f.audioProperties()->bitrate()); + fileValue += "::" + TQString::number(f.audioProperties()->bitrate()); } entry->setField(file, insertValue(entry->field(file), fileValue, trackNum)); } @@ -250,14 +250,14 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { myDebug() << *it << " has an empty title, so the track is not imported." << endl; } if(!tag->comment().stripWhiteSpace().isEmpty()) { - QString c = entry->field(comments); + TQString c = entry->field(comments); if(!c.isEmpty()) { - c += QString::fromLatin1("<br/>"); + c += TQString::tqfromLatin1("<br/>"); } if(!tag->title().isEmpty()) { - c += QString::fromLatin1("<em>") + TStringToQString(tag->title()).stripWhiteSpace() + QString::fromLatin1("</em> - "); + c += TQString::tqfromLatin1("<em>") + TQString(TStringToQString(tag->title())).stripWhiteSpace() + TQString::tqfromLatin1("</em> - "); } - c += TStringToQString(tag->comment().stripWhiteSpace()).stripWhiteSpace(); + c += TQString(TStringToQString(tag->comment().stripWhiteSpace())).stripWhiteSpace(); entry->setField(comments, c); } @@ -285,31 +285,31 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { return 0; } - QTextStream ts; - QRegExp iconRx(QString::fromLatin1("Icon\\s*=\\s*(.*)")); - for(QStringList::ConstIterator it = directoryFiles.begin(); !m_cancelled && it != directoryFiles.end(); ++it, ++j) { - QFile file(*it); + TQTextStream ts; + TQRegExp iconRx(TQString::tqfromLatin1("Icon\\s*=\\s*(.*)")); + for(TQStringList::ConstIterator it = directoryFiles.begin(); !m_cancelled && it != directoryFiles.end(); ++it, ++j) { + TQFile file(*it); if(!file.open(IO_ReadOnly)) { continue; } ts.unsetDevice(); - ts.setDevice(&file); - for(QString line = ts.readLine(); !line.isNull(); line = ts.readLine()) { + ts.setDevice(TQT_TQIODEVICE(&file)); + for(TQString line = ts.readLine(); !line.isNull(); line = ts.readLine()) { if(!iconRx.exactMatch(line)) { continue; } - QDir thisDir(*it); + TQDir thisDir(*it); thisDir.cdUp(); - QFileInfo fi(thisDir, iconRx.cap(1)); + TQFileInfo fi(thisDir, iconRx.cap(1)); Data::EntryPtr entry = albumMap[thisDir.dirName()]; if(!entry) { continue; } KURL u; u.setPath(fi.absFilePath()); - QString id = ImageFactory::addImage(u, true); + TQString id = ImageFactory::addImage(u, true); if(!id.isEmpty()) { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } break; } @@ -329,28 +329,28 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { #endif } -QWidget* AudioFileImporter::widget(QWidget* parent_, const char* name_) { +TQWidget* AudioFileImporter::widget(TQWidget* tqparent_, const char* name_) { if(m_widget) { 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); - QVGroupBox* box = new QVGroupBox(i18n("Audio File Options"), m_widget); + TQVGroupBox* box = new TQVGroupBox(i18n("Audio File Options"), m_widget); - m_recursive = new QCheckBox(i18n("Recursive &folder search"), box); - QWhatsThis::add(m_recursive, i18n("If checked, folders are recursively searched for audio files.")); + m_recursive = new TQCheckBox(i18n("Recursive &folder search"), box); + TQWhatsThis::add(m_recursive, i18n("If checked, folders are recursively searched for audio files.")); // by default, make it checked m_recursive->setChecked(true); - m_addFilePath = new QCheckBox(i18n("Include file &location"), box); - QWhatsThis::add(m_addFilePath, i18n("If checked, the file names for each track are added to the entries.")); + m_addFilePath = new TQCheckBox(i18n("Include file &location"), box); + TQWhatsThis::add(m_addFilePath, i18n("If checked, the file names for each track are added to the entries.")); m_addFilePath->setChecked(false); - connect(m_addFilePath, SIGNAL(toggled(bool)), SLOT(slotAddFileToggled(bool))); + connect(m_addFilePath, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotAddFileToggled(bool))); - m_addBitrate = new QCheckBox(i18n("Include &bitrate"), box); - QWhatsThis::add(m_addBitrate, i18n("If checked, the bitrate for each track is added to the entries.")); + m_addBitrate = new TQCheckBox(i18n("Include &bitrate"), box); + TQWhatsThis::add(m_addBitrate, i18n("If checked, the bitrate for each track is added to the entries.")); m_addBitrate->setChecked(false); m_addBitrate->setEnabled(false); @@ -360,10 +360,10 @@ QWidget* AudioFileImporter::widget(QWidget* parent_, const char* name_) { } // pos_ is NOT zero-indexed! -QString AudioFileImporter::insertValue(const QString& str_, const QString& value_, uint pos_) { - QStringList list = Data::Field::split(str_, true); +TQString AudioFileImporter::insertValue(const TQString& str_, const TQString& value_, uint pos_) { + TQStringList list = Data::Field::split(str_, true); for(uint i = list.count(); i < pos_; ++i) { - list += QString::null; + list += TQString(); } if(!list[pos_-1].isNull()) { myDebug() << "AudioFileImporter::insertValue() - overwriting track " << pos_ << endl; @@ -371,7 +371,7 @@ QString AudioFileImporter::insertValue(const QString& str_, const QString& value myDebug() << "*** New value: " << value_ << endl; } list[pos_-1] = value_; - return list.join(QString::fromLatin1("; ")); + return list.join(TQString::tqfromLatin1("; ")); } void AudioFileImporter::slotCancel() { @@ -389,23 +389,23 @@ int AudioFileImporter::discNumber(const TagLib::FileRef& ref_) const { // default to 1 unless otherwise int num = 1; #ifdef HAVE_TAGLIB - QString disc; + TQString disc; if(TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(ref_.file())) { if(file->ID3v2Tag() && !file->ID3v2Tag()->frameListMap()["TPOS"].isEmpty()) { - disc = TStringToQString(file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString()).stripWhiteSpace(); + disc = TQString(TStringToQString(file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString())).stripWhiteSpace(); } } else if(TagLib::Ogg::Vorbis::File* file = dynamic_cast<TagLib::Ogg::Vorbis::File*>(ref_.file())) { if(file->tag() && !file->tag()->fieldListMap()["DISCNUMBER"].isEmpty()) { - disc = TStringToQString(file->tag()->fieldListMap()["DISCNUMBER"].front()).stripWhiteSpace(); + disc = TQString(TStringToQString(file->tag()->fieldListMap()["DISCNUMBER"].front())).stripWhiteSpace(); } } else if(TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(ref_.file())) { if(file->xiphComment() && !file->xiphComment()->fieldListMap()["DISCNUMBER"].isEmpty()) { - disc = TStringToQString(file->xiphComment()->fieldListMap()["DISCNUMBER"].front()).stripWhiteSpace(); + disc = TQString(TStringToQString(file->xiphComment()->fieldListMap()["DISCNUMBER"].front())).stripWhiteSpace(); } } if(!disc.isEmpty()) { - int pos = disc.find('/'); + int pos = disc.tqfind('/'); int n; bool ok; if(pos == -1) { diff --git a/src/translators/audiofileimporter.h b/src/translators/audiofileimporter.h index d9c0c9a..5733860 100644 --- a/src/translators/audiofileimporter.h +++ b/src/translators/audiofileimporter.h @@ -14,7 +14,7 @@ #ifndef AUDIOFILEIMPORTER_H #define AUDIOFILEIMPORTER_H -class QCheckBox; +class TQCheckBox; #include "importer.h" #include "../datavectors.h" @@ -33,6 +33,7 @@ namespace Tellico { */ class AudioFileImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -44,7 +45,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual bool canImport(int type) const; public slots: @@ -52,15 +53,15 @@ public slots: void slotAddFileToggled(bool on); private: - static QString insertValue(const QString& str, const QString& value, uint pos); + static TQString insertValue(const TQString& str, const TQString& value, uint pos); int discNumber(const TagLib::FileRef& file) const; Data::CollPtr m_coll; - QWidget* m_widget; - QCheckBox* m_recursive; - QCheckBox* m_addFilePath; - QCheckBox* m_addBitrate; + TQWidget* m_widget; + TQCheckBox* m_recursive; + TQCheckBox* m_addFilePath; + TQCheckBox* m_addBitrate; bool m_cancelled : 1; }; diff --git a/src/translators/bibtexexporter.cpp b/src/translators/bibtexexporter.cpp index 2706ac8..d1aa57b 100644 --- a/src/translators/bibtexexporter.cpp +++ b/src/translators/bibtexexporter.cpp @@ -28,13 +28,13 @@ #include <kconfig.h> #include <kcombobox.h> -#include <qregexp.h> -#include <qcheckbox.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qwhatsthis.h> -#include <qlabel.h> -#include <qhbox.h> +#include <tqregexp.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqwhatsthis.h> +#include <tqlabel.h> +#include <tqhbox.h> using Tellico::Export::BibtexExporter; @@ -45,12 +45,12 @@ BibtexExporter::BibtexExporter() : Tellico::Export::Exporter(), m_widget(0) { } -QString BibtexExporter::formatString() const { +TQString BibtexExporter::formatString() const { return i18n("Bibtex"); } -QString BibtexExporter::fileFilter() const { - return i18n("*.bib|Bibtex Files (*.bib)") + QChar('\n') + i18n("*|All Files"); +TQString BibtexExporter::fileFilter() const { + return i18n("*.bib|Bibtex Files (*.bib)") + TQChar('\n') + i18n("*|All Files"); } bool BibtexExporter::exec() { @@ -62,19 +62,19 @@ bool BibtexExporter::exec() { // there are some special attributes // the entry-type specifies the entry type - book, inproceedings, whatever - QString typeField; + TQString typeField; // the key specifies the cite-key - QString keyField; + TQString keyField; // the crossref bibtex field can reference another entry - QString crossRefField; + TQString crossRefField; bool hasCrossRefs = false; - const QString bibtex = QString::fromLatin1("bibtex"); + const TQString bibtex = TQString::tqfromLatin1("bibtex"); // keep a list of all the 'ordinary' fields to iterate through later Data::FieldVec fields; Data::FieldVec vec = coll->fields(); for(Data::FieldVec::Iterator it = vec.begin(); it != vec.end(); ++it) { - QString bibtexField = it->property(bibtex); + TQString bibtexField = it->property(bibtex); if(bibtexField == Latin1Literal("entry-type")) { typeField = it->name(); } else if(bibtexField == Latin1Literal("key")) { @@ -98,24 +98,24 @@ bool BibtexExporter::exec() { return false; } - QString text = QString::fromLatin1("@comment{Generated by Tellico ") - + QString::fromLatin1(VERSION) - + QString::fromLatin1("}\n\n"); + TQString text = TQString::tqfromLatin1("@comment{Generated by Tellico ") + + TQString::tqfromLatin1(VERSION) + + TQString::tqfromLatin1("}\n\n"); if(!coll->preamble().isEmpty()) { - text += QString::fromLatin1("@preamble{") + coll->preamble() + QString::fromLatin1("}\n\n"); + text += TQString::tqfromLatin1("@preamble{") + coll->preamble() + TQString::tqfromLatin1("}\n\n"); } - const QStringList macros = coll->macroList().keys(); + const TQStringList macros = coll->macroList().keys(); if(!m_expandMacros) { - QMap<QString, QString>::ConstIterator macroIt; + TQMap<TQString, TQString>::ConstIterator macroIt; for(macroIt = coll->macroList().constBegin(); macroIt != coll->macroList().constEnd(); ++macroIt) { if(!macroIt.data().isEmpty()) { - text += QString::fromLatin1("@string{") + text += TQString::tqfromLatin1("@string{") + macroIt.key() - + QString::fromLatin1("=") + + TQString::tqfromLatin1("=") + BibtexHandler::exportText(macroIt.data(), macros) - + QString::fromLatin1("}\n\n"); + + TQString::tqfromLatin1("}\n\n"); } } } @@ -132,7 +132,7 @@ bool BibtexExporter::exec() { StringSet usedKeys; Data::ConstEntryVec crossRefs; - QString type, key, newKey, value; + TQString type, key, newKey, value; for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { type = entryIt->field(typeField); if(type.isEmpty()) { @@ -190,41 +190,41 @@ bool BibtexExporter::exec() { return FileHandler::writeTextURL(url(), text, options() & ExportUTF8, options() & Export::ExportForce); } -QWidget* BibtexExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* BibtexExporter::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("Bibtex Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("Bibtex Options"), m_widget); l->addWidget(box); - m_checkExpandMacros = new QCheckBox(i18n("Expand string macros"), box); + m_checkExpandMacros = new TQCheckBox(i18n("Expand string macros"), box); m_checkExpandMacros->setChecked(m_expandMacros); - QWhatsThis::add(m_checkExpandMacros, i18n("If checked, the string macros will be expanded and no " + TQWhatsThis::add(m_checkExpandMacros, i18n("If checked, the string macros will be expanded and no " "@string{} entries will be written.")); - m_checkPackageURL = new QCheckBox(i18n("Use URL package"), box); + m_checkPackageURL = new TQCheckBox(i18n("Use URL package"), box); m_checkPackageURL->setChecked(m_packageURL); - QWhatsThis::add(m_checkPackageURL, i18n("If checked, any URL fields will be wrapped in a " + TQWhatsThis::add(m_checkPackageURL, i18n("If checked, any URL fields will be wrapped in a " "\\url declaration.")); - m_checkSkipEmpty = new QCheckBox(i18n("Skip entries with empty citation keys"), box); + m_checkSkipEmpty = new TQCheckBox(i18n("Skip entries with empty citation keys"), box); m_checkSkipEmpty->setChecked(m_skipEmptyKeys); - QWhatsThis::add(m_checkSkipEmpty, i18n("If checked, any entries without a bibtex citation key " + TQWhatsThis::add(m_checkSkipEmpty, i18n("If checked, any entries without a bibtex citation key " "will be skipped.")); - QHBox* hbox = new QHBox(box); - QLabel* l1 = new QLabel(i18n("Bibtex quotation style:") + ' ', hbox); // add a space for astheticss + TQHBox* hbox = new TQHBox(box); + TQLabel* l1 = new TQLabel(i18n("Bibtex quotation style:") + ' ', hbox); // add a space for astheticss m_cbBibtexStyle = new KComboBox(hbox); m_cbBibtexStyle->insertItem(i18n("Braces")); m_cbBibtexStyle->insertItem(i18n("Quotes")); - QString whats = i18n("<qt>The quotation style used when exporting bibtex. All field values will " + TQString whats = i18n("<qt>The quotation style used when exporting bibtex. All field values will " " be escaped with either braces or quotation marks.</qt>"); - QWhatsThis::add(l1, whats); - QWhatsThis::add(m_cbBibtexStyle, whats); + TQWhatsThis::add(l1, whats); + TQWhatsThis::add(m_cbBibtexStyle, whats); if(BibtexHandler::s_quoteStyle == BibtexHandler::BRACES) { m_cbBibtexStyle->setCurrentItem(i18n("Braces")); } else { @@ -236,7 +236,7 @@ QWidget* BibtexExporter::widget(QWidget* parent_, const char* name_/*=0*/) { } void BibtexExporter::readOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_expandMacros = group.readBoolEntry("Expand Macros", m_expandMacros); m_packageURL = group.readBoolEntry("URL Package", m_packageURL); m_skipEmptyKeys = group.readBoolEntry("Skip Empty Keys", m_skipEmptyKeys); @@ -244,12 +244,12 @@ void BibtexExporter::readOptions(KConfig* config_) { if(group.readBoolEntry("Use Braces", true)) { BibtexHandler::s_quoteStyle = BibtexHandler::BRACES; } else { - BibtexHandler::s_quoteStyle = BibtexHandler::QUOTES; + BibtexHandler::s_quoteStyle = BibtexHandler::TQUOTES; } } void BibtexExporter::saveOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_expandMacros = m_checkExpandMacros->isChecked(); group.writeEntry("Expand Macros", m_expandMacros); m_packageURL = m_checkPackageURL->isChecked(); @@ -262,19 +262,19 @@ void BibtexExporter::saveOptions(KConfig* config_) { if(useBraces) { BibtexHandler::s_quoteStyle = BibtexHandler::BRACES; } else { - BibtexHandler::s_quoteStyle = BibtexHandler::QUOTES; + BibtexHandler::s_quoteStyle = BibtexHandler::TQUOTES; } } -void BibtexExporter::writeEntryText(QString& text_, const Data::FieldVec& fields_, const Data::Entry& entry_, - const QString& type_, const QString& key_) { - const QStringList macros = static_cast<const Data::BibtexCollection*>(Data::Document::self()->collection().data())->macroList().keys(); - const QString bibtex = QString::fromLatin1("bibtex"); - const QString bibtexSep = QString::fromLatin1("bibtex-separator"); +void BibtexExporter::writeEntryText(TQString& text_, const Data::FieldVec& fields_, const Data::Entry& entry_, + const TQString& type_, const TQString& key_) { + const TQStringList macros = static_cast<const Data::BibtexCollection*>(Data::Document::self()->collection().data())->macroList().keys(); + const TQString bibtex = TQString::tqfromLatin1("bibtex"); + const TQString bibtexSep = TQString::tqfromLatin1("bibtex-separator"); text_ += '@' + type_ + '{' + key_; - QString value; + TQString value; Data::FieldVec::ConstIterator fIt, end = fields_.constEnd(); bool format = options() & Export::ExportFormatted; for(fIt = fields_.constBegin(); fIt != end; ++fIt) { @@ -287,40 +287,40 @@ void BibtexExporter::writeEntryText(QString& text_, const Data::FieldVec& fields // insert "and" in between them (e.g. author and editor) if(fIt->formatFlag() == Data::Field::FormatName && fIt->flags() & Data::Field::AllowMultiple) { - value.replace(Data::Field::delimiter(), QString::fromLatin1(" and ")); + value.tqreplace(Data::Field::delimiter(), TQString::tqfromLatin1(" and ")); } else if(fIt->flags() & Data::Field::AllowMultiple) { - QString bibsep = fIt->property(bibtexSep); + TQString bibsep = fIt->property(bibtexSep); if(!bibsep.isEmpty()) { - value.replace(Data::Field::delimiter(), bibsep); + value.tqreplace(Data::Field::delimiter(), bibsep); } } else if(fIt->type() == Data::Field::Para) { // strip HTML from bibtex export - QRegExp stripHTML(QString::fromLatin1("<.*>"), true); + TQRegExp stripHTML(TQString::tqfromLatin1("<.*>"), true); stripHTML.setMinimal(true); value.remove(stripHTML); } else if(fIt->property(bibtex) == Latin1Literal("pages")) { - QRegExp rx(QString::fromLatin1("(\\d)-(\\d)")); + TQRegExp rx(TQString::tqfromLatin1("(\\d)-(\\d)")); for(int pos = rx.search(value); pos > -1; pos = rx.search(value, pos+2)) { - value.replace(pos, 3, rx.cap(1)+"--"+rx.cap(2)); + value.tqreplace(pos, 3, rx.cap(1)+"--"+rx.cap(2)); } } if(m_packageURL && fIt->type() == Data::Field::URL) { bool b = BibtexHandler::s_quoteStyle == BibtexHandler::BRACES; - value = (b ? QChar('{') : QChar('"')) - + QString::fromLatin1("\\url{") + BibtexHandler::exportText(value, macros) + QChar('}') - + (b ? QChar('}') : QChar('"')); + value = (b ? TQChar('{') : TQChar('"')) + + TQString::tqfromLatin1("\\url{") + BibtexHandler::exportText(value, macros) + TQChar('}') + + (b ? TQChar('}') : TQChar('"')); } else if(fIt->type() != Data::Field::Number) { // numbers aren't escaped, nor will they have macros // if m_expandMacros is true, then macros is empty, so this is ok even then value = BibtexHandler::exportText(value, macros); } - text_ += QString::fromLatin1(",\n ") + text_ += TQString::tqfromLatin1(",\n ") + fIt->property(bibtex) - + QString::fromLatin1(" = ") + + TQString::tqfromLatin1(" = ") + value; } - text_ += QString::fromLatin1("\n}\n\n"); + text_ += TQString::tqfromLatin1("\n}\n\n"); } #include "bibtexexporter.moc" diff --git a/src/translators/bibtexexporter.h b/src/translators/bibtexexporter.h index dccfde8..b626e88 100644 --- a/src/translators/bibtexexporter.h +++ b/src/translators/bibtexexporter.h @@ -14,7 +14,7 @@ #ifndef BIBTEXEXPORTER_H #define BIBTEXEXPORTER_H -class QCheckBox; +class TQCheckBox; class KComboBox; #include "exporter.h" @@ -31,30 +31,31 @@ namespace Tellico { */ class BibtexExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: BibtexExporter(); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual void readOptions(KConfig*); virtual void saveOptions(KConfig*); private: - void writeEntryText(QString& text, const Data::FieldVec& field, const Data::Entry& entry, - const QString& type, const QString& key); + void writeEntryText(TQString& text, const Data::FieldVec& field, const Data::Entry& entry, + const TQString& type, const TQString& key); bool m_expandMacros; bool m_packageURL; bool m_skipEmptyKeys; - QWidget* m_widget; - QCheckBox* m_checkExpandMacros; - QCheckBox* m_checkPackageURL; - QCheckBox* m_checkSkipEmpty; + TQWidget* m_widget; + TQCheckBox* m_checkExpandMacros; + TQCheckBox* m_checkPackageURL; + TQCheckBox* m_checkSkipEmpty; KComboBox* m_cbBibtexStyle; }; diff --git a/src/translators/bibtexhandler.cpp b/src/translators/bibtexhandler.cpp index 8c88e43..e6c07fa 100644 --- a/src/translators/bibtexhandler.cpp +++ b/src/translators/bibtexhandler.cpp @@ -26,10 +26,10 @@ #include <kstringhandler.h> #include <klocale.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qdom.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqregexp.h> +#include <tqdom.h> // don't add braces around capital letters by default #define TELLICO_BIBTEX_BRACES 0 @@ -38,12 +38,12 @@ using Tellico::BibtexHandler; BibtexHandler::StringListMap* BibtexHandler::s_utf8LatexMap = 0; BibtexHandler::QuoteStyle BibtexHandler::s_quoteStyle = BibtexHandler::BRACES; -const QRegExp BibtexHandler::s_badKeyChars(QString::fromLatin1("[^0-9a-zA-Z-]")); +const TQRegExp BibtexHandler::s_badKeyChars(TQString::tqfromLatin1("[^0-9a-zA-Z-]")); -QStringList BibtexHandler::bibtexKeys(const Data::EntryVec& entries_) { - QStringList keys; +TQStringList BibtexHandler::bibtexKeys(const Data::EntryVec& entries_) { + TQStringList keys; for(Data::EntryVec::ConstIterator it = entries_.begin(); it != entries_.end(); ++it) { - QString s = bibtexKey(it.data()); + TQString s = bibtexKey(it.data()); if(!s.isEmpty()) { keys << s; } @@ -51,47 +51,47 @@ QStringList BibtexHandler::bibtexKeys(const Data::EntryVec& entries_) { return keys; } -QString BibtexHandler::bibtexKey(Data::ConstEntryPtr entry_) { +TQString BibtexHandler::bibtexKey(Data::ConstEntryPtr entry_) { if(!entry_ || !entry_->collection() || entry_->collection()->type() != Data::Collection::Bibtex) { - return QString::null; + return TQString(); } const Data::BibtexCollection* c = static_cast<const Data::BibtexCollection*>(entry_->collection().data()); - Data::FieldPtr f = c->fieldByBibtexName(QString::fromLatin1("key")); + Data::FieldPtr f = c->fieldByBibtexName(TQString::tqfromLatin1("key")); if(f) { - QString key = entry_->field(f->name()); + TQString key = entry_->field(f->name()); if(!key.isEmpty()) { return key; } } - QString author; - Data::FieldPtr authorField = c->fieldByBibtexName(QString::fromLatin1("author")); + TQString author; + Data::FieldPtr authorField = c->fieldByBibtexName(TQString::tqfromLatin1("author")); if(authorField) { if(authorField->flags() & Data::Field::AllowMultiple) { // grab first author only; - QString tmp = entry_->field(authorField->name()); + TQString tmp = entry_->field(authorField->name()); author = tmp.section(';', 0, 0); } else { author = entry_->field(authorField->name()); } } - Data::FieldPtr titleField = c->fieldByBibtexName(QString::fromLatin1("title")); - QString title; + Data::FieldPtr titleField = c->fieldByBibtexName(TQString::tqfromLatin1("title")); + TQString title; if(titleField) { title = entry_->field(titleField->name()); } - Data::FieldPtr yearField = c->fieldByBibtexName(QString::fromLatin1("year")); - QString year; + Data::FieldPtr yearField = c->fieldByBibtexName(TQString::tqfromLatin1("year")); + TQString year; if(yearField) { year = entry_->field(yearField->name()); } if(year.isEmpty()) { - year = entry_->field(QString::fromLatin1("pub_year")); + year = entry_->field(TQString::tqfromLatin1("pub_year")); if(year.isEmpty()) { - year = entry_->field(QString::fromLatin1("cr_year")); + year = entry_->field(TQString::tqfromLatin1("cr_year")); } } year = year.section(';', 0, 0); @@ -99,28 +99,28 @@ QString BibtexHandler::bibtexKey(Data::ConstEntryPtr entry_) { return bibtexKey(author, title, year); } -QString BibtexHandler::bibtexKey(const QString& author_, const QString& title_, const QString& year_) { - QString key; +TQString BibtexHandler::bibtexKey(const TQString& author_, const TQString& title_, const TQString& year_) { + TQString key; // if no comma, take the last word if(!author_.isEmpty()) { - if(author_.find(',') == -1) { + if(author_.tqfind(',') == -1) { key += author_.section(' ', -1).lower() + '-'; } else { // if there is a comma, take the string up to the first comma key += author_.section(',', 0, 0).lower() + '-'; } } - QStringList words = QStringList::split(' ', title_); - for(QStringList::ConstIterator it = words.begin(); it != words.end(); ++it) { + TQStringList words = TQStringList::split(' ', title_); + for(TQStringList::ConstIterator it = words.begin(); it != words.end(); ++it) { key += (*it).left(1).lower(); } key += year_; // bibtex key may only contain [0-9a-zA-Z-] - return key.replace(s_badKeyChars, QString::null); + return key.tqreplace(s_badKeyChars, TQString()); } void BibtexHandler::loadTranslationMaps() { - QString mapfile = locate("appdata", QString::fromLatin1("bibtex-translation.xml")); + TQString mapfile = locate("appdata", TQString::tqfromLatin1("bibtex-translation.xml")); if(mapfile.isEmpty()) { return; } @@ -130,15 +130,15 @@ void BibtexHandler::loadTranslationMaps() { KURL u; u.setPath(mapfile); // no namespace processing - QDomDocument dom = FileHandler::readXMLFile(u, false); + TQDomDocument dom = FileHandler::readXMLFile(u, false); - QDomNodeList keyList = dom.elementsByTagName(QString::fromLatin1("key")); + TQDomNodeList keyList = dom.elementsByTagName(TQString::tqfromLatin1("key")); for(unsigned i = 0; i < keyList.count(); ++i) { - QDomNodeList strList = keyList.item(i).toElement().elementsByTagName(QString::fromLatin1("string")); + TQDomNodeList strList = keyList.item(i).toElement().elementsByTagName(TQString::tqfromLatin1("string")); // the strList might have more than one node since there are multiple ways // to represent a character in LaTex. - QString s = keyList.item(i).toElement().attribute(QString::fromLatin1("char")); + TQString s = keyList.item(i).toElement().attribute(TQString::tqfromLatin1("char")); for(unsigned j = 0; j < strList.count(); ++j) { (*s_utf8LatexMap)[s].append(strList.item(j).toElement().text()); // kdDebug() << "BibtexHandler::loadTranslationMaps - " @@ -147,15 +147,15 @@ void BibtexHandler::loadTranslationMaps() { } } -QString BibtexHandler::importText(char* text_) { +TQString BibtexHandler::importText(char* text_) { if(!s_utf8LatexMap) { loadTranslationMaps(); } - QString str = QString::fromUtf8(text_); + TQString str = TQString::fromUtf8(text_); for(StringListMap::Iterator it = s_utf8LatexMap->begin(); it != s_utf8LatexMap->end(); ++it) { - for(QStringList::Iterator sit = it.data().begin(); sit != it.data().end(); ++sit) { - str.replace(*sit, it.key()); + for(TQStringList::Iterator sit = it.data().begin(); sit != it.data().end(); ++sit) { + str.tqreplace(*sit, it.key()); } } @@ -164,34 +164,34 @@ QString BibtexHandler::importText(char* text_) { // we need to lower-case any capitalized text after the first letter that is // NOT contained in braces - QRegExp rx(QString::fromLatin1("\\{([A-Z]+)\\}")); + TQRegExp rx(TQString::tqfromLatin1("\\{([A-Z]+)\\}")); rx.setMinimal(true); - str.replace(rx, QString::fromLatin1("\\1")); + str.tqreplace(rx, TQString::tqfromLatin1("\\1")); return str; } -QString BibtexHandler::exportText(const QString& text_, const QStringList& macros_) { +TQString BibtexHandler::exportText(const TQString& text_, const TQStringList& macros_) { if(!s_utf8LatexMap) { loadTranslationMaps(); } - QChar lquote, rquote; + TQChar lquote, rquote; switch(s_quoteStyle) { case BRACES: lquote = '{'; rquote = '}'; break; - case QUOTES: + case TQUOTES: lquote = '"'; rquote = '"'; break; } - QString text = text_; + TQString text = text_; for(StringListMap::Iterator it = s_utf8LatexMap->begin(); it != s_utf8LatexMap->end(); ++it) { - text.replace(it.key(), it.data()[0]); + text.tqreplace(it.key(), it.data()[0]); } if(macros_.isEmpty()) { @@ -203,13 +203,13 @@ QString BibtexHandler::exportText(const QString& text_, const QStringList& macro // change it. Then, in case '#' occurs in a non-macro string, replace any occurrences of '}#{' with '#' // list of new tokens - QStringList list; + TQStringList list; // first, split the text - QStringList tokens = QStringList::split('#', text, true); - for(QStringList::Iterator it = tokens.begin(); it != tokens.end(); ++it) { + TQStringList tokens = TQStringList::split('#', text, true); + for(TQStringList::Iterator it = tokens.begin(); it != tokens.end(); ++it) { // check to see if token is a macro - if(macros_.findIndex((*it).stripWhiteSpace()) == -1) { + if(macros_.tqfindIndex((*it).stripWhiteSpace()) == -1) { // the token is NOT a macro, add braces around whole words and also around capitals list << lquote + addBraces(*it) + rquote; } else { @@ -217,14 +217,14 @@ QString BibtexHandler::exportText(const QString& text_, const QStringList& macro } } - const QChar octo = '#'; + const TQChar octo = '#'; text = list.join(octo); - text.replace(QString(rquote)+octo+lquote, octo); + text.tqreplace(TQString(rquote)+octo+lquote, octo); return text; } -bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const QString& bibtexField_, const QString& value_) { +bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const TQString& bibtexField_, const TQString& value_) { Data::BibtexCollection* c = static_cast<Data::BibtexCollection*>(entry_->collection().data()); Data::FieldPtr field = c->fieldByBibtexName(bibtexField_); if(!field) { @@ -241,14 +241,14 @@ bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const QString& bibtexFi field = new Data::Field(*existingField); } else if(value_.length() < 100) { // arbitrarily say if the value has more than 100 chars, then it's a paragraph - QString vlower = value_.lower(); + TQString vlower = value_.lower(); // special case, try to detect URLs - // In qt 3.1, QString::startsWith() is always case-sensitive + // In qt 3.1, TQString::startsWith() is always case-sensitive if(bibtexField_ == Latin1Literal("url") - || vlower.startsWith(QString::fromLatin1("http")) // may also be https - || vlower.startsWith(QString::fromLatin1("ftp:/")) - || vlower.startsWith(QString::fromLatin1("file:/")) - || vlower.startsWith(QString::fromLatin1("/"))) { // assume this indicates a local path + || vlower.startsWith(TQString::tqfromLatin1("http")) // may also be https + || vlower.startsWith(TQString::tqfromLatin1("ftp:/")) + || vlower.startsWith(TQString::tqfromLatin1("file:/")) + || vlower.startsWith(TQString::tqfromLatin1("/"))) { // assume this indicates a local path myDebug() << "BibtexHandler::setFieldValue() - creating a URL field for " << bibtexField_ << endl; field = new Data::Field(bibtexField_, KStringHandler::capwords(bibtexField_), Data::Field::URL); } else { @@ -258,15 +258,15 @@ bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const QString& bibtexFi } else { field = new Data::Field(bibtexField_, KStringHandler::capwords(bibtexField_), Data::Field::Para); } - field->setProperty(QString::fromLatin1("bibtex"), bibtexField_); + field->setProperty(TQString::tqfromLatin1("bibtex"), bibtexField_); c->addField(field); } // special case keywords, replace commas with semi-colons so they get separated - QString value = value_; - if(field->property(QString::fromLatin1("bibtex")).startsWith(QString::fromLatin1("keyword"))) { - value.replace(',', ';'); + TQString value = value_; + if(field->property(TQString::tqfromLatin1("bibtex")).startsWith(TQString::tqfromLatin1("keyword"))) { + value.tqreplace(',', ';'); // special case refbase bibtex export, with multiple keywords fields - QString oValue = entry_->field(field); + TQString oValue = entry_->field(field); if(!oValue.isEmpty()) { value = oValue + "; " + value; } @@ -274,19 +274,19 @@ bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const QString& bibtexFi return entry_->setField(field, value); } -QString& BibtexHandler::cleanText(QString& text_) { +TQString& BibtexHandler::cleanText(TQString& text_) { // FIXME: need to improve this for removing all Latex entities -// QRegExp rx(QString::fromLatin1("(?=[^\\\\])\\\\.+\\{")); - QRegExp rx(QString::fromLatin1("\\\\.+\\{")); +// TQRegExp rx(TQString::tqfromLatin1("(?=[^\\\\])\\\\.+\\{")); + TQRegExp rx(TQString::tqfromLatin1("\\\\.+\\{")); rx.setMinimal(true); - text_.replace(rx, QString::null); - text_.replace(QRegExp(QString::fromLatin1("[{}]")), QString::null); - text_.replace('~', ' '); + text_.tqreplace(rx, TQString()); + text_.tqreplace(TQRegExp(TQString::tqfromLatin1("[{}]")), TQString()); + text_.tqreplace('~', ' '); return text_; } // add braces around capital letters -QString& BibtexHandler::addBraces(QString& text) { +TQString& BibtexHandler::addBraces(TQString& text) { #if !TELLICO_BIBTEX_BRACES return text; #else @@ -294,7 +294,7 @@ QString& BibtexHandler::addBraces(QString& text) { uint l = text.length(); // start at first letter, but skip if only the first is capitalized for(uint i = 0; i < l; ++i) { - const QChar c = text.at(i); + const TQChar c = text.at(i); if(inside == 0 && c >= 'A' && c <= 'Z') { uint j = i+1; while(text.at(j) >= 'A' && text.at(j) <= 'Z' && j < l) { diff --git a/src/translators/bibtexhandler.h b/src/translators/bibtexhandler.h index 87d8bf0..afaf599 100644 --- a/src/translators/bibtexhandler.h +++ b/src/translators/bibtexhandler.h @@ -14,13 +14,13 @@ #ifndef BIBTEXHANDLER_H #define BIBTEXHANDLER_H -class QString; -class QStringList; -class QRegExp; +class TQString; +class TQStringList; +class TQRegExp; #include "../datavectors.h" -#include <qmap.h> +#include <tqmap.h> namespace Tellico { @@ -29,31 +29,31 @@ namespace Tellico { */ class BibtexHandler { public: - enum QuoteStyle { BRACES=0, QUOTES=1 }; - static QStringList bibtexKeys(const Data::EntryVec& entries); - static QString bibtexKey(Data::ConstEntryPtr entry); - static QString importText(char* text); - static QString exportText(const QString& text, const QStringList& macros); - static bool setFieldValue(Data::EntryPtr entry, const QString& bibtexField, const QString& value); + enum QuoteStyle { BRACES=0, TQUOTES=1 }; + static TQStringList bibtexKeys(const Data::EntryVec& entries); + static TQString bibtexKey(Data::ConstEntryPtr entry); + static TQString importText(char* text); + static TQString exportText(const TQString& text, const TQStringList& macros); + static bool setFieldValue(Data::EntryPtr entry, const TQString& bibtexField, const TQString& value); /** * Strips the text of all vestiges of LaTeX. * * @param text A reference to the text * @return A reference to the text */ - static QString& cleanText(QString& text); + static TQString& cleanText(TQString& text); static QuoteStyle s_quoteStyle; private: - typedef QMap<QString, QStringList> StringListMap; + typedef TQMap<TQString, TQStringList> StringListMap; - static QString bibtexKey(const QString& author, const QString& title, const QString& year); + static TQString bibtexKey(const TQString& author, const TQString& title, const TQString& year); static void loadTranslationMaps(); - static QString& addBraces(QString& string); + static TQString& addBraces(TQString& string); static StringListMap* s_utf8LatexMap; - static const QRegExp s_badKeyChars; + static const TQRegExp s_badKeyChars; }; } // end namespace diff --git a/src/translators/bibteximporter.cpp b/src/translators/bibteximporter.cpp index 2e514d3..8394f6a 100644 --- a/src/translators/bibteximporter.cpp +++ b/src/translators/bibteximporter.cpp @@ -23,13 +23,13 @@ #include <kapplication.h> #include <kconfig.h> -#include <qptrlist.h> -#include <qregexp.h> -#include <qlayout.h> -#include <qvbuttongroup.h> -#include <qradiobutton.h> -#include <qwhatsthis.h> -#include <qtextcodec.h> +#include <tqptrlist.h> +#include <tqregexp.h> +#include <tqlayout.h> +#include <tqvbuttongroup.h> +#include <tqradiobutton.h> +#include <tqwhatsthis.h> +#include <tqtextcodec.h> using Tellico::Import::BibtexImporter; @@ -38,7 +38,7 @@ BibtexImporter::BibtexImporter(const KURL::List& urls_) : Importer(urls_) bt_initialize(); } -BibtexImporter::BibtexImporter(const QString& text_) : Importer(text_) +BibtexImporter::BibtexImporter(const TQString& text_) : Importer(text_) , m_coll(0), m_widget(0), m_readUTF8(0), m_readLocale(0), m_cancelled(false) { bt_initialize(); } @@ -62,7 +62,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(urls().count() * 100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); bool useUTF8 = m_widget && m_readUTF8->isChecked(); @@ -72,7 +72,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() { int count = 0; // might be importing text only if(!text().isEmpty()) { - QString text = this->text(); + TQString text = this->text(); Data::CollPtr coll = readCollection(text, count); if(!coll || coll->entryCount() == 0) { setStatusMessage(i18n("No valid bibtex entries were found")); @@ -89,13 +89,13 @@ Tellico::Data::CollPtr BibtexImporter::collection() { if(!(*it).isValid()) { continue; } - QString text = FileHandler::readTextFile(*it, false, useUTF8); + TQString text = FileHandler::readTextFile(*it, false, useUTF8); if(text.isEmpty()) { continue; } Data::CollPtr coll = readCollection(text, count); if(!coll || coll->entryCount() == 0) { - setStatusMessage(i18n("No valid bibtex entries were found in file - %1").arg(url().fileName())); + setStatusMessage(i18n("No valid bibtex entries were found in file - %1").tqarg(url().fileName())); continue; } m_coll->addEntries(coll->entries()); @@ -108,7 +108,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() { return m_coll; } -Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n) { +Tellico::Data::CollPtr BibtexImporter::readCollection(const TQString& text, int n) { if(text.isEmpty()) { myDebug() << "BibtexImporter::readCollection() - no text" << endl; return 0; @@ -125,9 +125,9 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n return 0; } - QString str; + TQString str; const uint count = m_nodes.count(); - const uint stepSize = QMAX(s_stepSize, count/100); + const uint stepSize = TQMAX(s_stepSize, count/100); const bool showProgress = options() & ImportProgress; uint j = 0; @@ -136,7 +136,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n if(bt_entry_metatype(it.current()) == BTE_PREAMBLE) { char* preamble = bt_get_text(it.current()); if(preamble) { - c->setPreamble(QString::fromUtf8(preamble)); + c->setPreamble(TQString::fromUtf8(preamble)); } continue; } @@ -146,7 +146,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n (void) bt_next_field(it.current(), 0, ¯o); // FIXME: replace macros within macro definitions! // lookup lowercase macro in map - c->addMacro(m_macros[QString::fromUtf8(macro)], QString::fromUtf8(bt_macro_text(macro, 0, 0))); + c->addMacro(m_macros[TQString::fromUtf8(macro)], TQString::fromUtf8(bt_macro_text(macro, 0, 0))); continue; } @@ -157,20 +157,20 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n // now we're parsing a regular entry Data::EntryPtr entry = new Data::Entry(ptr); - str = QString::fromUtf8(bt_entry_type(it.current())); + str = TQString::fromUtf8(bt_entry_type(it.current())); // kdDebug() << "entry type: " << str << endl; // text is automatically put into lower-case by btparse - BibtexHandler::setFieldValue(entry, QString::fromLatin1("entry-type"), str); + BibtexHandler::setFieldValue(entry, TQString::tqfromLatin1("entry-type"), str); - str = QString::fromUtf8(bt_entry_key(it.current())); + str = TQString::fromUtf8(bt_entry_key(it.current())); // kdDebug() << "entry key: " << str << endl; - BibtexHandler::setFieldValue(entry, QString::fromLatin1("key"), str); + BibtexHandler::setFieldValue(entry, TQString::tqfromLatin1("key"), str); char* name; AST* field = 0; while((field = bt_next_field(it.current(), field, &name))) { // kdDebug() << "\tfound: " << name << endl; -// str = QString::fromLatin1(bt_get_text(field)); +// str = TQString::tqfromLatin1(bt_get_text(field)); str.truncate(0); AST* value = 0; bt_nodetype type; @@ -184,7 +184,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n end_macro = false; break; case BTAST_MACRO: - str += QString::fromUtf8(svalue) + '#'; + str += TQString::fromUtf8(svalue) + '#'; end_macro = true; break; default: @@ -195,9 +195,9 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n // remove last character '#' str.truncate(str.length() - 1); } - QString fieldName = QString::fromUtf8(name); + TQString fieldName = TQString::fromUtf8(name); if(fieldName == Latin1Literal("author") || fieldName == Latin1Literal("editor")) { - str.replace(QRegExp(QString::fromLatin1("\\sand\\s")), QString::fromLatin1("; ")); + str.tqreplace(TQRegExp(TQString::tqfromLatin1("\\sand\\s")), TQString::tqfromLatin1("; ")); } BibtexHandler::setFieldValue(entry, fieldName, str); } @@ -222,7 +222,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n return ptr; } -void BibtexImporter::parseText(const QString& text) { +void BibtexImporter::parseText(const TQString& text) { m_nodes.clear(); m_macros.clear(); @@ -234,15 +234,15 @@ void BibtexImporter::parseText(const QString& text) { bt_set_stringopts(BTE_MACRODEF, 0); // bt_set_stringopts(BTE_PREAMBLE, BTO_CONVERT | BTO_EXPAND); - QString entry; - QRegExp rx(QString::fromLatin1("[{}]")); - QRegExp macroName(QString::fromLatin1("@string\\s*\\{\\s*(.*)="), false /*case sensitive*/); + TQString entry; + TQRegExp rx(TQString::tqfromLatin1("[{}]")); + TQRegExp macroName(TQString::tqfromLatin1("@string\\s*\\{\\s*(.*)="), false /*case sensitive*/); macroName.setMinimal(true); bool needsCleanup = false; int brace = 0; int startpos = 0; - int pos = text.find(rx, 0); + int pos = text.tqfind(rx, 0); while(pos > 0 && !m_cancelled) { if(text[pos] == '{') { ++brace; @@ -259,14 +259,14 @@ void BibtexImporter::parseText(const QString& text) { if(bt_entry_metatype(node) == BTE_MACRODEF && macroName.search(entry) > -1) { char* macro; (void) bt_next_field(node, 0, ¯o); - m_macros.insert(QString::fromUtf8(macro), macroName.cap(1).stripWhiteSpace()); + m_macros.insert(TQString::fromUtf8(macro), macroName.cap(1).stripWhiteSpace()); } m_nodes.append(node); needsCleanup = true; } startpos = pos+1; } - pos = text.find(rx, pos+1); + pos = text.tqfind(rx, pos+1); } if(needsCleanup) { // clean up some structures @@ -278,22 +278,22 @@ void BibtexImporter::slotCancel() { m_cancelled = true; } -QWidget* BibtexImporter::widget(QWidget* parent_, const char* name_/*=0*/) { +TQWidget* BibtexImporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) { if(m_widget) { 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); - QButtonGroup* box = new QVButtonGroup(i18n("Bibtex Options"), m_widget); - m_readUTF8 = new QRadioButton(i18n("Use Unicode (UTF-8) encoding"), box); - QWhatsThis::add(m_readUTF8, i18n("Read the imported file in Unicode (UTF-8).")); - QString localStr = i18n("Use user locale (%1) encoding").arg( - QString::fromLatin1(QTextCodec::codecForLocale()->name())); - m_readLocale = new QRadioButton(localStr, box); + TQButtonGroup* box = new TQVButtonGroup(i18n("Bibtex Options"), m_widget); + m_readUTF8 = new TQRadioButton(i18n("Use Unicode (UTF-8) encoding"), box); + TQWhatsThis::add(m_readUTF8, i18n("Read the imported file in Unicode (UTF-8).")); + TQString localStr = i18n("Use user locale (%1) encoding").tqarg( + TQString::tqfromLatin1(TQTextCodec::codecForLocale()->name())); + m_readLocale = new TQRadioButton(localStr, box); m_readLocale->setChecked(true); - QWhatsThis::add(m_readLocale, i18n("Read the imported file in the local encoding.")); + TQWhatsThis::add(m_readLocale, i18n("Read the imported file in the local encoding.")); KConfigGroup config(kapp->config(), "Import Options"); bool useUTF8 = config.readBoolEntry("Bibtex UTF8", false); diff --git a/src/translators/bibteximporter.h b/src/translators/bibteximporter.h index c17195b..e0d248c 100644 --- a/src/translators/bibteximporter.h +++ b/src/translators/bibteximporter.h @@ -26,10 +26,10 @@ extern "C" { } #endif -#include <qptrlist.h> -#include <qmap.h> +#include <tqptrlist.h> +#include <tqmap.h> -class QRadioButton; +class TQRadioButton; namespace Tellico { namespace Import { @@ -42,6 +42,7 @@ namespace Tellico { */ class BibtexImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -50,7 +51,7 @@ public: * @param url The url of the bibtex file */ BibtexImporter(const KURL::List& urls); - BibtexImporter(const QString& text); + BibtexImporter(const TQString& text); /* * Some cleanup is done for the btparse library */ @@ -63,25 +64,25 @@ public: * @return A pointer to a @ref BibtexCollection, or 0 if none can be created. */ virtual Data::CollPtr collection(); - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual bool canImport(int type) const; public slots: void slotCancel(); private: - Data::CollPtr readCollection(const QString& text, int n); - void parseText(const QString& text); + Data::CollPtr readCollection(const TQString& text, int n); + void parseText(const TQString& text); - typedef QPtrList<AST> ASTList; - typedef QPtrListIterator<AST> ASTListIterator; + typedef TQPtrList<AST> ASTList; + typedef TQPtrListIterator<AST> ASTListIterator; ASTList m_nodes; - QMap<QString, QString> m_macros; + TQMap<TQString, TQString> m_macros; Data::CollPtr m_coll; - QWidget* m_widget; - QRadioButton* m_readUTF8; - QRadioButton* m_readLocale; + TQWidget* m_widget; + TQRadioButton* m_readUTF8; + TQRadioButton* m_readLocale; bool m_cancelled : 1; }; diff --git a/src/translators/bibtexmlexporter.cpp b/src/translators/bibtexmlexporter.cpp index 4a0a4d3..153fd3f 100644 --- a/src/translators/bibtexmlexporter.cpp +++ b/src/translators/bibtexmlexporter.cpp @@ -25,19 +25,19 @@ #include <klocale.h> #include <kdebug.h> -#include <qvbox.h> -#include <qdom.h> -#include <qregexp.h> -#include <qtextcodec.h> +#include <tqvbox.h> +#include <tqdom.h> +#include <tqregexp.h> +#include <tqtextcodec.h> using Tellico::Export::BibtexmlExporter; -QString BibtexmlExporter::formatString() const { +TQString BibtexmlExporter::formatString() const { return i18n("Bibtexml"); } -QString BibtexmlExporter::fileFilter() const { - return i18n("*.xml|Bibtexml Files (*.xml)") + QChar('\n') + i18n("*|All Files"); +TQString BibtexmlExporter::fileFilter() const { + return i18n("*.xml|Bibtexml Files (*.xml)") + TQChar('\n') + i18n("*|All Files"); } bool BibtexmlExporter::exec() { @@ -49,16 +49,16 @@ bool BibtexmlExporter::exec() { // there are some special fields // the entry-type specifies the entry type - book, inproceedings, whatever - QString typeField; + TQString typeField; // the key specifies the cite-key - QString keyField; + TQString keyField; - const QString bibtex = QString::fromLatin1("bibtex"); + const TQString bibtex = TQString::tqfromLatin1("bibtex"); // keep a list of all the 'ordinary' fields to iterate through later Data::FieldVec fields; Data::FieldVec vec = coll->fields(); for(Data::FieldVec::Iterator it = vec.begin(); it != vec.end(); ++it) { - QString bibtexField = it->property(bibtex); + TQString bibtexField = it->property(bibtex); if(bibtexField == Latin1Literal("entry-type")) { typeField = it->name(); } else if(bibtexField == Latin1Literal("key")) { @@ -68,29 +68,29 @@ bool BibtexmlExporter::exec() { } } - QDomImplementation impl; - QDomDocumentType doctype = impl.createDocumentType(QString::fromLatin1("file"), - QString::null, + TQDomImplementation impl; + TQDomDocumentType doctype = impl.createDocumentType(TQString::tqfromLatin1("file"), + TQString(), XML::dtdBibtexml); //default namespace - const QString& ns = XML::nsBibtexml; + const TQString& ns = XML::nsBibtexml; - QDomDocument dom = impl.createDocument(ns, QString::fromLatin1("file"), doctype); + TQDomDocument dom = impl.createDocument(ns, TQString::tqfromLatin1("file"), doctype); // root element - QDomElement root = dom.documentElement(); + TQDomElement root = dom.documentElement(); - QString encodeStr = QString::fromLatin1("version=\"1.0\" encoding=\""); + TQString encodeStr = TQString::tqfromLatin1("version=\"1.0\" encoding=\""); if(options() & Export::ExportUTF8) { - encodeStr += QString::fromLatin1("UTF-8"); + encodeStr += TQString::tqfromLatin1("UTF-8"); } else { - encodeStr += QString::fromLatin1(QTextCodec::codecForLocale()->mimeName()); + encodeStr += TQString::tqfromLatin1(TQTextCodec::codecForLocale()->mimeName()); } encodeStr += '"'; // createDocument creates a root node, insert the processing instruction before it - dom.insertBefore(dom.createProcessingInstruction(QString::fromLatin1("xml"), encodeStr), root); - QString comment = QString::fromLatin1("Generated by Tellico ") + QString::fromLatin1(VERSION); + dom.insertBefore(dom.createProcessingInstruction(TQString::tqfromLatin1("xml"), encodeStr), root); + TQString comment = TQString::tqfromLatin1("Generated by Tellico ") + TQString::tqfromLatin1(VERSION); dom.insertBefore(dom.createComment(comment), root); Data::ConstFieldPtr field; @@ -98,14 +98,14 @@ bool BibtexmlExporter::exec() { bool format = options() & Export::ExportFormatted; StringSet usedKeys; - QString type, key, newKey, value, elemName, parElemName; - QDomElement btElem, entryElem, parentElem, fieldElem; + TQString type, key, newKey, value, elemName, parElemName; + TQDomElement btElem, entryElem, tqparentElem, fieldElem; for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { key = entryIt->field(keyField); if(key.isEmpty()) { key = BibtexHandler::bibtexKey(entryIt.data()); } - QString newKey = key; + TQString newKey = key; char c = 'a'; while(usedKeys.has(newKey)) { // duplicate found! @@ -115,8 +115,8 @@ bool BibtexmlExporter::exec() { key = newKey; usedKeys.add(key); - btElem = dom.createElement(QString::fromLatin1("entry")); - btElem.setAttribute(QString::fromLatin1("id"), key); + btElem = dom.createElement(TQString::tqfromLatin1("entry")); + btElem.setAttribute(TQString::tqfromLatin1("id"), key); root.appendChild(btElem); type = entryIt->field(typeField); @@ -149,23 +149,23 @@ bool BibtexmlExporter::exec() { elemName == Latin1Literal("editor") || elemName == Latin1Literal("keywords")) { if(elemName == Latin1Literal("author")) { - parElemName = QString::fromLatin1("authorlist"); + parElemName = TQString::tqfromLatin1("authorlist"); } else if(elemName == Latin1Literal("editor")) { - parElemName = QString::fromLatin1("editorlist"); + parElemName = TQString::tqfromLatin1("editorlist"); } else { // keywords - parElemName = QString::fromLatin1("keywords"); - elemName = QString::fromLatin1("keyword"); + parElemName = TQString::tqfromLatin1("keywords"); + elemName = TQString::tqfromLatin1("keyword"); } - parentElem = dom.createElement(parElemName); - const QStringList values = entryIt->fields(field->name(), false); - for(QStringList::ConstIterator it = values.begin(); it != values.end(); ++it) { + tqparentElem = dom.createElement(parElemName); + const TQStringList values = entryIt->fields(field->name(), false); + for(TQStringList::ConstIterator it = values.begin(); it != values.end(); ++it) { fieldElem = dom.createElement(elemName); fieldElem.appendChild(dom.createTextNode(*it)); - parentElem.appendChild(fieldElem); + tqparentElem.appendChild(fieldElem); } - if(parentElem.hasChildNodes()) { - entryElem.appendChild(parentElem); + if(tqparentElem.hasChildNodes()) { + entryElem.appendChild(tqparentElem); } } else { fieldElem = dom.createElement(elemName); diff --git a/src/translators/bibtexmlexporter.h b/src/translators/bibtexmlexporter.h index 8f63a55..7813f18 100644 --- a/src/translators/bibtexmlexporter.h +++ b/src/translators/bibtexmlexporter.h @@ -24,16 +24,17 @@ namespace Tellico { */ class BibtexmlExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: BibtexmlExporter() : Exporter() {} virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; // no options - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } }; } // end namespace diff --git a/src/translators/bibtexmlimporter.cpp b/src/translators/bibtexmlimporter.cpp index 2feb2f2..9131320 100644 --- a/src/translators/bibtexmlimporter.cpp +++ b/src/translators/bibtexmlimporter.cpp @@ -38,25 +38,25 @@ Tellico::Data::CollPtr BibtexmlImporter::collection() { } void BibtexmlImporter::loadDomDocument() { - QDomElement root = domDocument().documentElement(); + TQDomElement root = domDocument().documentElement(); if(root.isNull() || root.localName() != Latin1Literal("file")) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); return; } - const QString& ns = XML::nsBibtexml; + const TQString& ns = XML::nsBibtexml; m_coll = new Data::BibtexCollection(true); - QDomNodeList entryelems = root.elementsByTagNameNS(ns, QString::fromLatin1("entry")); + TQDomNodeList entryelems = root.elementsByTagNameNS(ns, TQString::tqfromLatin1("entry")); // kdDebug() << "BibtexmlImporter::loadDomDocument - found " << entryelems.count() << " entries" << endl; const uint count = entryelems.count(); - const uint stepSize = QMAX(s_stepSize, count/100); + const uint stepSize = TQMAX(s_stepSize, count/100); const bool showProgress = options() & ImportProgress; ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(count); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); for(uint j = 0; !m_cancelled && j < entryelems.count(); ++j) { @@ -69,8 +69,8 @@ void BibtexmlImporter::loadDomDocument() { } // end entry loop } -void BibtexmlImporter::readEntry(const QDomNode& entryNode_) { - QDomNode node = const_cast<QDomNode&>(entryNode_); +void BibtexmlImporter::readEntry(const TQDomNode& entryNode_) { + TQDomNode node = const_cast<TQDomNode&>(entryNode_); Data::EntryPtr entry = new Data::Entry(m_coll); @@ -82,14 +82,14 @@ void BibtexmlImporter::readEntry(const QDomNode& entryNode_) { </authorlist> <publisher>...</publisher> */ - QString type = node.firstChild().toElement().tagName(); - entry->setField(QString::fromLatin1("entry-type"), type); - QString id = node.toElement().attribute(QString::fromLatin1("id")); - entry->setField(QString::fromLatin1("bibtex-key"), id); + TQString type = node.firstChild().toElement().tagName(); + entry->setField(TQString::tqfromLatin1("entry-type"), type); + TQString id = node.toElement().attribute(TQString::tqfromLatin1("id")); + entry->setField(TQString::tqfromLatin1("bibtex-key"), id); - QString name, value; + TQString name, value; // field values are first child of first child of entry node - for(QDomNode n = node.firstChild().firstChild(); !n.isNull(); n = n.nextSibling()) { + for(TQDomNode n = node.firstChild().firstChild(); !n.isNull(); n = n.nextSibling()) { // n could be something like authorlist, with multiple authors, or just // a plain element with a single text child... // second case first @@ -98,9 +98,9 @@ void BibtexmlImporter::readEntry(const QDomNode& entryNode_) { value = n.toElement().text(); } else { // is either titlelist, authorlist, editorlist, or keywords - QString parName = n.toElement().tagName(); + TQString parName = n.toElement().tagName(); if(parName == Latin1Literal("titlelist")) { - for(QDomNode n2 = node.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) { + for(TQDomNode n2 = node.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) { name = n2.toElement().tagName(); value = n2.toElement().text(); if(!name.isEmpty() && !value.isEmpty()) { @@ -112,38 +112,38 @@ void BibtexmlImporter::readEntry(const QDomNode& entryNode_) { } else { name = n.firstChild().toElement().tagName(); if(name == Latin1Literal("keyword")) { - name = QString::fromLatin1("keywords"); + name = TQString::tqfromLatin1("keywords"); } value.truncate(0); - for(QDomNode n2 = n.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) { + for(TQDomNode n2 = n.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) { // n2 could have first, middle, lastname elements... if(name == Latin1Literal("person")) { - QStringList names; - names << QString::fromLatin1("initials") << QString::fromLatin1("first") - << QString::fromLatin1("middle") << QString::fromLatin1("prelast") - << QString::fromLatin1("last") << QString::fromLatin1("lineage"); - for(QStringList::ConstIterator it = names.begin(); it != names.end(); ++it) { - QDomNodeList list = n2.toElement().elementsByTagName(*it); + TQStringList names; + names << TQString::tqfromLatin1("initials") << TQString::tqfromLatin1("first") + << TQString::tqfromLatin1("middle") << TQString::tqfromLatin1("prelast") + << TQString::tqfromLatin1("last") << TQString::tqfromLatin1("lineage"); + for(TQStringList::ConstIterator it = names.begin(); it != names.end(); ++it) { + TQDomNodeList list = n2.toElement().elementsByTagName(*it); if(list.count() > 1) { value += list.item(0).toElement().text(); } if(*it != names.last()) { - value += QString::fromLatin1(" "); + value += TQString::tqfromLatin1(" "); } } } - for(QDomNode n3 = n2.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) { + for(TQDomNode n3 = n2.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) { if(n3.isElement()) { value += n3.toElement().text(); } else if(n3.isText()) { value += n3.toText().data(); } if(n3 != n2.lastChild()) { - value += QString::fromLatin1(" "); + value += TQString::tqfromLatin1(" "); } } if(n2 != n.lastChild()) { - value += QString::fromLatin1("; "); + value += TQString::tqfromLatin1("; "); } } } diff --git a/src/translators/bibtexmlimporter.h b/src/translators/bibtexmlimporter.h index 826ea30..d86dd3e 100644 --- a/src/translators/bibtexmlimporter.h +++ b/src/translators/bibtexmlimporter.h @@ -17,7 +17,7 @@ #include "xmlimporter.h" #include "../datavectors.h" -class QDomNode; +class TQDomNode; namespace Tellico { namespace Import { @@ -27,6 +27,7 @@ namespace Tellico { */ class BibtexmlImporter : public XMLImporter { Q_OBJECT + TQ_OBJECT public: /** @@ -43,7 +44,7 @@ public slots: private: void loadDomDocument(); - void readEntry(const QDomNode& entryNode); + void readEntry(const TQDomNode& entryNode); Data::CollPtr m_coll; bool m_cancelled : 1; diff --git a/src/translators/btparse/ast.c b/src/translators/btparse/ast.c index d433f79..e3479b7 100644 --- a/src/translators/btparse/ast.c +++ b/src/translators/btparse/ast.c @@ -144,7 +144,7 @@ zzfree_ast(AST *tree) } /* build a tree (root child1 child2 ... NULL) - * If root is NULL, simply make the children siblings and return ptr + * If root is NULL, simply make the tqchildren siblings and return ptr * to 1st sibling (child1). If root is not single node, return NULL. * * Siblings that are actually siblins lists themselves are handled diff --git a/src/translators/btparse/ast.h b/src/translators/btparse/ast.h index 59622ec..56dcb90 100644 --- a/src/translators/btparse/ast.h +++ b/src/translators/btparse/ast.h @@ -55,9 +55,9 @@ typedef struct _ast { #else #ifdef zzAST_DOUBLE -#define AST_REQUIRED_FIELDS struct _ast *right, *down, *left, *up; +#define AST_RETQUIRED_FIELDS struct _ast *right, *down, *left, *up; #else -#define AST_REQUIRED_FIELDS struct _ast *right, *down; +#define AST_RETQUIRED_FIELDS struct _ast *right, *down; #endif #endif diff --git a/src/translators/btparse/bibtex.c b/src/translators/btparse/bibtex.c index c922803..fb4518a 100644 --- a/src/translators/btparse/bibtex.c +++ b/src/translators/btparse/bibtex.c @@ -226,7 +226,7 @@ field(AST**_root) zzastArg(1)->nodetype = BTAST_FIELD; check_field_name (zzastArg(1)); zzCONSUME; - zzmatch(EQUALS); zzCONSUME; + zzmatch(ETQUALS); zzCONSUME; value(zzSTR); zzlink(_root, &_sibling, &_tail); #if DEBUG > 1 diff --git a/src/translators/btparse/btparse.h b/src/translators/btparse/btparse.h index 841d3ee..c2d0200 100644 --- a/src/translators/btparse/btparse.h +++ b/src/translators/btparse/btparse.h @@ -254,7 +254,7 @@ extern "C" { * First, we might need a prototype for strdup() (because the zzcr_ast * macro uses it, and that macro is used in pccts/ast.c -- which I don't * want to modify if I can help it, because it's someone else's code). - * This is to accomodate AIX, where including <string.h> apparently doesn't + * This is to accomodate AIX, where including <string.h> aptqparently doesn't * declare strdup() (reported by Reiner Schlotte * <[email protected]>), and compiling bibtex.c (which * includes pccts/ast.c) crashes because of this (yes, yes, I know it @@ -297,8 +297,8 @@ AST * bt_parse_file (char * filename, /* postprocess.c */ void bt_postprocess_string (char * s, ushort options); -char * bt_postprocess_value (AST * value, ushort options, boolean replace); -char * bt_postprocess_field (AST * field, ushort options, boolean replace); +char * bt_postprocess_value (AST * value, ushort options, boolean tqreplace); +char * bt_postprocess_field (AST * field, ushort options, boolean tqreplace); void bt_postprocess_entry (AST * entry, ushort options); /* error.c */ diff --git a/src/translators/btparse/err.c b/src/translators/btparse/err.c index f143048..341ab70 100644 --- a/src/translators/btparse/err.c +++ b/src/translators/btparse/err.c @@ -47,7 +47,7 @@ const ANTLRChar *zztokens[27]={ /* 12 */ "RBRACE", /* 13 */ "ENTRY_OPEN", /* 14 */ "ENTRY_CLOSE", - /* 15 */ "EQUALS", + /* 15 */ "ETQUALS", /* 16 */ "HASH", /* 17 */ "COMMA", /* 18 */ "\"", diff --git a/src/translators/btparse/err.h b/src/translators/btparse/err.h index d16615d..a9ba6da 100644 --- a/src/translators/btparse/err.h +++ b/src/translators/btparse/err.h @@ -61,13 +61,13 @@ * hidden and does not need to be saved during a "save state" operation */ /* maximum of 32 bits/unsigned int and must be 8 bits/byte */ -static SetWordType bitmask[] = { +static SetWordType bittqmask[] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080 }; void -zzresynch(SetWordType *wd,SetWordType mask) +zzresynch(SetWordType *wd,SetWordType tqmask) { static int consumed = 1; @@ -77,10 +77,10 @@ zzresynch(SetWordType *wd,SetWordType mask) if ( !consumed ) {zzCONSUME; return;} /* if current token is in resynch set, we've got what we wanted */ - if ( wd[LA(1)]&mask || LA(1) == zzEOF_TOKEN ) {consumed=0; return;} + if ( wd[LA(1)]&tqmask || LA(1) == zzEOF_TOKEN ) {consumed=0; return;} /* scan until we find something in the resynch set */ - while ( !(wd[LA(1)]&mask) && LA(1) != zzEOF_TOKEN ) {zzCONSUME;} + while ( !(wd[LA(1)]&tqmask) && LA(1) != zzEOF_TOKEN ) {zzCONSUME;} consumed=1; } @@ -237,11 +237,11 @@ zzedecode(SetWordType *a) if ( zzset_deg(a)>1 ) fprintf(stderr, " {"); do { register SetWordType t = *p; - register SetWordType *b = &(bitmask[0]); + register SetWordType *b = &(bittqmask[0]); do { if ( t & *b ) fprintf(stderr, " %s", zztokens[e]); e++; - } while (++b < &(bitmask[sizeof(SetWordType)*8])); + } while (++b < &(bittqmask[sizeof(SetWordType)*8])); } while (++p < endp); if ( zzset_deg(a)>1 ) fprintf(stderr, " }"); } @@ -271,7 +271,7 @@ zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, cha int zzset_el(unsigned b, SetWordType *p) { - return( p[BSETDIVWORD(b)] & bitmask[BSETMODWORD(b)] ); + return( p[BSETDIVWORD(b)] & bittqmask[BSETMODWORD(b)] ); } int @@ -289,10 +289,10 @@ zzset_deg(SetWordType *a) while ( p < endp ) { register SetWordType t = *p; - register SetWordType *b = &(bitmask[0]); + register SetWordType *b = &(bittqmask[0]); do { if (t & *b) ++degree; - } while (++b < &(bitmask[sizeof(SetWordType)*8])); + } while (++b < &(bittqmask[sizeof(SetWordType)*8])); p++; } diff --git a/src/translators/btparse/input.c b/src/translators/btparse/input.c index dbb7b44..c50468e 100644 --- a/src/translators/btparse/input.c +++ b/src/translators/btparse/input.c @@ -164,7 +164,7 @@ finish_parse (int **err_counts) @RETURNS : false if there were serious errors in the recently-parsed input true otherwise (no errors or just warnings) @DESCRIPTION: Gets the "error status" bitmap relative to a saved set of - error counts and masks of non-serious errors. + error counts and tqmasks of non-serious errors. @GLOBALS : @CALLS : @CALLERS : @@ -174,17 +174,17 @@ finish_parse (int **err_counts) static boolean parse_status (int *saved_counts) { - ushort ignore_emask; + ushort ignore_etqmask; /* * This bit-twiddling fetches the error status (which has a bit - * for each error class), masks off the bits for trivial errors + * for each error class), tqmasks off the bits for trivial errors * to get "true" if there were any serious errors, and then * returns the opposite of that. */ - ignore_emask = + ignore_etqmask = (1<<BTERR_NOTIFY) | (1<<BTERR_CONTENT) | (1<<BTERR_LEXWARN); - return !(bt_error_status (saved_counts) & ~ignore_emask); + return !(bt_error_status (saved_counts) & ~ignore_etqmask); } @@ -237,7 +237,7 @@ AST * bt_parse_entry_s (char * entry_text, return NULL; } - zzast_sp = ZZAST_STACKSIZE; /* workaround apparent pccts bug */ + zzast_sp = ZZAST_STACKSIZE; /* workaround aptqparent pccts bug */ start_parse (NULL, entry_text, line); entry (&entry_ast); /* enter the parser */ @@ -364,7 +364,7 @@ AST * bt_parse_entry (FILE * infile, * functions? */ - zzast_sp = ZZAST_STACKSIZE; /* workaround apparent pccts bug */ + zzast_sp = ZZAST_STACKSIZE; /* workaround aptqparent pccts bug */ #if defined(LL_K) || defined(ZZINF_LOOK) || defined(DEMAND_LOOK) # error One of LL_K, ZZINF_LOOK, or DEMAND_LOOK was defined diff --git a/src/translators/btparse/lex_auxiliary.c b/src/translators/btparse/lex_auxiliary.c index 8fac463..9e5b452 100644 --- a/src/translators/btparse/lex_auxiliary.c +++ b/src/translators/btparse/lex_auxiliary.c @@ -107,7 +107,7 @@ static int JunkCount; /* non-whitespace chars at toplevel */ * brace depth within a string; we can only end the current string * when this is zero * ParenDepth: - * parenthesis depth within a string; needed for @comment entries + * tqparenthesis depth within a string; needed for @comment entries * that are paren-delimited (because the comment in that case is * a paren-delimited string) * StringOpener: @@ -115,9 +115,9 @@ static int JunkCount; /* non-whitespace chars at toplevel */ * mismatch -- this determines which character ('"' or '}') can * actually end the string * StringStart: - * line on which current string started; if we detect an apparent + * line on which current string started; if we detect an aptqparent * runaway, this is used to report where the runaway started - * ApparentRunaway: + * AptqparentRunaway: * flags if we have already detected (and warned) that the current * string appears to be a runaway, so that we don't warn again * (and again and again and again) @@ -130,9 +130,9 @@ static int JunkCount; /* non-whitespace chars at toplevel */ */ static char StringOpener = '\0'; /* '{' or '"' */ static int BraceDepth; /* depth of brace-nesting */ -static int ParenDepth; /* depth of parenthesis-nesting */ +static int ParenDepth; /* depth of tqparenthesis-nesting */ static int StringStart = -1; /* start line of current string */ -static int ApparentRunaway; /* current string looks like runaway */ +static int AptqparentRunaway; /* current string looks like runaway */ static int QuoteWarned; /* already warned about " in string? */ @@ -590,7 +590,7 @@ void start_string (char start_char) BraceDepth = 0; ParenDepth = 0; StringStart = zzline; - ApparentRunaway = 0; + AptqparentRunaway = 0; QuoteWarned = 0; if (start_char == '{') open_brace (); @@ -598,7 +598,7 @@ void start_string (char start_char) ParenDepth++; if (start_char == '"' && EntryState == in_comment) { - lexical_error ("comment entries must be delimited by either braces or parentheses"); + lexical_error ("comment entries must be delimited by either braces or tqparentheses"); EntryState = toplevel; zzmode (START); return; @@ -878,7 +878,7 @@ void check_runaway_string (void) } - if (!ApparentRunaway) /* haven't already warned about it */ + if (!AptqparentRunaway) /* haven't already warned about it */ { enum { none, entry, field, giveup } guess; @@ -930,7 +930,7 @@ void check_runaway_string (void) { lexical_warning ("possible runaway string started at line %d", StringStart); - ApparentRunaway = 1; + AptqparentRunaway = 1; } } diff --git a/src/translators/btparse/parse_auxiliary.c b/src/translators/btparse/parse_auxiliary.c index f509741..105e84e 100644 --- a/src/translators/btparse/parse_auxiliary.c +++ b/src/translators/btparse/parse_auxiliary.c @@ -36,7 +36,7 @@ GEN_PRIVATE_ERRFUNC (syntax_error, (char * fmt, ...), /* this is stolen from PCCTS' err.h */ -static SetWordType bitmask[] = +static SetWordType bittqmask[] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080 @@ -54,7 +54,7 @@ static struct { RBRACE, "right brace (\"}\")" }, { ENTRY_OPEN, "start of entry (\"{\" or \"(\")" }, { ENTRY_CLOSE,"end of entry (\"}\" or \")\")" }, - { EQUALS, "\"=\"" }, + { ETQUALS, "\"=\"" }, { HASH, "\"#\"" }, { COMMA, "\",\"" }, { NUMBER, "number" }, @@ -71,7 +71,7 @@ void fix_token_names (void) { int i; - int num_replace; + int num_tqreplace; #ifdef CLEVER_TOKEN_STUFF /* clever, but it doesn't work... */ /* arg! this doesn't work because I don't know how to find out the @@ -91,8 +91,8 @@ fix_token_names (void) } #endif - num_replace = (sizeof(new_tokens) / sizeof(*new_tokens)); - for (i = 0; i < num_replace; i++) + num_tqreplace = (sizeof(new_tokens) / sizeof(*new_tokens)); + for (i = 0; i < num_tqreplace; i++) { const char *new = new_tokens[i].new_name; const char **old = zztokens + new_tokens[i].token; @@ -115,7 +115,7 @@ append_token_set (char *msg, SetWordType *a) do { SetWordType t = *p; - SetWordType *b = &(bitmask[0]); + SetWordType *b = &(bittqmask[0]); do { if (t & *b) @@ -128,7 +128,7 @@ append_token_set (char *msg, SetWordType *a) strcat (msg, " or "); } e++; - } while (++b < &(bitmask[sizeof(SetWordType)*8])); + } while (++b < &(bittqmask[sizeof(SetWordType)*8])); } while (++p < endp); } diff --git a/src/translators/btparse/postprocess.c b/src/translators/btparse/postprocess.c index 7f7bfd4..127342c 100644 --- a/src/translators/btparse/postprocess.c +++ b/src/translators/btparse/postprocess.c @@ -156,7 +156,7 @@ bt_postprocess_string (char * s, ushort options) sub-strings, which would be bad if you intend to concatenate them later in the BibTeX sense.) - The 'replace' parameter is used to govern whether the + The 'tqreplace' parameter is used to govern whether the existing strings in the AST should be replaced with their post-processed versions. This can extend as far as collapsing a series of simple values into a single BTAST_STRING @@ -168,10 +168,10 @@ bt_postprocess_string (char * s, ushort options) @CREATED : 1997/01/10, GPW @MODIFIED : 1997/08/25, GPW: renamed from bt_postprocess_field(), and changed to take the head of a list of simple values, - rather than the parent of that list + rather than the tqparent of that list -------------------------------------------------------------------------- */ char * -bt_postprocess_value (AST * value, ushort options, boolean replace) +bt_postprocess_value (AST * value, ushort options, boolean tqreplace) { AST * simple_value; /* current simple value */ boolean pasting; @@ -300,7 +300,7 @@ bt_postprocess_value (AST * value, ushort options, boolean replace) bt_postprocess_string (tmp_string, string_opts); } - if (replace) + if (tqreplace) { simple_value->nodetype = BTAST_STRING; if (simple_value->text) @@ -312,12 +312,12 @@ bt_postprocess_value (AST * value, ushort options, boolean replace) /* * If the current simple value is a literal string, then just - * post-process it. This will be done in-place if 'replace' is + * post-process it. This will be done in-place if 'tqreplace' is * true, otherwise a copy of the string will be post-processed. */ else if (simple_value->nodetype == BTAST_STRING && simple_value->text) { - if (replace) + if (tqreplace) { tmp_string = simple_value->text; } @@ -340,12 +340,12 @@ bt_postprocess_value (AST * value, ushort options, boolean replace) */ if (simple_value->nodetype == BTAST_NUMBER) { - if (replace && (options & BTO_CONVERT)) + if (tqreplace && (options & BTO_CONVERT)) simple_value->nodetype = BTAST_STRING; if (simple_value->text) { - if (replace) + if (tqreplace) tmp_string = simple_value->text; else { @@ -395,7 +395,7 @@ bt_postprocess_value (AST * value, ushort options, boolean replace) * `field', and replace text for first child with new_string. */ - if (replace) + if (tqreplace) { assert (value->right != NULL); /* there has to be > 1 simple value! */ zzfree_ast (value->right); /* free from second simple value on */ @@ -418,7 +418,7 @@ bt_postprocess_value (AST * value, ushort options, boolean replace) @RETURNS : @DESCRIPTION: Postprocesses all the strings in a single "field = value" assignment subtree. Just checks that 'field' does indeed - point to an BTAST_FIELD node (presumably the parent of a list + point to an BTAST_FIELD node (presumably the tqparent of a list of simple values), downcases the field name, and calls bt_postprocess_value() on the value. @GLOBALS : @@ -428,14 +428,14 @@ bt_postprocess_value (AST * value, ushort options, boolean replace) @MODIFIED : -------------------------------------------------------------------------- */ char * -bt_postprocess_field (AST * field, ushort options, boolean replace) +bt_postprocess_field (AST * field, ushort options, boolean tqreplace) { if (field == NULL) return NULL; if (field->nodetype != BTAST_FIELD) usage_error ("bt_postprocess_field: invalid AST node (not a field)"); strlwr (field->text); /* downcase field name */ - return bt_postprocess_value (field->down, options, replace); + return bt_postprocess_value (field->down, options, tqreplace); } /* bt_postprocess_field() */ @@ -464,7 +464,7 @@ bt_postprocess_entry (AST * top, ushort options) "invalid node type (not entry root)"); strlwr (top->text); /* downcase entry type */ - if (top->down == NULL) return; /* no children at all */ + if (top->down == NULL) return; /* no tqchildren at all */ cur = top->down; if (cur->nodetype == BTAST_KEY) diff --git a/src/translators/btparse/scan.c b/src/translators/btparse/scan.c index b9899e4..8f01d3c 100644 --- a/src/translators/btparse/scan.c +++ b/src/translators/btparse/scan.c @@ -188,7 +188,7 @@ static void act16() static void act17() { - NLA = EQUALS; + NLA = ETQUALS; } diff --git a/src/translators/btparse/sym.c b/src/translators/btparse/sym.c index 2426dea..b1eabd9 100644 --- a/src/translators/btparse/sym.c +++ b/src/translators/btparse/sym.c @@ -80,7 +80,7 @@ * a = zzs_new("Truck"); zzs_add(a->symbol, a); * * p = zzs_get("Plum"); - * if ( p == NULL ) fprintf(stderr, "Hmmm...Can't find 'Plum'\n"); + * if ( p == NULL ) fprintf(stderr, "Hmmm...Can't tqfind 'Plum'\n"); * * p = zzs_rmscope(&scope1) * for (; p!=NULL; p=p->scope) {printf("Scope1: %s\n", p->symbol);} diff --git a/src/translators/btparse/tokens.h b/src/translators/btparse/tokens.h index 6f9405a..1f51459 100644 --- a/src/translators/btparse/tokens.h +++ b/src/translators/btparse/tokens.h @@ -17,7 +17,7 @@ #define RBRACE 12 #define ENTRY_OPEN 13 #define ENTRY_CLOSE 14 -#define EQUALS 15 +#define ETQUALS 15 #define HASH 16 #define COMMA 17 #define STRING 25 diff --git a/src/translators/csvexporter.cpp b/src/translators/csvexporter.cpp index bb206e1..4d4d32e 100644 --- a/src/translators/csvexporter.cpp +++ b/src/translators/csvexporter.cpp @@ -21,38 +21,38 @@ #include <klineedit.h> #include <kconfig.h> -#include <qgroupbox.h> -#include <qcheckbox.h> -#include <qlayout.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qwhatsthis.h> +#include <tqgroupbox.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqwhatsthis.h> using Tellico::Export::CSVExporter; CSVExporter::CSVExporter() : Tellico::Export::Exporter(), m_includeTitles(true), - m_delimiter(QChar(',')), + m_delimiter(TQChar(',')), m_widget(0) { } -QString CSVExporter::formatString() const { +TQString CSVExporter::formatString() const { return i18n("CSV"); } -QString CSVExporter::fileFilter() const { - return i18n("*.csv|CSV Files (*.csv)") + QChar('\n') + i18n("*|All Files"); +TQString CSVExporter::fileFilter() const { + return i18n("*.csv|CSV Files (*.csv)") + TQChar('\n') + i18n("*|All Files"); } -QString& CSVExporter::escapeText(QString& text_) { +TQString& CSVExporter::escapeText(TQString& text_) { bool quotes = false; - if(text_.find('"') != -1) { + if(text_.tqfind('"') != -1) { quotes = true; // quotation marks will be escaped by using a double pair - text_.replace('"', QString::fromLatin1("\"\"")); + text_.tqreplace('"', TQString::tqfromLatin1("\"\"")); } // if the text contains quotes or the delimiter, it needs to be surrounded by quotes - if(quotes || text_.find(m_delimiter) != -1) { + if(quotes || text_.tqfind(m_delimiter) != -1) { text_.prepend('"'); text_.append('"'); } @@ -64,14 +64,14 @@ bool CSVExporter::exec() { return false; } - QString text; + TQString text; Data::FieldVec fields = collection()->fields(); Data::FieldVec::Iterator fIt; if(m_includeTitles) { for(fIt = fields.begin(); fIt != fields.end(); ++fIt) { - QString title = fIt->title(); + TQString title = fIt->title(); text += escapeText(title); if(!fIt.nextEnd()) { text += m_delimiter; @@ -82,7 +82,7 @@ bool CSVExporter::exec() { bool format = options() & Export::ExportFormatted; - QString tmp; + TQString tmp; for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { for(fIt = fields.begin(); fIt != fields.end(); ++fIt) { tmp = entryIt->field(fIt->name(), format); @@ -98,61 +98,61 @@ bool CSVExporter::exec() { return FileHandler::writeTextURL(url(), text, options() & ExportUTF8, options() & Export::ExportForce); } -QWidget* CSVExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* CSVExporter::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("CSV Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("CSV Options"), m_widget); l->addWidget(box); - m_checkIncludeTitles = new QCheckBox(i18n("Include field titles as column headers"), box); + m_checkIncludeTitles = new TQCheckBox(i18n("Include field titles as column headers"), box); m_checkIncludeTitles->setChecked(m_includeTitles); - QWhatsThis::add(m_checkIncludeTitles, i18n("If checked, a header row will be added with the " + TQWhatsThis::add(m_checkIncludeTitles, i18n("If checked, a header row will be added with the " "field titles.")); - QButtonGroup* delimiterGroup = new QButtonGroup(0, Qt::Vertical, i18n("Delimiter"), box); - QGridLayout* m_delimiterGroupLayout = new QGridLayout(delimiterGroup->layout()); - m_delimiterGroupLayout->setAlignment(Qt::AlignTop); - QWhatsThis::add(delimiterGroup, i18n("In addition to a comma, other characters may be used as " + TQButtonGroup* delimiterGroup = new TQButtonGroup(0, Qt::Vertical, i18n("Delimiter"), box); + TQGridLayout* m_delimiterGroupLayout = new TQGridLayout(delimiterGroup->tqlayout()); + m_delimiterGroupLayout->tqsetAlignment(TQt::AlignTop); + TQWhatsThis::add(delimiterGroup, i18n("In addition to a comma, other characters may be used as " "a delimiter, separating each value in the file.")); - m_radioComma = new QRadioButton(delimiterGroup); + m_radioComma = new TQRadioButton(delimiterGroup); m_radioComma->setText(i18n("Comma")); m_radioComma->setChecked(true); - QWhatsThis::add(m_radioComma, i18n("Use a comma as the delimiter.")); + TQWhatsThis::add(m_radioComma, i18n("Use a comma as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioComma, 0, 0); - m_radioSemicolon = new QRadioButton( delimiterGroup); + m_radioSemicolon = new TQRadioButton( delimiterGroup); m_radioSemicolon->setText(i18n("Semicolon")); - QWhatsThis::add(m_radioSemicolon, i18n("Use a semi-colon as the delimiter.")); + TQWhatsThis::add(m_radioSemicolon, i18n("Use a semi-colon as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioSemicolon, 0, 1); - m_radioTab = new QRadioButton(delimiterGroup); + m_radioTab = new TQRadioButton(delimiterGroup); m_radioTab->setText(i18n("Tab")); - QWhatsThis::add(m_radioTab, i18n("Use a tab as the delimiter.")); + TQWhatsThis::add(m_radioTab, i18n("Use a tab as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioTab, 1, 0); - m_radioOther = new QRadioButton(delimiterGroup); + m_radioOther = new TQRadioButton(delimiterGroup); m_radioOther->setText(i18n("Other")); - QWhatsThis::add(m_radioOther, i18n("Use a custom string as the delimiter.")); + TQWhatsThis::add(m_radioOther, i18n("Use a custom string as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioOther, 1, 1); m_editOther = new KLineEdit(delimiterGroup); m_editOther->setEnabled(m_radioOther->isChecked()); - QWhatsThis::add(m_editOther, i18n("A custom string, such as a colon, may be used as a delimiter.")); + TQWhatsThis::add(m_editOther, i18n("A custom string, such as a colon, may be used as a delimiter.")); m_delimiterGroupLayout->addWidget(m_editOther, 1, 2); - QObject::connect(m_radioOther, SIGNAL(toggled(bool)), - m_editOther, SLOT(setEnabled(bool))); + TQObject::connect(m_radioOther, TQT_SIGNAL(toggled(bool)), + m_editOther, TQT_SLOT(setEnabled(bool))); - if(m_delimiter == QChar(',')) { + if(m_delimiter == TQChar(',')) { m_radioComma->setChecked(true); - } else if(m_delimiter == QChar(';')) { + } else if(m_delimiter == TQChar(';')) { m_radioSemicolon->setChecked(true); - } else if(m_delimiter == QChar('\t')) { + } else if(m_delimiter == TQChar('\t')) { m_radioTab->setChecked(true); } else if(!m_delimiter.isEmpty()) { m_radioOther->setChecked(true); @@ -165,7 +165,7 @@ QWidget* CSVExporter::widget(QWidget* parent_, const char* name_/*=0*/) { } void CSVExporter::readOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_includeTitles = group.readBoolEntry("Include Titles", m_includeTitles); m_delimiter = group.readEntry("Delimiter", m_delimiter); } @@ -173,16 +173,16 @@ void CSVExporter::readOptions(KConfig* config_) { void CSVExporter::saveOptions(KConfig* config_) { m_includeTitles = m_checkIncludeTitles->isChecked(); if(m_radioComma->isChecked()) { - m_delimiter = QChar(','); + m_delimiter = TQChar(','); } else if(m_radioSemicolon->isChecked()) { - m_delimiter = QChar(';'); + m_delimiter = TQChar(';'); } else if(m_radioTab->isChecked()) { - m_delimiter = QChar('\t'); + m_delimiter = TQChar('\t'); } else { m_delimiter = m_editOther->text(); } - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); group.writeEntry("Include Titles", m_includeTitles); group.writeEntry("Delimiter", m_delimiter); } diff --git a/src/translators/csvexporter.h b/src/translators/csvexporter.h index 23624e3..ee300cf 100644 --- a/src/translators/csvexporter.h +++ b/src/translators/csvexporter.h @@ -17,9 +17,9 @@ class KLineEdit; class KConfig; -class QWidget; -class QCheckBox; -class QRadioButton; +class TQWidget; +class TQCheckBox; +class TQRadioButton; #include "exporter.h" @@ -31,30 +31,31 @@ namespace Tellico { */ class CSVExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: CSVExporter(); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual void readOptions(KConfig* config); virtual void saveOptions(KConfig* config); private: - QString& escapeText(QString& text); + TQString& escapeText(TQString& text); bool m_includeTitles; - QString m_delimiter; - - QWidget* m_widget; - QCheckBox* m_checkIncludeTitles; - QRadioButton* m_radioComma; - QRadioButton* m_radioSemicolon; - QRadioButton* m_radioTab; - QRadioButton* m_radioOther; + TQString m_delimiter; + + TQWidget* m_widget; + TQCheckBox* m_checkIncludeTitles; + TQRadioButton* m_radioComma; + TQRadioButton* m_radioSemicolon; + TQRadioButton* m_radioTab; + TQRadioButton* m_radioOther; KLineEdit* m_editOther; }; diff --git a/src/translators/csvimporter.cpp b/src/translators/csvimporter.cpp index f0c0900..683a3d1 100644 --- a/src/translators/csvimporter.cpp +++ b/src/translators/csvimporter.cpp @@ -36,17 +36,17 @@ extern "C" { #include <kconfig.h> #include <kmessagebox.h> -#include <qgroupbox.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qlabel.h> -#include <qcheckbox.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qwhatsthis.h> -#include <qtable.h> -#include <qvaluevector.h> -#include <qregexp.h> +#include <tqgroupbox.h> +#include <tqlayout.h> +#include <tqhbox.h> +#include <tqlabel.h> +#include <tqcheckbox.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqwhatsthis.h> +#include <tqtable.h> +#include <tqvaluevector.h> +#include <tqregexp.h> using Tellico::Import::CSVImporter; @@ -55,22 +55,22 @@ static void writeRow(char buffer, void* data); class CSVImporter::Parser { public: - Parser(const QString& str) : stream(new QTextIStream(&str)) { csv_init(&parser, 0); } + Parser(const TQString& str) : stream(new TQTextIStream(&str)) { csv_init(&parser, 0); } ~Parser() { csv_free(parser); delete stream; stream = 0; } - void setDelimiter(const QString& s) { Q_ASSERT(s.length() == 1); csv_set_delim(parser, s[0].latin1()); } - void reset(const QString& str) { delete stream; stream = new QTextIStream(&str); }; + void setDelimiter(const TQString& s) { Q_ASSERT(s.length() == 1); csv_set_delim(parser, s[0].latin1()); } + void reset(const TQString& str) { delete stream; stream = new TQTextIStream(&str); }; bool hasNext() { return !stream->atEnd(); } void skipLine() { stream->readLine(); } - void addToken(const QString& t) { tokens += t; } + void addToken(const TQString& t) { tokens += t; } void setRowDone(bool b) { done = b; } - QStringList nextTokens() { + TQStringList nextTokens() { tokens.clear(); done = false; while(hasNext() && !done) { - QCString line = stream->readLine().utf8() + '\n'; // need the eol char + TQCString line = stream->readLine().utf8() + '\n'; // need the eol char csv_parse(parser, line, line.length(), &writeToken, &writeRow, this); } csv_fini(parser, &writeToken, &writeRow, this); @@ -79,14 +79,14 @@ public: private: struct csv_parser* parser; - QTextIStream* stream; - QStringList tokens; + TQTextIStream* stream; + TQStringList tokens; bool done; }; static void writeToken(char* buffer, size_t len, void* data) { CSVImporter::Parser* p = static_cast<CSVImporter::Parser*>(data); - p->addToken(QString::fromUtf8(buffer, len)); + p->addToken(TQString::fromUtf8(buffer, len)); } static void writeRow(char c, void* data) { @@ -99,7 +99,7 @@ CSVImporter::CSVImporter(const KURL& url_) : Tellico::Import::TextImporter(url_) m_coll(0), m_existingCollection(0), m_firstRowHeader(false), - m_delimiter(QString::fromLatin1(",")), + m_delimiter(TQString::tqfromLatin1(",")), m_cancelled(false), m_widget(0), m_table(0), @@ -123,12 +123,12 @@ Tellico::Data::CollPtr CSVImporter::collection() { m_coll = CollectionFactory::collection(m_comboColl->currentType(), true); } - const QStringList existingNames = m_coll->fieldNames(); + const TQStringList existingNames = m_coll->fieldNames(); - QValueVector<int> cols; - QStringList names; + TQValueVector<int> cols; + TQStringList names; for(int col = 0; col < m_table->numCols(); ++col) { - QString t = m_table->horizontalHeader()->label(col); + TQString t = m_table->horizontalHeader()->label(col); if(m_existingCollection && m_existingCollection->fieldByTitle(t)) { // the collection might have the right field, but a different title, say for translations Data::FieldPtr f = m_existingCollection->fieldByTitle(t); @@ -157,23 +157,23 @@ Tellico::Data::CollPtr CSVImporter::collection() { m_parser->skipLine(); } - const uint numLines = text().contains('\n'); - const uint stepSize = QMAX(s_stepSize, numLines/100); + const uint numLines = text().tqcontains('\n'); + const uint stepSize = TQMAX(s_stepSize, numLines/100); const bool showProgress = options() & ImportProgress; ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(numLines); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); uint j = 0; while(!m_cancelled && m_parser->hasNext()) { bool empty = true; Data::EntryPtr entry = new Data::Entry(m_coll); - QStringList values = m_parser->nextTokens(); + TQStringList values = m_parser->nextTokens(); for(uint i = 0; i < names.size(); ++i) { -// QString value = values[cols[i]].simplifyWhiteSpace(); - QString value = values[cols[i]].stripWhiteSpace(); +// TQString value = values[cols[i]].simplifyWhiteSpace(); + TQString value = values[cols[i]].stripWhiteSpace(); bool success = entry->setField(names[i], value); // we might need to add a new allowed value // assume that if the user is importing the value, it should be allowed @@ -202,7 +202,7 @@ Tellico::Data::CollPtr CSVImporter::collection() { } { - KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - CSV")); + KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - CSV")); config.writeEntry("Delimiter", m_delimiter); config.writeEntry("First Row Titles", m_firstRowHeader); } @@ -210,117 +210,117 @@ Tellico::Data::CollPtr CSVImporter::collection() { return m_coll; } -QWidget* CSVImporter::widget(QWidget* parent_, const char* name_) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* CSVImporter::widget(TQWidget* tqparent_, const char* name_) { + 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* group = new QGroupBox(1, Qt::Horizontal, i18n("CSV Options"), m_widget); + TQGroupBox* group = new TQGroupBox(1, Qt::Horizontal, i18n("CSV Options"), m_widget); l->addWidget(group); - QHBox* box = new QHBox(group); + TQHBox* box = new TQHBox(group); box->setSpacing(5); - QLabel* lab = new QLabel(i18n("Collection &type:"), box); + TQLabel* lab = new TQLabel(i18n("Collection &type:"), box); m_comboColl = new GUI::CollectionTypeCombo(box); lab->setBuddy(m_comboColl); - QWhatsThis::add(m_comboColl, i18n("Select the type of collection being imported.")); - connect(m_comboColl, SIGNAL(activated(int)), SLOT(slotTypeChanged())); + TQWhatsThis::add(m_comboColl, i18n("Select the type of collection being imported.")); + connect(m_comboColl, TQT_SIGNAL(activated(int)), TQT_SLOT(slotTypeChanged())); // need a spacer - QWidget* w = new QWidget(box); + TQWidget* w = new TQWidget(box); box->setStretchFactor(w, 1); - m_checkFirstRowHeader = new QCheckBox(i18n("&First row contains field titles"), group); - QWhatsThis::add(m_checkFirstRowHeader, i18n("If checked, the first row is used as field titles.")); - connect(m_checkFirstRowHeader, SIGNAL(toggled(bool)), SLOT(slotFirstRowHeader(bool))); + m_checkFirstRowHeader = new TQCheckBox(i18n("&First row contains field titles"), group); + TQWhatsThis::add(m_checkFirstRowHeader, i18n("If checked, the first row is used as field titles.")); + connect(m_checkFirstRowHeader, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotFirstRowHeader(bool))); - QHBox* hbox2 = new QHBox(group); - m_delimiterGroup = new QButtonGroup(0, Qt::Vertical, i18n("Delimiter"), hbox2); - QGridLayout* m_delimiterGroupLayout = new QGridLayout(m_delimiterGroup->layout(), 3, 3); - m_delimiterGroupLayout->setAlignment(Qt::AlignTop); - QWhatsThis::add(m_delimiterGroup, i18n("In addition to a comma, other characters may be used as " + TQHBox* hbox2 = new TQHBox(group); + m_delimiterGroup = new TQButtonGroup(0, Qt::Vertical, i18n("Delimiter"), hbox2); + TQGridLayout* m_delimiterGroupLayout = new TQGridLayout(m_delimiterGroup->tqlayout(), 3, 3); + m_delimiterGroupLayout->tqsetAlignment(TQt::AlignTop); + TQWhatsThis::add(m_delimiterGroup, i18n("In addition to a comma, other characters may be used as " "a delimiter, separating each value in the file.")); - connect(m_delimiterGroup, SIGNAL(clicked(int)), SLOT(slotDelimiter())); + connect(m_delimiterGroup, TQT_SIGNAL(clicked(int)), TQT_SLOT(slotDelimiter())); - m_radioComma = new QRadioButton(m_delimiterGroup); + m_radioComma = new TQRadioButton(m_delimiterGroup); m_radioComma->setText(i18n("&Comma")); m_radioComma->setChecked(true); - QWhatsThis::add(m_radioComma, i18n("Use a comma as the delimiter.")); + TQWhatsThis::add(m_radioComma, i18n("Use a comma as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioComma, 1, 0); - m_radioSemicolon = new QRadioButton( m_delimiterGroup); + m_radioSemicolon = new TQRadioButton( m_delimiterGroup); m_radioSemicolon->setText(i18n("&Semicolon")); - QWhatsThis::add(m_radioSemicolon, i18n("Use a semi-colon as the delimiter.")); + TQWhatsThis::add(m_radioSemicolon, i18n("Use a semi-colon as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioSemicolon, 1, 1); - m_radioTab = new QRadioButton(m_delimiterGroup); + m_radioTab = new TQRadioButton(m_delimiterGroup); m_radioTab->setText(i18n("Ta&b")); - QWhatsThis::add(m_radioTab, i18n("Use a tab as the delimiter.")); + TQWhatsThis::add(m_radioTab, i18n("Use a tab as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioTab, 2, 0); - m_radioOther = new QRadioButton(m_delimiterGroup); + m_radioOther = new TQRadioButton(m_delimiterGroup); m_radioOther->setText(i18n("Ot&her:")); - QWhatsThis::add(m_radioOther, i18n("Use a custom string as the delimiter.")); + TQWhatsThis::add(m_radioOther, i18n("Use a custom string as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioOther, 2, 1); m_editOther = new KLineEdit(m_delimiterGroup); m_editOther->setEnabled(false); m_editOther->setFixedWidth(m_widget->fontMetrics().width('X') * 4); m_editOther->setMaxLength(1); - QWhatsThis::add(m_editOther, i18n("A custom string, such as a colon, may be used as a delimiter.")); + TQWhatsThis::add(m_editOther, i18n("A custom string, such as a colon, may be used as a delimiter.")); m_delimiterGroupLayout->addWidget(m_editOther, 2, 2); - connect(m_radioOther, SIGNAL(toggled(bool)), - m_editOther, SLOT(setEnabled(bool))); - connect(m_editOther, SIGNAL(textChanged(const QString&)), SLOT(slotDelimiter())); + connect(m_radioOther, TQT_SIGNAL(toggled(bool)), + m_editOther, TQT_SLOT(setEnabled(bool))); + connect(m_editOther, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotDelimiter())); - w = new QWidget(hbox2); + w = new TQWidget(hbox2); hbox2->setStretchFactor(w, 1); - m_table = new QTable(5, 0, group); - m_table->setSelectionMode(QTable::Single); - m_table->setFocusStyle(QTable::FollowStyle); + m_table = new TQTable(5, 0, group); + m_table->setSelectionMode(TQTable::Single); + m_table->setFocusStyle(TQTable::FollowStyle); m_table->setLeftMargin(0); m_table->verticalHeader()->hide(); m_table->horizontalHeader()->setClickEnabled(true); m_table->setReadOnly(true); m_table->setMinimumHeight(m_widget->fontMetrics().lineSpacing() * 8); - QWhatsThis::add(m_table, i18n("The table shows up to the first five lines of the CSV file.")); - connect(m_table, SIGNAL(currentChanged(int, int)), SLOT(slotCurrentChanged(int, int))); - connect(m_table->horizontalHeader(), SIGNAL(clicked(int)), SLOT(slotHeaderClicked(int))); + TQWhatsThis::add(m_table, i18n("The table shows up to the first five lines of the CSV file.")); + connect(m_table, TQT_SIGNAL(currentChanged(int, int)), TQT_SLOT(slotCurrentChanged(int, int))); + connect(m_table->horizontalHeader(), TQT_SIGNAL(clicked(int)), TQT_SLOT(slotHeaderClicked(int))); - QWidget* hbox = new QWidget(group); - QHBoxLayout* hlay = new QHBoxLayout(hbox, 5); + TQWidget* hbox = new TQWidget(group); + TQHBoxLayout* hlay = new TQHBoxLayout(hbox, 5); hlay->addStretch(10); - QWhatsThis::add(hbox, i18n("<qt>Set each column to correspond to a field in the collection by choosing " + TQWhatsThis::add(hbox, i18n("<qt>Set each column to correspond to a field in the collection by choosing " "a column, selecting the field, then clicking the <i>Assign Field</i> button.</qt>")); - lab = new QLabel(i18n("Co&lumn:"), hbox); + lab = new TQLabel(i18n("Co&lumn:"), hbox); hlay->addWidget(lab); m_colSpinBox = new KIntSpinBox(hbox); hlay->addWidget(m_colSpinBox); m_colSpinBox->setMinValue(1); - connect(m_colSpinBox, SIGNAL(valueChanged(int)), SLOT(slotSelectColumn(int))); + connect(m_colSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotSelectColumn(int))); lab->setBuddy(m_colSpinBox); hlay->addSpacing(10); - lab = new QLabel(i18n("&Data field in this column:"), hbox); + lab = new TQLabel(i18n("&Data field in this column:"), hbox); hlay->addWidget(lab); m_comboField = new KComboBox(hbox); hlay->addWidget(m_comboField); - connect(m_comboField, SIGNAL(activated(int)), SLOT(slotFieldChanged(int))); + connect(m_comboField, TQT_SIGNAL(activated(int)), TQT_SLOT(slotFieldChanged(int))); lab->setBuddy(m_comboField); hlay->addSpacing(10); m_setColumnBtn = new KPushButton(i18n("&Assign Field"), hbox); hlay->addWidget(m_setColumnBtn); - m_setColumnBtn->setIconSet(SmallIconSet(QString::fromLatin1("apply"))); - connect(m_setColumnBtn, SIGNAL(clicked()), SLOT(slotSetColumnTitle())); + m_setColumnBtn->setIconSet(SmallIconSet(TQString::tqfromLatin1("apply"))); + connect(m_setColumnBtn, TQT_SIGNAL(clicked()), TQT_SLOT(slotSetColumnTitle())); hlay->addStretch(10); l->addStretch(1); - KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - CSV")); + KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - CSV")); m_delimiter = config.readEntry("Delimiter", m_delimiter); m_firstRowHeader = config.readBoolEntry("First Row Titles", m_firstRowHeader); @@ -361,13 +361,13 @@ void CSVImporter::fillTable() { int maxCols = 0; int row = 0; for( ; m_parser->hasNext() && row < m_table->numRows(); ++row) { - QStringList values = m_parser->nextTokens(); + TQStringList values = m_parser->nextTokens(); if(static_cast<int>(values.count()) > m_table->numCols()) { m_table->setNumCols(values.count()); m_colSpinBox->setMaxValue(values.count()); } int col = 0; - for(QStringList::ConstIterator it = values.begin(); it != values.end(); ++it) { + for(TQStringList::ConstIterator it = values.begin(); it != values.end(); ++it) { m_table->setText(row, col, *it); m_table->adjustColumn(col); ++col; @@ -443,14 +443,14 @@ void CSVImporter::slotSelectColumn(int pos_) { void CSVImporter::slotSetColumnTitle() { int col = m_colSpinBox->value()-1; - const QString title = m_comboField->currentText(); + const TQString title = m_comboField->currentText(); m_table->horizontalHeader()->setLabel(col, title); m_hasAssignedFields = true; // make sure none of the other columns have this title bool found = false; for(int i = 0; i < col; ++i) { if(m_table->horizontalHeader()->label(i) == title) { - m_table->horizontalHeader()->setLabel(i, QString::number(i+1)); + m_table->horizontalHeader()->setLabel(i, TQString::number(i+1)); found = true; break; } @@ -461,7 +461,7 @@ void CSVImporter::slotSetColumnTitle() { } for(int i = col+1; i < m_table->numCols(); ++i) { if(m_table->horizontalHeader()->label(i) == title) { - m_table->horizontalHeader()->setLabel(i, QString::number(i+1)); + m_table->horizontalHeader()->setLabel(i, TQString::number(i+1)); break; } } @@ -477,7 +477,7 @@ void CSVImporter::updateHeader(bool force_) { Data::CollPtr c = m_existingCollection ? m_existingCollection : m_coll; for(int col = 0; col < m_table->numCols(); ++col) { - QString s = m_table->text(0, col); + TQString s = m_table->text(0, col); Data::FieldPtr f; if(c) { c->fieldByTitle(s); @@ -489,7 +489,7 @@ void CSVImporter::updateHeader(bool force_) { m_table->horizontalHeader()->setLabel(col, f->title()); m_hasAssignedFields = true; } else { - m_table->horizontalHeader()->setLabel(col, QString::number(col+1)); + m_table->horizontalHeader()->setLabel(col, TQString::number(col+1)); } } } @@ -504,7 +504,7 @@ void CSVImporter::slotFieldChanged(int idx_) { uint count = c->fieldTitles().count(); CollectionFieldsDialog dlg(c, m_widget); // dlg.setModal(true); - if(dlg.exec() == QDialog::Accepted) { + if(dlg.exec() == TQDialog::Accepted) { m_comboField->clear(); m_comboField->insertStringList(c->fieldTitles()); m_comboField->insertItem('<' + i18n("New Field") + '>'); @@ -536,7 +536,7 @@ void CSVImporter::slotActionChanged(int action_) { case Import::Merge: { m_comboColl->clear(); - QString name = CollectionFactory::nameMap()[currColl->type()]; + TQString name = CollectionFactory::nameMap()[currColl->type()]; m_comboColl->insertItem(name, currColl->type()); m_existingCollection = currColl; } diff --git a/src/translators/csvimporter.h b/src/translators/csvimporter.h index 6561584..d12f3c0 100644 --- a/src/translators/csvimporter.h +++ b/src/translators/csvimporter.h @@ -21,10 +21,10 @@ class KComboBox; class KIntSpinBox; class KPushButton; -class QButtonGroup; -class QCheckBox; -class QRadioButton; -class QTable; +class TQButtonGroup; +class TQCheckBox; +class TQRadioButton; +class TQTable; #include "textimporter.h" #include "../datavectors.h" @@ -40,6 +40,7 @@ namespace Tellico { */ class CSVImporter : public TextImporter { Q_OBJECT + TQ_OBJECT public: class Parser; @@ -55,7 +56,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual bool validImport() const; @@ -80,19 +81,19 @@ private: Data::CollPtr m_coll; Data::CollPtr m_existingCollection; // used to grab fields from current collection in window bool m_firstRowHeader; - QString m_delimiter; + TQString m_delimiter; bool m_cancelled; - QWidget* m_widget; + TQWidget* m_widget; GUI::CollectionTypeCombo* m_comboColl; - QCheckBox* m_checkFirstRowHeader; - QButtonGroup* m_delimiterGroup; - QRadioButton* m_radioComma; - QRadioButton* m_radioSemicolon; - QRadioButton* m_radioTab; - QRadioButton* m_radioOther; + TQCheckBox* m_checkFirstRowHeader; + TQButtonGroup* m_delimiterGroup; + TQRadioButton* m_radioComma; + TQRadioButton* m_radioSemicolon; + TQRadioButton* m_radioTab; + TQRadioButton* m_radioOther; KLineEdit* m_editOther; - QTable* m_table; + TQTable* m_table; KIntSpinBox* m_colSpinBox; KComboBox* m_comboField; KPushButton* m_setColumnBtn; diff --git a/src/translators/dataimporter.h b/src/translators/dataimporter.h index 4d21a53..46a512d 100644 --- a/src/translators/dataimporter.h +++ b/src/translators/dataimporter.h @@ -25,6 +25,7 @@ namespace Tellico { */ class DataImporter : public Importer { Q_OBJECT + TQ_OBJECT public: enum Source { URL, Text }; @@ -35,11 +36,11 @@ public: // DataImporter(const KURL& url) : Importer(url), m_data(FileHandler::readDataFile(url)), m_source(URL) {} DataImporter(const KURL& url) : Importer(url), m_source(URL) { m_fileRef = FileHandler::fileRef(url); } /** - * Since the conversion to a QCString appends a \0 character at the end, remove it. + * Since the conversion to a TQCString appends a \0 character at the end, remove it. * * @param text The text. It MUST be in UTF-8. */ - DataImporter(const QString& text) : Importer(text), m_data(text.utf8()), m_source(Text), m_fileRef(0) + DataImporter(const TQString& text) : Importer(text), m_data(text.utf8()), m_source(Text), m_fileRef(0) { m_data.truncate(m_data.size()-1); } /** */ @@ -47,7 +48,7 @@ public: Source source() const { return m_source; } - virtual void setText(const QString& text) { + virtual void setText(const TQString& text) { Importer::setText(text); m_data = text.utf8(); m_data.truncate(m_data.size()-1); m_source = Text; } @@ -57,11 +58,11 @@ protected: * * @return the file data */ - const QByteArray& data() const { return m_data; } + const TQByteArray& data() const { return m_data; } FileHandler::FileRef& fileRef() const { return *m_fileRef; } private: - QByteArray m_data; + TQByteArray m_data; Source m_source; FileHandler::FileRef* m_fileRef; }; diff --git a/src/translators/dcimporter.cpp b/src/translators/dcimporter.cpp index c8bb59f..55d9716 100644 --- a/src/translators/dcimporter.cpp +++ b/src/translators/dcimporter.cpp @@ -21,41 +21,41 @@ using Tellico::Import::DCImporter; DCImporter::DCImporter(const KURL& url_) : XMLImporter(url_) { } -DCImporter::DCImporter(const QString& text_) : XMLImporter(text_) { +DCImporter::DCImporter(const TQString& text_) : XMLImporter(text_) { } -DCImporter::DCImporter(const QDomDocument& dom_) : XMLImporter(dom_) { +DCImporter::DCImporter(const TQDomDocument& dom_) : XMLImporter(dom_) { } Tellico::Data::CollPtr DCImporter::collection() { - const QString& dc = XML::nsDublinCore; - const QString& zing = XML::nsZing; + const TQString& dc = XML::nsDublinCore; + const TQString& zing = XML::nsZing; Data::CollPtr c = new Data::BookCollection(true); - QDomDocument doc = domDocument(); + TQDomDocument doc = domDocument(); - QRegExp authorDateRX(QString::fromLatin1(",?(\\s+\\d{4}-?(?:\\d{4})?\\.?)(.*)$")); - QRegExp dateRX(QString::fromLatin1("\\d{4}")); + TQRegExp authorDateRX(TQString::tqfromLatin1(",?(\\s+\\d{4}-?(?:\\d{4})?\\.?)(.*)$")); + TQRegExp dateRX(TQString::tqfromLatin1("\\d{4}")); - QDomNodeList recordList = doc.elementsByTagNameNS(zing, QString::fromLatin1("recordData")); + TQDomNodeList recordList = doc.elementsByTagNameNS(zing, TQString::tqfromLatin1("recordData")); myDebug() << "DCImporter::collection() - number of records: " << recordList.count() << endl; enum { UnknownNS, UseNS, NoNS } useNS = UnknownNS; #define GETELEMENTS(s) (useNS == NoNS) \ - ? elem.elementsByTagName(QString::fromLatin1(s)) \ - : elem.elementsByTagNameNS(dc, QString::fromLatin1(s)) + ? elem.elementsByTagName(TQString::tqfromLatin1(s)) \ + : elem.elementsByTagNameNS(dc, TQString::tqfromLatin1(s)) for(uint i = 0; i < recordList.count(); ++i) { Data::EntryPtr e = new Data::Entry(c); - QDomElement elem = recordList.item(i).toElement(); + TQDomElement elem = recordList.item(i).toElement(); - QDomNodeList nodeList = GETELEMENTS("title"); + TQDomNodeList nodeList = GETELEMENTS("title"); if(nodeList.count() == 0) { // no title, skip if(useNS == UnknownNS) { - nodeList = elem.elementsByTagName(QString::fromLatin1("title")); + nodeList = elem.elementsByTagName(TQString::tqfromLatin1("title")); if(nodeList.count() > 0) { useNS = NoNS; } else { @@ -69,15 +69,15 @@ Tellico::Data::CollPtr DCImporter::collection() { } else if(useNS == UnknownNS) { useNS = UseNS; } - QString s = nodeList.item(0).toElement().text(); - s.replace('\n', ' '); + TQString s = nodeList.item(0).toElement().text(); + s.tqreplace('\n', ' '); s = s.simplifyWhiteSpace(); - e->setField(QString::fromLatin1("title"), s); + e->setField(TQString::tqfromLatin1("title"), s); nodeList = GETELEMENTS("creator"); - QStringList creators; + TQStringList creators; for(uint j = 0; j < nodeList.count(); ++j) { - QString s = nodeList.item(j).toElement().text(); + TQString s = nodeList.item(j).toElement().text(); if(authorDateRX.search(s) > -1) { // check if anything after date like [publisher] if(authorDateRX.cap(2).stripWhiteSpace().isEmpty()) { @@ -91,33 +91,33 @@ Tellico::Data::CollPtr DCImporter::collection() { creators << s; } } - e->setField(QString::fromLatin1("author"), creators.join(QString::fromLatin1("; "))); + e->setField(TQString::tqfromLatin1("author"), creators.join(TQString::tqfromLatin1("; "))); nodeList = GETELEMENTS("publisher"); - QStringList publishers; + TQStringList publishers; for(uint j = 0; j < nodeList.count(); ++j) { publishers << nodeList.item(j).toElement().text(); } - e->setField(QString::fromLatin1("publisher"), publishers.join(QString::fromLatin1("; "))); + e->setField(TQString::tqfromLatin1("publisher"), publishers.join(TQString::tqfromLatin1("; "))); nodeList = GETELEMENTS("subject"); - QStringList keywords; + TQStringList keywords; for(uint j = 0; j < nodeList.count(); ++j) { keywords << nodeList.item(j).toElement().text(); } - e->setField(QString::fromLatin1("keyword"), keywords.join(QString::fromLatin1("; "))); + e->setField(TQString::tqfromLatin1("keyword"), keywords.join(TQString::tqfromLatin1("; "))); nodeList = GETELEMENTS("date"); if(nodeList.count() > 0) { - QString s = nodeList.item(0).toElement().text(); + TQString s = nodeList.item(0).toElement().text(); if(dateRX.search(s) > -1) { - e->setField(QString::fromLatin1("pub_year"), dateRX.cap()); + e->setField(TQString::tqfromLatin1("pub_year"), dateRX.cap()); } } nodeList = GETELEMENTS("description"); if(nodeList.count() > 0) { // no title, skip - e->setField(QString::fromLatin1("comments"), nodeList.item(0).toElement().text()); + e->setField(TQString::tqfromLatin1("comments"), nodeList.item(0).toElement().text()); } c->addEntries(e); diff --git a/src/translators/dcimporter.h b/src/translators/dcimporter.h index 03eaedf..8a9adce 100644 --- a/src/translators/dcimporter.h +++ b/src/translators/dcimporter.h @@ -22,8 +22,8 @@ namespace Tellico { class DCImporter : public XMLImporter { public: DCImporter(const KURL& url); - DCImporter(const QString& text); - DCImporter(const QDomDocument& dom); + DCImporter(const TQString& text); + DCImporter(const TQDomDocument& dom); ~DCImporter() {} virtual Data::CollPtr collection(); diff --git a/src/translators/deliciousimporter.cpp b/src/translators/deliciousimporter.cpp index 5c434cd..78c128d 100644 --- a/src/translators/deliciousimporter.cpp +++ b/src/translators/deliciousimporter.cpp @@ -19,12 +19,12 @@ #include <kstandarddirs.h> -#include <qfile.h> +#include <tqfile.h> using Tellico::Import::DeliciousImporter; DeliciousImporter::DeliciousImporter(const KURL& url_) : XSLTImporter(url_) { - QString xsltFile = locate("appdata", QString::fromLatin1("delicious2tellico.xsl")); + TQString xsltFile = locate("appdata", TQString::tqfromLatin1("delicious2tellico.xsl")); if(!xsltFile.isEmpty()) { KURL u; u.setPath(xsltFile); @@ -46,33 +46,33 @@ Tellico::Data::CollPtr DeliciousImporter::collection() { KURL libraryDir = url(); libraryDir.setPath(url().directory() + "Images/"); - const QStringList imageDirs = QStringList() - << QString::fromLatin1("Large Covers/") - << QString::fromLatin1("Medium Covers/") - << QString::fromLatin1("Small Covers/") - << QString::fromLatin1("Plain Covers/"); - const QString commField = QString::fromLatin1("comments"); - const QString uuidField = QString::fromLatin1("uuid"); - const QString coverField = QString::fromLatin1("cover"); + const TQStringList imageDirs = TQStringList() + << TQString::tqfromLatin1("Large Covers/") + << TQString::tqfromLatin1("Medium Covers/") + << TQString::tqfromLatin1("Small Covers/") + << TQString::tqfromLatin1("Plain Covers/"); + const TQString commField = TQString::tqfromLatin1("comments"); + const TQString uuidField = TQString::tqfromLatin1("uuid"); + const TQString coverField = TQString::tqfromLatin1("cover"); const bool isLocal = url().isLocalFile(); Data::EntryVec entries = coll->entries(); for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { - QString comments = entry->field(commField); + TQString comments = entry->field(commField); if(!comments.isEmpty()) { RTF2HTML rtf2html(comments); entry->setField(commField, rtf2html.toHTML()); } //try to add images - QString uuid = entry->field(uuidField); + TQString uuid = entry->field(uuidField); if(!uuid.isEmpty() && isLocal) { - for(QStringList::ConstIterator it = imageDirs.begin(); it != imageDirs.end(); ++it) { - QString imgPath = libraryDir.path() + *it + uuid; - if(!QFile::exists(imgPath)) { + for(TQStringList::ConstIterator it = imageDirs.begin(); it != imageDirs.end(); ++it) { + TQString imgPath = libraryDir.path() + *it + uuid; + if(!TQFile::exists(imgPath)) { continue; } - QString imgID = ImageFactory::addImage(imgPath, true); + TQString imgID = ImageFactory::addImage(imgPath, true); if(!imgID.isEmpty()) { entry->setField(coverField, imgID); } diff --git a/src/translators/deliciousimporter.h b/src/translators/deliciousimporter.h index 657160e..77011dc 100644 --- a/src/translators/deliciousimporter.h +++ b/src/translators/deliciousimporter.h @@ -25,6 +25,7 @@ namespace Tellico { */ class DeliciousImporter : public XSLTImporter { Q_OBJECT + TQ_OBJECT public: /** @@ -36,7 +37,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } virtual bool canImport(int type) const; private: diff --git a/src/translators/exporter.cpp b/src/translators/exporter.cpp index 2fe78b7..4a5e2c9 100644 --- a/src/translators/exporter.cpp +++ b/src/translators/exporter.cpp @@ -17,10 +17,10 @@ using Tellico::Export::Exporter; -Exporter::Exporter() : QObject(), m_options(Export::ExportUTF8 | Export::ExportComplete), m_coll(0) { +Exporter::Exporter() : TQObject(), m_options(Export::ExportUTF8 | Export::ExportComplete), m_coll(0) { } -Exporter::Exporter(Data::CollPtr coll) : QObject(), m_options(Export::ExportUTF8), m_coll(coll) { +Exporter::Exporter(Data::CollPtr coll) : TQObject(), m_options(Export::ExportUTF8), m_coll(coll) { } Exporter::~Exporter() { diff --git a/src/translators/exporter.h b/src/translators/exporter.h index 2ffc13b..3085609 100644 --- a/src/translators/exporter.h +++ b/src/translators/exporter.h @@ -16,15 +16,15 @@ class KConfig; -class QWidget; -class QString; +class TQWidget; +class TQString; #include "../entry.h" #include "../datavectors.h" #include <kurl.h> -#include <qobject.h> +#include <tqobject.h> namespace Tellico { namespace Export { @@ -43,8 +43,9 @@ namespace Tellico { /** * @author Robby Stephenson */ -class Exporter : public QObject { +class Exporter : public TQObject { Q_OBJECT + TQ_OBJECT public: Exporter(); @@ -57,8 +58,8 @@ public: void setEntries(const Data::EntryVec& entries) { m_entries = entries; } void setOptions(long options) { m_options = options; reset(); } - virtual QString formatString() const = 0; - virtual QString fileFilter() const = 0; + virtual TQString formatString() const = 0; + virtual TQString fileFilter() const = 0; const KURL& url() const { return m_url; } const Data::EntryVec& entries() const { return m_entries; } long options() const { return m_options; } @@ -73,7 +74,7 @@ public: */ virtual void reset() {} - virtual QWidget* widget(QWidget* parent, const char* name=0) = 0; + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0) = 0; virtual void readOptions(KConfig*) {} virtual void saveOptions(KConfig*) {} diff --git a/src/translators/filelistingimporter.cpp b/src/translators/filelistingimporter.cpp index bef9288..00e0709 100644 --- a/src/translators/filelistingimporter.cpp +++ b/src/translators/filelistingimporter.cpp @@ -28,12 +28,12 @@ #include <kio/job.h> #include <kio/netaccess.h> -#include <qcheckbox.h> -#include <qvgroupbox.h> -#include <qlayout.h> -#include <qwhatsthis.h> -#include <qfile.h> -#include <qfileinfo.h> +#include <tqcheckbox.h> +#include <tqvgroupbox.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include <tqfile.h> +#include <tqfileinfo.h> #include <stdio.h> @@ -62,17 +62,17 @@ Tellico::Data::CollPtr FileListingImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, i18n("Scanning files..."), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); // going to assume only one volume will ever be imported - QString volume = volumeName(); + TQString volume = volumeName(); m_job = m_recursive->isChecked() ? KIO::listRecursive(url(), true, false) : KIO::listDir(url(), true, false); - connect(m_job, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)), - SLOT(slotEntries(KIO::Job*, const KIO::UDSEntryList&))); + connect(m_job, TQT_SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)), + TQT_SLOT(slotEntries(KIO::Job*, const KIO::UDSEntryList&))); if(!KIO::NetAccess::synchronousRun(m_job, Kernel::self()->widget()) || m_cancelled) { return 0; @@ -80,24 +80,24 @@ Tellico::Data::CollPtr FileListingImporter::collection() { const bool usePreview = m_filePreview->isChecked(); - const QString title = QString::fromLatin1("title"); - const QString url = QString::fromLatin1("url"); - const QString desc = QString::fromLatin1("description"); - const QString vol = QString::fromLatin1("volume"); - const QString folder = QString::fromLatin1("folder"); - const QString type = QString::fromLatin1("mimetype"); - const QString size = QString::fromLatin1("size"); - const QString perm = QString::fromLatin1("permissions"); - const QString owner = QString::fromLatin1("owner"); - const QString group = QString::fromLatin1("group"); - const QString created = QString::fromLatin1("created"); - const QString modified = QString::fromLatin1("modified"); - const QString metainfo = QString::fromLatin1("metainfo"); - const QString icon = QString::fromLatin1("icon"); + const TQString title = TQString::tqfromLatin1("title"); + const TQString url = TQString::tqfromLatin1("url"); + const TQString desc = TQString::tqfromLatin1("description"); + const TQString vol = TQString::tqfromLatin1("volume"); + const TQString folder = TQString::tqfromLatin1("folder"); + const TQString type = TQString::tqfromLatin1("mimetype"); + const TQString size = TQString::tqfromLatin1("size"); + const TQString perm = TQString::tqfromLatin1("permissions"); + const TQString owner = TQString::tqfromLatin1("owner"); + const TQString group = TQString::tqfromLatin1("group"); + const TQString created = TQString::tqfromLatin1("created"); + const TQString modified = TQString::tqfromLatin1("modified"); + const TQString metainfo = TQString::tqfromLatin1("metainfo"); + const TQString icon = TQString::tqfromLatin1("icon"); m_coll = new Data::FileCatalog(true); - QString tmp; - const uint stepSize = QMAX(1, m_files.count()/100); + TQString tmp; + const uint stepSize = TQMAX(1, m_files.count()/100); const bool showProgress = options() & ImportProgress; item.setTotalSteps(m_files.count()); @@ -121,30 +121,30 @@ Tellico::Data::CollPtr FileListingImporter::collection() { time_t t = it.current()->time(KIO::UDS_CREATION_TIME); if(t > 0) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(t); entry->setField(created, dt.toString(Qt::ISODate)); } t = it.current()->time(KIO::UDS_MODIFICATION_TIME); if(t > 0) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(t); entry->setField(modified, dt.toString(Qt::ISODate)); } const KFileMetaInfo& meta = it.current()->metaInfo(); if(meta.isValid() && !meta.isEmpty()) { - const QStringList keys = meta.supportedKeys(); - QStringList strings; - for(QStringList::ConstIterator it2 = keys.begin(); it2 != keys.end(); ++it2) { + const TQStringList keys = meta.supportedKeys(); + TQStringList strings; + for(TQStringList::ConstIterator it2 = keys.begin(); it2 != keys.end(); ++it2) { KFileMetaInfoItem item = meta.item(*it2); if(item.isValid()) { - QString s = item.string(); + TQString s = item.string(); if(!s.isEmpty()) { strings << item.key() + "::" + s; } } } - entry->setField(metainfo, strings.join(QString::fromLatin1("; "))); + entry->setField(metainfo, strings.join(TQString::tqfromLatin1("; "))); } if(!m_cancelled && usePreview) { @@ -158,7 +158,7 @@ Tellico::Data::CollPtr FileListingImporter::collection() { if(!m_pixmap.isNull()) { // is png best option? - QString id = ImageFactory::addImage(m_pixmap, QString::fromLatin1("PNG")); + TQString id = ImageFactory::addImage(m_pixmap, TQString::tqfromLatin1("PNG")); if(!id.isEmpty()) { entry->setField(icon, id); } @@ -180,23 +180,23 @@ Tellico::Data::CollPtr FileListingImporter::collection() { return m_coll; } -QWidget* FileListingImporter::widget(QWidget* parent_, const char* name_) { +TQWidget* FileListingImporter::widget(TQWidget* tqparent_, const char* name_) { if(m_widget) { 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); - QVGroupBox* box = new QVGroupBox(i18n("File Listing Options"), m_widget); + TQVGroupBox* box = new TQVGroupBox(i18n("File Listing Options"), m_widget); - m_recursive = new QCheckBox(i18n("Recursive folder search"), box); - QWhatsThis::add(m_recursive, i18n("If checked, folders are recursively searched for all files.")); + m_recursive = new TQCheckBox(i18n("Recursive folder search"), box); + TQWhatsThis::add(m_recursive, i18n("If checked, folders are recursively searched for all files.")); // by default, make it checked m_recursive->setChecked(true); - m_filePreview = new QCheckBox(i18n("Generate file previews"), box); - QWhatsThis::add(m_filePreview, i18n("If checked, previews of the file contents are generated, which can slow down " + m_filePreview = new TQCheckBox(i18n("Generate file previews"), box); + TQWhatsThis::add(m_filePreview, i18n("If checked, previews of the file contents are generated, which can slow down " "the folder listing.")); // by default, make it no previews m_filePreview->setChecked(false); @@ -223,9 +223,9 @@ void FileListingImporter::slotEntries(KIO::Job* job_, const KIO::UDSEntryList& l } } -QString FileListingImporter::volumeName() const { +TQString FileListingImporter::volumeName() const { // this functions turns /media/cdrom into /dev/hdc, then reads 32 bytes after the 16 x 2048 header - QString volume; + TQString volume; const KMountPoint::List mountPoints = KMountPoint::currentMountPoints(KMountPoint::NeedRealDeviceName); for(KMountPoint::List::ConstIterator it = mountPoints.begin(), end = mountPoints.end(); it != end; ++it) { // path() could be /media/cdrom @@ -236,11 +236,11 @@ QString FileListingImporter::volumeName() const { || (*it)->mountType() == Latin1Literal("udf"))) { volume = (*it)->mountPoint(); if(!(*it)->realDeviceName().isEmpty()) { - QString devName = (*it)->realDeviceName(); - if(devName.endsWith(QChar('/'))) { + TQString devName = (*it)->realDeviceName(); + if(devName.endsWith(TQChar('/'))) { devName.truncate(devName.length()-1); } - // QFile can't do a sequential seek, and I don't want to do a 32808x loop on getch() + // TQFile can't do a sequential seek, and I don't want to do a 32808x loop on getch() FILE* dev = 0; if((dev = fopen(devName.latin1(), "rb")) != 0) { // returns 0 on success @@ -248,7 +248,7 @@ QString FileListingImporter::volumeName() const { char buf[VOLUME_NAME_SIZE]; int ret = fread(buf, 1, VOLUME_NAME_SIZE, dev); if(ret == VOLUME_NAME_SIZE) { - volume = QString::fromLatin1(buf, VOLUME_NAME_SIZE).stripWhiteSpace(); + volume = TQString::tqfromLatin1(buf, VOLUME_NAME_SIZE).stripWhiteSpace(); } } else { myDebug() << "FileListingImporter::volumeName() - can't seek " << devName << endl; diff --git a/src/translators/filelistingimporter.h b/src/translators/filelistingimporter.h index aca4602..452f3f6 100644 --- a/src/translators/filelistingimporter.h +++ b/src/translators/filelistingimporter.h @@ -20,9 +20,9 @@ #include <kio/global.h> #include <kfileitem.h> -#include <qguardedptr.h> +#include <tqguardedptr.h> -class QCheckBox; +class TQCheckBox; namespace KIO { class Job; } @@ -35,6 +35,7 @@ namespace Tellico { */ class FileListingImporter : public Importer { Q_OBJECT + TQ_OBJECT public: FileListingImporter(const KURL& url); @@ -45,7 +46,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget*, const char*); + virtual TQWidget* widget(TQWidget*, const char*); virtual bool canImport(int type) const; public slots: @@ -55,15 +56,15 @@ private slots: void slotEntries(KIO::Job* job, const KIO::UDSEntryList& list); private: - QString volumeName() const; + TQString volumeName() const; Data::CollPtr m_coll; - QWidget* m_widget; - QCheckBox* m_recursive; - QCheckBox* m_filePreview; - QGuardedPtr<KIO::Job> m_job; + TQWidget* m_widget; + TQCheckBox* m_recursive; + TQCheckBox* m_filePreview; + TQGuardedPtr<KIO::Job> m_job; KFileItemList m_files; - QPixmap m_pixmap; + TQPixmap m_pixmap; bool m_cancelled : 1; }; diff --git a/src/translators/freedb_util.cpp b/src/translators/freedb_util.cpp index 6640ef6..07292af 100644 --- a/src/translators/freedb_util.cpp +++ b/src/translators/freedb_util.cpp @@ -129,8 +129,8 @@ namespace { }; } -QValueList<uint> FreeDBImporter::offsetList(const QCString& drive_, QValueList<uint>& trackLengths_) { - QValueList<uint> list; +TQValueList<uint> FreeDBImporter::offsetList(const TQCString& drive_, TQValueList<uint>& trackLengths_) { + TQValueList<uint> list; int drive = ::open(drive_.data(), O_RDONLY | O_NONBLOCK); CloseDrive closer(drive); @@ -235,7 +235,7 @@ ushort from2Byte(uchar* d) { #define SIZE 61 // mostly taken from kover and k3b // licensed under GPL -FreeDBImporter::CDText FreeDBImporter::getCDText(const QCString& drive_) { +FreeDBImporter::CDText FreeDBImporter::getCDText(const TQCString& drive_) { CDText cdtext; #ifdef USE_CDTEXT // only works for linux ATM @@ -337,23 +337,23 @@ FreeDBImporter::CDText FreeDBImporter::getCDText(const QCString& drive_) { data[pos_data] = c; if(track == 0) { if(code == (char)0xFFFFFF80) { - cdtext.title = QString::fromUtf8(data); + cdtext.title = TQString::fromUtf8(data); } else if(code == (char)0xFFFFFF81) { - cdtext.artist = QString::fromUtf8(data); + cdtext.artist = TQString::fromUtf8(data); } else if (code == (char)0xFFFFFF85) { - cdtext.message = QString::fromUtf8(data); + cdtext.message = TQString::fromUtf8(data); } } else { if(code == (char)0xFFFFFF80) { if(cdtext.trackTitles.size() < track) { cdtext.trackTitles.resize(track); } - cdtext.trackTitles[track-1] = QString::fromUtf8(data); + cdtext.trackTitles[track-1] = TQString::fromUtf8(data); } else if(code == (char)0xFFFFFF81) { if(cdtext.trackArtists.size() < track) { cdtext.trackArtists.resize(track); } - cdtext.trackArtists[track-1] = QString::fromUtf8(data); + cdtext.trackArtists[track-1] = TQString::fromUtf8(data); } } rc = true; @@ -365,7 +365,7 @@ FreeDBImporter::CDText FreeDBImporter::getCDText(const QCString& drive_) { } } if(cdtext.trackTitles.size() != cdtext.trackArtists.size()) { - int size = QMAX(cdtext.trackTitles.size(), cdtext.trackArtists.size()); + int size = TQMAX(cdtext.trackTitles.size(), cdtext.trackArtists.size()); cdtext.trackTitles.resize(size); cdtext.trackArtists.resize(size); } diff --git a/src/translators/freedbimporter.cpp b/src/translators/freedbimporter.cpp index 14d92d8..1364b4e 100644 --- a/src/translators/freedbimporter.cpp +++ b/src/translators/freedbimporter.cpp @@ -24,14 +24,14 @@ #include <config.h> #ifdef HAVE_KCDDB -#ifdef QT_NO_CAST_ASCII -#define HAD_QT_NO_CAST_ASCII -#undef QT_NO_CAST_ASCII +#ifdef TQT_NO_CAST_ASCII +#define HAD_TQT_NO_CAST_ASCII +#undef TQT_NO_CAST_ASCII #endif #include <libkcddb/client.h> -#ifdef HAD_QT_NO_CAST_ASCII -#define QT_NO_CAST_ASCII -#undef HAD_QT_NO_CAST_ASCII +#ifdef HAD_TQT_NO_CAST_ASCII +#define TQT_NO_CAST_ASCII +#undef HAD_TQT_NO_CAST_ASCII #endif #endif @@ -40,16 +40,16 @@ #include <kapplication.h> #include <kinputdialog.h> -#include <qfile.h> -#include <qdir.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qwhatsthis.h> -#include <qradiobutton.h> -#include <qbuttongroup.h> -#include <qhbox.h> -#include <qcheckbox.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqwhatsthis.h> +#include <tqradiobutton.h> +#include <tqbuttongroup.h> +#include <tqhbox.h> +#include <tqcheckbox.h> using Tellico::Import::FreeDBImporter; @@ -79,16 +79,16 @@ Tellico::Data::CollPtr FreeDBImporter::collection() { void FreeDBImporter::readCDROM() { #ifdef HAVE_KCDDB - QString drivePath = m_driveCombo->currentText(); + TQString drivePath = m_driveCombo->currentText(); if(drivePath.isEmpty()) { - setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").arg(drivePath)); + setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").tqarg(drivePath)); myDebug() << "FreeDBImporter::readCDROM() - no drive!" << endl; return; } // now it's ok to add device to saved list m_driveCombo->insertItem(drivePath); - QStringList drives; + TQStringList drives; for(int i = 0; i < m_driveCombo->count(); ++i) { if(drives.findIndex(m_driveCombo->text(i)) == -1) { drives += m_driveCombo->text(i); @@ -96,14 +96,14 @@ void FreeDBImporter::readCDROM() { } { - KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - FreeDB")); + KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - FreeDB")); config.writeEntry("CD-ROM Devices", drives); config.writeEntry("Last Device", drivePath); config.writeEntry("Cache Files Only", false); } - QCString drive = QFile::encodeName(drivePath); - QValueList<uint> lengths; + TQCString drive = TQFile::encodeName(drivePath); + TQValueList<uint> lengths; KCDDB::TrackOffsetList list; #if 0 // a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One. @@ -167,7 +167,7 @@ void FreeDBImporter::readCDROM() { #endif if(list.isEmpty()) { - setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").arg(drivePath)); + setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").tqarg(drivePath)); return; } // myDebug() << KCDDB::CDDB::trackOffsetListToId(list) << endl; @@ -182,24 +182,24 @@ void FreeDBImporter::readCDROM() { KCDDB::CDDB::Result r = client.lookup(list); // KCDDB doesn't return MultipleRecordFound properly, so check outselves if(r == KCDDB::CDDB::MultipleRecordFound || client.lookupResponse().count() > 1) { - QStringList list; + TQStringList list; KCDDB::CDInfoList infoList = client.lookupResponse(); for(KCDDB::CDInfoList::iterator it = infoList.begin(); it != infoList.end(); ++it) { - list.append(QString::fromLatin1("%1, %2, %3").arg((*it).artist) - .arg((*it).title) - .arg((*it).genre)); + list.append(TQString::tqfromLatin1("%1, %2, %3").tqarg((*it).artist) + .tqarg((*it).title) + .tqarg((*it).genre)); } // switch back to pointer cursor - GUI::CursorSaver cs(Qt::arrowCursor); + GUI::CursorSaver cs(TQt::arrowCursor); bool ok; - QString res = KInputDialog::getItem(i18n("Select CDDB Entry"), + TQString res = KInputDialog::getItem(i18n("Select CDDB Entry"), i18n("Select a CDDB entry:"), list, 0, false, &ok, Kernel::self()->widget()); if(ok) { uint i = 0; - for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it, ++i) { + for(TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it, ++i) { if(*it == res) { break; } @@ -214,7 +214,7 @@ void FreeDBImporter::readCDROM() { info = client.bestLookupResponse(); } else { // myDebug() << "FreeDBImporter::readCDROM() - no success! Return value = " << r << endl; - QString s; + TQString s; switch(r) { case KCDDB::CDDB::NoRecordFound: s = i18n("<qt>No records were found to match the CD.</qt>"); @@ -254,25 +254,25 @@ void FreeDBImporter::readCDROM() { Data::EntryPtr entry = new Data::Entry(m_coll); // obviously a CD - entry->setField(QString::fromLatin1("medium"), i18n("Compact Disc")); - entry->setField(QString::fromLatin1("title"), info.title); - entry->setField(QString::fromLatin1("artist"), info.artist); - entry->setField(QString::fromLatin1("genre"), info.genre); + entry->setField(TQString::tqfromLatin1("medium"), i18n("Compact Disc")); + entry->setField(TQString::tqfromLatin1("title"), info.title); + entry->setField(TQString::tqfromLatin1("artist"), info.artist); + entry->setField(TQString::tqfromLatin1("genre"), info.genre); if(info.year > 0) { - entry->setField(QString::fromLatin1("year"), QString::number(info.year)); + entry->setField(TQString::tqfromLatin1("year"), TQString::number(info.year)); } - entry->setField(QString::fromLatin1("keyword"), info.category); - QString extd = info.extd; - extd.replace('\n', QString::fromLatin1("<br/>")); - entry->setField(QString::fromLatin1("comments"), extd); + entry->setField(TQString::tqfromLatin1("keyword"), info.category); + TQString extd = info.extd; + extd.tqreplace('\n', TQString::tqfromLatin1("<br/>")); + entry->setField(TQString::tqfromLatin1("comments"), extd); - QStringList trackList; + TQStringList trackList; KCDDB::TrackInfoList t = info.trackInfoList; for(uint i = 0; i < t.count(); ++i) { #if KDE_IS_VERSION(3,4,90) - QString s = t[i].get(QString::fromLatin1("title")).toString() + "::" + info.artist; + TQString s = t[i].get(TQString::tqfromLatin1("title")).toString() + "::" + info.artist; #else - QString s = t[i].title + "::" + info.artist; + TQString s = t[i].title + "::" + info.artist; #endif if(i < lengths.count()) { s += "::" + Tellico::minutes(lengths[i]); @@ -280,7 +280,7 @@ void FreeDBImporter::readCDROM() { trackList << s; // TODO: KDE4 will probably have track length too } - entry->setField(QString::fromLatin1("track"), trackList.join(QString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("track"), trackList.join(TQString::tqfromLatin1("; "))); m_coll->addEntries(entry); readCDText(drive); @@ -291,41 +291,41 @@ void FreeDBImporter::readCache() { #ifdef HAVE_KCDDB { // remember the import options - KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - FreeDB")); + KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - FreeDB")); config.writeEntry("Cache Files Only", true); } KCDDB::Config cfg; cfg.readConfig(); - QStringList dirs = cfg.cacheLocations(); - for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { + TQStringList dirs = cfg.cacheLocations(); + for(TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { dirs += Tellico::findAllSubDirs(*it); } - // using a QMap is a lazy man's way of getting unique keys + // using a TQMap is a lazy man's way of getting unique keys // the cddb info may be in multiple files, all with the same filename, the cddb id - QMap<QString, QString> files; - for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { + TQMap<TQString, TQString> files; + for(TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { if((*it).isEmpty()) { continue; } - QDir dir(*it); - dir.setFilter(QDir::Files | QDir::Readable | QDir::Hidden); // hidden since I want directory files - const QStringList list = dir.entryList(); - for(QStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) { + TQDir dir(*it); + dir.setFilter(TQDir::Files | TQDir::Readable | TQDir::Hidden); // hidden since I want directory files + const TQStringList list = dir.entryList(); + for(TQStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) { files.insert(*it2, dir.absFilePath(*it2), false); } // kapp->processEvents(); // really needed ? } - const QString title = QString::fromLatin1("title"); - const QString artist = QString::fromLatin1("artist"); - const QString year = QString::fromLatin1("year"); - const QString genre = QString::fromLatin1("genre"); - const QString track = QString::fromLatin1("track"); - const QString comments = QString::fromLatin1("comments"); + const TQString title = TQString::tqfromLatin1("title"); + const TQString artist = TQString::tqfromLatin1("artist"); + const TQString year = TQString::tqfromLatin1("year"); + const TQString genre = TQString::tqfromLatin1("genre"); + const TQString track = TQString::tqfromLatin1("track"); + const TQString comments = TQString::tqfromLatin1("comments"); uint numFiles = files.count(); if(numFiles == 0) { @@ -335,32 +335,32 @@ void FreeDBImporter::readCache() { m_coll = new Data::MusicCollection(true); - const uint stepSize = QMAX(1, numFiles / 100); + const uint stepSize = TQMAX(1, numFiles / 100); const bool showProgress = options() & ImportProgress; ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(numFiles); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); uint step = 1; KCDDB::CDInfo info; - for(QMap<QString, QString>::Iterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++step) { + for(TQMap<TQString, TQString>::Iterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++step) { // open file and read content - QFileInfo fileinfo(it.data()); // skip files larger than 10 kB + TQFileInfo fileinfo(it.data()); // skip files larger than 10 kB if(!fileinfo.exists() || !fileinfo.isReadable() || fileinfo.size() > 10*1024) { myDebug() << "FreeDBImporter::readCache() - skipping " << it.data() << endl; continue; } - QFile file(it.data()); + TQFile file(it.data()); if(!file.open(IO_ReadOnly)) { continue; } - QTextStream ts(&file); + TQTextStream ts(&file); // libkcddb always writes the cache files in utf-8 - ts.setEncoding(QTextStream::UnicodeUTF8); - QString cddbData = ts.read(); + ts.setEncoding(TQTextStream::UnicodeUTF8); + TQString cddbData = ts.read(); file.close(); if(cddbData.isEmpty() || !info.load(cddbData) || !info.isValid()) { @@ -372,45 +372,45 @@ void FreeDBImporter::readCache() { // create a new entry and set fields Data::EntryPtr entry = new Data::Entry(m_coll); // obviously a CD - entry->setField(QString::fromLatin1("medium"), i18n("Compact Disc")); + entry->setField(TQString::tqfromLatin1("medium"), i18n("Compact Disc")); entry->setField(title, info.title); entry->setField(artist, info.artist); entry->setField(genre, info.genre); if(info.year > 0) { - entry->setField(QString::fromLatin1("year"), QString::number(info.year)); + entry->setField(TQString::tqfromLatin1("year"), TQString::number(info.year)); } - entry->setField(QString::fromLatin1("keyword"), info.category); - QString extd = info.extd; - extd.replace('\n', QString::fromLatin1("<br/>")); - entry->setField(QString::fromLatin1("comments"), extd); + entry->setField(TQString::tqfromLatin1("keyword"), info.category); + TQString extd = info.extd; + extd.tqreplace('\n', TQString::tqfromLatin1("<br/>")); + entry->setField(TQString::tqfromLatin1("comments"), extd); // step through trackList - QStringList trackList; + TQStringList trackList; KCDDB::TrackInfoList t = info.trackInfoList; for(uint i = 0; i < t.count(); ++i) { #if KDE_IS_VERSION(3,4,90) - trackList << t[i].get(QString::fromLatin1("title")).toString(); + trackList << t[i].get(TQString::tqfromLatin1("title")).toString(); #else trackList << t[i].title; #endif } - entry->setField(track, trackList.join(QString::fromLatin1("; "))); + entry->setField(track, trackList.join(TQString::tqfromLatin1("; "))); #if 0 // add CDDB info - const QString br = QString::fromLatin1("<br/>"); - QString comment; + const TQString br = TQString::tqfromLatin1("<br/>"); + TQString comment; if(!info.extd.isEmpty()) { comment.append(info.extd + br); } if(!info.id.isEmpty()) { - comment.append(QString::fromLatin1("CDDB-ID: ") + info.id + br); + comment.append(TQString::tqfromLatin1("CDDB-ID: ") + info.id + br); } if(info.length > 0) { - comment.append("Length: " + QString::number(info.length) + br); + comment.append("Length: " + TQString::number(info.length) + br); } if(info.revision > 0) { - comment.append("Revision: " + QString::number(info.revision) + br); + comment.append("Revision: " + TQString::number(info.revision) + br); } entry->setField(comments, comment); #endif @@ -427,11 +427,11 @@ void FreeDBImporter::readCache() { } #define SETFIELD(name,value) \ - if(entry->field(QString::fromLatin1(name)).isEmpty()) { \ - entry->setField(QString::fromLatin1(name), value); \ + if(entry->field(TQString::tqfromLatin1(name)).isEmpty()) { \ + entry->setField(TQString::tqfromLatin1(name), value); \ } -void FreeDBImporter::readCDText(const QCString& drive_) { +void FreeDBImporter::readCDText(const TQCString& drive_) { #ifdef USE_CDTEXT Data::EntryPtr entry; if(m_coll) { @@ -443,7 +443,7 @@ void FreeDBImporter::readCDText(const QCString& drive_) { } if(!entry) { entry = new Data::Entry(m_coll); - entry->setField(QString::fromLatin1("medium"), i18n("Compact Disc")); + entry->setField(TQString::tqfromLatin1("medium"), i18n("Compact Disc")); m_coll->addEntries(entry); } @@ -456,11 +456,11 @@ void FreeDBImporter::readCDText(const QCString& drive_) { } */ - QString artist = cdtext.artist; + TQString artist = cdtext.artist; SETFIELD("title", cdtext.title); SETFIELD("artist", artist); SETFIELD("comments", cdtext.message); - QStringList tracks; + TQStringList tracks; for(uint i = 0; i < cdtext.trackTitles.size(); ++i) { tracks << cdtext.trackTitles[i] + "::" + cdtext.trackArtists[i]; if(artist.isEmpty()) { @@ -470,7 +470,7 @@ void FreeDBImporter::readCDText(const QCString& drive_) { artist = i18n("Various"); } } - SETFIELD("track", tracks.join(QString::fromLatin1("; "))); + SETFIELD("track", tracks.join(TQString::tqfromLatin1("; "))); // something special for compilations and such SETFIELD("title", i18n(Data::Collection::s_emptyGroupTitle)); @@ -479,53 +479,53 @@ void FreeDBImporter::readCDText(const QCString& drive_) { } #undef SETFIELD -QWidget* FreeDBImporter::widget(QWidget* parent_, const char* name_/*=0*/) { +TQWidget* FreeDBImporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) { if(m_widget) { 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* bigbox = new QGroupBox(1, Qt::Horizontal, i18n("Audio CD Options"), m_widget); + TQGroupBox* bigbox = new TQGroupBox(1, Qt::Horizontal, i18n("Audio CD Options"), m_widget); // cdrom stuff - QHBox* box = new QHBox(bigbox); - m_radioCDROM = new QRadioButton(i18n("Read data from CD-ROM device"), box); + TQHBox* box = new TQHBox(bigbox); + m_radioCDROM = new TQRadioButton(i18n("Read data from CD-ROM device"), box); m_driveCombo = new KComboBox(true, box); m_driveCombo->setDuplicatesEnabled(false); - QString w = i18n("Select or input the CD-ROM device location."); - QWhatsThis::add(m_radioCDROM, w); - QWhatsThis::add(m_driveCombo, w); + TQString w = i18n("Select or input the CD-ROM device location."); + TQWhatsThis::add(m_radioCDROM, w); + TQWhatsThis::add(m_driveCombo, w); /********************************************************************************/ - m_radioCache = new QRadioButton(i18n("Read all CDDB cache files only"), bigbox); - QWhatsThis::add(m_radioCache, i18n("Read data recursively from all the CDDB cache files " + m_radioCache = new TQRadioButton(i18n("Read all CDDB cache files only"), bigbox); + TQWhatsThis::add(m_radioCache, i18n("Read data recursively from all the CDDB cache files " "contained in the default cache folders.")); // cddb cache stuff - m_buttonGroup = new QButtonGroup(m_widget); - m_buttonGroup->hide(); // only use as button parent + m_buttonGroup = new TQButtonGroup(m_widget); + m_buttonGroup->hide(); // only use as button tqparent m_buttonGroup->setExclusive(true); m_buttonGroup->insert(m_radioCDROM); m_buttonGroup->insert(m_radioCache); - connect(m_buttonGroup, SIGNAL(clicked(int)), SLOT(slotClicked(int))); + connect(m_buttonGroup, TQT_SIGNAL(clicked(int)), TQT_SLOT(slotClicked(int))); l->addWidget(bigbox); l->addStretch(1); // now read config options - KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - FreeDB")); - QStringList devices = config.readListEntry("CD-ROM Devices"); + KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - FreeDB")); + TQStringList devices = config.readListEntry("CD-ROM Devices"); if(devices.isEmpty()) { #if defined(__OpenBSD__) - devices += QString::fromLatin1("/dev/rcd0c"); + devices += TQString::tqfromLatin1("/dev/rcd0c"); #endif - devices += QString::fromLatin1("/dev/cdrom"); - devices += QString::fromLatin1("/dev/dvd"); + devices += TQString::tqfromLatin1("/dev/cdrom"); + devices += TQString::tqfromLatin1("/dev/dvd"); } m_driveCombo->insertStringList(devices); - QString device = config.readEntry("Last Device"); + TQString device = config.readEntry("Last Device"); if(!device.isEmpty()) { m_driveCombo->setCurrentText(device); } @@ -541,7 +541,7 @@ QWidget* FreeDBImporter::widget(QWidget* parent_, const char* name_/*=0*/) { } void FreeDBImporter::slotClicked(int id_) { - QButton* button = m_buttonGroup->find(id_); + TQButton* button = m_buttonGroup->tqfind(id_); if(!button) { return; } diff --git a/src/translators/freedbimporter.h b/src/translators/freedbimporter.h index 263f89d..22003ee 100644 --- a/src/translators/freedbimporter.h +++ b/src/translators/freedbimporter.h @@ -17,10 +17,10 @@ #include "importer.h" #include "../datavectors.h" -#include <qvaluevector.h> +#include <tqvaluevector.h> -class QButtonGroup; -class QRadioButton; +class TQButtonGroup; +class TQRadioButton; class KComboBox; namespace Tellico { @@ -33,6 +33,7 @@ namespace Tellico { */ class FreeDBImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -44,7 +45,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual bool canImport(int type) const; public slots: @@ -54,28 +55,28 @@ private slots: void slotClicked(int id); private: - typedef QValueVector<QString> StringVector; + typedef TQValueVector<TQString> StringVector; struct CDText { friend class FreeDBImporter; - QString title; - QString artist; - QString message; + TQString title; + TQString artist; + TQString message; StringVector trackTitles; StringVector trackArtists; }; - static QValueList<uint> offsetList(const QCString& drive, QValueList<uint>& trackLengths); - static CDText getCDText(const QCString& drive); + static TQValueList<uint> offsetList(const TQCString& drive, TQValueList<uint>& trackLengths); + static CDText getCDText(const TQCString& drive); void readCDROM(); void readCache(); - void readCDText(const QCString& drive); + void readCDText(const TQCString& drive); Data::CollPtr m_coll; - QWidget* m_widget; - QButtonGroup* m_buttonGroup; - QRadioButton* m_radioCDROM; - QRadioButton* m_radioCache; + TQWidget* m_widget; + TQButtonGroup* m_buttonGroup; + TQRadioButton* m_radioCDROM; + TQRadioButton* m_radioCache; KComboBox* m_driveCombo; bool m_cancelled : 1; }; diff --git a/src/translators/gcfilmsexporter.cpp b/src/translators/gcfilmsexporter.cpp index b172996..5bf3285 100644 --- a/src/translators/gcfilmsexporter.cpp +++ b/src/translators/gcfilmsexporter.cpp @@ -33,12 +33,12 @@ using Tellico::Export::GCfilmsExporter; GCfilmsExporter::GCfilmsExporter() : Tellico::Export::Exporter() { } -QString GCfilmsExporter::formatString() const { +TQString GCfilmsExporter::formatString() const { return i18n("GCfilms"); } -QString GCfilmsExporter::fileFilter() const { - return i18n("*.gcf|GCfilms Data Files (*.gcf)") + QChar('\n') + i18n("*|All Files"); +TQString GCfilmsExporter::fileFilter() const { + return i18n("*.gcf|GCfilms Data Files (*.gcf)") + TQChar('\n') + i18n("*|All Files"); #if 0 i18n("*.gcs|GCstar Data Files (*.gcs)") #endif @@ -50,8 +50,8 @@ bool GCfilmsExporter::exec() { return false; } - QString text; - QTextOStream ts(&text); + TQString text; + TQTextOStream ts(&text); ts << "GCfilms|" << coll->entryCount() << "|"; if(options() & Export::ExportUTF8) { @@ -61,19 +61,19 @@ bool GCfilmsExporter::exec() { char d = GCFILMS_DELIMITER; bool format = options() & Export::ExportFormatted; // when importing GCfilms, a url field is added - bool hasURL = coll->hasField(QString::fromLatin1("url")) - && coll->fieldByName(QString::fromLatin1("url"))->type() == Data::Field::URL; + bool hasURL = coll->hasField(TQString::tqfromLatin1("url")) + && coll->fieldByName(TQString::tqfromLatin1("url"))->type() == Data::Field::URL; uint minRating = 1; uint maxRating = 5; - Data::FieldPtr f = coll->fieldByName(QString::fromLatin1("rating")); + Data::FieldPtr f = coll->fieldByName(TQString::tqfromLatin1("rating")); if(f) { bool ok; - uint n = Tellico::toUInt(f->property(QString::fromLatin1("minimum")), &ok); + uint n = Tellico::toUInt(f->property(TQString::tqfromLatin1("minimum")), &ok); if(ok) { minRating = n; } - n = Tellico::toUInt(f->property(QString::fromLatin1("maximum")), &ok); + n = Tellico::toUInt(f->property(TQString::tqfromLatin1("maximum")), &ok); if(ok) { maxRating = n; } @@ -83,8 +83,8 @@ bool GCfilmsExporter::exec() { KURL imageDir; if(url().isLocalFile()) { imageDir = url(); - imageDir.cd(QString::fromLatin1("..")); - imageDir.addPath(url().fileName().section('.', 0, 0) + QString::fromLatin1("_images/")); + imageDir.cd(TQString::tqfromLatin1("..")); + imageDir.addPath(url().fileName().section('.', 0, 0) + TQString::tqfromLatin1("_images/")); if(!KIO::NetAccess::exists(imageDir, false, 0)) { bool success = KIO::NetAccess::mkdir(imageDir, Kernel::self()->widget()); if(!success) { @@ -93,7 +93,7 @@ bool GCfilmsExporter::exec() { } } - QStringList images; + TQStringList images; for(Data::EntryVec::ConstIterator entry = entries().begin(); entry != entries().end(); ++entry) { ts << entry->id() << d; push(ts, "title", entry, format); @@ -103,7 +103,7 @@ bool GCfilmsExporter::exec() { push(ts, "nationality", entry, format); push(ts, "genre", entry, format); // do image - QString tmp = entry->field(QString::fromLatin1("cover")); + TQString tmp = entry->field(TQString::tqfromLatin1("cover")); if(!tmp.isEmpty() && !imageDir.isEmpty()) { images << tmp; ts << imageDir.path() << tmp; @@ -111,9 +111,9 @@ bool GCfilmsExporter::exec() { ts << d; // do not format cast since the commas could get mixed up - const QStringList cast = entry->fields(QString::fromLatin1("cast"), false); - for(QStringList::ConstIterator it = cast.begin(); it != cast.end(); ++it) { - ts << (*it).section(QString::fromLatin1("::"), 0, 0); + const TQStringList cast = entry->fields(TQString::tqfromLatin1("cast"), false); + for(TQStringList::ConstIterator it = cast.begin(); it != cast.end(); ++it) { + ts << (*it).section(TQString::tqfromLatin1("::"), 0, 0); if(it != cast.fromLast()) { ts << ", "; } @@ -142,7 +142,7 @@ bool GCfilmsExporter::exec() { // gcfilms's ratings go 0-10, just multiply by two bool ok; - int rat = Tellico::toUInt(entry->field(QString::fromLatin1("rating"), format), &ok); + int rat = Tellico::toUInt(entry->field(TQString::tqfromLatin1("rating"), format), &ok); if(ok) { ts << rat * 10/(maxRating-minRating); } @@ -154,7 +154,7 @@ bool GCfilmsExporter::exec() { push(ts, "subtitle", entry, format); // values[20] is borrower name, values[21] is loan date - if(entry->field(QString::fromLatin1("loaned")).isEmpty()) { + if(entry->field(TQString::tqfromLatin1("loaned")).isEmpty()) { ts << d << d; } else { // find loan @@ -179,7 +179,7 @@ bool GCfilmsExporter::exec() { ts << d; // for certification, only thing we can do is assume default american ratings - tmp = entry->field(QString::fromLatin1("certification"), format); + tmp = entry->field(TQString::tqfromLatin1("certification"), format); int age = 0; if(tmp == Latin1Literal("U (USA)")) { age = 1; @@ -202,7 +202,7 @@ bool GCfilmsExporter::exec() { } StringSet imageSet; - for(QStringList::ConstIterator it = images.begin(); it != images.end(); ++it) { + for(TQStringList::ConstIterator it = images.begin(); it != images.end(); ++it) { if(imageSet.has(*it)) { continue; } @@ -217,15 +217,15 @@ bool GCfilmsExporter::exec() { return FileHandler::writeTextURL(url(), text, options() & Export::ExportUTF8, options() & Export::ExportForce); } -void GCfilmsExporter::push(QTextOStream& ts_, QCString fieldName_, Data::EntryVec::ConstIterator entry_, bool format_) { - Data::FieldPtr f = collection()->fieldByName(QString::fromLatin1(fieldName_)); +void GCfilmsExporter::push(TQTextOStream& ts_, TQCString fieldName_, Data::EntryVec::ConstIterator entry_, bool format_) { + Data::FieldPtr f = collection()->fieldByName(TQString::tqfromLatin1(fieldName_)); // don't format multiple names cause commas will cause problems if(f->formatFlag() == Data::Field::FormatName && (f->flags() & Data::Field::AllowMultiple)) { format_ = false; } - QString s = entry_->field(QString::fromLatin1(fieldName_), format_); + TQString s = entry_->field(TQString::tqfromLatin1(fieldName_), format_); if(f->flags() & Data::Field::AllowMultiple) { - ts_ << s.replace(QString::fromLatin1("; "), QChar(',')); + ts_ << s.tqreplace(TQString::tqfromLatin1("; "), TQChar(',')); } else { ts_ << s; } diff --git a/src/translators/gcfilmsexporter.h b/src/translators/gcfilmsexporter.h index 50ee31c..c226d7d 100644 --- a/src/translators/gcfilmsexporter.h +++ b/src/translators/gcfilmsexporter.h @@ -14,7 +14,7 @@ #ifndef TELLICO_EXPORT_GCFILMSEXPORTER_H #define TELLICO_EXPORT_GCFILMSEXPORTER_H -class QTextOStream; +class TQTextOStream; #include "exporter.h" @@ -26,19 +26,20 @@ namespace Tellico { */ class GCfilmsExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: GCfilmsExporter(); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; // no options - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } private: - void push(QTextOStream& ts, QCString fieldName, Data::EntryVec::ConstIterator entry, bool format); + void push(TQTextOStream& ts, TQCString fieldName, Data::EntryVec::ConstIterator entry, bool format); }; } // end namespace diff --git a/src/translators/gcfilmsimporter.cpp b/src/translators/gcfilmsimporter.cpp index e2ff9ca..5b66691 100644 --- a/src/translators/gcfilmsimporter.cpp +++ b/src/translators/gcfilmsimporter.cpp @@ -24,7 +24,7 @@ #include <kapplication.h> #include <kstandarddirs.h> -#include <qtextcodec.h> +#include <tqtextcodec.h> #define CHECKLIMITS(n) if(values.count() <= n) continue @@ -49,57 +49,57 @@ Tellico::Data::CollPtr GCfilmsImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); - QString str = text(); - QTextIStream t(&str); - QString line = t.readLine(); - if(line.startsWith(QString::fromLatin1("GCfilms"))) { + TQString str = text(); + TQTextIStream t(&str); + TQString line = t.readLine(); + if(line.startsWith(TQString::tqfromLatin1("GCfilms"))) { readGCfilms(str); } else { // need to reparse the string if it's in utf-8 - if(line.lower().find(QString::fromLatin1("utf-8")) > 0) { - str = QString::fromUtf8(str.local8Bit()); + if(line.lower().tqfind(TQString::tqfromLatin1("utf-8")) > 0) { + str = TQString::fromUtf8(str.local8Bit()); } readGCstar(str); } return m_coll; } -void GCfilmsImporter::readGCfilms(const QString& text_) { +void GCfilmsImporter::readGCfilms(const TQString& text_) { m_coll = new Data::VideoCollection(true); bool hasURL = false; - if(m_coll->hasField(QString::fromLatin1("url"))) { - hasURL = m_coll->fieldByName(QString::fromLatin1("url"))->type() == Data::Field::URL; + if(m_coll->hasField(TQString::tqfromLatin1("url"))) { + hasURL = m_coll->fieldByName(TQString::tqfromLatin1("url"))->type() == Data::Field::URL; } else { - Data::FieldPtr field = new Data::Field(QString::fromLatin1("url"), i18n("URL"), Data::Field::URL); + Data::FieldPtr field = new Data::Field(TQString::tqfromLatin1("url"), i18n("URL"), Data::Field::URL); field->setCategory(i18n("General")); m_coll->addField(field); hasURL = true; } bool convertUTF8 = false; - QMap<QString, Data::BorrowerPtr> borrowers; - const QRegExp rx(QString::fromLatin1("\\s*,\\s*")); - QRegExp year(QString::fromLatin1("\\d{4}")); - QRegExp runTimeHr(QString::fromLatin1("(\\d+)\\s?hr?")); - QRegExp runTimeMin(QString::fromLatin1("(\\d+)\\s?mi?n?")); + TQMap<TQString, Data::BorrowerPtr> borrowers; + const TQRegExp rx(TQString::tqfromLatin1("\\s*,\\s*")); + TQRegExp year(TQString::tqfromLatin1("\\d{4}")); + TQRegExp runTimeHr(TQString::tqfromLatin1("(\\d+)\\s?hr?")); + TQRegExp runTimeMin(TQString::tqfromLatin1("(\\d+)\\s?mi?n?")); bool gotFirstLine = false; uint total = 0; - QTextIStream t(&text_); + TQTextIStream t(&text_); const uint length = text_.length(); - const uint stepSize = QMAX(s_stepSize, length/100); + const uint stepSize = TQMAX(s_stepSize, length/100); const bool showProgress = options() & ImportProgress; ProgressManager::self()->setTotalSteps(this, length); uint j = 0; - for(QString line = t.readLine(); !m_cancelled && !line.isNull(); line = t.readLine(), j += line.length()) { + for(TQString line = t.readLine(); !m_cancelled && !line.isNull(); line = t.readLine(), j += line.length()) { // string was wrongly converted - QStringList values = QStringList::split('|', (convertUTF8 ? QString::fromUtf8(line.local8Bit()) : line), true); + TQStringList values = TQStringList::split('|', (convertUTF8 ? TQString::fromUtf8(line.local8Bit()) : line), true); if(values.empty()) { continue; } @@ -113,8 +113,8 @@ void GCfilmsImporter::readGCfilms(const QString& text_) { total = Tellico::toUInt(values[1], 0)+1; // number of lines really if(values.size() > 2 && values[2] == Latin1Literal("UTF8")) { // if locale encoding isn't utf8, need to do a reconversion - QTextCodec* codec = QTextCodec::codecForLocale(); - if(QCString(codec->name()).find("utf-8", 0, false) == -1) { + TQTextCodec* codec = TQTextCodec::codecForLocale(); + if(TQCString(codec->name()).tqfind("utf-8", 0, false) == -1) { convertUTF8 = true; } } @@ -126,9 +126,9 @@ void GCfilmsImporter::readGCfilms(const QString& text_) { Data::EntryPtr entry = new Data::Entry(m_coll); entry->setId(Tellico::toUInt(values[0], &ok)); - entry->setField(QString::fromLatin1("title"), values[1]); + entry->setField(TQString::tqfromLatin1("title"), values[1]); if(year.search(values[2]) > -1) { - entry->setField(QString::fromLatin1("year"), year.cap()); + entry->setField(TQString::tqfromLatin1("year"), year.cap()); } uint time = 0; @@ -139,57 +139,57 @@ void GCfilmsImporter::readGCfilms(const QString& text_) { time += Tellico::toUInt(runTimeMin.cap(1), &ok); } if(time > 0) { - entry->setField(QString::fromLatin1("running-time"), QString::number(time)); + entry->setField(TQString::tqfromLatin1("running-time"), TQString::number(time)); } - entry->setField(QString::fromLatin1("director"), splitJoin(rx, values[4])); - entry->setField(QString::fromLatin1("nationality"), splitJoin(rx, values[5])); - entry->setField(QString::fromLatin1("genre"), splitJoin(rx, values[6])); + entry->setField(TQString::tqfromLatin1("director"), splitJoin(rx, values[4])); + entry->setField(TQString::tqfromLatin1("nationality"), splitJoin(rx, values[5])); + entry->setField(TQString::tqfromLatin1("genre"), splitJoin(rx, values[6])); KURL u = KURL::fromPathOrURL(values[7]); if(!u.isEmpty()) { - QString id = ImageFactory::addImage(u, true /* quiet */); + TQString id = ImageFactory::addImage(u, true /* quiet */); if(!id.isEmpty()) { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } - entry->setField(QString::fromLatin1("cast"), splitJoin(rx, values[8])); + entry->setField(TQString::tqfromLatin1("cast"), splitJoin(rx, values[8])); // values[9] is the original title - entry->setField(QString::fromLatin1("plot"), values[10]); + entry->setField(TQString::tqfromLatin1("plot"), values[10]); if(hasURL) { - entry->setField(QString::fromLatin1("url"), values[11]); + entry->setField(TQString::tqfromLatin1("url"), values[11]); } CHECKLIMITS(12); // values[12] is whether the film has been viewed or not - entry->setField(QString::fromLatin1("medium"), values[13]); + entry->setField(TQString::tqfromLatin1("medium"), values[13]); // values[14] is number of DVDS? // values[15] is place? // gcfilms's ratings go 0-10, just divide by two - entry->setField(QString::fromLatin1("rating"), QString::number(int(Tellico::toUInt(values[16], &ok)/2))); - entry->setField(QString::fromLatin1("comments"), values[17]); + entry->setField(TQString::tqfromLatin1("rating"), TQString::number(int(Tellico::toUInt(values[16], &ok)/2))); + entry->setField(TQString::tqfromLatin1("comments"), values[17]); CHECKLIMITS(18); - QStringList s = QStringList::split(',', values[18]); - QStringList tracks, langs; - for(QStringList::ConstIterator it = s.begin(); it != s.end(); ++it) { + TQStringList s = TQStringList::split(',', values[18]); + TQStringList tracks, langs; + for(TQStringList::ConstIterator it = s.begin(); it != s.end(); ++it) { langs << (*it).section(';', 0, 0); tracks << (*it).section(';', 1, 1); } - entry->setField(QString::fromLatin1("language"), langs.join(QString::fromLatin1("; "))); - entry->setField(QString::fromLatin1("audio-track"), tracks.join(QString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("language"), langs.join(TQString::tqfromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("audio-track"), tracks.join(TQString::tqfromLatin1("; "))); - entry->setField(QString::fromLatin1("subtitle"), splitJoin(rx, values[19])); + entry->setField(TQString::tqfromLatin1("subtitle"), splitJoin(rx, values[19])); CHECKLIMITS(20); // values[20] is borrower name if(!values[20].isEmpty()) { - QString tmp = values[20]; + TQString tmp = values[20]; Data::BorrowerPtr b = borrowers[tmp]; if(!b) { - b = new Data::Borrower(tmp, QString()); + b = new Data::Borrower(tmp, TQString()); borrowers.insert(tmp, b); } // values[21] is loan date @@ -198,8 +198,8 @@ void GCfilmsImporter::readGCfilms(const QString& text_) { int d = Tellico::toUInt(tmp.section('/', 0, 0), &ok); int m = Tellico::toUInt(tmp.section('/', 1, 1), &ok); int y = Tellico::toUInt(tmp.section('/', 2, 2), &ok); - b->addLoan(new Data::Loan(entry, QDate(y, m, d), QDate(), QString())); - entry->setField(QString::fromLatin1("loaned"), QString::fromLatin1("true")); + b->addLoan(new Data::Loan(entry, TQDate(y, m, d), TQDate(), TQString())); + entry->setField(TQString::tqfromLatin1("loaned"), TQString::tqfromLatin1("true")); } } // values[22] is history ? @@ -209,15 +209,15 @@ void GCfilmsImporter::readGCfilms(const QString& text_) { int age = Tellico::toUInt(values[23], &ok); if(age < 2) { - entry->setField(QString::fromLatin1("certification"), QString::fromLatin1("U (USA)")); + entry->setField(TQString::tqfromLatin1("certification"), TQString::tqfromLatin1("U (USA)")); } else if(age < 3) { - entry->setField(QString::fromLatin1("certification"), QString::fromLatin1("G (USA)")); + entry->setField(TQString::tqfromLatin1("certification"), TQString::tqfromLatin1("G (USA)")); } else if(age < 6) { - entry->setField(QString::fromLatin1("certification"), QString::fromLatin1("PG (USA)")); + entry->setField(TQString::tqfromLatin1("certification"), TQString::tqfromLatin1("PG (USA)")); } else if(age < 14) { - entry->setField(QString::fromLatin1("certification"), QString::fromLatin1("PG-13 (USA)")); + entry->setField(TQString::tqfromLatin1("certification"), TQString::tqfromLatin1("PG-13 (USA)")); } else { - entry->setField(QString::fromLatin1("certification"), QString::fromLatin1("R (USA)")); + entry->setField(TQString::tqfromLatin1("certification"), TQString::tqfromLatin1("R (USA)")); } m_coll->addEntries(entry); @@ -233,22 +233,22 @@ void GCfilmsImporter::readGCfilms(const QString& text_) { return; } - for(QMap<QString, Data::BorrowerPtr>::Iterator it = borrowers.begin(); it != borrowers.end(); ++it) { + for(TQMap<TQString, Data::BorrowerPtr>::Iterator it = borrowers.begin(); it != borrowers.end(); ++it) { if(!it.data()->isEmpty()) { m_coll->addBorrower(it.data()); } } } -void GCfilmsImporter::readGCstar(const QString& text_) { - QString xsltFile = locate("appdata", QString::fromLatin1("gcstar2tellico.xsl")); +void GCfilmsImporter::readGCstar(const TQString& text_) { + TQString xsltFile = locate("appdata", TQString::tqfromLatin1("gcstar2tellico.xsl")); XSLTHandler handler(xsltFile); if(!handler.isValid()) { setStatusMessage(i18n("Tellico encountered an error in XSLT processing.")); return; } - QString str = handler.applyStylesheet(text_); + TQString str = handler.applyStylesheet(text_); if(str.isEmpty()) { setStatusMessage(i18n("<qt>The file is not a valid GCstar data file.</qt>")); @@ -261,8 +261,8 @@ void GCfilmsImporter::readGCstar(const QString& text_) { } inline -QString GCfilmsImporter::splitJoin(const QRegExp& rx, const QString& s) { - return QStringList::split(rx, s, false).join(QString::fromLatin1("; ")); +TQString GCfilmsImporter::splitJoin(const TQRegExp& rx, const TQString& s) { + return TQStringList::split(rx, s, false).join(TQString::tqfromLatin1("; ")); } void GCfilmsImporter::slotCancel() { diff --git a/src/translators/gcfilmsimporter.h b/src/translators/gcfilmsimporter.h index 8fa9a0d..9dca11d 100644 --- a/src/translators/gcfilmsimporter.h +++ b/src/translators/gcfilmsimporter.h @@ -17,7 +17,7 @@ #include "textimporter.h" #include "../datavectors.h" -class QRegExp; +class TQRegExp; namespace Tellico { namespace Import { @@ -27,6 +27,7 @@ namespace Tellico { */ class GCfilmsImporter : public TextImporter { Q_OBJECT + TQ_OBJECT public: /** @@ -39,17 +40,17 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } virtual bool canImport(int type) const; public slots: void slotCancel(); private: - static QString splitJoin(const QRegExp& rx, const QString& s); + static TQString splitJoin(const TQRegExp& rx, const TQString& s); - void readGCfilms(const QString& text); - void readGCstar(const QString& text); + void readGCfilms(const TQString& text); + void readGCstar(const TQString& text); Data::CollPtr m_coll; bool m_cancelled; diff --git a/src/translators/griffith2tellico.py b/src/translators/griffith2tellico.py index 24bfb41..31c947e 100755 --- a/src/translators/griffith2tellico.py +++ b/src/translators/griffith2tellico.py @@ -149,7 +149,7 @@ class BasicTellicoDOM: else: field = key - parentNode = self.__doc.createElement(field + 's') + tqparentNode = self.__doc.createElement(field + 's') for value in values: if len(value) == 0: continue @@ -173,9 +173,9 @@ class BasicTellicoDOM: else: node.appendChild(self.__doc.createTextNode(value.strip())) - if node.hasChildNodes(): parentNode.appendChild(node) + if node.hasChildNodes(): tqparentNode.appendChild(node) - if parentNode.hasChildNodes(): entryNode.appendChild(parentNode) + if tqparentNode.hasChildNodes(): entryNode.appendChild(tqparentNode) self.__collection.appendChild(entryNode) @@ -246,12 +246,12 @@ class GriffithParser: except: value = str(row[i]) - col = columns[i].replace('[','').replace(']','') + col = columns[i].tqreplace('[','').tqreplace(']','') if col == 'genre' or col == 'studio': values = value.split('/') elif col == 'plot' or col == 'notes': - value = value.replace('\n', '\n<br/>') + value = value.tqreplace('\n', '\n<br/>') values = (value,) elif col == 'cast': values = [] @@ -272,7 +272,7 @@ class GriffithParser: values = (value,) else: values = (value,) - col = col.replace('"','') + col = col.tqreplace('"','') data[col] = values # get medium diff --git a/src/translators/griffithimporter.cpp b/src/translators/griffithimporter.cpp index 8b0394f..953a159 100644 --- a/src/translators/griffithimporter.cpp +++ b/src/translators/griffithimporter.cpp @@ -20,8 +20,8 @@ #include <kstandarddirs.h> #include <kprocess.h> -#include <qdir.h> -#include <qfile.h> +#include <tqdir.h> +#include <tqfile.h> using Tellico::Import::GriffithImporter; @@ -34,28 +34,28 @@ GriffithImporter::~GriffithImporter() { } Tellico::Data::CollPtr GriffithImporter::collection() { - QString filename = QDir::homeDirPath() + QString::fromLatin1("/.griffith/griffith.db"); - if(!QFile::exists(filename)) { + TQString filename = TQDir::homeDirPath() + TQString::tqfromLatin1("/.griffith/griffith.db"); + if(!TQFile::exists(filename)) { myWarning() << "GriffithImporter::collection() - database not found: " << filename << endl; return 0; } - QString python = KStandardDirs::findExe(QString::fromLatin1("python")); + TQString python = KStandardDirs::findExe(TQString::tqfromLatin1("python")); if(python.isEmpty()) { myWarning() << "GriffithImporter::collection() - python not found!" << endl; return 0; } - QString griffith = KGlobal::dirs()->findResource("appdata", QString::fromLatin1("griffith2tellico.py")); + TQString griffith = KGlobal::dirs()->findResource("appdata", TQString::tqfromLatin1("griffith2tellico.py")); if(griffith.isEmpty()) { myWarning() << "GriffithImporter::collection() - griffith2tellico.py not found!" << endl; return 0; } m_process = new KProcess(); - connect(m_process, SIGNAL(receivedStdout(KProcess*, char*, int)), SLOT(slotData(KProcess*, char*, int))); - connect(m_process, SIGNAL(receivedStderr(KProcess*, char*, int)), SLOT(slotError(KProcess*, char*, int))); - connect(m_process, SIGNAL(processExited(KProcess*)), SLOT(slotProcessExited(KProcess*))); + connect(m_process, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), TQT_SLOT(slotData(KProcess*, char*, int))); + connect(m_process, TQT_SIGNAL(receivedStderr(KProcess*, char*, int)), TQT_SLOT(slotError(KProcess*, char*, int))); + connect(m_process, TQT_SIGNAL(processExited(KProcess*)), TQT_SLOT(slotProcessExited(KProcess*))); *m_process << python << griffith; if(!m_process->start(KProcess::Block, KProcess::AllOutput)) { myDebug() << "ExecExternalFetcher::startSearch() - process failed to start" << endl; @@ -66,12 +66,12 @@ Tellico::Data::CollPtr GriffithImporter::collection() { } void GriffithImporter::slotData(KProcess*, char* buffer_, int len_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(buffer_, len_); } void GriffithImporter::slotError(KProcess*, char* buffer_, int len_) { - QString msg = QString::fromLocal8Bit(buffer_, len_); + TQString msg = TQString::fromLocal8Bit(buffer_, len_); myDebug() << "GriffithImporter::slotError() - " << msg << endl; setStatusMessage(msg); } @@ -89,7 +89,7 @@ void GriffithImporter::slotProcessExited(KProcess*) { return; } - QString text = QString::fromUtf8(m_data, m_data.size()); + TQString text = TQString::fromUtf8(m_data, m_data.size()); TellicoImporter imp(text); m_coll = imp.collection(); diff --git a/src/translators/griffithimporter.h b/src/translators/griffithimporter.h index 60bae07..de3d59a 100644 --- a/src/translators/griffithimporter.h +++ b/src/translators/griffithimporter.h @@ -32,6 +32,7 @@ namespace Tellico { */ class GriffithImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -55,7 +56,7 @@ private: Data::CollPtr m_coll; KProcess* m_process; - QByteArray m_data; + TQByteArray m_data; }; } // end namespace diff --git a/src/translators/grs1importer.cpp b/src/translators/grs1importer.cpp index 7eca9e3..6b6c8d2 100644 --- a/src/translators/grs1importer.cpp +++ b/src/translators/grs1importer.cpp @@ -26,24 +26,24 @@ void GRS1Importer::initTagMap() { if(!s_tagMap) { s_tagMap = new TagMap(); // BT is special and is handled separately - s_tagMap->insert(TagPair(2, 1), QString::fromLatin1("title")); - s_tagMap->insert(TagPair(2, 2), QString::fromLatin1("author")); - s_tagMap->insert(TagPair(2, 4), QString::fromLatin1("year")); - s_tagMap->insert(TagPair(2, 7), QString::fromLatin1("publisher")); - s_tagMap->insert(TagPair(2, 31), QString::fromLatin1("publisher")); - s_tagMap->insert(TagPair(2, 20), QString::fromLatin1("language")); - s_tagMap->insert(TagPair(2, 21), QString::fromLatin1("keyword")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("isbn/issn")), QString::fromLatin1("isbn")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("isbn")), QString::fromLatin1("isbn")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("notes")), QString::fromLatin1("note")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("note")), QString::fromLatin1("note")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("series")), QString::fromLatin1("series")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("physical description")), QString::fromLatin1("note")); - s_tagMap->insert(TagPair(3, QString::fromLatin1("subtitle")), QString::fromLatin1("subtitle")); + s_tagMap->insert(TagPair(2, 1), TQString::tqfromLatin1("title")); + s_tagMap->insert(TagPair(2, 2), TQString::tqfromLatin1("author")); + s_tagMap->insert(TagPair(2, 4), TQString::tqfromLatin1("year")); + s_tagMap->insert(TagPair(2, 7), TQString::tqfromLatin1("publisher")); + s_tagMap->insert(TagPair(2, 31), TQString::tqfromLatin1("publisher")); + s_tagMap->insert(TagPair(2, 20), TQString::tqfromLatin1("language")); + s_tagMap->insert(TagPair(2, 21), TQString::tqfromLatin1("keyword")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("isbn/issn")), TQString::tqfromLatin1("isbn")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("isbn")), TQString::tqfromLatin1("isbn")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("notes")), TQString::tqfromLatin1("note")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("note")), TQString::tqfromLatin1("note")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("series")), TQString::tqfromLatin1("series")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("physical description")), TQString::tqfromLatin1("note")); + s_tagMap->insert(TagPair(3, TQString::tqfromLatin1("subtitle")), TQString::tqfromLatin1("subtitle")); } } -GRS1Importer::GRS1Importer(const QString& text_) : TextImporter(text_) { +GRS1Importer::GRS1Importer(const TQString& text_) : TextImporter(text_) { initTagMap(); } @@ -54,12 +54,12 @@ bool GRS1Importer::canImport(int type) const { Tellico::Data::CollPtr GRS1Importer::collection() { Data::CollPtr coll = new Data::BibtexCollection(true); - Data::FieldPtr f = new Data::Field(QString::fromLatin1("isbn"), i18n("ISBN#")); + Data::FieldPtr f = new Data::Field(TQString::tqfromLatin1("isbn"), i18n("ISBN#")); f->setCategory(i18n("Publishing")); f->setDescription(i18n("International Standard Book Number")); coll->addField(f); - f = new Data::Field(QString::fromLatin1("language"), i18n("Language")); + f = new Data::Field(TQString::tqfromLatin1("language"), i18n("Language")); f->setCategory(i18n("Publishing")); f->setFlags(Data::Field::AllowCompletion | Data::Field::AllowGrouped | Data::Field::AllowMultiple); coll->addField(f); @@ -68,20 +68,20 @@ Tellico::Data::CollPtr GRS1Importer::collection() { bool empty = true; // in format "(tag, tag) value" - QRegExp rx(QString::fromLatin1("\\s*\\((\\d+),\\s*(.+)\\s*\\)\\s*(.+)\\s*")); + TQRegExp rx(TQString::tqfromLatin1("\\s*\\((\\d+),\\s*(.+)\\s*\\)\\s*(.+)\\s*")); // rx.setMinimal(true); - QRegExp dateRx(QString::fromLatin1(",[^,]*\\d{3,4}[^,]*")); // remove dates from authors - QRegExp pubRx(QString::fromLatin1("([^:]+):([^,]+),?")); // split location and publisher + TQRegExp dateRx(TQString::tqfromLatin1(",[^,]*\\d{3,4}[^,]*")); // remove dates from authors + TQRegExp pubRx(TQString::tqfromLatin1("([^:]+):([^,]+),?")); // split location and publisher bool ok; int n; - QVariant v; - QString tmp, field, val, str = text(); + TQVariant v; + TQString tmp, field, val, str = text(); if(str.isEmpty()) { return 0; } - QTextStream t(&str, IO_ReadOnly); - for(QString line = t.readLine(); !line.isNull(); line = t.readLine()) { + TQTextStream t(&str, IO_ReadOnly); + for(TQString line = t.readLine(); !line.isNull(); line = t.readLine()) { // myDebug() << line << endl; if(!rx.exactMatch(line)) { continue; @@ -105,18 +105,18 @@ Tellico::Data::CollPtr GRS1Importer::collection() { if(field == Latin1Literal("title")) { val = val.section('/', 0, 0).stripWhiteSpace(); // only take portion of title before slash } else if(field == Latin1Literal("author")) { - val.replace(dateRx, QString::null); + val.tqreplace(dateRx, TQString()); } else if(field == Latin1Literal("publisher")) { - int pos = val.find(pubRx); + int pos = val.tqfind(pubRx); if(pos > -1) { - e->setField(QString::fromLatin1("address"), pubRx.cap(1)); + e->setField(TQString::tqfromLatin1("address"), pubRx.cap(1)); val = pubRx.cap(2); } } tmp = e->field(field); if(!tmp.isEmpty()) { - tmp += QString::fromLatin1("; "); + tmp += TQString::tqfromLatin1("; "); } e->setField(field, tmp + val); } diff --git a/src/translators/grs1importer.h b/src/translators/grs1importer.h index a4929a4..04ea35b 100644 --- a/src/translators/grs1importer.h +++ b/src/translators/grs1importer.h @@ -17,9 +17,9 @@ #include "textimporter.h" #include "../datavectors.h" -#include <qvariant.h> -#include <qmap.h> -#include <qpair.h> +#include <tqvariant.h> +#include <tqmap.h> +#include <tqpair.h> namespace Tellico { namespace Import { @@ -29,9 +29,10 @@ namespace Tellico { */ class GRS1Importer : public TextImporter { Q_OBJECT + TQ_OBJECT public: - GRS1Importer(const QString& text); + GRS1Importer(const TQString& text); virtual ~GRS1Importer() {} /** @@ -40,23 +41,23 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } virtual bool canImport(int type) const; private: static void initTagMap(); - class TagPair : public QPair<int, QVariant> { + class TagPair : public TQPair<int, TQVariant> { public: - TagPair() : QPair<int, QVariant>(-1, QVariant()) {} - TagPair(int n, const QVariant& v) : QPair<int, QVariant>(n, v) {} - QString toString() const { return QString::number(first) + second.toString(); } + TagPair() : TQPair<int, TQVariant>(-1, TQVariant()) {} + TagPair(int n, const TQVariant& v) : TQPair<int, TQVariant>(n, v) {} + TQString toString() const { return TQString::number(first) + second.toString(); } bool operator< (const TagPair& p) const { return toString() < p.toString(); } }; - typedef QMap<TagPair, QString> TagMap; + typedef TQMap<TagPair, TQString> TagMap; static TagMap* s_tagMap; }; diff --git a/src/translators/htmlexporter.cpp b/src/translators/htmlexporter.cpp index e947793..b8a38c0 100644 --- a/src/translators/htmlexporter.cpp +++ b/src/translators/htmlexporter.cpp @@ -32,14 +32,14 @@ #include <kapplication.h> #include <klocale.h> -#include <qdom.h> -#include <qgroupbox.h> -#include <qlayout.h> -#include <qcheckbox.h> -#include <qwhatsthis.h> -#include <qfile.h> -#include <qhbox.h> -#include <qlabel.h> +#include <tqdom.h> +#include <tqgroupbox.h> +#include <tqlayout.h> +#include <tqcheckbox.h> +#include <tqwhatsthis.h> +#include <tqfile.h> +#include <tqhbox.h> +#include <tqlabel.h> extern "C" { #include <libxml/HTMLparser.h> @@ -59,7 +59,7 @@ HTMLExporter::HTMLExporter() : Tellico::Export::Exporter(), m_imageWidth(0), m_imageHeight(0), m_widget(0), - m_xsltFile(QString::fromLatin1("tellico2html.xsl")) { + m_xsltFile(TQString::tqfromLatin1("tellico2html.xsl")) { } HTMLExporter::HTMLExporter(Data::CollPtr coll_) : Tellico::Export::Exporter(coll_), @@ -73,7 +73,7 @@ HTMLExporter::HTMLExporter(Data::CollPtr coll_) : Tellico::Export::Exporter(coll m_imageWidth(0), m_imageHeight(0), m_widget(0), - m_xsltFile(QString::fromLatin1("tellico2html.xsl")) { + m_xsltFile(TQString::tqfromLatin1("tellico2html.xsl")) { } HTMLExporter::~HTMLExporter() { @@ -81,12 +81,12 @@ HTMLExporter::~HTMLExporter() { m_handler = 0; } -QString HTMLExporter::formatString() const { +TQString HTMLExporter::formatString() const { return i18n("HTML"); } -QString HTMLExporter::fileFilter() const { - return i18n("*.html|HTML Files (*.html)") + QChar('\n') + i18n("*|All Files"); +TQString HTMLExporter::fileFilter() const { + return i18n("*.html|HTML Files (*.html)") + TQChar('\n') + i18n("*|All Files"); } void HTMLExporter::reset() { @@ -118,9 +118,9 @@ bool HTMLExporter::exec() { m_cancelled = false; // TODO: maybe need label? if(options() & ExportProgress) { - ProgressItem& item = ProgressManager::self()->newProgressItem(this, QString::null, true); + ProgressItem& item = ProgressManager::self()->newProgressItem(this, TQString(), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); } // ok if not ExportProgress, no worries ProgressItem::Done done(this); @@ -141,9 +141,9 @@ bool HTMLExporter::exec() { xmlChar* c; int bytes; htmlDocDumpMemory(htmlDoc, &c, &bytes); - QString allText; + TQString allText; if(bytes > 0) { - allText = QString::fromUtf8(reinterpret_cast<const char*>(c), bytes); + allText = TQString::fromUtf8(reinterpret_cast<const char*>(c), bytes); xmlFree(c); } @@ -158,7 +158,7 @@ bool HTMLExporter::exec() { } bool HTMLExporter::loadXSLTFile() { - QString xsltfile = locate("appdata", m_xsltFile); + TQString xsltfile = locate("appdata", m_xsltFile); if(xsltfile.isNull()) { myDebug() << "HTMLExporter::loadXSLTFile() - no xslt file for " << m_xsltFile << endl; return false; @@ -167,9 +167,9 @@ bool HTMLExporter::loadXSLTFile() { 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() << "HTMLExporter::loadXSLTFile() - error loading xslt file: " << xsltfile << endl; return false; @@ -186,7 +186,7 @@ bool HTMLExporter::loadXSLTFile() { } delete m_handler; - m_handler = new XSLTHandler(dom, QFile::encodeName(xsltfile), true /*translate*/); + m_handler = new XSLTHandler(dom, TQFile::encodeName(xsltfile), true /*translate*/); if(!m_handler->isValid()) { delete m_handler; m_handler = 0; @@ -195,13 +195,13 @@ bool HTMLExporter::loadXSLTFile() { if(m_exportEntryFiles) { // export entries to same place as all the other date files - m_handler->addStringParam("entrydir", QFile::encodeName(fileDir().fileName())+ '/'); + m_handler->addStringParam("entrydir", TQFile::encodeName(fileDir().fileName())+ '/'); // be sure to link all the entries m_handler->addParam("link-entries", "true()"); } if(!m_collectionURL.isEmpty()) { - QString s = QString::fromLatin1("../") + m_collectionURL.fileName(); + TQString s = TQString::tqfromLatin1("../") + m_collectionURL.fileName(); m_handler->addStringParam("collection-file", s.utf8()); } @@ -209,12 +209,12 @@ bool HTMLExporter::loadXSLTFile() { // if parseDOM, that means we want the locations to be the actual location // otherwise, we assume it'll be relative if(m_parseDOM && m_dataDir.isEmpty()) { - m_dataDir = KGlobal::dirs()->findResourceDir("appdata", QString::fromLatin1("pics/tellico.png")); + m_dataDir = KGlobal::dirs()->findResourceDir("appdata", TQString::tqfromLatin1("pics/tellico.png")); } else if(!m_parseDOM) { m_dataDir.truncate(0); } if(!m_dataDir.isEmpty()) { - m_handler->addStringParam("datadir", QFile::encodeName(m_dataDir)); + m_handler->addStringParam("datadir", TQFile::encodeName(m_dataDir)); } setFormattingOptions(collection()); @@ -222,16 +222,16 @@ bool HTMLExporter::loadXSLTFile() { return m_handler->isValid(); } -QString HTMLExporter::text() { +TQString HTMLExporter::text() { if((!m_handler || !m_handler->isValid()) && !loadXSLTFile()) { kdWarning() << "HTMLExporter::text() - error loading xslt file: " << m_xsltFile << endl; - return QString::null; + return TQString(); } Data::CollPtr coll = collection(); if(!coll) { myDebug() << "HTMLExporter::text() - no collection pointer!" << endl; - return QString::null; + return TQString(); } if(m_groupBy.isEmpty()) { @@ -248,21 +248,21 @@ QString HTMLExporter::text() { exporter.setIncludeGroups(m_printGrouped); // yes, this should be in utf8, always exporter.setOptions(options() | Export::ExportUTF8 | Export::ExportImages); - 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(); #endif - QString text = m_handler->applyStylesheet(output.toString()); + TQString text = m_handler->applyStylesheet(output.toString()); #if 0 - QFile f2(QString::fromLatin1("/tmp/test.html")); + TQFile f2(TQString::tqfromLatin1("/tmp/test.html")); if(f2.open(IO_WriteOnly)) { - QTextStream t(&f2); + TQTextStream t(&f2); t << text; // t << "\n\n-------------------------------------------------------\n\n"; // t << Tellico::i18nReplace(text); @@ -275,15 +275,15 @@ QString HTMLExporter::text() { } void HTMLExporter::setFormattingOptions(Data::CollPtr coll) { - QString file = Kernel::self()->URL().fileName(); + TQString file = Kernel::self()->URL().fileName(); if(file != i18n("Untitled")) { - m_handler->addStringParam("filename", QFile::encodeName(file)); + m_handler->addStringParam("filename", TQFile::encodeName(file)); } - m_handler->addStringParam("cdate", KGlobal::locale()->formatDate(QDate::currentDate()).utf8()); + m_handler->addStringParam("cdate", KGlobal::locale()->formatDate(TQDate::tqcurrentDate()).utf8()); m_handler->addParam("show-headers", m_printHeaders ? "true()" : "false()"); m_handler->addParam("group-entries", m_printGrouped ? "true()" : "false()"); - QStringList sortTitles; + TQStringList sortTitles; if(!m_sort1.isEmpty()) { sortTitles << m_sort1; } @@ -292,7 +292,7 @@ void HTMLExporter::setFormattingOptions(Data::CollPtr coll) { } // the third sort column may be same as first - if(!m_sort3.isEmpty() && sortTitles.findIndex(m_sort3) == -1) { + if(!m_sort3.isEmpty() && sortTitles.tqfindIndex(m_sort3) == -1) { sortTitles << m_sort3; } @@ -308,38 +308,38 @@ void HTMLExporter::setFormattingOptions(Data::CollPtr coll) { // no longer showing "sorted by..." since the column headers are clickable // but still use "grouped by" - QString sortString; + TQString sortString; if(m_printGrouped) { - QString s; + TQString s; // if more than one, then it's the People pseudo-group if(m_groupBy.count() > 1) { s = i18n("People"); } else { s = coll->fieldTitleByName(m_groupBy[0]); } - sortString = i18n("(grouped by %1)").arg(s); + sortString = i18n("(grouped by %1)").tqarg(s); - QString groupFields; - for(QStringList::ConstIterator it = m_groupBy.begin(); it != m_groupBy.end(); ++it) { + TQString groupFields; + for(TQStringList::ConstIterator it = m_groupBy.begin(); it != m_groupBy.end(); ++it) { Data::FieldPtr f = coll->fieldByName(*it); if(!f) { continue; } if(f->flags() & Data::Field::AllowMultiple) { - groupFields += QString::fromLatin1("tc:") + *it + QString::fromLatin1("s/tc:") + *it; + groupFields += TQString::tqfromLatin1("tc:") + *it + TQString::tqfromLatin1("s/tc:") + *it; } else { - groupFields += QString::fromLatin1("tc:") + *it; + groupFields += TQString::tqfromLatin1("tc:") + *it; } int ncols = 0; if(f->type() == Data::Field::Table) { bool ok; - ncols = Tellico::toUInt(f->property(QString::fromLatin1("columns")), &ok); + ncols = Tellico::toUInt(f->property(TQString::tqfromLatin1("columns")), &ok); if(!ok) { ncols = 1; } } if(ncols > 1) { - groupFields += QString::fromLatin1("/tc:column[1]"); + groupFields += TQString::tqfromLatin1("/tc:column[1]"); } if(*it != m_groupBy.last()) { groupFields += '|'; @@ -350,29 +350,29 @@ void HTMLExporter::setFormattingOptions(Data::CollPtr coll) { m_handler->addStringParam("sort-title", sortString.utf8()); } - QString pageTitle = coll->title(); - pageTitle += QChar(' ') + sortString; + TQString pageTitle = coll->title(); + pageTitle += TQChar(' ') + sortString; m_handler->addStringParam("page-title", pageTitle.utf8()); - QStringList showFields; - for(QStringList::ConstIterator it = m_columns.begin(); it != m_columns.end(); ++it) { + TQStringList showFields; + for(TQStringList::ConstIterator it = m_columns.begin(); it != m_columns.end(); ++it) { showFields << coll->fieldNameByTitle(*it); } - m_handler->addStringParam("column-names", showFields.join(QChar(' ')).utf8()); + m_handler->addStringParam("column-names", showFields.join(TQChar(' ')).utf8()); if(m_imageWidth > 0 && m_imageHeight > 0) { - m_handler->addParam("image-width", QCString().setNum(m_imageWidth)); - m_handler->addParam("image-height", QCString().setNum(m_imageHeight)); + m_handler->addParam("image-width", TQCString().setNum(m_imageWidth)); + m_handler->addParam("image-height", TQCString().setNum(m_imageHeight)); } // add system colors to stylesheet const int type = coll->type(); - m_handler->addStringParam("font", Config::templateFont(type).family().latin1()); - m_handler->addStringParam("fontsize", QCString().setNum(Config::templateFont(type).pointSize())); - m_handler->addStringParam("bgcolor", Config::templateBaseColor(type).name().latin1()); - m_handler->addStringParam("fgcolor", Config::templateTextColor(type).name().latin1()); - m_handler->addStringParam("color1", Config::templateHighlightedTextColor(type).name().latin1()); - m_handler->addStringParam("color2", Config::templateHighlightedBaseColor(type).name().latin1()); + m_handler->addStringParam("font", TQString(Config::templateFont(type).family()).latin1()); + m_handler->addStringParam("fontsize", TQCString().setNum(Config::templateFont(type).pointSize())); + m_handler->addStringParam("bgcolor", TQString(Config::templateBaseColor(type).name()).latin1()); + m_handler->addStringParam("fgcolor", TQString(Config::templateTextColor(type).name()).latin1()); + m_handler->addStringParam("color1", TQString(Config::templateHighlightedTextColor(type).name()).latin1()); + m_handler->addStringParam("color2", TQString(Config::templateHighlightedBaseColor(type).name()).latin1()); // add locale code to stylesheet (for sorting) m_handler->addStringParam("lang", KGlobal::locale()->languagesTwoAlpha().first().utf8()); @@ -381,7 +381,7 @@ void HTMLExporter::setFormattingOptions(Data::CollPtr coll) { void HTMLExporter::writeImages(Data::CollPtr coll_) { // keep track of which image fields to write, this is for field names StringSet imageFields; - for(QStringList::ConstIterator it = m_columns.begin(); it != m_columns.end(); ++it) { + for(TQStringList::ConstIterator it = m_columns.begin(); it != m_columns.end(); ++it) { if(coll_->fieldByTitle(*it)->type() == Data::Field::Image) { imageFields.add(*it); } @@ -402,7 +402,7 @@ void HTMLExporter::writeImages(Data::CollPtr coll_) { // all of them are going to get written to tmp file bool useTemp = url().isEmpty(); KURL imgDir; - QString imgDirRelative; + TQString imgDirRelative; // really some convoluted logic here // basically, four cases. 1) we're writing to a tmp file, for printing probably // so then write all the images to the tmp directory, 2) we're exporting to HTML, and @@ -423,16 +423,16 @@ void HTMLExporter::writeImages(Data::CollPtr coll_) { imgDirRelative = KURL::relativeURL(url(), imgDir); createDir(); } - m_handler->addStringParam("imgdir", QFile::encodeName(imgDirRelative)); + m_handler->addStringParam("imgdir", TQFile::encodeName(imgDirRelative)); int count = 0; const int processCount = 100; // process after every 100 events - QStringList fieldsList = imageFields.toList(); + TQStringList fieldsList = imageFields.toList(); StringSet imageSet; // track which images are written - for(QStringList::ConstIterator fieldName = fieldsList.begin(); fieldName != fieldsList.end(); ++fieldName) { + for(TQStringList::ConstIterator fieldName = fieldsList.begin(); fieldName != fieldsList.end(); ++fieldName) { for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { - QString id = entryIt->field(*fieldName); + TQString id = entryIt->field(*fieldName); // if no id or is already writen, continue if(id.isEmpty() || imageSet.has(id)) { continue; @@ -454,29 +454,29 @@ void HTMLExporter::writeImages(Data::CollPtr coll_) { } } -QWidget* HTMLExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* HTMLExporter::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("HTML Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("HTML Options"), m_widget); l->addWidget(box); - m_checkPrintHeaders = new QCheckBox(i18n("Print field headers"), box); - QWhatsThis::add(m_checkPrintHeaders, i18n("If checked, the field names will be " + m_checkPrintHeaders = new TQCheckBox(i18n("Print field headers"), box); + TQWhatsThis::add(m_checkPrintHeaders, i18n("If checked, the field names will be " "printed as table headers.")); m_checkPrintHeaders->setChecked(m_printHeaders); - m_checkPrintGrouped = new QCheckBox(i18n("Group the entries"), box); - QWhatsThis::add(m_checkPrintGrouped, i18n("If checked, the entries will be grouped by " + m_checkPrintGrouped = new TQCheckBox(i18n("Group the entries"), box); + TQWhatsThis::add(m_checkPrintGrouped, i18n("If checked, the entries will be grouped by " "the selected field.")); m_checkPrintGrouped->setChecked(m_printGrouped); - m_checkExportEntryFiles = new QCheckBox(i18n("Export individual entry files"), box); - QWhatsThis::add(m_checkExportEntryFiles, i18n("If checked, individual files will be created for each entry.")); + m_checkExportEntryFiles = new TQCheckBox(i18n("Export individual entry files"), box); + TQWhatsThis::add(m_checkExportEntryFiles, i18n("If checked, individual files will be created for each entry.")); m_checkExportEntryFiles->setChecked(m_exportEntryFiles); l->addStretch(1); @@ -484,19 +484,19 @@ QWidget* HTMLExporter::widget(QWidget* parent_, const char* name_/*=0*/) { } void HTMLExporter::readOptions(KConfig* config_) { - KConfigGroup exportConfig(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup exportConfig(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_printHeaders = exportConfig.readBoolEntry("Print Field Headers", m_printHeaders); m_printGrouped = exportConfig.readBoolEntry("Print Grouped", m_printGrouped); m_exportEntryFiles = exportConfig.readBoolEntry("Export Entry Files", m_exportEntryFiles); // read current entry export template m_entryXSLTFile = Config::templateName(collection()->type()); - m_entryXSLTFile = locate("appdata", QString::fromLatin1("entry-templates/") - + m_entryXSLTFile + QString::fromLatin1(".xsl")); + m_entryXSLTFile = locate("appdata", TQString::tqfromLatin1("entry-templates/") + + m_entryXSLTFile + TQString::tqfromLatin1(".xsl")); } void HTMLExporter::saveOptions(KConfig* config_) { - KConfigGroup cfg(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup cfg(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_printHeaders = m_checkPrintHeaders->isChecked(); cfg.writeEntry("Print Field Headers", m_printHeaders); m_printGrouped = m_checkPrintGrouped->isChecked(); @@ -505,13 +505,13 @@ void HTMLExporter::saveOptions(KConfig* config_) { cfg.writeEntry("Export Entry Files", m_exportEntryFiles); } -void HTMLExporter::setXSLTFile(const QString& filename_) { +void HTMLExporter::setXSLTFile(const TQString& filename_) { if(m_xsltFile == filename_) { return; } m_xsltFile = filename_; - m_xsltFilePath = QString::null; + m_xsltFilePath = TQString(); reset(); } @@ -521,25 +521,25 @@ KURL HTMLExporter::fileDir() const { } KURL fileDir = url(); // cd to directory of target URL - fileDir.cd(QString::fromLatin1("..")); + fileDir.cd(TQString::tqfromLatin1("..")); fileDir.addPath(fileDirName()); return fileDir; } -QString HTMLExporter::fileDirName() const { +TQString HTMLExporter::fileDirName() const { if(!m_collectionURL.isEmpty()) { - return QString::fromLatin1("/"); + return TQString::tqfromLatin1("/"); } - return url().fileName().section('.', 0, 0) + QString::fromLatin1("_files/"); + return url().fileName().section('.', 0, 0) + TQString::tqfromLatin1("_files/"); } // how ugly is this? const xmlChar* HTMLExporter::handleLink(const xmlChar* link_) { - return reinterpret_cast<xmlChar*>(qstrdup(handleLink(QString::fromUtf8(reinterpret_cast<const char*>(link_))).utf8())); + return reinterpret_cast<xmlChar*>(qstrdup(handleLink(TQString::fromUtf8(reinterpret_cast<const char*>(link_))).utf8())); } -QString HTMLExporter::handleLink(const QString& link_) { - if(m_links.contains(link_)) { +TQString HTMLExporter::handleLink(const TQString& link_) { + if(m_links.tqcontains(link_)) { return m_links[link_]; } // assume that if the link_ is not relative, then we don't need to copy it @@ -569,10 +569,10 @@ QString HTMLExporter::handleLink(const QString& link_) { // if we're exporting entry files, we want pics/ to // go in pics/ - const bool isPic = link_.startsWith(m_dataDir + QString::fromLatin1("pics/")); - QString midDir; + const bool isPic = link_.startsWith(m_dataDir + TQString::tqfromLatin1("pics/")); + TQString midDir; if(m_exportEntryFiles && isPic) { - midDir = QString::fromLatin1("pics/"); + midDir = TQString::tqfromLatin1("pics/"); } // pictures are special since they might not exist when the HTML is exported, since they might get copied later // on the other hand, don't change the file location if it doesn't exist @@ -585,28 +585,28 @@ QString HTMLExporter::handleLink(const QString& link_) { } const xmlChar* HTMLExporter::analyzeInternalCSS(const xmlChar* str_) { - return reinterpret_cast<xmlChar*>(qstrdup(analyzeInternalCSS(QString::fromUtf8(reinterpret_cast<const char*>(str_))).utf8())); + return reinterpret_cast<xmlChar*>(qstrdup(analyzeInternalCSS(TQString::fromUtf8(reinterpret_cast<const char*>(str_))).utf8())); } -QString HTMLExporter::analyzeInternalCSS(const QString& str_) { - QString str = str_; +TQString HTMLExporter::analyzeInternalCSS(const TQString& str_) { + TQString str = str_; int start = 0; int end = 0; - const QString url = QString::fromLatin1("url("); - for(int pos = str.find(url); pos >= 0; pos = str.find(url, pos+1)) { + const TQString url = TQString::tqfromLatin1("url("); + for(int pos = str.tqfind(url); pos >= 0; pos = str.tqfind(url, pos+1)) { pos += 4; // url( if(str[pos] == '"' || str[pos] == '\'') { ++pos; } start = pos; - pos = str.find(')', start); + pos = str.tqfind(')', start); end = pos; if(str[pos-1] == '"' || str[pos-1] == '\'') { --end; } - str.replace(start, end-start, handleLink(str.mid(start, end-start))); + str.tqreplace(start, end-start, handleLink(str.mid(start, end-start))); } return str; } @@ -633,7 +633,7 @@ bool HTMLExporter::copyFiles() { } const uint start = 20; const uint maxProgress = m_exportEntryFiles ? 40 : 80; - const uint stepSize = QMAX(1, m_files.count()/maxProgress); + const uint stepSize = TQMAX(1, m_files.count()/maxProgress); uint j = 0; createDir(); @@ -656,7 +656,7 @@ bool HTMLExporter::copyFiles() { } if(j%stepSize == 0) { if(options() & ExportProgress) { - ProgressManager::self()->setProgress(this, QMIN(start+j/stepSize, 99)); + ProgressManager::self()->setProgress(this, TQMIN(start+j/stepSize, 99)); } kapp->processEvents(); } @@ -671,19 +671,19 @@ bool HTMLExporter::writeEntryFiles() { } const uint start = 60; - const uint stepSize = QMAX(1, entries().count()/40); + const uint stepSize = TQMAX(1, entries().count()/40); uint j = 0; // now worry about actually exporting entry files // I can't reliable encode a string as a URI, so I'm punting, and I'll just replace everything but // a-zA-Z0-9 with an underscore. This MUST match the filename template in tellico2html.xsl // the id is used so uniqueness is guaranteed - const QRegExp badChars(QString::fromLatin1("[^-a-zA-Z0-9]")); + const TQRegExp badChars(TQString::tqfromLatin1("[^-a-zA-Z0-9]")); bool formatted = options() & Export::ExportFormatted; KURL outputFile = fileDir(); - GUI::CursorSaver cs(Qt::waitCursor); + GUI::CursorSaver cs(TQt::waitCursor); HTMLExporter exporter(collection()); long opt = options() | Export::ExportForce; @@ -693,19 +693,19 @@ bool HTMLExporter::writeEntryFiles() { exporter.setCollectionURL(url()); bool parseDOM = true; - const QString title = QString::fromLatin1("title"); - const QString html = QString::fromLatin1(".html"); + const TQString title = TQString::tqfromLatin1("title"); + const TQString html = TQString::tqfromLatin1(".html"); bool multipleTitles = collection()->fieldByName(title)->flags() & Data::Field::AllowMultiple; Data::EntryVec entries = this->entries(); // not const since the pointer has to be copied for(Data::EntryVecIt entryIt = entries.begin(); entryIt != entries.end() && !m_cancelled; ++entryIt, ++j) { - QString file = entryIt->field(title, formatted); + TQString file = entryIt->field(title, formatted); // but only use the first title if it has multiple if(multipleTitles) { file = file.section(';', 0, 0); } - file.replace(badChars, QChar('_')); - file += QChar('-') + QString::number(entryIt->id()) + html; + file.tqreplace(badChars, TQChar('_')); + file += TQChar('-') + TQString::number(entryIt->id()) + html; outputFile.setFileName(file); exporter.setEntries(Data::EntryVec(entryIt)); @@ -725,24 +725,24 @@ bool HTMLExporter::writeEntryFiles() { if(j%stepSize == 0) { if(options() & ExportProgress) { - ProgressManager::self()->setProgress(this, QMIN(start+j/stepSize, 99)); + ProgressManager::self()->setProgress(this, TQMIN(start+j/stepSize, 99)); } kapp->processEvents(); } } // the images in "pics/" are special data images, copy them always // since the entry files may refer to them, but we don't know that - QStringList dataImages; - dataImages << QString::fromLatin1("checkmark.png"); + TQStringList dataImages; + dataImages << TQString::tqfromLatin1("checkmark.png"); for(uint i = 1; i <= 10; ++i) { - dataImages << QString::fromLatin1("stars%1.png").arg(i); + dataImages << TQString::tqfromLatin1("stars%1.png").tqarg(i); } KURL dataDir; - dataDir.setPath(KGlobal::dirs()->findResourceDir("appdata", QString::fromLatin1("pics/tellico.png")) + "pics/"); + dataDir.setPath(KGlobal::dirs()->findResourceDir("appdata", TQString::tqfromLatin1("pics/tellico.png")) + "pics/"); KURL target = fileDir(); - target.addPath(QString::fromLatin1("pics/")); + target.addPath(TQString::tqfromLatin1("pics/")); KIO::NetAccess::mkdir(target, m_widget); - for(QStringList::ConstIterator it = dataImages.begin(); it != dataImages.end(); ++it) { + for(TQStringList::ConstIterator it = dataImages.begin(); it != dataImages.end(); ++it) { dataDir.setFileName(*it); target.setFileName(*it); KIO::NetAccess::copy(dataDir, target, m_widget); @@ -764,12 +764,12 @@ void HTMLExporter::parseDOM(xmlNode* node_) { bool parseChildren = true; if(node_->type == XML_ELEMENT_NODE) { - const QCString nodeName = QCString(reinterpret_cast<const char*>(node_->name)).upper(); + const TQCString nodeName = TQCString(reinterpret_cast<const char*>(node_->name)).upper(); xmlElement* elem = reinterpret_cast<xmlElement*>(node_); // to speed up things, check now for nodename if(nodeName == "IMG" || nodeName == "SCRIPT" || nodeName == "LINK") { for(xmlAttribute* attr = elem->attributes; attr; attr = reinterpret_cast<xmlAttribute*>(attr->next)) { - QCString attrName = QCString(reinterpret_cast<const char*>(attr->name)).upper(); + TQCString attrName = TQCString(reinterpret_cast<const char*>(attr->name)).upper(); if( (attrName == "SRC" && (nodeName == "IMG" || nodeName == "SCRIPT")) || (attrName == "HREF" && nodeName == "LINK")) { diff --git a/src/translators/htmlexporter.h b/src/translators/htmlexporter.h index be89bbf..421d09e 100644 --- a/src/translators/htmlexporter.h +++ b/src/translators/htmlexporter.h @@ -14,12 +14,12 @@ #ifndef HTMLEXPORTER_H #define HTMLEXPORTER_H -class QCheckBox; +class TQCheckBox; #include "exporter.h" #include "../stringset.h" -#include <qstringlist.h> +#include <tqstringlist.h> #include <libxml/xmlstring.h> @@ -40,6 +40,7 @@ namespace Tellico { */ class HTMLExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: HTMLExporter(); @@ -48,25 +49,25 @@ public: virtual bool exec(); virtual void reset(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual void readOptions(KConfig*); virtual void saveOptions(KConfig*); void setCollectionURL(const KURL& url) { m_collectionURL = url; m_links.clear(); } - void setXSLTFile(const QString& filename); + void setXSLTFile(const TQString& filename); void setPrintHeaders(bool printHeaders) { m_printHeaders = printHeaders; } void setPrintGrouped(bool printGrouped) { m_printGrouped = printGrouped; } void setMaxImageSize(int w, int h) { m_imageWidth = w; m_imageHeight = h; } - void setGroupBy(const QStringList& groupBy) { m_groupBy = groupBy; } - void setSortTitles(const QStringList& l) + void setGroupBy(const TQStringList& groupBy) { m_groupBy = groupBy; } + void setSortTitles(const TQStringList& l) { m_sort1 = l[0]; m_sort2 = l[1]; m_sort3 = l[2]; } - void setColumns(const QStringList& columns) { m_columns = columns; } + void setColumns(const TQStringList& columns) { m_columns = columns; } void setParseDOM(bool parseDOM) { m_parseDOM = parseDOM; reset(); } - QString text(); + TQString text(); public slots: void slotCancel(); @@ -76,12 +77,12 @@ private: void writeImages(Data::CollPtr coll); bool writeEntryFiles(); KURL fileDir() const; - QString fileDirName() const; + TQString fileDirName() const; void parseDOM(_xmlNode* node); - QString handleLink(const QString& link); + TQString handleLink(const TQString& link); const xmlChar* handleLink(const xmlChar* link); - QString analyzeInternalCSS(const QString& string); + TQString analyzeInternalCSS(const TQString& string); const xmlChar* analyzeInternalCSS(const xmlChar* string); bool copyFiles(); bool loadXSLTFile(); @@ -97,25 +98,25 @@ private: int m_imageWidth; int m_imageHeight; - QWidget* m_widget; - QCheckBox* m_checkPrintHeaders; - QCheckBox* m_checkPrintGrouped; - QCheckBox* m_checkExportEntryFiles; - QCheckBox* m_checkExportImages; + TQWidget* m_widget; + TQCheckBox* m_checkPrintHeaders; + TQCheckBox* m_checkPrintGrouped; + TQCheckBox* m_checkExportEntryFiles; + TQCheckBox* m_checkExportImages; KURL m_collectionURL; - QString m_xsltFile; - QString m_xsltFilePath; - QString m_dataDir; - QStringList m_groupBy; - QString m_sort1; - QString m_sort2; - QString m_sort3; - QStringList m_columns; - QString m_entryXSLTFile; + TQString m_xsltFile; + TQString m_xsltFilePath; + TQString m_dataDir; + TQStringList m_groupBy; + TQString m_sort1; + TQString m_sort2; + TQString m_sort3; + TQStringList m_columns; + TQString m_entryXSLTFile; KURL::List m_files; - QMap<QString, QString> m_links; + TQMap<TQString, TQString> m_links; StringSet m_copiedFiles; }; diff --git a/src/translators/importer.h b/src/translators/importer.h index 4df5ccb..d10e027 100644 --- a/src/translators/importer.h +++ b/src/translators/importer.h @@ -14,15 +14,15 @@ #ifndef IMPORTER_H #define IMPORTER_H -class QWidget; +class TQWidget; #include "../datavectors.h" #include <klocale.h> #include <kurl.h> -#include <qobject.h> -#include <qstring.h> +#include <tqobject.h> +#include <tqstring.h> namespace Tellico { namespace Import { @@ -39,20 +39,21 @@ namespace Tellico { * * @author Robby Stephenson */ -class Importer : public QObject { +class Importer : public TQObject { Q_OBJECT + TQ_OBJECT public: - Importer() : QObject(), m_options(ImportProgress) {} + Importer() : TQObject(), m_options(ImportProgress) {} /** * The constructor should immediately load the contents of the file to be imported. * Any warnings or errors should be added the the status message queue. * * @param url The URL of the file to import */ - Importer(const KURL& url) : QObject(), m_options(ImportProgress), m_urls(url) {} - Importer(const KURL::List& urls) : QObject(), m_options(ImportProgress), m_urls(urls) {} - Importer(const QString& text) : QObject(), m_options(ImportProgress), m_text(text) {} + Importer(const KURL& url) : TQObject(), m_options(ImportProgress), m_urls(url) {} + Importer(const KURL::List& urls) : TQObject(), m_options(ImportProgress), m_urls(urls) {} + Importer(const TQString& text) : TQObject(), m_options(ImportProgress), m_text(text) {} /** */ virtual ~Importer() {} @@ -71,14 +72,14 @@ public: * * @return The status message */ - const QString& statusMessage() const { return m_statusMsg; } + const TQString& statusMessage() const { return m_statusMsg; } /** * Returns a widget with the setting specific to this importer, or 0 if no * options are needed. * * @return A pointer to the setting widget */ - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } /** * Checks to see if the importer can return a collection of this type * @@ -90,14 +91,14 @@ public: * Validate the import settings */ virtual bool validImport() const { return true; } - virtual void setText(const QString& text) { m_text = text; } + virtual void setText(const TQString& text) { m_text = text; } long options() const { return m_options; } void setOptions(long options) { m_options = options; } /** * Returns a string useful for the ProgressManager */ - QString progressLabel() const { - if(url().isEmpty()) return i18n("Loading data..."); else return i18n("Loading %1...").arg(url().fileName()); + TQString progressLabel() const { + if(url().isEmpty()) return i18n("Loading data..."); else return i18n("Loading %1...").tqarg(url().fileName()); } public slots: @@ -114,21 +115,21 @@ protected: */ KURL url() const { return m_urls.isEmpty() ? KURL() : m_urls[0]; } KURL::List urls() const { return m_urls; } - QString text() const { return m_text; } + TQString text() const { return m_text; } /** * Adds a message to the status queue. * * @param msg A string containing a warning or error. */ - void setStatusMessage(const QString& msg) { if(!msg.isEmpty()) m_statusMsg += msg + QChar(' '); } + void setStatusMessage(const TQString& msg) { if(!msg.isEmpty()) m_statusMsg += msg + TQChar(' '); } static const uint s_stepSize; private: long m_options; KURL::List m_urls; - QString m_text; - QString m_statusMsg; + TQString m_text; + TQString m_statusMsg; }; } // end namespace diff --git a/src/translators/libcsv.c b/src/translators/libcsv.c index 4e53f63..6cb39a0 100644 --- a/src/translators/libcsv.c +++ b/src/translators/libcsv.c @@ -114,7 +114,7 @@ csv_init(struct csv_parser **p, unsigned char options) (*p)->entry_size = MEM_BLK_SIZE; (*p)->status = 0; (*p)->options = options; - (*p)->quote_char = CSV_QUOTE; + (*p)->quote_char = CSV_TQUOTE; (*p)->delim_char = CSV_COMMA; (*p)->is_space = NULL; (*p)->is_term = NULL; diff --git a/src/translators/libcsv.h b/src/translators/libcsv.h index 9058192..4830c15 100644 --- a/src/translators/libcsv.h +++ b/src/translators/libcsv.h @@ -46,7 +46,7 @@ Copyright (C) 2007 Robert Gamble #define CSV_CR 0x0d #define CSV_LF 0x0a #define CSV_COMMA 0x2c -#define CSV_QUOTE 0x22 +#define CSV_TQUOTE 0x22 struct csv_parser { int pstate; /* Parser state */ 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); } diff --git a/src/translators/onixexporter.h b/src/translators/onixexporter.h index 19d52dd..fd947ae 100644 --- a/src/translators/onixexporter.h +++ b/src/translators/onixexporter.h @@ -14,7 +14,7 @@ #ifndef ONIXEXPORTER_H #define ONIXEXPORTER_H -class QCheckBox; +class TQCheckBox; #include "exporter.h" @@ -30,6 +30,7 @@ namespace Tellico { */ class ONIXExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: ONIXExporter(); @@ -37,22 +38,22 @@ public: ~ONIXExporter(); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - virtual QWidget* widget(QWidget*, const char* name=0); + virtual TQWidget* widget(TQWidget*, const char* name=0); virtual void readOptions(KConfig*); virtual void saveOptions(KConfig*); - QString text(); + TQString text(); private: XSLTHandler* m_handler; - QString m_xsltFile; + TQString m_xsltFile; bool m_includeImages; - QWidget* m_widget; - QCheckBox* m_checkIncludeImages; + TQWidget* m_widget; + TQCheckBox* m_checkIncludeImages; }; } // end namespace diff --git a/src/translators/pdfimporter.cpp b/src/translators/pdfimporter.cpp index 2d59b33..09df294 100644 --- a/src/translators/pdfimporter.cpp +++ b/src/translators/pdfimporter.cpp @@ -48,7 +48,7 @@ bool PDFImporter::canImport(int type_) const { } Tellico::Data::CollPtr PDFImporter::collection() { - QString xsltfile = ::locate("appdata", QString::fromLatin1("xmp2tellico.xsl")); + TQString xsltfile = ::locate("appdata", TQString::tqfromLatin1("xmp2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "DropHandler::handleURL() - can not locate xmp2tellico.xsl" << endl; return 0; @@ -56,7 +56,7 @@ Tellico::Data::CollPtr PDFImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(urls().count()); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); const bool showProgress = options() & ImportProgress; @@ -86,12 +86,12 @@ Tellico::Data::CollPtr PDFImporter::collection() { Data::CollPtr newColl; Data::EntryPtr entry; - QString xmp = xmpHandler.extractXMP(ref->fileName()); + TQString xmp = xmpHandler.extractXMP(ref->fileName()); // myDebug() << xmp << endl; if(xmp.isEmpty()) { setStatusMessage(i18n("Tellico was unable to read any metadata from the PDF file.")); } else { - setStatusMessage(QString()); + setStatusMessage(TQString()); Import::TellicoImporter importer(xsltHandler.applyStylesheet(xmp)); newColl = importer.collection(); @@ -100,7 +100,7 @@ Tellico::Data::CollPtr PDFImporter::collection() { setStatusMessage(i18n("Tellico was unable to read any metadata from the PDF file.")); } else { entry = newColl->entries().front(); - hasDOI |= !entry->field(QString::fromLatin1("doi")).isEmpty(); + hasDOI |= !entry->field(TQString::tqfromLatin1("doi")).isEmpty(); } } @@ -119,30 +119,30 @@ Tellico::Data::CollPtr PDFImporter::collection() { if(doc && !doc->isLocked()) { // now the question is, do we overwrite XMP data with Poppler data? // for now, let's say yes conditionally - QString s = doc->getInfo(QString::fromLatin1("Title")).simplifyWhiteSpace(); + TQString s = doc->getInfo(TQString::tqfromLatin1("Title")).simplifyWhiteSpace(); if(!s.isEmpty()) { - entry->setField(QString::fromLatin1("title"), s); + entry->setField(TQString::tqfromLatin1("title"), s); } // author could be separated by commas, "and" or whatever // we're not going to overwrite it - if(entry->field(QString::fromLatin1("author")).isEmpty()) { - QRegExp rx(QString::fromLatin1("\\s*(and|,|;)\\s*")); - QStringList authors = QStringList::split(rx, doc->getInfo(QString::fromLatin1("Author")).simplifyWhiteSpace()); - entry->setField(QString::fromLatin1("author"), authors.join(QString::fromLatin1("; "))); + if(entry->field(TQString::tqfromLatin1("author")).isEmpty()) { + TQRegExp rx(TQString::tqfromLatin1("\\s*(and|,|;)\\s*")); + TQStringList authors = TQStringList::split(rx, doc->getInfo(TQString::tqfromLatin1("Author")).simplifyWhiteSpace()); + entry->setField(TQString::tqfromLatin1("author"), authors.join(TQString::tqfromLatin1("; "))); } - s = doc->getInfo(QString::fromLatin1("Keywords")).simplifyWhiteSpace(); + s = doc->getInfo(TQString::tqfromLatin1("Keywords")).simplifyWhiteSpace(); if(!s.isEmpty()) { // keywords are also separated by semi-colons in poppler - entry->setField(QString::fromLatin1("keyword"), s); + entry->setField(TQString::tqfromLatin1("keyword"), s); } // now parse the first page text and try to guess Poppler::Page* page = doc->getPage(0); if(page) { // a null rectangle means get all text on page - QString text = page->getText(Poppler::Rectangle()); + TQString text = page->getText(Poppler::Rectangle()); // borrowed from Referencer - QRegExp rx(QString::fromLatin1("(?:" + TQRegExp rx(TQString::tqfromLatin1("(?:" "(?:[Dd][Oo][Ii]:? *)" "|" "(?:[Dd]igital *[Oo]bject *[Ii]dentifier:? *)" @@ -155,26 +155,26 @@ Tellico::Data::CollPtr PDFImporter::collection() { "[^\\s]+" ")")); if(rx.search(text) > -1) { - QString doi = rx.cap(1); + TQString doi = rx.cap(1); myDebug() << "PDFImporter::collection() - in PDF file, found DOI: " << doi << endl; - entry->setField(QString::fromLatin1("doi"), doi); + entry->setField(TQString::tqfromLatin1("doi"), doi); hasDOI = true; } - rx = QRegExp(QString::fromLatin1("arXiv:" + rx = TQRegExp(TQString::tqfromLatin1("arXiv:" "(" "[^\\/\\s]+" "[\\/\\.]" "[^\\s]+" ")")); if(rx.search(text) > -1) { - QString arxiv = rx.cap(1); + TQString arxiv = rx.cap(1); myDebug() << "PDFImporter::collection() - in PDF file, found arxiv: " << arxiv << endl; - if(entry->collection()->fieldByName(QString::fromLatin1("arxiv")) == 0) { - Data::FieldPtr field = new Data::Field(QString::fromLatin1("arxiv"), i18n("arXiv ID")); + if(entry->collection()->fieldByName(TQString::tqfromLatin1("arxiv")) == 0) { + Data::FieldPtr field = new Data::Field(TQString::tqfromLatin1("arxiv"), i18n("arXiv ID")); field->setCategory(i18n("Publishing")); entry->collection()->addField(field); } - entry->setField(QString::fromLatin1("arxiv"), arxiv); + entry->setField(TQString::tqfromLatin1("arxiv"), arxiv); hasArxiv = true; } @@ -186,22 +186,22 @@ Tellico::Data::CollPtr PDFImporter::collection() { delete doc; #endif - entry->setField(QString::fromLatin1("url"), (*it).url()); + entry->setField(TQString::tqfromLatin1("url"), (*it).url()); // always an article? - entry->setField(QString::fromLatin1("entry-type"), QString::fromLatin1("article")); + entry->setField(TQString::tqfromLatin1("entry-type"), TQString::tqfromLatin1("article")); - QPixmap pix = NetAccess::filePreview(ref->fileName(), PDF_FILE_PREVIEW_SIZE); + TQPixmap pix = NetAccess::filePreview(ref->fileName(), PDF_FILE_PREVIEW_SIZE); delete ref; // removes temp file if(!pix.isNull()) { // is png best option? - QString id = ImageFactory::addImage(pix, QString::fromLatin1("PNG")); + TQString id = ImageFactory::addImage(pix, TQString::tqfromLatin1("PNG")); if(!id.isEmpty()) { - Data::FieldPtr field = newColl->fieldByName(QString::fromLatin1("cover")); + Data::FieldPtr field = newColl->fieldByName(TQString::tqfromLatin1("cover")); if(!field && !newColl->imageFields().isEmpty()) { field = newColl->imageFields().front(); } else if(!field) { - field = new Data::Field(QString::fromLatin1("cover"), i18n("Front Cover"), Data::Field::Image); + field = new Data::Field(TQString::tqfromLatin1("cover"), i18n("Front Cover"), Data::Field::Image); newColl->addField(field); } entry->setField(field, id); @@ -227,13 +227,13 @@ Tellico::Data::CollPtr PDFImporter::collection() { myDebug() << "looking for DOI" << endl; Fetch::FetcherVec vec = Fetch::Manager::self()->createUpdateFetchers(coll->type(), Fetch::DOI); if(vec.isEmpty()) { - GUI::CursorSaver cs(Qt::arrowCursor); + GUI::CursorSaver cs(TQt::arrowCursor); KMessageBox::information(Kernel::self()->widget(), i18n("Tellico is able to download information about entries with a DOI from " "CrossRef.org. However, you must create an CrossRef account and add a new " "data source with your account information."), - QString::null, - QString::fromLatin1("CrossRefSourceNeeded")); + TQString(), + TQString::tqfromLatin1("CrossRefSourceNeeded")); } else { Data::EntryVec entries = coll->entries(); for(Fetch::FetcherVec::Iterator fetcher = vec.begin(); fetcher != vec.end(); ++fetcher) { @@ -263,8 +263,8 @@ Tellico::Data::CollPtr PDFImporter::collection() { for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { if(entry->title().isEmpty()) { // use file name - KURL u = entry->field(QString::fromLatin1("url")); - entry->setField(QString::fromLatin1("title"), u.fileName()); + KURL u = entry->field(TQString::tqfromLatin1("url")); + entry->setField(TQString::tqfromLatin1("title"), u.fileName()); } } diff --git a/src/translators/pdfimporter.h b/src/translators/pdfimporter.h index 87da58e..b16136d 100644 --- a/src/translators/pdfimporter.h +++ b/src/translators/pdfimporter.h @@ -21,6 +21,7 @@ namespace Tellico { class PDFImporter : public Importer { Q_OBJECT + TQ_OBJECT public: PDFImporter(const KURL::List& urls); diff --git a/src/translators/pilotdb/pilotdb.cpp b/src/translators/pilotdb/pilotdb.cpp index d7779e4..b42cb6a 100644 --- a/src/translators/pilotdb/pilotdb.cpp +++ b/src/translators/pilotdb/pilotdb.cpp @@ -17,7 +17,7 @@ #include <kdebug.h> -#include <qbuffer.h> +#include <tqbuffer.h> using namespace PalmLib; using Tellico::Export::PilotDB; @@ -42,8 +42,8 @@ PilotDB::~PilotDB() { } } -QByteArray PilotDB::data() { - QBuffer b; +TQByteArray PilotDB::data() { + TQBuffer b; b.open(IO_WriteOnly); pi_char_t buf[PI_HDR_SIZE]; @@ -53,7 +53,7 @@ QByteArray PilotDB::data() { for(int i=0; i<32; ++i) { buf[i] = 0; } - memcpy(buf, name().c_str(), QMIN(31, name().length())); + memcpy(buf, name().c_str(), TQMIN(31, name().length())); set_short(buf + 32, flags()); set_short(buf + 34, version()); set_long(buf + 36, creation_time()); diff --git a/src/translators/pilotdb/pilotdb.h b/src/translators/pilotdb/pilotdb.h index dd21c7b..871b6bb 100644 --- a/src/translators/pilotdb/pilotdb.h +++ b/src/translators/pilotdb/pilotdb.h @@ -23,7 +23,7 @@ #include "libpalm/Database.h" #include "libflatfile/Field.h" -#include <qcstring.h> +#include <tqcstring.h> namespace Tellico { namespace Export { @@ -36,7 +36,7 @@ public: PilotDB(); ~PilotDB(); - QByteArray data(); + TQByteArray data(); /** * Return the total number of records/resources in this database. diff --git a/src/translators/pilotdb/strop.cpp b/src/translators/pilotdb/strop.cpp index b8c7f55..3b0deeb 100644 --- a/src/translators/pilotdb/strop.cpp +++ b/src/translators/pilotdb/strop.cpp @@ -167,7 +167,7 @@ std::string StrOps::strip_front(const std::string& str,const std::string& what) StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, bool quoted_string) { - enum { STATE_NORMAL, STATE_QUOTES } state; + enum { STATE_NORMAL, STATE_TQUOTES } state; StrOps::string_list_t result; std::string elem; @@ -176,7 +176,7 @@ StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, b switch (state) { case STATE_NORMAL: if (quoted_string && *p == '"') { - state = STATE_QUOTES; + state = STATE_TQUOTES; } else if (*p == delim) { result.push_back(elem); elem = ""; @@ -185,7 +185,7 @@ StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, b } break; - case STATE_QUOTES: + case STATE_TQUOTES: if (quoted_string && *p == '"') { if ((p + 1) != str.end() && *(p+1) == '"') { ++p; @@ -204,7 +204,7 @@ StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, b case STATE_NORMAL: result.push_back(elem); break; - case STATE_QUOTES: + case STATE_TQUOTES: kdDebug() << "unterminated quotes" << endl; break; } @@ -216,8 +216,8 @@ StrOps::string_list_t StrOps::str_to_array(const std::string& str, const std::string& delim, bool multiple_delim, bool handle_comments) { - enum { STATE_NORMAL, STATE_COMMENT, STATE_QUOTE_DOUBLE, STATE_QUOTE_SINGLE, - STATE_BACKSLASH, STATE_BACKSLASH_DOUBLEQUOTE } state; + enum { STATE_NORMAL, STATE_COMMENT, STATE_TQUOTE_DOUBLE, STATE_TQUOTE_SINGLE, + STATE_BACKSLASH, STATE_BACKSLASH_DOUBLETQUOTE } state; StrOps::string_list_t result; std::string elem; @@ -226,9 +226,9 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, switch (state) { case STATE_NORMAL: if (*p == '"') { - state = STATE_QUOTE_DOUBLE; + state = STATE_TQUOTE_DOUBLE; } else if (*p == '\'') { - state = STATE_QUOTE_SINGLE; + state = STATE_TQUOTE_SINGLE; } else if (std::find(delim.begin(), delim.end(), *p) != delim.end()) { if (multiple_delim) { ++p; @@ -252,16 +252,16 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, case STATE_COMMENT: break; - case STATE_QUOTE_DOUBLE: + case STATE_TQUOTE_DOUBLE: if (*p == '"') state = STATE_NORMAL; else if (*p == '\\') - state = STATE_BACKSLASH_DOUBLEQUOTE; + state = STATE_BACKSLASH_DOUBLETQUOTE; else elem += *p; break; - case STATE_QUOTE_SINGLE: + case STATE_TQUOTE_SINGLE: if (*p == '\'') state = STATE_NORMAL; else @@ -273,7 +273,7 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, state = STATE_NORMAL; break; - case STATE_BACKSLASH_DOUBLEQUOTE: + case STATE_BACKSLASH_DOUBLETQUOTE: switch (*p) { case '\\': elem += '\\'; @@ -329,7 +329,7 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, } // Escape is done. Go back to the normal double quote state. - state = STATE_QUOTE_DOUBLE; + state = STATE_TQUOTE_DOUBLE; break; } } @@ -339,16 +339,16 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, result.push_back(elem); break; - case STATE_QUOTE_DOUBLE: + case STATE_TQUOTE_DOUBLE: kdDebug() << "unterminated double quotes" << endl; break; - case STATE_QUOTE_SINGLE: + case STATE_TQUOTE_SINGLE: kdDebug() << "unterminated single quotes" << endl; break; case STATE_BACKSLASH: - case STATE_BACKSLASH_DOUBLEQUOTE: + case STATE_BACKSLASH_DOUBLETQUOTE: kdDebug() << "an escape character must follow a backslash" << endl; break; diff --git a/src/translators/pilotdbexporter.cpp b/src/translators/pilotdbexporter.cpp index b9e7367..03115e9 100644 --- a/src/translators/pilotdbexporter.cpp +++ b/src/translators/pilotdbexporter.cpp @@ -24,12 +24,12 @@ #include <kglobal.h> #include <kcharsets.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qcheckbox.h> -#include <qwhatsthis.h> -#include <qtextcodec.h> -#include <qdatetime.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqcheckbox.h> +#include <tqwhatsthis.h> +#include <tqtextcodec.h> +#include <tqdatetime.h> using Tellico::Export::PilotDBExporter; @@ -39,12 +39,12 @@ PilotDBExporter::PilotDBExporter() : Tellico::Export::Exporter(), m_checkBackup(0) { } -QString PilotDBExporter::formatString() const { +TQString PilotDBExporter::formatString() const { return i18n("PilotDB"); } -QString PilotDBExporter::fileFilter() const { - return i18n("*.pdb|Pilot Database Files (*.pdb)") + QChar('\n') + i18n("*|All Files"); +TQString PilotDBExporter::fileFilter() const { + return i18n("*.pdb|Pilot Database Files (*.pdb)") + TQChar('\n') + i18n("*|All Files"); } bool PilotDBExporter::exec() { @@ -55,14 +55,14 @@ bool PilotDBExporter::exec() { // This is something of a hidden preference cause I don't want to put it in the GUI right now // Latin1 by default - QTextCodec* codec = 0; + TQTextCodec* codec = 0; { // Latin1 is default - KConfigGroup group(KGlobal::config(), QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(KGlobal::config(), TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); codec = KGlobal::charsets()->codecForName(group.readEntry("Charset")); } if(!codec) { - kdWarning() << "PilotDBExporter::exec() - no QTextCodec!" << endl; + kdWarning() << "PilotDBExporter::exec() - no TQTextCodec!" << endl; return false; #ifndef NDEBUG } else { @@ -89,7 +89,7 @@ bool PilotDBExporter::exec() { case Data::Field::Choice: // the charSeparator is actually defined in DB.h db.appendField(codec->fromUnicode(fIt->title()).data(), PalmLib::FlatFile::Field::LIST, - codec->fromUnicode(fIt->allowed().join(QChar('/'))).data()); + codec->fromUnicode(fIt->allowed().join(TQChar('/'))).data()); outputFields.append(fIt); break; @@ -141,9 +141,9 @@ bool PilotDBExporter::exec() { if(m_columns.count() > 0) { PalmLib::FlatFile::ListView lv; lv.name = codec->fromUnicode(i18n("View Columns")).data(); - for(QStringList::ConstIterator it = m_columns.begin(); it != m_columns.end(); ++it) { + for(TQStringList::ConstIterator it = m_columns.begin(); it != m_columns.end(); ++it) { PalmLib::FlatFile::ListViewColumn col; - col.field = coll->fieldTitles().findIndex(*it); + col.field = coll->fieldTitles().tqfindIndex(*it); lv.push_back(col); } db.appendListView(lv); @@ -153,11 +153,11 @@ bool PilotDBExporter::exec() { Data::FieldVec::ConstIterator fIt, end = outputFields.constEnd(); bool format = options() & Export::ExportFormatted; - QRegExp br(QString::fromLatin1("<br/?>"), false /*case-sensitive*/); - QRegExp tags(QString::fromLatin1("<.*>")); + TQRegExp br(TQString::tqfromLatin1("<br/?>"), false /*case-sensitive*/); + TQRegExp tags(TQString::tqfromLatin1("<.*>")); tags.setMinimal(true); - QString value; + TQString value; for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { PalmLib::FlatFile::Record record; unsigned i = 0; @@ -165,11 +165,11 @@ bool PilotDBExporter::exec() { value = entryIt->field(fIt->name(), format); if(fIt->type() == Data::Field::Date) { - QStringList s = QStringList::split('-', value, true); + TQStringList s = TQStringList::split('-', value, true); bool ok = true; - int y = s.count() > 0 ? s[0].toInt(&ok) : QDate::currentDate().year(); + int y = s.count() > 0 ? s[0].toInt(&ok) : TQDate::tqcurrentDate().year(); if(!ok) { - y = QDate::currentDate().year(); + y = TQDate::tqcurrentDate().year(); } int m = s.count() > 1 ? s[1].toInt(&ok) : 1; if(!ok) { @@ -179,11 +179,11 @@ bool PilotDBExporter::exec() { if(!ok) { d = 1; } - QDate date(y, m, d); - value = date.toString(QString::fromLatin1("yyyy/MM/dd")); + TQDate date(y, m, d); + value = date.toString(TQString::tqfromLatin1("yyyy/MM/dd")); } else if(fIt->type() == Data::Field::Para) { - value.replace(br, QChar('\n')); - value.replace(tags, QString::null); + value.tqreplace(br, TQChar('\n')); + value.tqreplace(tags, TQString()); } // the number of fields in the record must match the number of fields in the database record.appendField(PilotDB::string2field(db.field_type(i), @@ -199,32 +199,32 @@ bool PilotDBExporter::exec() { return FileHandler::writeDataURL(url(), pdb.data(), options() & Export::ExportForce); } -QWidget* PilotDBExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* PilotDBExporter::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("PilotDB Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("PilotDB Options"), m_widget); l->addWidget(box); - m_checkBackup = new QCheckBox(i18n("Set PDA backup flag for database"), box); + m_checkBackup = new TQCheckBox(i18n("Set PDA backup flag for database"), box); m_checkBackup->setChecked(m_backup); - QWhatsThis::add(m_checkBackup, i18n("Set PDA backup flag for database")); + TQWhatsThis::add(m_checkBackup, i18n("Set PDA backup flag for database")); l->addStretch(1); return m_widget; } void PilotDBExporter::readOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_backup = group.readBoolEntry("Backup", m_backup); } void PilotDBExporter::saveOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_backup = m_checkBackup->isChecked(); group.writeEntry("Backup", m_backup); } diff --git a/src/translators/pilotdbexporter.h b/src/translators/pilotdbexporter.h index 13d603b..8b3e4b2 100644 --- a/src/translators/pilotdbexporter.h +++ b/src/translators/pilotdbexporter.h @@ -14,11 +14,11 @@ #ifndef PILOTDBEXPORTER_H #define PILOTDBEXPORTER_H -class QCheckBox; +class TQCheckBox; #include "exporter.h" -#include <qstringlist.h> +#include <tqstringlist.h> namespace Tellico { namespace Export { @@ -28,26 +28,27 @@ namespace Tellico { */ class PilotDBExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: PilotDBExporter(); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); virtual void readOptions(KConfig* cfg); virtual void saveOptions(KConfig* cfg); - void setColumns(const QStringList& columns) { m_columns = columns; } + void setColumns(const TQStringList& columns) { m_columns = columns; } private: bool m_backup; - QWidget* m_widget; - QCheckBox* m_checkBackup; - QStringList m_columns; + TQWidget* m_widget; + TQCheckBox* m_checkBackup; + TQStringList m_columns; }; } // end namespace diff --git a/src/translators/referencerimporter.cpp b/src/translators/referencerimporter.cpp index 32ba251..332bf8c 100644 --- a/src/translators/referencerimporter.cpp +++ b/src/translators/referencerimporter.cpp @@ -21,7 +21,7 @@ using Tellico::Import::ReferencerImporter; ReferencerImporter::ReferencerImporter(const KURL& url_) : XSLTImporter(url_) { - QString xsltFile = locate("appdata", QString::fromLatin1("referencer2tellico.xsl")); + TQString xsltFile = locate("appdata", TQString::tqfromLatin1("referencer2tellico.xsl")); if(!xsltFile.isEmpty()) { KURL u; u.setPath(xsltFile); @@ -41,25 +41,25 @@ Tellico::Data::CollPtr ReferencerImporter::collection() { return 0; } - Data::FieldPtr field = coll->fieldByName(QString::fromLatin1("cover")); + Data::FieldPtr field = coll->fieldByName(TQString::tqfromLatin1("cover")); if(!field && !coll->imageFields().isEmpty()) { field = coll->imageFields().front(); } else if(!field) { - field = new Data::Field(QString::fromLatin1("cover"), i18n("Front Cover"), Data::Field::Image); + field = new Data::Field(TQString::tqfromLatin1("cover"), i18n("Front Cover"), Data::Field::Image); coll->addField(field); } Data::EntryVec entries = coll->entries(); for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { - QString url = entry->field(QString::fromLatin1("url")); + TQString url = entry->field(TQString::tqfromLatin1("url")); if(url.isEmpty()) { continue; } - QPixmap pix = NetAccess::filePreview(url); + TQPixmap pix = NetAccess::filePreview(url); if(pix.isNull()) { continue; } - QString id = ImageFactory::addImage(pix, QString::fromLatin1("PNG")); + TQString id = ImageFactory::addImage(pix, TQString::tqfromLatin1("PNG")); if(id.isEmpty()) { continue; } diff --git a/src/translators/referencerimporter.h b/src/translators/referencerimporter.h index 65cc3a0..9105bd1 100644 --- a/src/translators/referencerimporter.h +++ b/src/translators/referencerimporter.h @@ -25,6 +25,7 @@ namespace Tellico { */ class ReferencerImporter : public XSLTImporter { Q_OBJECT + TQ_OBJECT public: /** @@ -36,7 +37,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } virtual bool canImport(int type) const; private: diff --git a/src/translators/risimporter.cpp b/src/translators/risimporter.cpp index 0420f66..e0a75a3 100644 --- a/src/translators/risimporter.cpp +++ b/src/translators/risimporter.cpp @@ -24,89 +24,89 @@ #include <kapplication.h> -#include <qdict.h> -#include <qregexp.h> -#include <qmap.h> +#include <tqdict.h> +#include <tqregexp.h> +#include <tqmap.h> using Tellico::Import::RISImporter; -QMap<QString, QString>* RISImporter::s_tagMap = 0; -QMap<QString, QString>* RISImporter::s_typeMap = 0; +TQMap<TQString, TQString>* RISImporter::s_tagMap = 0; +TQMap<TQString, TQString>* RISImporter::s_typeMap = 0; // static void RISImporter::initTagMap() { if(!s_tagMap) { - s_tagMap = new QMap<QString, QString>(); + s_tagMap = new TQMap<TQString, TQString>(); // BT is special and is handled separately - s_tagMap->insert(QString::fromLatin1("TY"), QString::fromLatin1("entry-type")); - s_tagMap->insert(QString::fromLatin1("ID"), QString::fromLatin1("bibtex-key")); - s_tagMap->insert(QString::fromLatin1("T1"), QString::fromLatin1("title")); - s_tagMap->insert(QString::fromLatin1("TI"), QString::fromLatin1("title")); - s_tagMap->insert(QString::fromLatin1("T2"), QString::fromLatin1("booktitle")); - s_tagMap->insert(QString::fromLatin1("A1"), QString::fromLatin1("author")); - s_tagMap->insert(QString::fromLatin1("AU"), QString::fromLatin1("author")); - s_tagMap->insert(QString::fromLatin1("ED"), QString::fromLatin1("editor")); - s_tagMap->insert(QString::fromLatin1("YR"), QString::fromLatin1("year")); - s_tagMap->insert(QString::fromLatin1("PY"), QString::fromLatin1("year")); - s_tagMap->insert(QString::fromLatin1("N1"), QString::fromLatin1("note")); - s_tagMap->insert(QString::fromLatin1("AB"), QString::fromLatin1("abstract")); // should be note? - s_tagMap->insert(QString::fromLatin1("N2"), QString::fromLatin1("abstract")); - s_tagMap->insert(QString::fromLatin1("KW"), QString::fromLatin1("keyword")); - s_tagMap->insert(QString::fromLatin1("JF"), QString::fromLatin1("journal")); - s_tagMap->insert(QString::fromLatin1("JO"), QString::fromLatin1("journal")); - s_tagMap->insert(QString::fromLatin1("JA"), QString::fromLatin1("journal")); - s_tagMap->insert(QString::fromLatin1("VL"), QString::fromLatin1("volume")); - s_tagMap->insert(QString::fromLatin1("IS"), QString::fromLatin1("number")); - s_tagMap->insert(QString::fromLatin1("PB"), QString::fromLatin1("publisher")); - s_tagMap->insert(QString::fromLatin1("SN"), QString::fromLatin1("isbn")); - s_tagMap->insert(QString::fromLatin1("AD"), QString::fromLatin1("address")); - s_tagMap->insert(QString::fromLatin1("CY"), QString::fromLatin1("address")); - s_tagMap->insert(QString::fromLatin1("UR"), QString::fromLatin1("url")); - s_tagMap->insert(QString::fromLatin1("L1"), QString::fromLatin1("pdf")); - s_tagMap->insert(QString::fromLatin1("T3"), QString::fromLatin1("series")); - s_tagMap->insert(QString::fromLatin1("EP"), QString::fromLatin1("pages")); + s_tagMap->insert(TQString::tqfromLatin1("TY"), TQString::tqfromLatin1("entry-type")); + s_tagMap->insert(TQString::tqfromLatin1("ID"), TQString::tqfromLatin1("bibtex-key")); + s_tagMap->insert(TQString::tqfromLatin1("T1"), TQString::tqfromLatin1("title")); + s_tagMap->insert(TQString::tqfromLatin1("TI"), TQString::tqfromLatin1("title")); + s_tagMap->insert(TQString::tqfromLatin1("T2"), TQString::tqfromLatin1("booktitle")); + s_tagMap->insert(TQString::tqfromLatin1("A1"), TQString::tqfromLatin1("author")); + s_tagMap->insert(TQString::tqfromLatin1("AU"), TQString::tqfromLatin1("author")); + s_tagMap->insert(TQString::tqfromLatin1("ED"), TQString::tqfromLatin1("editor")); + s_tagMap->insert(TQString::tqfromLatin1("YR"), TQString::tqfromLatin1("year")); + s_tagMap->insert(TQString::tqfromLatin1("PY"), TQString::tqfromLatin1("year")); + s_tagMap->insert(TQString::tqfromLatin1("N1"), TQString::tqfromLatin1("note")); + s_tagMap->insert(TQString::tqfromLatin1("AB"), TQString::tqfromLatin1("abstract")); // should be note? + s_tagMap->insert(TQString::tqfromLatin1("N2"), TQString::tqfromLatin1("abstract")); + s_tagMap->insert(TQString::tqfromLatin1("KW"), TQString::tqfromLatin1("keyword")); + s_tagMap->insert(TQString::tqfromLatin1("JF"), TQString::tqfromLatin1("journal")); + s_tagMap->insert(TQString::tqfromLatin1("JO"), TQString::tqfromLatin1("journal")); + s_tagMap->insert(TQString::tqfromLatin1("JA"), TQString::tqfromLatin1("journal")); + s_tagMap->insert(TQString::tqfromLatin1("VL"), TQString::tqfromLatin1("volume")); + s_tagMap->insert(TQString::tqfromLatin1("IS"), TQString::tqfromLatin1("number")); + s_tagMap->insert(TQString::tqfromLatin1("PB"), TQString::tqfromLatin1("publisher")); + s_tagMap->insert(TQString::tqfromLatin1("SN"), TQString::tqfromLatin1("isbn")); + s_tagMap->insert(TQString::tqfromLatin1("AD"), TQString::tqfromLatin1("address")); + s_tagMap->insert(TQString::tqfromLatin1("CY"), TQString::tqfromLatin1("address")); + s_tagMap->insert(TQString::tqfromLatin1("UR"), TQString::tqfromLatin1("url")); + s_tagMap->insert(TQString::tqfromLatin1("L1"), TQString::tqfromLatin1("pdf")); + s_tagMap->insert(TQString::tqfromLatin1("T3"), TQString::tqfromLatin1("series")); + s_tagMap->insert(TQString::tqfromLatin1("EP"), TQString::tqfromLatin1("pages")); } } // static void RISImporter::initTypeMap() { if(!s_typeMap) { - s_typeMap = new QMap<QString, QString>(); + s_typeMap = new TQMap<TQString, TQString>(); // leave capitalized, except for bibtex types - s_typeMap->insert(QString::fromLatin1("ABST"), QString::fromLatin1("Abstract")); - s_typeMap->insert(QString::fromLatin1("ADVS"), QString::fromLatin1("Audiovisual material")); - s_typeMap->insert(QString::fromLatin1("ART"), QString::fromLatin1("Art Work")); - s_typeMap->insert(QString::fromLatin1("BILL"), QString::fromLatin1("Bill/Resolution")); - s_typeMap->insert(QString::fromLatin1("BOOK"), QString::fromLatin1("book")); // bibtex - s_typeMap->insert(QString::fromLatin1("CASE"), QString::fromLatin1("Case")); - s_typeMap->insert(QString::fromLatin1("CHAP"), QString::fromLatin1("inbook")); // == "inbook" ? - s_typeMap->insert(QString::fromLatin1("COMP"), QString::fromLatin1("Computer program")); - s_typeMap->insert(QString::fromLatin1("CONF"), QString::fromLatin1("inproceedings")); // == "conference" ? - s_typeMap->insert(QString::fromLatin1("CTLG"), QString::fromLatin1("Catalog")); - s_typeMap->insert(QString::fromLatin1("DATA"), QString::fromLatin1("Data file")); - s_typeMap->insert(QString::fromLatin1("ELEC"), QString::fromLatin1("Electronic Citation")); - s_typeMap->insert(QString::fromLatin1("GEN"), QString::fromLatin1("Generic")); - s_typeMap->insert(QString::fromLatin1("HEAR"), QString::fromLatin1("Hearing")); - s_typeMap->insert(QString::fromLatin1("ICOMM"), QString::fromLatin1("Internet Communication")); - s_typeMap->insert(QString::fromLatin1("INPR"), QString::fromLatin1("In Press")); - s_typeMap->insert(QString::fromLatin1("JFULL"), QString::fromLatin1("Journal (full)")); // = "periodical" ? - s_typeMap->insert(QString::fromLatin1("JOUR"), QString::fromLatin1("article")); // "Journal" - s_typeMap->insert(QString::fromLatin1("MAP"), QString::fromLatin1("Map")); - s_typeMap->insert(QString::fromLatin1("MGZN"), QString::fromLatin1("article")); // bibtex - s_typeMap->insert(QString::fromLatin1("MPCT"), QString::fromLatin1("Motion picture")); - s_typeMap->insert(QString::fromLatin1("MUSIC"), QString::fromLatin1("Music score")); - s_typeMap->insert(QString::fromLatin1("NEWS"), QString::fromLatin1("Newspaper")); - s_typeMap->insert(QString::fromLatin1("PAMP"), QString::fromLatin1("Pamphlet")); // = "booklet" ? - s_typeMap->insert(QString::fromLatin1("PAT"), QString::fromLatin1("Patent")); - s_typeMap->insert(QString::fromLatin1("PCOMM"), QString::fromLatin1("Personal communication")); - s_typeMap->insert(QString::fromLatin1("RPRT"), QString::fromLatin1("Report")); // = "techreport" ? - s_typeMap->insert(QString::fromLatin1("SER"), QString::fromLatin1("Serial (BookMonograph)")); - s_typeMap->insert(QString::fromLatin1("SLIDE"), QString::fromLatin1("Slide")); - s_typeMap->insert(QString::fromLatin1("SOUND"), QString::fromLatin1("Sound recording")); - s_typeMap->insert(QString::fromLatin1("STAT"), QString::fromLatin1("Statute")); - s_typeMap->insert(QString::fromLatin1("THES"), QString::fromLatin1("phdthesis")); // "mastersthesis" ? - s_typeMap->insert(QString::fromLatin1("UNBILL"), QString::fromLatin1("Unenacted bill/resolution")); - s_typeMap->insert(QString::fromLatin1("UNPB"), QString::fromLatin1("unpublished")); // bibtex - s_typeMap->insert(QString::fromLatin1("VIDEO"), QString::fromLatin1("Video recording")); + s_typeMap->insert(TQString::tqfromLatin1("ABST"), TQString::tqfromLatin1("Abstract")); + s_typeMap->insert(TQString::tqfromLatin1("ADVS"), TQString::tqfromLatin1("Audiovisual material")); + s_typeMap->insert(TQString::tqfromLatin1("ART"), TQString::tqfromLatin1("Art Work")); + s_typeMap->insert(TQString::tqfromLatin1("BILL"), TQString::tqfromLatin1("Bill/Resolution")); + s_typeMap->insert(TQString::tqfromLatin1("BOOK"), TQString::tqfromLatin1("book")); // bibtex + s_typeMap->insert(TQString::tqfromLatin1("CASE"), TQString::tqfromLatin1("Case")); + s_typeMap->insert(TQString::tqfromLatin1("CHAP"), TQString::tqfromLatin1("inbook")); // == "inbook" ? + s_typeMap->insert(TQString::tqfromLatin1("COMP"), TQString::tqfromLatin1("Computer program")); + s_typeMap->insert(TQString::tqfromLatin1("CONF"), TQString::tqfromLatin1("inproceedings")); // == "conference" ? + s_typeMap->insert(TQString::tqfromLatin1("CTLG"), TQString::tqfromLatin1("Catalog")); + s_typeMap->insert(TQString::tqfromLatin1("DATA"), TQString::tqfromLatin1("Data file")); + s_typeMap->insert(TQString::tqfromLatin1("ELEC"), TQString::tqfromLatin1("Electronic Citation")); + s_typeMap->insert(TQString::tqfromLatin1("GEN"), TQString::tqfromLatin1("Generic")); + s_typeMap->insert(TQString::tqfromLatin1("HEAR"), TQString::tqfromLatin1("Hearing")); + s_typeMap->insert(TQString::tqfromLatin1("ICOMM"), TQString::tqfromLatin1("Internet Communication")); + s_typeMap->insert(TQString::tqfromLatin1("INPR"), TQString::tqfromLatin1("In Press")); + s_typeMap->insert(TQString::tqfromLatin1("JFULL"), TQString::tqfromLatin1("Journal (full)")); // = "periodical" ? + s_typeMap->insert(TQString::tqfromLatin1("JOUR"), TQString::tqfromLatin1("article")); // "Journal" + s_typeMap->insert(TQString::tqfromLatin1("MAP"), TQString::tqfromLatin1("Map")); + s_typeMap->insert(TQString::tqfromLatin1("MGZN"), TQString::tqfromLatin1("article")); // bibtex + s_typeMap->insert(TQString::tqfromLatin1("MPCT"), TQString::tqfromLatin1("Motion picture")); + s_typeMap->insert(TQString::tqfromLatin1("MUSIC"), TQString::tqfromLatin1("Music score")); + s_typeMap->insert(TQString::tqfromLatin1("NEWS"), TQString::tqfromLatin1("Newspaper")); + s_typeMap->insert(TQString::tqfromLatin1("PAMP"), TQString::tqfromLatin1("Pamphlet")); // = "booklet" ? + s_typeMap->insert(TQString::tqfromLatin1("PAT"), TQString::tqfromLatin1("Patent")); + s_typeMap->insert(TQString::tqfromLatin1("PCOMM"), TQString::tqfromLatin1("Personal communication")); + s_typeMap->insert(TQString::tqfromLatin1("RPRT"), TQString::tqfromLatin1("Report")); // = "techreport" ? + s_typeMap->insert(TQString::tqfromLatin1("SER"), TQString::tqfromLatin1("Serial (BookMonograph)")); + s_typeMap->insert(TQString::tqfromLatin1("SLIDE"), TQString::tqfromLatin1("Slide")); + s_typeMap->insert(TQString::tqfromLatin1("SOUND"), TQString::tqfromLatin1("Sound recording")); + s_typeMap->insert(TQString::tqfromLatin1("STAT"), TQString::tqfromLatin1("Statute")); + s_typeMap->insert(TQString::tqfromLatin1("THES"), TQString::tqfromLatin1("phdthesis")); // "mastersthesis" ? + s_typeMap->insert(TQString::tqfromLatin1("UNBILL"), TQString::tqfromLatin1("Unenacted bill/resolution")); + s_typeMap->insert(TQString::tqfromLatin1("UNPB"), TQString::tqfromLatin1("unpublished")); // bibtex + s_typeMap->insert(TQString::tqfromLatin1("VIDEO"), TQString::tqfromLatin1("Video recording")); } } @@ -126,7 +126,7 @@ Tellico::Data::CollPtr RISImporter::collection() { m_coll = new Data::BibtexCollection(true); - QDict<Data::Field> risFields; + TQDict<Data::Field> risFields; // need to know if any extended properties in current collection point to RIS // if so, add to collection @@ -134,7 +134,7 @@ Tellico::Data::CollPtr RISImporter::collection() { Data::FieldVec vec = currColl->fields(); for(Data::FieldVec::Iterator it = vec.begin(); it != vec.end(); ++it) { // continue if property is empty - QString ris = it->property(QString::fromLatin1("ris")); + TQString ris = it->property(TQString::tqfromLatin1("ris")); if(ris.isEmpty()) { continue; } @@ -144,13 +144,13 @@ Tellico::Data::CollPtr RISImporter::collection() { f = new Data::Field(*it); m_coll->addField(f); } - f->setProperty(QString::fromLatin1("ris"), ris); + f->setProperty(TQString::tqfromLatin1("ris"), ris); risFields.insert(ris, f); } ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(urls().count() * 100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); int count = 0; @@ -165,23 +165,23 @@ Tellico::Data::CollPtr RISImporter::collection() { return m_coll; } -void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& risFields_) { - QString str = FileHandler::readTextFile(url_); +void RISImporter::readURL(const KURL& url_, int n, const TQDict<Data::Field>& risFields_) { + TQString str = FileHandler::readTextFile(url_); if(str.isEmpty()) { return; } ISBNValidator isbnval(this); - QTextIStream t(&str); + TQTextIStream t(&str); const uint length = str.length(); - const uint stepSize = QMAX(s_stepSize, length/100); + const uint stepSize = TQMAX(s_stepSize, length/100); const bool showProgress = options() & ImportProgress; bool needToAddFinal = false; - QString sp, ep; + TQString sp, ep; uint j = 0; Data::EntryPtr entry = new Data::Entry(m_coll); @@ -189,19 +189,19 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris // however, at least one website (Springer) outputs RIS with no space after the final "ER -" // so just strip the white space later // also be gracious and allow only any amount of space before hyphen - QRegExp rx(QString::fromLatin1("^(\\w\\w)\\s+-(.*)$")); - QString currLine, nextLine; + TQRegExp rx(TQString::tqfromLatin1("^(\\w\\w)\\s+-(.*)$")); + TQString currLine, nextLine; for(currLine = t.readLine(); !m_cancelled && !currLine.isNull(); currLine = nextLine, j += currLine.length()) { nextLine = t.readLine(); rx.search(currLine); - QString tag = rx.cap(1); - QString value = rx.cap(2).stripWhiteSpace(); + TQString tag = rx.cap(1); + TQString value = rx.cap(2).stripWhiteSpace(); if(tag.isEmpty()) { continue; } // myDebug() << tag << ": " << value << endl; // if the next line is not empty and does not match start regexp, append to value - while(!nextLine.isEmpty() && nextLine.find(rx) == -1) { + while(!nextLine.isEmpty() && nextLine.tqfind(rx) == -1) { value += nextLine.stripWhiteSpace(); nextLine = t.readLine(); } @@ -212,7 +212,7 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris entry = new Data::Entry(m_coll); needToAddFinal = false; continue; - } else if(tag == Latin1Literal("TY") && s_typeMap->contains(value)) { + } else if(tag == Latin1Literal("TY") && s_typeMap->tqcontains(value)) { // for entry-type, switch it to normalized type name value = (*s_typeMap)[value]; } else if(tag == Latin1Literal("SN")) { @@ -225,9 +225,9 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris sp = value; if(!ep.isEmpty()) { value = sp + '-' + ep; - tag = QString::fromLatin1("EP"); - sp = QString(); - ep = QString(); + tag = TQString::tqfromLatin1("EP"); + sp = TQString(); + ep = TQString(); } else { // nothing else to do continue; @@ -236,8 +236,8 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris ep = value; if(!sp.isEmpty()) { value = sp + '-' + ep; - sp = QString(); - ep = QString(); + sp = TQString(); + ep = TQString(); } else { continue; } @@ -248,15 +248,15 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris // the lookup scheme is: // 1. any field has an RIS property that matches the tag name // 2. default field mapping tag -> field name - Data::FieldPtr f = risFields_.find(tag); + Data::FieldPtr f = risFields_.tqfind(tag); if(!f) { // special case for BT // primary title for books, secondary for everything else if(tag == Latin1Literal("BT")) { - if(entry->field(QString::fromLatin1("entry-type")) == Latin1Literal("book")) { - f = m_coll->fieldByName(QString::fromLatin1("title")); + if(entry->field(TQString::tqfromLatin1("entry-type")) == Latin1Literal("book")) { + f = m_coll->fieldByName(TQString::tqfromLatin1("title")); } else { - f = m_coll->fieldByName(QString::fromLatin1("booktitle")); + f = m_coll->fieldByName(TQString::tqfromLatin1("booktitle")); } } else { f = fieldByTag(tag); @@ -272,7 +272,7 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris f->addAllowed(value); // if the field can have multiple values, append current values to new value if((f->flags() & Data::Field::AllowMultiple) && !entry->field(f->name()).isEmpty()) { - value.prepend(entry->field(f->name()) + QString::fromLatin1("; ")); + value.prepend(entry->field(f->name()) + TQString::tqfromLatin1("; ")); } entry->setField(f, value); @@ -287,21 +287,21 @@ void RISImporter::readURL(const KURL& url_, int n, const QDict<Data::Field>& ris } } -Tellico::Data::FieldPtr RISImporter::fieldByTag(const QString& tag_) { +Tellico::Data::FieldPtr RISImporter::fieldByTag(const TQString& tag_) { Data::FieldPtr f = 0; - const QString& fieldTag = (*s_tagMap)[tag_]; + const TQString& fieldTag = (*s_tagMap)[tag_]; if(!fieldTag.isEmpty()) { f = m_coll->fieldByName(fieldTag); if(f) { - f->setProperty(QString::fromLatin1("ris"), tag_); + f->setProperty(TQString::tqfromLatin1("ris"), tag_); return f; } } // add non-default fields if not already there if(tag_== Latin1Literal("L1")) { - f = new Data::Field(QString::fromLatin1("pdf"), i18n("PDF"), Data::Field::URL); - f->setProperty(QString::fromLatin1("ris"), QString::fromLatin1("L1")); + f = new Data::Field(TQString::tqfromLatin1("pdf"), i18n("PDF"), Data::Field::URL); + f->setProperty(TQString::tqfromLatin1("ris"), TQString::tqfromLatin1("L1")); f->setCategory(i18n("Miscellaneous")); } m_coll->addField(f); diff --git a/src/translators/risimporter.h b/src/translators/risimporter.h index c7d08d2..9b5b07b 100644 --- a/src/translators/risimporter.h +++ b/src/translators/risimporter.h @@ -17,11 +17,11 @@ #include "importer.h" #include "../datavectors.h" -#include <qstring.h> -#include <qmap.h> +#include <tqstring.h> +#include <tqmap.h> template<class type> -class QDict; +class TQDict; namespace Tellico { namespace Data { @@ -34,6 +34,7 @@ namespace Tellico { */ class RISImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -46,7 +47,7 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } virtual bool canImport(int type) const; public slots: @@ -56,14 +57,14 @@ private: static void initTagMap(); static void initTypeMap(); - Data::FieldPtr fieldByTag(const QString& tag); - void readURL(const KURL& url, int n, const QDict<Data::Field>& risFields); + Data::FieldPtr fieldByTag(const TQString& tag); + void readURL(const KURL& url, int n, const TQDict<Data::Field>& risFields); Data::CollPtr m_coll; bool m_cancelled; - static QMap<QString, QString>* s_tagMap; - static QMap<QString, QString>* s_typeMap; + static TQMap<TQString, TQString>* s_tagMap; + static TQMap<TQString, TQString>* s_typeMap; }; } // end namespace diff --git a/src/translators/tellico_xml.cpp b/src/translators/tellico_xml.cpp index 8e7ac61..cddae3b 100644 --- a/src/translators/tellico_xml.cpp +++ b/src/translators/tellico_xml.cpp @@ -17,11 +17,11 @@ #include <libxml/parser.h> // has to be before valid.h #include <libxml/valid.h> -#include <qregexp.h> +#include <tqregexp.h> -const QString Tellico::XML::nsXSL = QString::fromLatin1("http://www.w3.org/1999/XSL/Transform"); -const QString Tellico::XML::nsBibtexml = QString::fromLatin1("http://bibtexml.sf.net/"); -const QString Tellico::XML::dtdBibtexml = QString::fromLatin1("bibtexml.dtd"); +const TQString Tellico::XML::nsXSL = TQString::tqfromLatin1("http://www.w3.org/1999/XSL/Transform"); +const TQString Tellico::XML::nsBibtexml = TQString::tqfromLatin1("http://bibtexml.sf.net/"); +const TQString Tellico::XML::dtdBibtexml = TQString::tqfromLatin1("bibtexml.dtd"); /* * VERSION 2 added namespaces, changed to multiple elements, @@ -48,36 +48,36 @@ const QString Tellico::XML::dtdBibtexml = QString::fromLatin1("bibtexml.dtd"); * VERSION 10 added the game board collection. */ const uint Tellico::XML::syntaxVersion = 10; -const QString Tellico::XML::nsTellico = QString::fromLatin1("http://periapsis.org/tellico/"); +const TQString Tellico::XML::nsTellico = TQString::tqfromLatin1("http://periapsis.org/tellico/"); -const QString Tellico::XML::nsBookcase = QString::fromLatin1("http://periapsis.org/bookcase/"); -const QString Tellico::XML::nsDublinCore = QString::fromLatin1("http://purl.org/dc/elements/1.1/"); -const QString Tellico::XML::nsZing = QString::fromLatin1("http://www.loc.gov/zing/srw/"); -const QString Tellico::XML::nsZingDiag = QString::fromLatin1("http://www.loc.gov/zing/srw/diagnostic/"); +const TQString Tellico::XML::nsBookcase = TQString::tqfromLatin1("http://periapsis.org/bookcase/"); +const TQString Tellico::XML::nsDublinCore = TQString::tqfromLatin1("http://purl.org/dc/elements/1.1/"); +const TQString Tellico::XML::nsZing = TQString::tqfromLatin1("http://www.loc.gov/zing/srw/"); +const TQString Tellico::XML::nsZingDiag = TQString::tqfromLatin1("http://www.loc.gov/zing/srw/diagnostic/"); -QString Tellico::XML::pubTellico(int version) { - return QString::fromLatin1("-//Robby Stephenson/DTD Tellico V%1.0//EN").arg(version); +TQString Tellico::XML::pubTellico(int version) { + return TQString::tqfromLatin1("-//Robby Stephenson/DTD Tellico V%1.0//EN").tqarg(version); } -QString Tellico::XML::dtdTellico(int version) { - return QString::fromLatin1("http://periapsis.org/tellico/dtd/v%1/tellico.dtd").arg(version); +TQString Tellico::XML::dtdTellico(int version) { + return TQString::tqfromLatin1("http://periapsis.org/tellico/dtd/v%1/tellico.dtd").tqarg(version); } -bool Tellico::XML::validXMLElementName(const QString& name_) { +bool Tellico::XML::validXMLElementName(const TQString& name_) { return xmlValidateNameValue((xmlChar *)name_.utf8().data()); } -QString Tellico::XML::elementName(const QString& name_) { - QString name = name_; +TQString Tellico::XML::elementName(const TQString& name_) { + TQString name = name_; // change white space to dashes - name.replace(QRegExp(QString::fromLatin1("\\s+")), QString::fromLatin1("-")); + name.tqreplace(TQRegExp(TQString::tqfromLatin1("\\s+")), TQString::tqfromLatin1("-")); // first cut, if it passes, we're done if(XML::validXMLElementName(name)) { return name; } // next check first characters IS_DIGIT is defined in libxml/vali.d - for(uint i = 0; i < name.length() && (!IS_LETTER(name[i].unicode()) || name[i] == '_'); ++i) { + for(uint i = 0; i < name.length() && (!IS_LETTER(name[i].tqunicode()) || name[i] == '_'); ++i) { name = name.mid(1); } if(name.isEmpty() || XML::validXMLElementName(name)) { diff --git a/src/translators/tellico_xml.h b/src/translators/tellico_xml.h index 7c1a3e2..6ff4c1b 100644 --- a/src/translators/tellico_xml.h +++ b/src/translators/tellico_xml.h @@ -14,27 +14,27 @@ #ifndef TELLICO_XML_H #define TELLICO_XML_H -#include <qstring.h> +#include <tqstring.h> namespace Tellico { namespace XML { - extern const QString nsXSL; - extern const QString nsBibtexml; - extern const QString dtdBibtexml; + extern const TQString nsXSL; + extern const TQString nsBibtexml; + extern const TQString dtdBibtexml; extern const uint syntaxVersion; - extern const QString nsTellico; + extern const TQString nsTellico; - QString pubTellico(int version = syntaxVersion); - QString dtdTellico(int version = syntaxVersion); + TQString pubTellico(int version = syntaxVersion); + TQString dtdTellico(int version = syntaxVersion); - extern const QString nsBookcase; - extern const QString nsDublinCore; - extern const QString nsZing; - extern const QString nsZingDiag; + extern const TQString nsBookcase; + extern const TQString nsDublinCore; + extern const TQString nsZing; + extern const TQString nsZingDiag; - bool validXMLElementName(const QString& name); - QString elementName(const QString& name); + bool validXMLElementName(const TQString& name); + TQString elementName(const TQString& name); } } diff --git a/src/translators/tellicoimporter.cpp b/src/translators/tellicoimporter.cpp index cb3c7a3..ae06500 100644 --- a/src/translators/tellicoimporter.cpp +++ b/src/translators/tellicoimporter.cpp @@ -32,10 +32,10 @@ #include <kzip.h> #include <kapplication.h> -#include <qdom.h> -#include <qbuffer.h> -#include <qfile.h> -#include <qtimer.h> +#include <tqdom.h> +#include <tqbuffer.h> +#include <tqfile.h> +#include <tqtimer.h> using Tellico::Import::TellicoImporter; @@ -49,7 +49,7 @@ TellicoImporter::TellicoImporter(const KURL& url_, bool loadAllImages_) : DataIm m_cancelled(false), m_hasImages(false), m_buffer(0), m_zip(0), m_imgDir(0) { } -TellicoImporter::TellicoImporter(const QString& text_) : DataImporter(text_), +TellicoImporter::TellicoImporter(const TQString& text_) : DataImporter(text_), m_coll(0), m_loadAllImages(true), m_format(Unknown), m_modified(false), m_cancelled(false), m_hasImages(false), m_buffer(0), m_zip(0), m_imgDir(0) { } @@ -69,12 +69,12 @@ Tellico::Data::CollPtr TellicoImporter::collection() { return m_coll; } - QCString s; // read first 5 characters + TQCString s; // read first 5 characters if(source() == URL) { if(!fileRef().open()) { return 0; } - QIODevice* f = fileRef().file(); + TQIODevice* f = fileRef().file(); for(uint i = 0; i < 5; ++i) { s += static_cast<char>(f->getch()); } @@ -84,14 +84,14 @@ Tellico::Data::CollPtr TellicoImporter::collection() { m_format = Error; return 0; } - s = QCString(data(), 6); + s = TQCString(data(), 6); } // need to decide if the data is xml text, or a zip file // if the first 5 characters are <?xml then treat it like text if(s[0] == '<' && s[1] == '?' && s[2] == 'x' && s[3] == 'm' && s[4] == 'l') { m_format = XML; - loadXMLData(source() == URL ? fileRef().file()->readAll() : data(), true); + loadXMLData(source() == URL ? TQByteArray(fileRef().file()->readAll()) : TQByteArray(data()), true); } else { m_format = Zip; loadZipData(); @@ -99,38 +99,38 @@ Tellico::Data::CollPtr TellicoImporter::collection() { return m_coll; } -void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { +void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); - QDomDocument dom; - QString errorMsg; + TQDomDocument dom; + TQString errorMsg; int errorLine, errorColumn; if(!dom.setContent(data_, true, &errorMsg, &errorLine, &errorColumn)) { - QString str = i18n(errorLoad).arg(url().fileName()) + QChar('\n'); - str += i18n("There is an XML parsing error in line %1, column %2.").arg(errorLine).arg(errorColumn); - str += QString::fromLatin1("\n"); - str += i18n("The error message from Qt is:"); - str += QString::fromLatin1("\n\t") + errorMsg; + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); + str += i18n("There is an XML parsing error in line %1, column %2.").tqarg(errorLine).tqarg(errorColumn); + str += TQString::tqfromLatin1("\n"); + str += i18n("The error message from TQt is:"); + str += TQString::tqfromLatin1("\n\t") + errorMsg; myDebug() << str << endl; setStatusMessage(str); m_format = Error; return; } - QDomElement root = dom.documentElement(); + TQDomElement root = dom.documentElement(); // the syntax version field name changed from "version" to "syntaxVersion" in version 3 uint syntaxVersion; - if(root.hasAttribute(QString::fromLatin1("syntaxVersion"))) { - syntaxVersion = root.attribute(QString::fromLatin1("syntaxVersion")).toInt(); - } else if (root.hasAttribute(QString::fromLatin1("version"))) { - syntaxVersion = root.attribute(QString::fromLatin1("version")).toInt(); + if(root.hasAttribute(TQString::tqfromLatin1("syntaxVersion"))) { + syntaxVersion = root.attribute(TQString::tqfromLatin1("syntaxVersion")).toInt(); + } else if (root.hasAttribute(TQString::tqfromLatin1("version"))) { + syntaxVersion = root.attribute(TQString::tqfromLatin1("version")).toInt(); } else { if(!url().isEmpty()) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); } m_format = Error; return; @@ -140,7 +140,7 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { if((syntaxVersion > 6 && root.tagName() != Latin1Literal("tellico")) || (syntaxVersion < 7 && root.tagName() != Latin1Literal("bookcase"))) { if(!url().isEmpty()) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); } m_format = Error; return; @@ -148,7 +148,7 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { if(syntaxVersion > XML::syntaxVersion) { if(!url().isEmpty()) { - QString str = i18n(errorLoad).arg(url().fileName()) + QChar('\n'); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); str += i18n("It is from a future version of Tellico."); myDebug() << str << endl; setStatusMessage(str); @@ -159,7 +159,7 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { return; } else if(versionConversion(syntaxVersion, XML::syntaxVersion)) { // going form version 9 to 10, there's no conversion needed - QString str = i18n("Tellico is converting the file to a more recent document format. " + TQString str = i18n("Tellico is converting the file to a more recent document format. " "Information loss may occur if an older version of Tellico is used " "to read this file in the future."); myDebug() << str << endl; @@ -170,8 +170,8 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { m_namespace = syntaxVersion > 6 ? XML::nsTellico : XML::nsBookcase; // the collection item should be the first dom element child of the root - QDomElement collelem; - for(QDomNode n = root.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement collelem; + for(TQDomNode n = root.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.namespaceURI() != m_namespace) { continue; } @@ -185,21 +185,21 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { return; } - QString title = collelem.attribute(QString::fromLatin1("title")); + TQString title = collelem.attribute(TQString::tqfromLatin1("title")); // be careful not to have element name collision // for fields, each true field element is a child of a fields element - QDomNodeList fieldelems; - for(QDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomNodeList fieldelems; + for(TQDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.namespaceURI() != m_namespace) { continue; } // Latin1Literal is a macro, so can't say Latin1Literal(syntaxVersion > 3 ? "fields" : "attributes") if((syntaxVersion > 3 && n.localName() == Latin1Literal("fields")) || (syntaxVersion < 4 && n.localName() == Latin1Literal("attributes"))) { - QDomElement e = n.toElement(); - fieldelems = e.elementsByTagNameNS(m_namespace, (syntaxVersion > 3) ? QString::fromLatin1("field") - : QString::fromLatin1("attribute")); + TQDomElement e = n.toElement(); + fieldelems = e.elementsByTagNameNS(m_namespace, (syntaxVersion > 3) ? TQString::tqfromLatin1("field") + : TQString::tqfromLatin1("attribute")); break; } } @@ -209,26 +209,26 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { // if there are no attributes or if the first one has the special name of _default bool addFields = (fieldelems.count() == 0); if(!addFields) { - QString name = fieldelems.item(0).toElement().attribute(QString::fromLatin1("name")); + TQString name = fieldelems.item(0).toElement().attribute(TQString::tqfromLatin1("name")); addFields = (name == Latin1Literal("_default")); - // removeChild only works for immediate children + // removeChild only works for immediate tqchildren // remove _default field if(addFields) { - fieldelems.item(0).parentNode().removeChild(fieldelems.item(0)); + fieldelems.item(0).tqparentNode().removeChild(fieldelems.item(0)); } } - QString entryName; + TQString entryName; // in syntax 4, the element name was changed to "entry", always, rather than depending on // on the entryName of the collection. A type field was added to the collection element // to specify what type of collection it is. if(syntaxVersion > 3) { - entryName = QString::fromLatin1("entry"); - QString typeStr = collelem.attribute(QString::fromLatin1("type")); + entryName = TQString::tqfromLatin1("entry"); + TQString typeStr = collelem.attribute(TQString::tqfromLatin1("type")); Data::Collection::Type type = static_cast<Data::Collection::Type>(typeStr.toInt()); m_coll = CollectionFactory::collection(type, addFields); } else { - entryName = collelem.attribute(QString::fromLatin1("unit")); + entryName = collelem.attribute(TQString::tqfromLatin1("unit")); m_coll = CollectionFactory::collection(entryName, addFields); } @@ -242,23 +242,23 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { if(m_coll->type() == Data::Collection::Bibtex) { Data::BibtexCollection* c = static_cast<Data::BibtexCollection*>(m_coll.data()); - QDomNodeList macroelems; - for(QDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomNodeList macroelems; + for(TQDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.namespaceURI() != m_namespace) { continue; } if(n.localName() == Latin1Literal("macros")) { - macroelems = n.toElement().elementsByTagNameNS(m_namespace, QString::fromLatin1("macro")); + macroelems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("macro")); break; } } // myDebug() << "TellicoImporter::loadXMLData() - found " << macroelems.count() << " macros" << endl; for(uint j = 0; c && j < macroelems.count(); ++j) { - QDomElement elem = macroelems.item(j).toElement(); - c->addMacro(elem.attribute(QString::fromLatin1("name")), elem.text()); + TQDomElement elem = macroelems.item(j).toElement(); + c->addMacro(elem.attribute(TQString::tqfromLatin1("name")), elem.text()); } - for(QDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { + for(TQDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.namespaceURI() != m_namespace) { continue; } @@ -276,12 +276,12 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { // as a special case, for old book collections with a bibtex-id field, convert to Bibtex if(syntaxVersion < 4 && m_coll->type() == Data::Collection::Book - && m_coll->hasField(QString::fromLatin1("bibtex-id"))) { + && m_coll->hasField(TQString::tqfromLatin1("bibtex-id"))) { m_coll = Data::BibtexCollection::convertBookCollection(m_coll); } const uint count = collelem.childNodes().count(); - const uint stepSize = QMAX(s_stepSize, count/100); + const uint stepSize = TQMAX(s_stepSize, count/100); const bool showProgress = options() & ImportProgress; item.setTotalSteps(count); @@ -289,13 +289,13 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { // have to read images before entries so we can figure out if // linkOnly() is true // m_loadAllImages only pertains to zip files - QDomNodeList imgelems; - for(QDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomNodeList imgelems; + for(TQDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.namespaceURI() != m_namespace) { continue; } if(n.localName() == Latin1Literal("images")) { - imgelems = n.toElement().elementsByTagNameNS(m_namespace, QString::fromLatin1("image")); + imgelems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("image")); break; } } @@ -309,7 +309,7 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { } uint j = 0; - for(QDomNode n = collelem.firstChild(); !n.isNull() && !m_cancelled; n = n.nextSibling(), ++j) { + for(TQDomNode n = collelem.firstChild(); !n.isNull() && !m_cancelled; n = n.nextSibling(), ++j) { if(n.namespaceURI() != m_namespace) { continue; } @@ -332,17 +332,17 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { } // filters and borrowers are at document root level, not collection - for(QDomNode n = root.firstChild(); !n.isNull() && !m_cancelled; n = n.nextSibling()) { + for(TQDomNode n = root.firstChild(); !n.isNull() && !m_cancelled; n = n.nextSibling()) { if(n.namespaceURI() != m_namespace) { continue; } if(n.localName() == Latin1Literal("borrowers")) { - QDomNodeList borrowerElems = n.toElement().elementsByTagNameNS(m_namespace, QString::fromLatin1("borrower")); + TQDomNodeList borrowerElems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("borrower")); for(uint j = 0; j < borrowerElems.count(); ++j) { readBorrower(borrowerElems.item(j).toElement()); } } else if(n.localName() == Latin1Literal("filters")) { - QDomNodeList filterElems = n.toElement().elementsByTagNameNS(m_namespace, QString::fromLatin1("filter")); + TQDomNodeList filterElems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("filter")); for(uint j = 0; j < filterElems.count(); ++j) { readFilter(filterElems.item(j).toElement()); } @@ -359,25 +359,25 @@ void TellicoImporter::loadXMLData(const QByteArray& data_, bool loadImages_) { } } -void TellicoImporter::readField(uint syntaxVersion_, const QDomElement& elem_) { +void TellicoImporter::readField(uint syntaxVersion_, const TQDomElement& elem_) { // special case: if the i18n attribute equals true, then translate the title, description, and category - bool isI18n = elem_.attribute(QString::fromLatin1("i18n")) == Latin1Literal("true"); + bool isI18n = elem_.attribute(TQString::tqfromLatin1("i18n")) == Latin1Literal("true"); - QString name = elem_.attribute(QString::fromLatin1("name"), QString::fromLatin1("unknown")); - QString title = elem_.attribute(QString::fromLatin1("title"), i18n("Unknown")); + TQString name = elem_.attribute(TQString::tqfromLatin1("name"), TQString::tqfromLatin1("unknown")); + TQString title = elem_.attribute(TQString::tqfromLatin1("title"), i18n("Unknown")); if(isI18n) { title = i18n(title.utf8()); } - QString typeStr = elem_.attribute(QString::fromLatin1("type"), QString::number(Data::Field::Line)); + TQString typeStr = elem_.attribute(TQString::tqfromLatin1("type"), TQString::number(Data::Field::Line)); Data::Field::Type type = static_cast<Data::Field::Type>(typeStr.toInt()); Data::FieldPtr field; if(type == Data::Field::Choice) { - QStringList allowed = QStringList::split(QString::fromLatin1(";"), - elem_.attribute(QString::fromLatin1("allowed"))); + TQStringList allowed = TQStringList::split(TQString::tqfromLatin1(";"), + elem_.attribute(TQString::tqfromLatin1("allowed"))); if(isI18n) { - for(QStringList::Iterator it = allowed.begin(); it != allowed.end(); ++it) { + for(TQStringList::Iterator it = allowed.begin(); it != allowed.end(); ++it) { (*it) = i18n((*it).utf8()); } } @@ -386,10 +386,10 @@ void TellicoImporter::readField(uint syntaxVersion_, const QDomElement& elem_) { field = new Data::Field(name, title, type); } - if(elem_.hasAttribute(QString::fromLatin1("category"))) { + if(elem_.hasAttribute(TQString::tqfromLatin1("category"))) { // at one point, the categories had keyboard accels - QString cat = elem_.attribute(QString::fromLatin1("category")); - if(syntaxVersion_ < 9 && cat.find('&') > -1) { + TQString cat = elem_.attribute(TQString::tqfromLatin1("category")); + if(syntaxVersion_ < 9 && cat.tqfind('&') > -1) { cat.remove('&'); } if(isI18n) { @@ -398,8 +398,8 @@ void TellicoImporter::readField(uint syntaxVersion_, const QDomElement& elem_) { field->setCategory(cat); } - if(elem_.hasAttribute(QString::fromLatin1("flags"))) { - int flags = elem_.attribute(QString::fromLatin1("flags")).toInt(); + if(elem_.hasAttribute(TQString::tqfromLatin1("flags"))) { + int flags = elem_.attribute(TQString::tqfromLatin1("flags")).toInt(); // I also changed the enum values for syntax 3, but the only custom field // would have been bibtex-id if(syntaxVersion_ < 3 && field->name() == Latin1Literal("bibtex-id")) { @@ -414,12 +414,12 @@ void TellicoImporter::readField(uint syntaxVersion_, const QDomElement& elem_) { field->setFlags(flags); } - QString formatStr = elem_.attribute(QString::fromLatin1("format"), QString::number(Data::Field::FormatNone)); + TQString formatStr = elem_.attribute(TQString::tqfromLatin1("format"), TQString::number(Data::Field::FormatNone)); Data::Field::FormatFlag format = static_cast<Data::Field::FormatFlag>(formatStr.toInt()); field->setFormatFlag(format); - if(elem_.hasAttribute(QString::fromLatin1("description"))) { - QString desc = elem_.attribute(QString::fromLatin1("description")); + if(elem_.hasAttribute(TQString::tqfromLatin1("description"))) { + TQString desc = elem_.attribute(TQString::tqfromLatin1("description")); if(isI18n) { desc = i18n(desc.utf8()); } @@ -427,42 +427,42 @@ void TellicoImporter::readField(uint syntaxVersion_, const QDomElement& elem_) { } if(syntaxVersion_ >= 5) { - QDomNodeList props = elem_.elementsByTagNameNS(m_namespace, QString::fromLatin1("prop")); + TQDomNodeList props = elem_.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("prop")); for(uint i = 0; i < props.count(); ++i) { - QDomElement e = props.item(i).toElement(); - field->setProperty(e.attribute(QString::fromLatin1("name")), e.text()); + TQDomElement e = props.item(i).toElement(); + field->setProperty(e.attribute(TQString::tqfromLatin1("name")), e.text()); } // all track fields in music collections prior to version 9 get converted to three columns if(syntaxVersion_ < 9) { if(m_coll->type() == Data::Collection::Album && field->name() == Latin1Literal("track")) { - field->setProperty(QString::fromLatin1("columns"), QChar('3')); - field->setProperty(QString::fromLatin1("column1"), i18n("Title")); - field->setProperty(QString::fromLatin1("column2"), i18n("Artist")); - field->setProperty(QString::fromLatin1("column3"), i18n("Length")); + field->setProperty(TQString::tqfromLatin1("columns"), TQChar('3')); + field->setProperty(TQString::tqfromLatin1("column1"), i18n("Title")); + field->setProperty(TQString::tqfromLatin1("column2"), i18n("Artist")); + field->setProperty(TQString::tqfromLatin1("column3"), i18n("Length")); } else if(m_coll->type() == Data::Collection::Video && field->name() == Latin1Literal("cast")) { - field->setProperty(QString::fromLatin1("column1"), i18n("Actor/Actress")); - field->setProperty(QString::fromLatin1("column2"), i18n("Role")); + field->setProperty(TQString::tqfromLatin1("column1"), i18n("Actor/Actress")); + field->setProperty(TQString::tqfromLatin1("column2"), i18n("Role")); } } - } else if(elem_.hasAttribute(QString::fromLatin1("bibtex-field"))) { - field->setProperty(QString::fromLatin1("bibtex"), elem_.attribute(QString::fromLatin1("bibtex-field"))); + } else if(elem_.hasAttribute(TQString::tqfromLatin1("bibtex-field"))) { + field->setProperty(TQString::tqfromLatin1("bibtex"), elem_.attribute(TQString::tqfromLatin1("bibtex-field"))); } // Table2 is deprecated if(field->type() == Data::Field::Table2) { field->setType(Data::Field::Table); - field->setProperty(QString::fromLatin1("columns"), QChar('2')); + field->setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); } // for syntax 8, rating fields got their own type if(syntaxVersion_ < 8) { Data::Field::convertOldRating(field); // does all its own checking } m_coll->addField(field); -// myDebug() << QString(" Added field: %1, %2").arg(field->name()).arg(field->title()) << endl; +// myDebug() << TQString(" Added field: %1, %2").tqarg(field->name()).tqarg(field->title()) << endl; } -void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryElem_) { - const int id = entryElem_.attribute(QString::fromLatin1("id")).toInt(); +void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryElem_) { + const int id = entryElem_.attribute(TQString::tqfromLatin1("id")).toInt(); Data::EntryPtr entry; if(id > 0) { entry = new Data::Entry(m_coll, id); @@ -472,31 +472,31 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle bool oldMusic = (syntaxVersion_ < 9 && m_coll->type() == Data::Collection::Album); - // iterate over all field value children - for(QDomNode node = entryElem_.firstChild(); !node.isNull(); node = node.nextSibling()) { - QDomElement elem = node.toElement(); + // iterate over all field value tqchildren + for(TQDomNode node = entryElem_.firstChild(); !node.isNull(); node = node.nextSibling()) { + TQDomElement elem = node.toElement(); if(elem.isNull()) { continue; } - bool isI18n = elem.attribute(QString::fromLatin1("i18n")) == Latin1Literal("true"); + bool isI18n = elem.attribute(TQString::tqfromLatin1("i18n")) == Latin1Literal("true"); // Entry::setField checks to see if an field of 'name' is allowed // in version 3 and prior, checkbox attributes had no text(), set it to "true" now if(syntaxVersion_ < 4 && elem.text().isEmpty()) { // "true" means checked - entry->setField(elem.localName(), QString::fromLatin1("true")); + entry->setField(elem.localName(), TQString::tqfromLatin1("true")); continue; } - QString name = elem.localName(); + TQString name = elem.localName(); Data::FieldPtr f = m_coll->fieldByName(name); // if the first child of the node is a text node, just set the attribute text - // otherwise, recurse over the node's children + // otherwise, recurse over the node's tqchildren // this is the case for <authors><author>..</author></authors> // but if there's nothing but white space, then it's a BaseNode for some reason -// if(node.firstChild().nodeType() == QDomNode::TextNode) { +// if(node.firstChild().nodeType() == TQDomNode::TextNode) { if(f) { // if it's a derived value, no field value is added if(f->type() == Data::Field::Dependent) { @@ -506,18 +506,18 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle // special case for Date fields if(f->type() == Data::Field::Date) { if(elem.hasChildNodes()) { - QString value; - QDomNode yNode = elem.elementsByTagNameNS(m_namespace, QString::fromLatin1("year")).item(0); + TQString value; + TQDomNode yNode = elem.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("year")).item(0); if(!yNode.isNull()) { value += yNode.toElement().text(); } value += '-'; - QDomNode mNode = elem.elementsByTagNameNS(m_namespace, QString::fromLatin1("month")).item(0); + TQDomNode mNode = elem.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("month")).item(0); if(!mNode.isNull()) { value += mNode.toElement().text(); } value += '-'; - QDomNode dNode = elem.elementsByTagNameNS(m_namespace, QString::fromLatin1("day")).item(0); + TQDomNode dNode = elem.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("day")).item(0); if(!dNode.isNull()) { value += dNode.toElement().text(); } @@ -536,7 +536,7 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle // text // </value // so we arbitrarily decide that only paragraphs get to have CRs? - QString value = elem.text(); + TQString value = elem.text(); if(f->type() != Data::Field::Para) { value = value.stripWhiteSpace(); } @@ -553,7 +553,7 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle // for local files only, allow paths here KURL u = KURL::fromPathOrURL(value); if(u.isValid() && u.isLocalFile()) { - QString result = ImageFactory::addImage(u, false /* quiet */); + TQString result = ImageFactory::addImage(u, false /* quiet */); if(!result.isEmpty()) { value = result; } @@ -567,11 +567,11 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle bool ok; uint i = Tellico::toUInt(value, &ok); if(ok) { - value = QString::number(i); + value = TQString::number(i); } } else if(syntaxVersion_ < 2 && name == Latin1Literal("keywords")) { // in version 2, "keywords" changed to "keyword" - name = QString::fromLatin1("keyword"); + name = TQString::tqfromLatin1("keyword"); } // special case: if the i18n attribute equals true, then translate the title, description, and category if(isI18n) { @@ -580,13 +580,13 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle // special case for isbn fields, go ahead and validate if(name == Latin1Literal("isbn")) { const ISBNValidator val(0); - if(elem.attribute(QString::fromLatin1("validate")) != Latin1Literal("no")) { + if(elem.attribute(TQString::tqfromLatin1("validate")) != Latin1Literal("no")) { val.fixup(value); } } entry->setField(name, value); } - } else { // if no field by the tag name, then it has children, iterate through them + } else { // if no field by the tag name, then it has tqchildren, iterate through them // the field name has the final 's', so remove it name.truncate(name.length() - 1); f = m_coll->fieldByName(name); @@ -598,69 +598,69 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const QDomElement& entryEle const bool oldTracks = (oldMusic && name == Latin1Literal("track")); - QStringList values; + TQStringList values; // concatenate values - for(QDomNode childNode = node.firstChild(); !childNode.isNull(); childNode = childNode.nextSibling()) { - QString value; + for(TQDomNode childNode = node.firstChild(); !childNode.isNull(); childNode = childNode.nextSibling()) { + TQString value; // don't worry about i18n here, Tables are never translated - QDomNodeList cols = childNode.toElement().elementsByTagNameNS(m_namespace, QString::fromLatin1("column")); + TQDomNodeList cols = childNode.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("column")); if(cols.count() > 0) { for(uint i = 0; i < cols.count(); ++i) { // special case for old tracks if(oldTracks && i == 1) { // if the second column holds the track length, bump it to next column - QRegExp rx(QString::fromLatin1("\\d+:\\d\\d")); + TQRegExp rx(TQString::tqfromLatin1("\\d+:\\d\\d")); if(rx.exactMatch(cols.item(i).toElement().text())) { - value += entry->field(QString::fromLatin1("artist")); - value += QString::fromLatin1("::"); + value += entry->field(TQString::tqfromLatin1("artist")); + value += TQString::tqfromLatin1("::"); } } value += cols.item(i).toElement().text().stripWhiteSpace(); if(i < cols.count()-1) { - value += QString::fromLatin1("::"); + value += TQString::tqfromLatin1("::"); } else if(oldTracks && cols.count() == 1) { - value += QString::fromLatin1("::"); - value += entry->field(QString::fromLatin1("artist")); + value += TQString::tqfromLatin1("::"); + value += entry->field(TQString::tqfromLatin1("artist")); } } values += value; } else { // really loose here, we don't even check that the element name // is what we think it is - QString s = childNode.toElement().text().stripWhiteSpace(); + TQString s = childNode.toElement().text().stripWhiteSpace(); if(isI18n && !s.isEmpty()) { value += i18n(s.utf8()); } else { value += s; } if(oldTracks) { - value += QString::fromLatin1("::"); - value += entry->field(QString::fromLatin1("artist")); + value += TQString::tqfromLatin1("::"); + value += entry->field(TQString::tqfromLatin1("artist")); } - if(values.findIndex(value) == -1) { + if(values.tqfindIndex(value) == -1) { values += value; } } } - entry->setField(name, values.join(QString::fromLatin1("; "))); + entry->setField(name, values.join(TQString::tqfromLatin1("; "))); } } // end field value loop m_coll->addEntries(entry); } -void TellicoImporter::readImage(const QDomElement& elem_, bool loadImage_) { - QString format = elem_.attribute(QString::fromLatin1("format")); - const bool link = elem_.attribute(QString::fromLatin1("link")) == Latin1Literal("true"); - QString id = shareString(link ? elem_.attribute(QString::fromLatin1("id")) - : Data::Image::idClean(elem_.attribute(QString::fromLatin1("id")))); +void TellicoImporter::readImage(const TQDomElement& elem_, bool loadImage_) { + TQString format = elem_.attribute(TQString::tqfromLatin1("format")); + const bool link = elem_.attribute(TQString::tqfromLatin1("link")) == Latin1Literal("true"); + TQString id = shareString(link ? elem_.attribute(TQString::tqfromLatin1("id")) + : Data::Image::idClean(elem_.attribute(TQString::tqfromLatin1("id")))); bool readInfo = true; if(loadImage_) { - QByteArray ba; - KCodecs::base64Decode(QCString(elem_.text().latin1()), ba); + TQByteArray ba; + KCodecs::base64Decode(TQCString(elem_.text().latin1()), ba); if(!ba.isEmpty()) { - QString result = ImageFactory::addImage(ba, format, id); + TQString result = ImageFactory::addImage(ba, format, id); if(result.isEmpty()) { myDebug() << "TellicoImporter::readImage(XML) - null image for " << id << endl; } @@ -670,42 +670,42 @@ void TellicoImporter::readImage(const QDomElement& elem_, bool loadImage_) { } if(readInfo) { // a width or height of 0 is ok here - int width = elem_.attribute(QString::fromLatin1("width")).toInt(); - int height = elem_.attribute(QString::fromLatin1("height")).toInt(); + int width = elem_.attribute(TQString::tqfromLatin1("width")).toInt(); + int height = elem_.attribute(TQString::tqfromLatin1("height")).toInt(); Data::ImageInfo info(id, format.latin1(), width, height, link); ImageFactory::cacheImageInfo(info); } } -void TellicoImporter::readFilter(const QDomElement& elem_) { +void TellicoImporter::readFilter(const TQDomElement& elem_) { FilterPtr f = new Filter(Filter::MatchAny); - f->setName(elem_.attribute(QString::fromLatin1("name"))); + f->setName(elem_.attribute(TQString::tqfromLatin1("name"))); - QString match = elem_.attribute(QString::fromLatin1("match")); + TQString match = elem_.attribute(TQString::tqfromLatin1("match")); if(match == Latin1Literal("all")) { f->setMatch(Filter::MatchAll); } - QDomNodeList rules = elem_.elementsByTagNameNS(m_namespace, QString::fromLatin1("rule")); + TQDomNodeList rules = elem_.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("rule")); for(uint i = 0; i < rules.count(); ++i) { - QDomElement e = rules.item(i).toElement(); + TQDomElement e = rules.item(i).toElement(); if(e.isNull()) { continue; } - QString field = e.attribute(QString::fromLatin1("field")); + TQString field = e.attribute(TQString::tqfromLatin1("field")); // empty field means match any of them - QString pattern = e.attribute(QString::fromLatin1("pattern")); + TQString pattern = e.attribute(TQString::tqfromLatin1("pattern")); // empty pattern is bad if(pattern.isEmpty()) { kdWarning() << "TellicoImporter::readFilter() - empty rule!" << endl; continue; } - QString function = e.attribute(QString::fromLatin1("function")).lower(); + TQString function = e.attribute(TQString::tqfromLatin1("function")).lower(); FilterRule::Function func; - if(function == Latin1Literal("contains")) { + if(function == Latin1Literal("tqcontains")) { func = FilterRule::FuncContains; - } else if(function == Latin1Literal("notcontains")) { + } else if(function == Latin1Literal("nottqcontains")) { func = FilterRule::FuncNotContains; } else if(function == Latin1Literal("equals")) { func = FilterRule::FuncEquals; @@ -727,37 +727,37 @@ void TellicoImporter::readFilter(const QDomElement& elem_) { } } -void TellicoImporter::readBorrower(const QDomElement& elem_) { - QString name = elem_.attribute(QString::fromLatin1("name")); - QString uid = elem_.attribute(QString::fromLatin1("uid")); +void TellicoImporter::readBorrower(const TQDomElement& elem_) { + TQString name = elem_.attribute(TQString::tqfromLatin1("name")); + TQString uid = elem_.attribute(TQString::tqfromLatin1("uid")); Data::BorrowerPtr b = new Data::Borrower(name, uid); - QDomNodeList loans = elem_.elementsByTagNameNS(m_namespace, QString::fromLatin1("loan")); + TQDomNodeList loans = elem_.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("loan")); for(uint i = 0; i < loans.count(); ++i) { - QDomElement e = loans.item(i).toElement(); + TQDomElement e = loans.item(i).toElement(); if(e.isNull()) { continue; } - long id = e.attribute(QString::fromLatin1("entryRef")).toLong(); + long id = e.attribute(TQString::tqfromLatin1("entryRef")).toLong(); Data::EntryPtr entry = m_coll->entryById(id); if(!entry) { myDebug() << "TellicoImporter::readBorrower() - no entry with id = " << id << endl; continue; } - QString uid = e.attribute(QString::fromLatin1("uid")); - QDate loanDate, dueDate; - QString s = e.attribute(QString::fromLatin1("loanDate")); + TQString uid = e.attribute(TQString::tqfromLatin1("uid")); + TQDate loanDate, dueDate; + TQString s = e.attribute(TQString::tqfromLatin1("loanDate")); if(!s.isEmpty()) { - loanDate = QDate::fromString(s, Qt::ISODate); + loanDate = TQDate::fromString(s, Qt::ISODate); } - s = e.attribute(QString::fromLatin1("dueDate")); + s = e.attribute(TQString::tqfromLatin1("dueDate")); if(!s.isEmpty()) { - dueDate = QDate::fromString(s, Qt::ISODate); + dueDate = TQDate::fromString(s, Qt::ISODate); } Data::LoanPtr loan = new Data::Loan(entry, loanDate, dueDate, e.text()); loan->setUID(uid); b->addLoan(loan); - s = e.attribute(QString::fromLatin1("calendar")); + s = e.attribute(TQString::tqfromLatin1("calendar")); loan->setInCalendar(s == Latin1Literal("true")); } if(!b->isEmpty()) { @@ -772,11 +772,11 @@ void TellicoImporter::loadZipData() { m_buffer = 0; m_zip = new KZip(fileRef().fileName()); } else { - m_buffer = new QBuffer(data()); - m_zip = new KZip(m_buffer); + m_buffer = new TQBuffer(data()); + m_zip = new KZip(TQT_TQIODEVICE(m_buffer)); } if(!m_zip->open(IO_ReadOnly)) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); m_format = Error; delete m_zip; m_zip = 0; @@ -787,7 +787,7 @@ void TellicoImporter::loadZipData() { const KArchiveDirectory* dir = m_zip->directory(); if(!dir) { - QString str = i18n(errorLoad).arg(url().fileName()) + QChar('\n'); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); str += i18n("The file is empty."); setStatusMessage(str); m_format = Error; @@ -800,12 +800,12 @@ void TellicoImporter::loadZipData() { } // main file was changed from bookcase.xml to tellico.xml as of version 0.13 - const KArchiveEntry* entry = dir->entry(QString::fromLatin1("tellico.xml")); + const KArchiveEntry* entry = dir->entry(TQString::tqfromLatin1("tellico.xml")); if(!entry) { - entry = dir->entry(QString::fromLatin1("bookcase.xml")); + entry = dir->entry(TQString::tqfromLatin1("bookcase.xml")); } if(!entry || !entry->isFile()) { - QString str = i18n(errorLoad).arg(url().fileName()) + QChar('\n'); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); str += i18n("The file contains no collection data."); setStatusMessage(str); m_format = Error; @@ -817,7 +817,7 @@ void TellicoImporter::loadZipData() { return; } - const QByteArray xmlData = static_cast<const KArchiveFile*>(entry)->data(); + const TQByteArray xmlData = static_cast<const KArchiveFile*>(entry)->data(); loadXMLData(xmlData, false); if(!m_coll) { m_format = Error; @@ -838,7 +838,7 @@ void TellicoImporter::loadZipData() { return; } - const KArchiveEntry* imgDirEntry = dir->entry(QString::fromLatin1("images")); + const KArchiveEntry* imgDirEntry = dir->entry(TQString::tqfromLatin1("images")); if(!imgDirEntry || !imgDirEntry->isDirectory()) { m_zip->close(); delete m_zip; @@ -858,11 +858,11 @@ void TellicoImporter::loadZipData() { return; } - const QStringList images = static_cast<const KArchiveDirectory*>(imgDirEntry)->entries(); - const uint stepSize = QMAX(s_stepSize, images.count()/100); + const TQStringList images = static_cast<const KArchiveDirectory*>(imgDirEntry)->entries(); + const uint stepSize = TQMAX(s_stepSize, images.count()/100); uint j = 0; - for(QStringList::ConstIterator it = images.begin(); !m_cancelled && it != images.end(); ++it, ++j) { + for(TQStringList::ConstIterator it = images.begin(); !m_cancelled && it != images.end(); ++it, ++j) { const KArchiveEntry* file = m_imgDir->entry(*it); if(file && file->isFile()) { ImageFactory::addImage(static_cast<const KArchiveFile*>(file)->data(), @@ -876,11 +876,11 @@ void TellicoImporter::loadZipData() { if(m_images.isEmpty()) { // give it some time - QTimer::singleShot(3000, this, SLOT(deleteLater())); + TQTimer::singleShot(3000, this, TQT_SLOT(deleteLater())); } } -bool TellicoImporter::loadImage(const QString& id_) { +bool TellicoImporter::loadImage(const TQString& id_) { // myLog() << "TellicoImporter::loadImage() - id = " << id_ << endl; if(m_format != Zip || !m_imgDir) { return false; @@ -889,12 +889,12 @@ bool TellicoImporter::loadImage(const QString& id_) { if(!file || !file->isFile()) { return false; } - QString newID = ImageFactory::addImage(static_cast<const KArchiveFile*>(file)->data(), + TQString newID = ImageFactory::addImage(static_cast<const KArchiveFile*>(file)->data(), id_.section('.', -1).upper(), id_); m_images.remove(id_); if(m_images.isEmpty()) { // give it some time - QTimer::singleShot(3000, this, SLOT(deleteLater())); + TQTimer::singleShot(3000, this, TQT_SLOT(deleteLater())); } return !newID.isEmpty(); } @@ -913,7 +913,7 @@ bool TellicoImporter::loadAllImages(const KURL& url_) { KZip zip(url_.path()); if(!zip.open(IO_ReadOnly)) { if(u != url_) { - Kernel::self()->sorry(i18n(errorImageLoad).arg(url_.fileName())); + Kernel::self()->sorry(i18n(errorImageLoad).tqarg(url_.fileName())); } u = url_; return false; @@ -922,20 +922,20 @@ bool TellicoImporter::loadAllImages(const KURL& url_) { const KArchiveDirectory* dir = zip.directory(); if(!dir) { if(u != url_) { - Kernel::self()->sorry(i18n(errorImageLoad).arg(url_.fileName())); + Kernel::self()->sorry(i18n(errorImageLoad).tqarg(url_.fileName())); } u = url_; zip.close(); return false; } - const KArchiveEntry* imgDirEntry = dir->entry(QString::fromLatin1("images")); + const KArchiveEntry* imgDirEntry = dir->entry(TQString::tqfromLatin1("images")); if(!imgDirEntry || !imgDirEntry->isDirectory()) { zip.close(); return false; } - const QStringList images = static_cast<const KArchiveDirectory*>(imgDirEntry)->entries(); - for(QStringList::ConstIterator it = images.begin(); it != images.end(); ++it) { + const TQStringList images = static_cast<const KArchiveDirectory*>(imgDirEntry)->entries(); + for(TQStringList::ConstIterator it = images.begin(); it != images.end(); ++it) { const KArchiveEntry* file = static_cast<const KArchiveDirectory*>(imgDirEntry)->entry(*it); if(file && file->isFile()) { ImageFactory::addImage(static_cast<const KArchiveFile*>(file)->data(), @@ -949,38 +949,38 @@ bool TellicoImporter::loadAllImages(const KURL& url_) { void TellicoImporter::addDefaultFilters() { switch(m_coll->type()) { case Data::Collection::Book: - if(m_coll->hasField(QString::fromLatin1("read"))) { + if(m_coll->hasField(TQString::tqfromLatin1("read"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("Unread Books")); - f->append(new FilterRule(QString::fromLatin1("read"), QString::fromLatin1("true"), FilterRule::FuncNotContains)); + f->append(new FilterRule(TQString::tqfromLatin1("read"), TQString::tqfromLatin1("true"), FilterRule::FuncNotContains)); m_coll->addFilter(f); m_modified = true; } break; case Data::Collection::Video: - if(m_coll->hasField(QString::fromLatin1("year"))) { + if(m_coll->hasField(TQString::tqfromLatin1("year"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("Old Movies")); // old movies from before 1960 - f->append(new FilterRule(QString::fromLatin1("year"), QString::fromLatin1("19[012345]\\d"), FilterRule::FuncRegExp)); + f->append(new FilterRule(TQString::tqfromLatin1("year"), TQString::tqfromLatin1("19[012345]\\d"), FilterRule::FuncRegExp)); m_coll->addFilter(f); m_modified = true; } - if(m_coll->hasField(QString::fromLatin1("widescreen"))) { + if(m_coll->hasField(TQString::tqfromLatin1("widescreen"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("Widescreen")); - f->append(new FilterRule(QString::fromLatin1("widescreen"), QString::fromLatin1("true"), FilterRule::FuncContains)); + f->append(new FilterRule(TQString::tqfromLatin1("widescreen"), TQString::tqfromLatin1("true"), FilterRule::FuncContains)); m_coll->addFilter(f); m_modified = true; } break; case Data::Collection::Album: - if(m_coll->hasField(QString::fromLatin1("year"))) { + if(m_coll->hasField(TQString::tqfromLatin1("year"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("80's Music")); - f->append(new FilterRule(QString::fromLatin1("year"), QString::fromLatin1("198\\d"),FilterRule::FuncRegExp)); + f->append(new FilterRule(TQString::tqfromLatin1("year"), TQString::tqfromLatin1("198\\d"),FilterRule::FuncRegExp)); m_coll->addFilter(f); m_modified = true; } @@ -989,22 +989,22 @@ void TellicoImporter::addDefaultFilters() { default: break; } - if(m_coll->hasField(QString::fromLatin1("rating"))) { + if(m_coll->hasField(TQString::tqfromLatin1("rating"))) { FilterPtr filter = new Filter(Filter::MatchAny); filter->setName(i18n("Favorites")); // check all the numbers, and use top 20% or so - Data::FieldPtr field = m_coll->fieldByName(QString::fromLatin1("rating")); + Data::FieldPtr field = m_coll->fieldByName(TQString::tqfromLatin1("rating")); bool ok; - uint min = Tellico::toUInt(field->property(QString::fromLatin1("minimum")), &ok); + uint min = Tellico::toUInt(field->property(TQString::tqfromLatin1("minimum")), &ok); if(!ok) { min = 1; } - uint max = Tellico::toUInt(field->property(QString::fromLatin1("maximum")), &ok); + uint max = Tellico::toUInt(field->property(TQString::tqfromLatin1("maximum")), &ok); if(!ok) { min = 5; } - for(uint i = QMAX(min, static_cast<uint>(0.8*(max-min+1))); i <= max; ++i) { - filter->append(new FilterRule(QString::fromLatin1("rating"), QString::number(i), FilterRule::FuncContains)); + for(uint i = TQMAX(min, static_cast<uint>(0.8*(max-min+1))); i <= max; ++i) { + filter->append(new FilterRule(TQString::tqfromLatin1("rating"), TQString::number(i), FilterRule::FuncContains)); } if(!filter->isEmpty()) { m_coll->addFilter(filter); diff --git a/src/translators/tellicoimporter.h b/src/translators/tellicoimporter.h index d4c6e13..a794c8a 100644 --- a/src/translators/tellicoimporter.h +++ b/src/translators/tellicoimporter.h @@ -14,7 +14,7 @@ #ifndef TELLICO_IMPORTER_H #define TELLICO_IMPORTER_H -class QBuffer; +class TQBuffer; class KZip; class KArchiveDirectory; @@ -22,7 +22,7 @@ class KArchiveDirectory; #include "../datavectors.h" #include "../stringset.h" -class QDomElement; +class TQDomElement; namespace Tellico { namespace Import { @@ -34,6 +34,7 @@ namespace Tellico { */ class TellicoImporter : public DataImporter { Q_OBJECT + TQ_OBJECT public: enum Format { Unknown, Error, XML, Zip, Cancel }; @@ -47,7 +48,7 @@ public: * * @param text The text */ - TellicoImporter(const QString& text); + TellicoImporter(const TQString& text); virtual ~TellicoImporter(); /** @@ -61,7 +62,7 @@ public: Format format() const { return m_format; } bool hasImages() const { return m_hasImages; } - bool loadImage(const QString& id_); + bool loadImage(const TQString& id_); static bool loadAllImages(const KURL& url); @@ -71,26 +72,26 @@ public slots: private: static bool versionConversion(uint from, uint to); - void loadXMLData(const QByteArray& data, bool loadImages); + void loadXMLData(const TQByteArray& data, bool loadImages); void loadZipData(); - void readField(uint syntaxVersion, const QDomElement& elem); - void readEntry(uint syntaxVersion, const QDomElement& elem); - void readImage(const QDomElement& elem, bool loadImage); - void readFilter(const QDomElement& elem); - void readBorrower(const QDomElement& elem); + void readField(uint syntaxVersion, const TQDomElement& elem); + void readEntry(uint syntaxVersion, const TQDomElement& elem); + void readImage(const TQDomElement& elem, bool loadImage); + void readFilter(const TQDomElement& elem); + void readBorrower(const TQDomElement& elem); void addDefaultFilters(); Data::CollPtr m_coll; bool m_loadAllImages; - QString m_namespace; + TQString m_namespace; Format m_format; bool m_modified : 1; bool m_cancelled : 1; bool m_hasImages : 1; StringSet m_images; - QBuffer* m_buffer; + TQBuffer* m_buffer; KZip* m_zip; const KArchiveDirectory* m_imgDir; }; diff --git a/src/translators/tellicoxmlexporter.cpp b/src/translators/tellicoxmlexporter.cpp index 6335ed1..397366b 100644 --- a/src/translators/tellicoxmlexporter.cpp +++ b/src/translators/tellicoxmlexporter.cpp @@ -33,12 +33,12 @@ #include <kglobal.h> #include <kcalendarsystem.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qcheckbox.h> -#include <qwhatsthis.h> -#include <qdom.h> -#include <qtextcodec.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqcheckbox.h> +#include <tqwhatsthis.h> +#include <tqdom.h> +#include <tqtextcodec.h> using Tellico::Export::TellicoXMLExporter; @@ -52,16 +52,16 @@ TellicoXMLExporter::TellicoXMLExporter(Data::CollPtr coll) : Exporter(coll), setOptions(options() | Export::ExportImages | Export::ExportImageSize); // not included by default } -QString TellicoXMLExporter::formatString() const { +TQString TellicoXMLExporter::formatString() const { return i18n("XML"); } -QString TellicoXMLExporter::fileFilter() const { - return i18n("*.xml|XML Files (*.xml)") + QChar('\n') + i18n("*|All Files"); +TQString TellicoXMLExporter::fileFilter() const { + return i18n("*.xml|XML Files (*.xml)") + TQChar('\n') + i18n("*|All Files"); } bool TellicoXMLExporter::exec() { - QDomDocument doc = exportXML(); + TQDomDocument doc = exportXML(); if(doc.isNull()) { return false; } @@ -70,37 +70,37 @@ bool TellicoXMLExporter::exec() { options() & Export::ExportForce); } -QDomDocument TellicoXMLExporter::exportXML() const { +TQDomDocument TellicoXMLExporter::exportXML() const { // don't be hard on people with older versions. The only difference with DTD 10 was adding // a board game collection, so use 9 still unless it's a board game int exportVersion = (XML::syntaxVersion == 10 && collection()->type() != Data::Collection::BoardGame) ? 9 : XML::syntaxVersion; - QDomImplementation impl; - QDomDocumentType doctype = impl.createDocumentType(QString::fromLatin1("tellico"), + TQDomImplementation impl; + TQDomDocumentType doctype = impl.createDocumentType(TQString::tqfromLatin1("tellico"), XML::pubTellico(exportVersion), XML::dtdTellico(exportVersion)); //default namespace - const QString& ns = XML::nsTellico; + const TQString& ns = XML::nsTellico; - QDomDocument dom = impl.createDocument(ns, QString::fromLatin1("tellico"), doctype); + TQDomDocument dom = impl.createDocument(ns, TQString::tqfromLatin1("tellico"), doctype); // root tellico element - QDomElement root = dom.documentElement(); + TQDomElement root = dom.documentElement(); - QString encodeStr = QString::fromLatin1("version=\"1.0\" encoding=\""); + TQString encodeStr = TQString::tqfromLatin1("version=\"1.0\" encoding=\""); if(options() & Export::ExportUTF8) { - encodeStr += QString::fromLatin1("UTF-8"); + encodeStr += TQString::tqfromLatin1("UTF-8"); } else { - encodeStr += QString::fromLatin1(QTextCodec::codecForLocale()->mimeName()); + encodeStr += TQString::tqfromLatin1(TQTextCodec::codecForLocale()->mimeName()); } - encodeStr += QChar('"'); + encodeStr += TQChar('"'); // createDocument creates a root node, insert the processing instruction before it - dom.insertBefore(dom.createProcessingInstruction(QString::fromLatin1("xml"), encodeStr), root); + dom.insertBefore(dom.createProcessingInstruction(TQString::tqfromLatin1("xml"), encodeStr), root); - root.setAttribute(QString::fromLatin1("syntaxVersion"), exportVersion); + root.setAttribute(TQString::tqfromLatin1("syntaxVersion"), exportVersion); exportCollectionXML(dom, root, options() & Export::ExportFormatted); @@ -110,22 +110,22 @@ QDomDocument TellicoXMLExporter::exportXML() const { return dom; } -QString TellicoXMLExporter::exportXMLString() const { +TQString TellicoXMLExporter::exportXMLString() const { return exportXML().toString(); } -void TellicoXMLExporter::exportCollectionXML(QDomDocument& dom_, QDomElement& parent_, bool format_) const { +void TellicoXMLExporter::exportCollectionXML(TQDomDocument& dom_, TQDomElement& tqparent_, bool format_) const { Data::CollPtr coll = collection(); if(!coll) { kdWarning() << "TellicoXMLExporter::exportCollectionXML() - no collection pointer!" << endl; return; } - QDomElement collElem = dom_.createElement(QString::fromLatin1("collection")); - collElem.setAttribute(QString::fromLatin1("type"), coll->type()); - collElem.setAttribute(QString::fromLatin1("title"), coll->title()); + TQDomElement collElem = dom_.createElement(TQString::tqfromLatin1("collection")); + collElem.setAttribute(TQString::tqfromLatin1("type"), coll->type()); + collElem.setAttribute(TQString::tqfromLatin1("title"), coll->title()); - QDomElement fieldsElem = dom_.createElement(QString::fromLatin1("fields")); + TQDomElement fieldsElem = dom_.createElement(TQString::tqfromLatin1("fields")); collElem.appendChild(fieldsElem); Data::FieldVec fields = coll->fields(); @@ -136,16 +136,16 @@ void TellicoXMLExporter::exportCollectionXML(QDomDocument& dom_, QDomElement& pa if(coll->type() == Data::Collection::Bibtex) { const Data::BibtexCollection* c = static_cast<const Data::BibtexCollection*>(coll.data()); if(!c->preamble().isEmpty()) { - QDomElement preElem = dom_.createElement(QString::fromLatin1("bibtex-preamble")); + TQDomElement preElem = dom_.createElement(TQString::tqfromLatin1("bibtex-preamble")); preElem.appendChild(dom_.createTextNode(c->preamble())); collElem.appendChild(preElem); } - QDomElement macrosElem = dom_.createElement(QString::fromLatin1("macros")); + TQDomElement macrosElem = dom_.createElement(TQString::tqfromLatin1("macros")); for(StringMap::ConstIterator macroIt = c->macroList().constBegin(); macroIt != c->macroList().constEnd(); ++macroIt) { if(!macroIt.data().isEmpty()) { - QDomElement macroElem = dom_.createElement(QString::fromLatin1("macro")); - macroElem.setAttribute(QString::fromLatin1("name"), macroIt.key()); + TQDomElement macroElem = dom_.createElement(TQString::tqfromLatin1("macro")); + macroElem.setAttribute(TQString::tqfromLatin1("name"), macroIt.key()); macroElem.appendChild(dom_.createTextNode(macroIt.data())); macrosElem.appendChild(macroElem); } @@ -161,10 +161,10 @@ void TellicoXMLExporter::exportCollectionXML(QDomDocument& dom_, QDomElement& pa } if(!m_images.isEmpty() && (options() & Export::ExportImages)) { - QDomElement imgsElem = dom_.createElement(QString::fromLatin1("images")); + TQDomElement imgsElem = dom_.createElement(TQString::tqfromLatin1("images")); collElem.appendChild(imgsElem); - const QStringList imageIds = m_images.toList(); - for(QStringList::ConstIterator it = imageIds.begin(); it != imageIds.end(); ++it) { + const TQStringList imageIds = m_images.toList(); + for(TQStringList::ConstIterator it = imageIds.begin(); it != imageIds.end(); ++it) { exportImageXML(dom_, imgsElem, *it); } } @@ -173,74 +173,74 @@ void TellicoXMLExporter::exportCollectionXML(QDomDocument& dom_, QDomElement& pa exportGroupXML(dom_, collElem); } - parent_.appendChild(collElem); + tqparent_.appendChild(collElem); // the borrowers and filters are in the tellico object, not the collection if(options() & Export::ExportComplete) { - QDomElement bElem = dom_.createElement(QString::fromLatin1("borrowers")); + TQDomElement bElem = dom_.createElement(TQString::tqfromLatin1("borrowers")); Data::BorrowerVec borrowers = coll->borrowers(); for(Data::BorrowerVec::Iterator bIt = borrowers.begin(); bIt != borrowers.end(); ++bIt) { exportBorrowerXML(dom_, bElem, bIt); } if(bElem.hasChildNodes()) { - parent_.appendChild(bElem); + tqparent_.appendChild(bElem); } - QDomElement fElem = dom_.createElement(QString::fromLatin1("filters")); + TQDomElement fElem = dom_.createElement(TQString::tqfromLatin1("filters")); FilterVec filters = coll->filters(); for(FilterVec::Iterator fIt = filters.begin(); fIt != filters.end(); ++fIt) { exportFilterXML(dom_, fElem, fIt); } if(fElem.hasChildNodes()) { - parent_.appendChild(fElem); + tqparent_.appendChild(fElem); } } } -void TellicoXMLExporter::exportFieldXML(QDomDocument& dom_, QDomElement& parent_, Data::FieldPtr field_) const { - QDomElement elem = dom_.createElement(QString::fromLatin1("field")); +void TellicoXMLExporter::exportFieldXML(TQDomDocument& dom_, TQDomElement& tqparent_, Data::FieldPtr field_) const { + TQDomElement elem = dom_.createElement(TQString::tqfromLatin1("field")); - elem.setAttribute(QString::fromLatin1("name"), field_->name()); - elem.setAttribute(QString::fromLatin1("title"), field_->title()); - elem.setAttribute(QString::fromLatin1("category"), field_->category()); - elem.setAttribute(QString::fromLatin1("type"), field_->type()); - elem.setAttribute(QString::fromLatin1("flags"), field_->flags()); - elem.setAttribute(QString::fromLatin1("format"), field_->formatFlag()); + elem.setAttribute(TQString::tqfromLatin1("name"), field_->name()); + elem.setAttribute(TQString::tqfromLatin1("title"), field_->title()); + elem.setAttribute(TQString::tqfromLatin1("category"), field_->category()); + elem.setAttribute(TQString::tqfromLatin1("type"), field_->type()); + elem.setAttribute(TQString::tqfromLatin1("flags"), field_->flags()); + elem.setAttribute(TQString::tqfromLatin1("format"), field_->formatFlag()); if(field_->type() == Data::Field::Choice) { - elem.setAttribute(QString::fromLatin1("allowed"), field_->allowed().join(QString::fromLatin1(";"))); + elem.setAttribute(TQString::tqfromLatin1("allowed"), field_->allowed().join(TQString::tqfromLatin1(";"))); } // only save description if it's not equal to title, which is the default // title is never empty, so this indirectly checks for empty descriptions if(field_->description() != field_->title()) { - elem.setAttribute(QString::fromLatin1("description"), field_->description()); + elem.setAttribute(TQString::tqfromLatin1("description"), field_->description()); } for(StringMap::ConstIterator it = field_->propertyList().begin(); it != field_->propertyList().end(); ++it) { if(it.data().isEmpty()) { continue; } - QDomElement e = dom_.createElement(QString::fromLatin1("prop")); - e.setAttribute(QString::fromLatin1("name"), it.key()); + TQDomElement e = dom_.createElement(TQString::tqfromLatin1("prop")); + e.setAttribute(TQString::tqfromLatin1("name"), it.key()); e.appendChild(dom_.createTextNode(it.data())); elem.appendChild(e); } - parent_.appendChild(elem); + tqparent_.appendChild(elem); } -void TellicoXMLExporter::exportEntryXML(QDomDocument& dom_, QDomElement& parent_, Data::EntryPtr entry_, bool format_) const { - QDomElement entryElem = dom_.createElement(QString::fromLatin1("entry")); - entryElem.setAttribute(QString::fromLatin1("id"), entry_->id()); +void TellicoXMLExporter::exportEntryXML(TQDomDocument& dom_, TQDomElement& tqparent_, Data::EntryPtr entry_, bool format_) const { + TQDomElement entryElem = dom_.createElement(TQString::tqfromLatin1("entry")); + entryElem.setAttribute(TQString::tqfromLatin1("id"), entry_->id()); // iterate through every field for the entry Data::FieldVec fields = entry_->collection()->fields(); for(Data::FieldVec::Iterator fIt = fields.begin(); fIt != fields.end(); ++fIt) { - QString fieldName = fIt->name(); + TQString fieldName = fIt->name(); // Date fields are special, don't format in export - QString fieldValue = (format_ && fIt->type() != Data::Field::Date) ? entry_->formattedField(fieldName) + TQString fieldValue = (format_ && fIt->type() != Data::Field::Date) ? entry_->formattedField(fieldName) : entry_->field(fieldName); if(options() & ExportClean) { BibtexHandler::cleanText(fieldValue); @@ -262,30 +262,30 @@ void TellicoXMLExporter::exportEntryXML(QDomDocument& dom_, QDomElement& parent_ // if multiple versions are allowed, split them into separate elements if(fIt->flags() & Data::Field::AllowMultiple) { - // parent element if field contains multiple values, child of entryElem + // tqparent element if field contains multiple values, child of entryElem // who cares about grammar, just add an 's' to the name - QDomElement parElem = dom_.createElement(fieldName + 's'); + TQDomElement parElem = dom_.createElement(fieldName + 's'); entryElem.appendChild(parElem); // the space after the semi-colon is enforced when the field is set for the entry - QStringList fields = QStringList::split(QString::fromLatin1("; "), fieldValue, true); - for(QStringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) { + TQStringList fields = TQStringList::split(TQString::tqfromLatin1("; "), fieldValue, true); + for(TQStringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) { // element for field value, child of either entryElem or ParentElem - QDomElement fieldElem = dom_.createElement(fieldName); + TQDomElement fieldElem = dom_.createElement(fieldName); // special case for multi-column tables int ncols = 0; if(fIt->type() == Data::Field::Table) { bool ok; - ncols = Tellico::toUInt(fIt->property(QString::fromLatin1("columns")), &ok); + ncols = Tellico::toUInt(fIt->property(TQString::tqfromLatin1("columns")), &ok); if(!ok) { ncols = 1; } } if(ncols > 1) { for(int col = 0; col < ncols; ++col) { - QDomElement elem; - elem = dom_.createElement(QString::fromLatin1("column")); - elem.appendChild(dom_.createTextNode((*it).section(QString::fromLatin1("::"), col, col))); + TQDomElement elem; + elem = dom_.createElement(TQString::tqfromLatin1("column")); + elem.appendChild(dom_.createTextNode((*it).section(TQString::tqfromLatin1("::"), col, col))); fieldElem.appendChild(elem); } } else { @@ -294,29 +294,29 @@ void TellicoXMLExporter::exportEntryXML(QDomDocument& dom_, QDomElement& parent_ parElem.appendChild(fieldElem); } } else { - QDomElement fieldElem = dom_.createElement(fieldName); + TQDomElement fieldElem = dom_.createElement(fieldName); entryElem.appendChild(fieldElem); // Date fields get special treatment if(fIt->type() == Data::Field::Date) { - fieldElem.setAttribute(QString::fromLatin1("calendar"), KGlobal::locale()->calendar()->calendarName()); - QStringList s = QStringList::split('-', fieldValue, true); + fieldElem.setAttribute(TQString::tqfromLatin1("calendar"), KGlobal::locale()->calendar()->calendarName()); + TQStringList s = TQStringList::split('-', fieldValue, true); if(s.count() > 0 && !s[0].isEmpty()) { - QDomElement e = dom_.createElement(QString::fromLatin1("year")); + TQDomElement e = dom_.createElement(TQString::tqfromLatin1("year")); fieldElem.appendChild(e); e.appendChild(dom_.createTextNode(s[0])); } if(s.count() > 1 && !s[1].isEmpty()) { - QDomElement e = dom_.createElement(QString::fromLatin1("month")); + TQDomElement e = dom_.createElement(TQString::tqfromLatin1("month")); fieldElem.appendChild(e); e.appendChild(dom_.createTextNode(s[1])); } if(s.count() > 2 && !s[2].isEmpty()) { - QDomElement e = dom_.createElement(QString::fromLatin1("day")); + TQDomElement e = dom_.createElement(TQString::tqfromLatin1("day")); fieldElem.appendChild(e); e.appendChild(dom_.createTextNode(s[2])); } } else if(fIt->type() == Data::Field::URL && - fIt->property(QString::fromLatin1("relative")) == Latin1Literal("true") && + fIt->property(TQString::tqfromLatin1("relative")) == Latin1Literal("true") && !url().isEmpty()) { // if a relative URL and url() is not empty, change the value! KURL old_url(Kernel::self()->URL(), fieldValue); @@ -333,105 +333,105 @@ void TellicoXMLExporter::exportEntryXML(QDomDocument& dom_, QDomElement& parent_ } } // end field loop - parent_.appendChild(entryElem); + tqparent_.appendChild(entryElem); } -void TellicoXMLExporter::exportImageXML(QDomDocument& dom_, QDomElement& parent_, const QString& id_) const { +void TellicoXMLExporter::exportImageXML(TQDomDocument& dom_, TQDomElement& tqparent_, const TQString& id_) const { if(id_.isEmpty()) { myDebug() << "TellicoXMLExporter::exportImageXML() - empty image!" << endl; return; } // myLog() << "TellicoXMLExporter::exportImageXML() - id = " << id_ << endl; - QDomElement imgElem = dom_.createElement(QString::fromLatin1("image")); + TQDomElement imgElem = dom_.createElement(TQString::tqfromLatin1("image")); if(m_includeImages) { const Data::Image& img = ImageFactory::imageById(id_); if(img.isNull()) { myDebug() << "TellicoXMLExporter::exportImageXML() - null image - " << id_ << endl; return; } - imgElem.setAttribute(QString::fromLatin1("format"), img.format()); - imgElem.setAttribute(QString::fromLatin1("id"), img.id()); - imgElem.setAttribute(QString::fromLatin1("width"), img.width()); - imgElem.setAttribute(QString::fromLatin1("height"), img.height()); + imgElem.setAttribute(TQString::tqfromLatin1("format"), img.format().data()); + imgElem.setAttribute(TQString::tqfromLatin1("id"), img.id()); + imgElem.setAttribute(TQString::tqfromLatin1("width"), img.width()); + imgElem.setAttribute(TQString::tqfromLatin1("height"), img.height()); if(img.linkOnly()) { - imgElem.setAttribute(QString::fromLatin1("link"), QString::fromLatin1("true")); + imgElem.setAttribute(TQString::tqfromLatin1("link"), TQString::tqfromLatin1("true")); } - QCString imgText = KCodecs::base64Encode(img.byteArray()); - imgElem.appendChild(dom_.createTextNode(QString::fromLatin1(imgText))); + TQCString imgText = KCodecs::base64Encode(img.byteArray()); + imgElem.appendChild(dom_.createTextNode(TQString::tqfromLatin1(imgText))); } else { const Data::ImageInfo& info = ImageFactory::imageInfo(id_); if(info.isNull()) { return; } - imgElem.setAttribute(QString::fromLatin1("format"), info.format); - imgElem.setAttribute(QString::fromLatin1("id"), info.id); + imgElem.setAttribute(TQString::tqfromLatin1("format"), info.format.data()); + imgElem.setAttribute(TQString::tqfromLatin1("id"), info.id); // only load the images to read the size if necessary const bool loadImageIfNecessary = options() & Export::ExportImageSize; - imgElem.setAttribute(QString::fromLatin1("width"), info.width(loadImageIfNecessary)); - imgElem.setAttribute(QString::fromLatin1("height"), info.height(loadImageIfNecessary)); + imgElem.setAttribute(TQString::tqfromLatin1("width"), info.width(loadImageIfNecessary)); + imgElem.setAttribute(TQString::tqfromLatin1("height"), info.height(loadImageIfNecessary)); if(info.linkOnly) { - imgElem.setAttribute(QString::fromLatin1("link"), QString::fromLatin1("true")); + imgElem.setAttribute(TQString::tqfromLatin1("link"), TQString::tqfromLatin1("true")); } } - parent_.appendChild(imgElem); + tqparent_.appendChild(imgElem); } -void TellicoXMLExporter::exportGroupXML(QDomDocument& dom_, QDomElement& parent_) const { - Data::EntryVec vec = entries(); // need a copy for ::contains(); +void TellicoXMLExporter::exportGroupXML(TQDomDocument& dom_, TQDomElement& tqparent_) const { + Data::EntryVec vec = entries(); // need a copy for ::tqcontains(); bool exportAll = collection()->entries().count() == vec.count(); - // iterate over each group, which are the first children + // iterate over each group, which are the first tqchildren for(GroupIterator gIt = Controller::self()->groupIterator(); gIt.group(); ++gIt) { if(gIt.group()->isEmpty()) { continue; } - QDomElement groupElem = dom_.createElement(QString::fromLatin1("group")); - groupElem.setAttribute(QString::fromLatin1("title"), gIt.group()->groupName()); + TQDomElement groupElem = dom_.createElement(TQString::tqfromLatin1("group")); + groupElem.setAttribute(TQString::tqfromLatin1("title"), gIt.group()->groupName()); // now iterate over all entry items in the group Data::EntryVec sorted = Data::Document::self()->sortEntries(*gIt.group()); for(Data::EntryVec::Iterator eIt = sorted.begin(); eIt != sorted.end(); ++eIt) { - if(!exportAll && !vec.contains(eIt)) { + if(!exportAll && !vec.tqcontains(eIt)) { continue; } - QDomElement entryRefElem = dom_.createElement(QString::fromLatin1("entryRef")); - entryRefElem.setAttribute(QString::fromLatin1("id"), eIt->id()); + TQDomElement entryRefElem = dom_.createElement(TQString::tqfromLatin1("entryRef")); + entryRefElem.setAttribute(TQString::tqfromLatin1("id"), eIt->id()); groupElem.appendChild(entryRefElem); } if(groupElem.hasChildNodes()) { - parent_.appendChild(groupElem); + tqparent_.appendChild(groupElem); } } } -void TellicoXMLExporter::exportFilterXML(QDomDocument& dom_, QDomElement& parent_, FilterPtr filter_) const { - QDomElement filterElem = dom_.createElement(QString::fromLatin1("filter")); - filterElem.setAttribute(QString::fromLatin1("name"), filter_->name()); +void TellicoXMLExporter::exportFilterXML(TQDomDocument& dom_, TQDomElement& tqparent_, FilterPtr filter_) const { + TQDomElement filterElem = dom_.createElement(TQString::tqfromLatin1("filter")); + filterElem.setAttribute(TQString::tqfromLatin1("name"), filter_->name()); - QString match = (filter_->op() == Filter::MatchAll) ? QString::fromLatin1("all") : QString::fromLatin1("any"); - filterElem.setAttribute(QString::fromLatin1("match"), match); + TQString match = (filter_->op() == Filter::MatchAll) ? TQString::tqfromLatin1("all") : TQString::tqfromLatin1("any"); + filterElem.setAttribute(TQString::tqfromLatin1("match"), match); - for(QPtrListIterator<FilterRule> it(*filter_); it.current(); ++it) { - QDomElement ruleElem = dom_.createElement(QString::fromLatin1("rule")); - ruleElem.setAttribute(QString::fromLatin1("field"), it.current()->fieldName()); - ruleElem.setAttribute(QString::fromLatin1("pattern"), it.current()->pattern()); + for(TQPtrListIterator<FilterRule> it(*filter_); it.current(); ++it) { + TQDomElement ruleElem = dom_.createElement(TQString::tqfromLatin1("rule")); + ruleElem.setAttribute(TQString::tqfromLatin1("field"), it.current()->fieldName()); + ruleElem.setAttribute(TQString::tqfromLatin1("pattern"), it.current()->pattern()); switch(it.current()->function()) { case FilterRule::FuncContains: - ruleElem.setAttribute(QString::fromLatin1("function"), QString::fromLatin1("contains")); + ruleElem.setAttribute(TQString::tqfromLatin1("function"), TQString::tqfromLatin1("tqcontains")); break; case FilterRule::FuncNotContains: - ruleElem.setAttribute(QString::fromLatin1("function"), QString::fromLatin1("notcontains")); + ruleElem.setAttribute(TQString::tqfromLatin1("function"), TQString::tqfromLatin1("nottqcontains")); break; case FilterRule::FuncEquals: - ruleElem.setAttribute(QString::fromLatin1("function"), QString::fromLatin1("equals")); + ruleElem.setAttribute(TQString::tqfromLatin1("function"), TQString::tqfromLatin1("equals")); break; case FilterRule::FuncNotEquals: - ruleElem.setAttribute(QString::fromLatin1("function"), QString::fromLatin1("notequals")); + ruleElem.setAttribute(TQString::tqfromLatin1("function"), TQString::tqfromLatin1("notequals")); break; case FilterRule::FuncRegExp: - ruleElem.setAttribute(QString::fromLatin1("function"), QString::fromLatin1("regexp")); + ruleElem.setAttribute(TQString::tqfromLatin1("function"), TQString::tqfromLatin1("regexp")); break; case FilterRule::FuncNotRegExp: - ruleElem.setAttribute(QString::fromLatin1("function"), QString::fromLatin1("notregexp")); + ruleElem.setAttribute(TQString::tqfromLatin1("function"), TQString::tqfromLatin1("notregexp")); break; default: kdWarning() << "TellicoXMLExporter::exportFilterXML() - no matching rule function!" << endl; @@ -439,66 +439,66 @@ void TellicoXMLExporter::exportFilterXML(QDomDocument& dom_, QDomElement& parent filterElem.appendChild(ruleElem); } - parent_.appendChild(filterElem); + tqparent_.appendChild(filterElem); } -void TellicoXMLExporter::exportBorrowerXML(QDomDocument& dom_, QDomElement& parent_, +void TellicoXMLExporter::exportBorrowerXML(TQDomDocument& dom_, TQDomElement& tqparent_, Data::BorrowerPtr borrower_) const { if(borrower_->isEmpty()) { return; } - QDomElement bElem = dom_.createElement(QString::fromLatin1("borrower")); - parent_.appendChild(bElem); + TQDomElement bElem = dom_.createElement(TQString::tqfromLatin1("borrower")); + tqparent_.appendChild(bElem); - bElem.setAttribute(QString::fromLatin1("name"), borrower_->name()); - bElem.setAttribute(QString::fromLatin1("uid"), borrower_->uid()); + bElem.setAttribute(TQString::tqfromLatin1("name"), borrower_->name()); + bElem.setAttribute(TQString::tqfromLatin1("uid"), borrower_->uid()); const Data::LoanVec& loans = borrower_->loans(); for(Data::LoanVec::ConstIterator it = loans.constBegin(); it != loans.constEnd(); ++it) { - QDomElement lElem = dom_.createElement(QString::fromLatin1("loan")); + TQDomElement lElem = dom_.createElement(TQString::tqfromLatin1("loan")); bElem.appendChild(lElem); - lElem.setAttribute(QString::fromLatin1("uid"), it->uid()); - lElem.setAttribute(QString::fromLatin1("entryRef"), it->entry()->id()); - lElem.setAttribute(QString::fromLatin1("loanDate"), it->loanDate().toString(Qt::ISODate)); - lElem.setAttribute(QString::fromLatin1("dueDate"), it->dueDate().toString(Qt::ISODate)); + lElem.setAttribute(TQString::tqfromLatin1("uid"), it->uid()); + lElem.setAttribute(TQString::tqfromLatin1("entryRef"), it->entry()->id()); + lElem.setAttribute(TQString::tqfromLatin1("loanDate"), it->loanDate().toString(Qt::ISODate)); + lElem.setAttribute(TQString::tqfromLatin1("dueDate"), it->dueDate().toString(Qt::ISODate)); if(it->inCalendar()) { - lElem.setAttribute(QString::fromLatin1("calendar"), QString::fromLatin1("true")); + lElem.setAttribute(TQString::tqfromLatin1("calendar"), TQString::tqfromLatin1("true")); } lElem.appendChild(dom_.createTextNode(it->note())); } } -QWidget* TellicoXMLExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* TellicoXMLExporter::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("Tellico XML Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("Tellico XML Options"), m_widget); l->addWidget(box); - m_checkIncludeImages = new QCheckBox(i18n("Include images in XML document"), box); + m_checkIncludeImages = new TQCheckBox(i18n("Include images in XML document"), 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 XML stream as base64 encoded elements.")); return m_widget; } void TellicoXMLExporter::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 TellicoXMLExporter::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); } diff --git a/src/translators/tellicoxmlexporter.h b/src/translators/tellicoxmlexporter.h index 705c2dc..1fe4f43 100644 --- a/src/translators/tellicoxmlexporter.h +++ b/src/translators/tellicoxmlexporter.h @@ -18,9 +18,9 @@ namespace Tellico { class Filter; } -class QDomDocument; -class QDomElement; -class QCheckBox; +class TQDomDocument; +class TQDomElement; +class TQCheckBox; #include "exporter.h" #include "../stringset.h" @@ -33,22 +33,23 @@ namespace Tellico { */ class TellicoXMLExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: TellicoXMLExporter(); TellicoXMLExporter(Data::CollPtr coll); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - QDomDocument exportXML() const; - QString exportXMLString() const; + TQDomDocument exportXML() const; + TQString exportXMLString() const; void setIncludeImages(bool b) { m_includeImages = b; } void setIncludeGroups(bool b) { m_includeGroups = b; } - virtual QWidget* widget(QWidget*, const char*); + virtual TQWidget* widget(TQWidget*, const char*); virtual void readOptions(KConfig* cfg); virtual void saveOptions(KConfig* cfg); @@ -58,21 +59,21 @@ public: static const unsigned syntaxVersion; private: - void exportCollectionXML(QDomDocument& doc, QDomElement& parent, bool format) const; - void exportFieldXML(QDomDocument& doc, QDomElement& parent, Data::FieldPtr field) const; - void exportEntryXML(QDomDocument& doc, QDomElement& parent, Data::EntryPtr entry, bool format) const; - void exportImageXML(QDomDocument& doc, QDomElement& parent, const QString& imageID) const; - void exportGroupXML(QDomDocument& doc, QDomElement& parent) const; - void exportFilterXML(QDomDocument& doc, QDomElement& parent, FilterPtr filter) const; - void exportBorrowerXML(QDomDocument& doc, QDomElement& parent, Data::BorrowerPtr borrower) const; + void exportCollectionXML(TQDomDocument& doc, TQDomElement& tqparent, bool format) const; + void exportFieldXML(TQDomDocument& doc, TQDomElement& tqparent, Data::FieldPtr field) const; + void exportEntryXML(TQDomDocument& doc, TQDomElement& tqparent, Data::EntryPtr entry, bool format) const; + void exportImageXML(TQDomDocument& doc, TQDomElement& tqparent, const TQString& imageID) const; + void exportGroupXML(TQDomDocument& doc, TQDomElement& tqparent) const; + void exportFilterXML(TQDomDocument& doc, TQDomElement& tqparent, FilterPtr filter) const; + void exportBorrowerXML(TQDomDocument& doc, TQDomElement& tqparent, Data::BorrowerPtr borrower) const; // keep track of which images were written, since some entries could have same image mutable StringSet m_images; bool m_includeImages : 1; bool m_includeGroups : 1; - QWidget* m_widget; - QCheckBox* m_checkIncludeImages; + TQWidget* m_widget; + TQCheckBox* m_checkIncludeImages; }; } // end namespace diff --git a/src/translators/tellicozipexporter.cpp b/src/translators/tellicozipexporter.cpp index 42e0e70..582003f 100644 --- a/src/translators/tellicozipexporter.cpp +++ b/src/translators/tellicozipexporter.cpp @@ -26,17 +26,17 @@ #include <kzip.h> #include <kapplication.h> -#include <qdom.h> -#include <qbuffer.h> +#include <tqdom.h> +#include <tqbuffer.h> using Tellico::Export::TellicoZipExporter; -QString TellicoZipExporter::formatString() const { +TQString TellicoZipExporter::formatString() const { return i18n("Tellico Zip File"); } -QString TellicoZipExporter::fileFilter() const { - return i18n("*.tc *.bc|Tellico Files (*.tc)") + QChar('\n') + i18n("*|All Files"); +TQString TellicoZipExporter::fileFilter() const { + return i18n("*.tc *.bc|Tellico Files (*.tc)") + TQChar('\n') + i18n("*|All Files"); } bool TellicoZipExporter::exec() { @@ -47,9 +47,9 @@ bool TellicoZipExporter::exec() { } // TODO: maybe need label? - ProgressItem& item = ProgressManager::self()->newProgressItem(this, QString::null, true); + ProgressItem& item = ProgressManager::self()->newProgressItem(this, TQString(), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); TellicoXMLExporter exp; @@ -61,33 +61,33 @@ bool TellicoZipExporter::exec() { opt &= ~Export::ExportProgress; // don't show progress for xml export exp.setOptions(opt); exp.setIncludeImages(false); // do not include the images themselves in XML - QCString xml = exp.exportXML().toCString(); // encoded in utf-8 + TQCString xml = exp.exportXML().toCString(); // encoded in utf-8 ProgressManager::self()->setProgress(this, 5); - QByteArray data; - QBuffer buf(data); + TQByteArray data; + TQBuffer buf(data); if(m_cancelled) { return true; // intentionally cancelled } - KZip zip(&buf); + KZip zip(TQT_TQIODEVICE(&buf)); zip.open(IO_WriteOnly); - zip.writeFile(QString::fromLatin1("tellico.xml"), QString::null, QString::null, xml.length(), xml); + zip.writeFile(TQString::tqfromLatin1("tellico.xml"), TQString(), TQString(), xml.length(), xml); if(m_includeImages) { ProgressManager::self()->setProgress(this, 10); // gonna be lazy and just increment progress every 3 images // it might be less, might be more uint j = 0; - const QString imagesDir = QString::fromLatin1("images/"); + const TQString imagesDir = TQString::tqfromLatin1("images/"); StringSet imageSet; Data::FieldVec imageFields = coll->imageFields(); // already took 10%, only 90% left - const uint stepSize = QMAX(1, (coll->entryCount() * imageFields.count()) / 90); + const uint stepSize = TQMAX(1, (coll->entryCount() * imageFields.count()) / 90); for(Data::EntryVec::ConstIterator it = entries().begin(); it != entries().end() && !m_cancelled; ++it) { for(Data::FieldVec::Iterator fIt = imageFields.begin(); fIt != imageFields.end(); ++fIt, ++j) { - const QString id = it->field(fIt); + const TQString id = it->field(fIt); if(id.isEmpty() || imageSet.has(id)) { continue; } @@ -103,12 +103,12 @@ bool TellicoZipExporter::exec() { kdWarning() << "...for the entry titled " << it->title() << endl; continue; } - QByteArray ba = img.byteArray(); + TQByteArray ba = img.byteArray(); // myDebug() << "TellicoZipExporter::data() - adding image id = " << it->field(fIt) << endl; - zip.writeFile(imagesDir + id, QString::null, QString::null, ba.size(), ba); + zip.writeFile(imagesDir + id, TQString(), TQString(), ba.size(), ba); imageSet.add(id); if(j%stepSize == 0) { - ProgressManager::self()->setProgress(this, QMIN(10+j/stepSize, 99)); + ProgressManager::self()->setProgress(this, TQMIN(10+j/stepSize, 99)); kapp->processEvents(); } } diff --git a/src/translators/tellicozipexporter.h b/src/translators/tellicozipexporter.h index da167d5..2e62c1d 100644 --- a/src/translators/tellicozipexporter.h +++ b/src/translators/tellicozipexporter.h @@ -24,16 +24,17 @@ namespace Tellico { */ class TellicoZipExporter : public Exporter { Q_OBJECT + TQ_OBJECT public: TellicoZipExporter() : Exporter(), m_includeImages(true), m_cancelled(false) {} virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; // no options - virtual QWidget* widget(QWidget*, const char*) { return 0; } + virtual TQWidget* widget(TQWidget*, const char*) { return 0; } void setIncludeImages(bool b) { m_includeImages = b; } diff --git a/src/translators/textimporter.cpp b/src/translators/textimporter.cpp index 3130a0f..341a874 100644 --- a/src/translators/textimporter.cpp +++ b/src/translators/textimporter.cpp @@ -23,7 +23,7 @@ TextImporter::TextImporter(const KURL& url_, bool useUTF8_) } } -TextImporter::TextImporter(const QString& text_) : Import::Importer(text_) { +TextImporter::TextImporter(const TQString& text_) : Import::Importer(text_) { } #include "textimporter.moc" diff --git a/src/translators/textimporter.h b/src/translators/textimporter.h index c4500e5..4f68b90 100644 --- a/src/translators/textimporter.h +++ b/src/translators/textimporter.h @@ -26,6 +26,7 @@ namespace Tellico { */ class TextImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -34,7 +35,7 @@ public: * @param url The file to be imported */ TextImporter(const KURL& url, bool useUTF8_=false); - TextImporter(const QString& text); + TextImporter(const TQString& text); }; } // end namespace diff --git a/src/translators/xmlimporter.cpp b/src/translators/xmlimporter.cpp index ce345c4..99cf002 100644 --- a/src/translators/xmlimporter.cpp +++ b/src/translators/xmlimporter.cpp @@ -25,42 +25,42 @@ XMLImporter::XMLImporter(const KURL& url_) : Import::Importer(url_) { } } -XMLImporter::XMLImporter(const QString& text_) : Import::Importer(text_) { +XMLImporter::XMLImporter(const TQString& text_) : Import::Importer(text_) { if(text_.isEmpty()) { return; } setText(text_); } -XMLImporter::XMLImporter(const QByteArray& data_) : Import::Importer(KURL()) { +XMLImporter::XMLImporter(const TQByteArray& data_) : Import::Importer(KURL()) { if(data_.isEmpty()) { return; } - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; if(!m_dom.setContent(data_, true, &errorMsg, &errorLine, &errorColumn)) { - QString str = i18n("There is an XML parsing error in line %1, column %2.").arg(errorLine).arg(errorColumn); - str += QString::fromLatin1("\n"); - str += i18n("The error message from Qt is:"); - str += QString::fromLatin1("\n\t") + errorMsg; + TQString str = i18n("There is an XML parsing error in line %1, column %2.").tqarg(errorLine).tqarg(errorColumn); + str += TQString::tqfromLatin1("\n"); + str += i18n("The error message from TQt is:"); + str += TQString::tqfromLatin1("\n\t") + errorMsg; setStatusMessage(str); return; } } -XMLImporter::XMLImporter(const QDomDocument& dom_) : Import::Importer(KURL()), m_dom(dom_) { +XMLImporter::XMLImporter(const TQDomDocument& dom_) : Import::Importer(KURL()), m_dom(dom_) { } -void XMLImporter::setText(const QString& text_) { +void XMLImporter::setText(const TQString& text_) { Importer::setText(text_); - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; if(!m_dom.setContent(text_, true, &errorMsg, &errorLine, &errorColumn)) { - QString str = i18n("There is an XML parsing error in line %1, column %2.").arg(errorLine).arg(errorColumn); - str += QString::fromLatin1("\n"); - str += i18n("The error message from Qt is:"); - str += QString::fromLatin1("\n\t") + errorMsg; + TQString str = i18n("There is an XML parsing error in line %1, column %2.").tqarg(errorLine).tqarg(errorColumn); + str += TQString::tqfromLatin1("\n"); + str += i18n("The error message from TQt is:"); + str += TQString::tqfromLatin1("\n\t") + errorMsg; setStatusMessage(str); } } diff --git a/src/translators/xmlimporter.h b/src/translators/xmlimporter.h index 743a1c1..e544a17 100644 --- a/src/translators/xmlimporter.h +++ b/src/translators/xmlimporter.h @@ -16,7 +16,7 @@ #include "importer.h" -#include <qdom.h> +#include <tqdom.h> namespace Tellico { namespace Import { @@ -28,6 +28,7 @@ namespace Tellico { */ class XMLImporter : public Importer { Q_OBJECT + TQ_OBJECT public: /** @@ -41,16 +42,16 @@ public: * * @param text The text */ - XMLImporter(const QString& text); + XMLImporter(const TQString& text); /** * Imports xml text from a byte array. * * @param data The Data */ - XMLImporter(const QByteArray& data); - XMLImporter(const QDomDocument& dom); + XMLImporter(const TQByteArray& data); + XMLImporter(const TQDomDocument& dom); - virtual void setText(const QString& text); + virtual void setText(const TQString& text); /** * This class gets used as a utility XML loader. This should never get called, @@ -63,10 +64,10 @@ public: * * @return The file contents */ - const QDomDocument& domDocument() const { return m_dom; } + const TQDomDocument& domDocument() const { return m_dom; } private: - QDomDocument m_dom; + TQDomDocument m_dom; }; } // end namespace diff --git a/src/translators/xsltexporter.cpp b/src/translators/xsltexporter.cpp index 54ca8aa..09636f2 100644 --- a/src/translators/xsltexporter.cpp +++ b/src/translators/xsltexporter.cpp @@ -19,12 +19,12 @@ #include <klocale.h> #include <kurlrequester.h> -#include <qlabel.h> -#include <qgroupbox.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qdom.h> -#include <qwhatsthis.h> +#include <tqlabel.h> +#include <tqgroupbox.h> +#include <tqlayout.h> +#include <tqhbox.h> +#include <tqdom.h> +#include <tqwhatsthis.h> using Tellico::Export::XSLTExporter; @@ -33,11 +33,11 @@ XSLTExporter::XSLTExporter() : Export::Exporter(), m_URLRequester(0) { } -QString XSLTExporter::formatString() const { +TQString XSLTExporter::formatString() const { return i18n("XSLT"); } -QString XSLTExporter::fileFilter() const { +TQString XSLTExporter::fileFilter() const { return i18n("*|All Files"); } @@ -45,7 +45,7 @@ QString XSLTExporter::fileFilter() const { bool XSLTExporter::exec() { KURL u = m_URLRequester->url(); if(u.isEmpty() || !u.isValid()) { - return QString::null; + return TQString(); } // XSLTHandler handler(FileHandler::readXMLFile(url)); XSLTHandler handler(u); @@ -53,27 +53,27 @@ bool XSLTExporter::exec() { TellicoXMLExporter exporter; exporter.setEntries(entries()); exporter.setOptions(options()); - QDomDocument dom = exporter.exportXML(); + TQDomDocument dom = exporter.exportXML(); return FileHandler::writeTextURL(url(), handler.applyStylesheet(dom.toString()), options() & ExportUTF8, options() & Export::ExportForce); } -QWidget* XSLTExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* XSLTExporter::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* group = new QGroupBox(1, Qt::Horizontal, i18n("XSLT Options"), m_widget); + TQGroupBox* group = new TQGroupBox(1, Qt::Horizontal, i18n("XSLT Options"), m_widget); l->addWidget(group); - QHBox* box = new QHBox(group); + TQHBox* box = new TQHBox(group); box->setSpacing(4); - (void) new QLabel(i18n("XSLT file:"), box); + (void) new TQLabel(i18n("XSLT file:"), box); m_URLRequester = new KURLRequester(box); - QWhatsThis::add(m_URLRequester, i18n("Choose the XSLT file used to transform the Tellico XML data.")); + TQWhatsThis::add(m_URLRequester, i18n("Choose the XSLT file used to transform the Tellico XML data.")); l->addStretch(1); return m_widget; diff --git a/src/translators/xsltexporter.h b/src/translators/xsltexporter.h index ae353d2..2a626f2 100644 --- a/src/translators/xsltexporter.h +++ b/src/translators/xsltexporter.h @@ -29,13 +29,13 @@ public: XSLTExporter(); virtual bool exec(); - virtual QString formatString() const; - virtual QString fileFilter() const; + virtual TQString formatString() const; + virtual TQString fileFilter() const; - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); private: - QWidget* m_widget; + TQWidget* m_widget; KURLRequester* m_URLRequester; }; diff --git a/src/translators/xslthandler.cpp b/src/translators/xslthandler.cpp index e25eef5..bdbe8f2 100644 --- a/src/translators/xslthandler.cpp +++ b/src/translators/xslthandler.cpp @@ -16,8 +16,8 @@ #include "../tellico_debug.h" #include "../tellico_utils.h" -#include <qdom.h> -#include <qtextcodec.h> +#include <tqdom.h> +#include <tqtextcodec.h> #include <kurl.h> @@ -35,22 +35,22 @@ static const int xml_options = XML_PARSE_NOENT | XML_PARSE_NONET | XML_PARSE_NOC static const int xslt_options = xml_options; /* some functions to pass to the XSLT libs */ -static int writeToQString(void* context, const char* buffer, int len) { - QString* t = static_cast<QString*>(context); - *t += QString::fromUtf8(buffer, len); +static int writeToTQString(void* context, const char* buffer, int len) { + TQString* t = static_cast<TQString*>(context); + *t += TQString::fromUtf8(buffer, len); return len; } -static void closeQString(void* context) { - QString* t = static_cast<QString*>(context); - *t += QString::fromLatin1("\n"); +static void closeTQString(void* context) { + TQString* t = static_cast<TQString*>(context); + *t += TQString::tqfromLatin1("\n"); } using Tellico::XSLTHandler; -XSLTHandler::XMLOutputBuffer::XMLOutputBuffer() : m_res(QString::null) { - m_buf = xmlOutputBufferCreateIO((xmlOutputWriteCallback)writeToQString, - (xmlOutputCloseCallback)closeQString, +XSLTHandler::XMLOutputBuffer::XMLOutputBuffer() : m_res(TQString()) { + m_buf = xmlOutputBufferCreateIO((xmlOutputWriteCallback)writeToTQString, + (xmlOutputCloseCallback)closeTQString, &m_res, 0); if(m_buf) { m_buf->written = 0; @@ -68,12 +68,12 @@ XSLTHandler::XMLOutputBuffer::~XMLOutputBuffer() { int XSLTHandler::s_initCount = 0; -XSLTHandler::XSLTHandler(const QCString& xsltFile_) : +XSLTHandler::XSLTHandler(const TQCString& xsltFile_) : m_stylesheet(0), m_docIn(0), m_docOut(0) { init(); - QString file = KURL::encode_string(QString::fromLocal8Bit(xsltFile_)); + TQString file = KURL::encode_string(TQString::fromLocal8Bit(xsltFile_)); if(!file.isEmpty()) { xmlDocPtr xsltDoc = xmlReadFile(file.utf8(), NULL, xslt_options); m_stylesheet = xsltParseStylesheetDoc(xsltDoc); @@ -97,12 +97,12 @@ XSLTHandler::XSLTHandler(const KURL& xsltURL_) : } } -XSLTHandler::XSLTHandler(const QDomDocument& xsltDoc_, const QCString& xsltFile_, bool translate_) : +XSLTHandler::XSLTHandler(const TQDomDocument& xsltDoc_, const TQCString& xsltFile_, bool translate_) : m_stylesheet(0), m_docIn(0), m_docOut(0) { init(); - QString file = KURL::encode_string(QString::fromLocal8Bit(xsltFile_)); + TQString file = KURL::encode_string(TQString::fromLocal8Bit(xsltFile_)); if(!xsltDoc_.isNull() && !file.isEmpty()) { setXSLTDoc(xsltDoc_, file.utf8(), translate_); } @@ -143,16 +143,16 @@ void XSLTHandler::init() { m_params.clear(); } -void XSLTHandler::setXSLTDoc(const QDomDocument& dom_, const QCString& xsltFile_, bool translate_) { +void XSLTHandler::setXSLTDoc(const TQDomDocument& dom_, const TQCString& xsltFile_, bool translate_) { bool utf8 = true; // XML defaults to utf-8 // need to find out if utf-8 or not - const QDomNodeList childs = dom_.childNodes(); + const TQDomNodeList childs = dom_.childNodes(); for(uint j = 0; j < childs.count(); ++j) { if(childs.item(j).isProcessingInstruction()) { - QDomProcessingInstruction pi = childs.item(j).toProcessingInstruction(); - if(pi.data().lower().contains(QString::fromLatin1("encoding"))) { - if(!pi.data().lower().contains(QString::fromLatin1("utf-8"))) { + TQDomProcessingInstruction pi = childs.item(j).toProcessingInstruction(); + if(pi.data().lower().tqcontains(TQString::tqfromLatin1("encoding"))) { + if(!pi.data().lower().tqcontains(TQString::tqfromLatin1("utf-8"))) { utf8 = false; // } else { // myDebug() << "XSLTHandler::setXSLTDoc() - PI = " << pi.data() << endl; @@ -162,7 +162,7 @@ void XSLTHandler::setXSLTDoc(const QDomDocument& dom_, const QCString& xsltFile_ } } - QString s; + TQString s; if(translate_) { s = Tellico::i18nReplace(dom_.toString(0 /* indent */)); } else { @@ -186,29 +186,29 @@ void XSLTHandler::setXSLTDoc(const QDomDocument& dom_, const QCString& xsltFile_ // xmlFreeDoc(xsltDoc); // this causes a crash for some reason } -void XSLTHandler::addStringParam(const QCString& name_, const QCString& value_) { - QCString value = value_; - value.replace('\'', "'"); - addParam(name_, QCString("'") + value + QCString("'")); +void XSLTHandler::addStringParam(const TQCString& name_, const TQCString& value_) { + TQCString value = value_; + value.tqreplace('\'', "'"); + addParam(name_, TQCString("'") + value + TQCString("'")); } -void XSLTHandler::addParam(const QCString& name_, const QCString& value_) { +void XSLTHandler::addParam(const TQCString& name_, const TQCString& value_) { m_params.insert(name_, value_); // myDebug() << "XSLTHandler::addParam() - " << name_ << ":" << value_ << endl; } -void XSLTHandler::removeParam(const QCString& name_) { +void XSLTHandler::removeParam(const TQCString& name_) { m_params.remove(name_); } -const QCString& XSLTHandler::param(const QCString& name_) { +const TQCString& XSLTHandler::param(const TQCString& name_) { return m_params[name_]; } -QString XSLTHandler::applyStylesheet(const QString& text_) { +TQString XSLTHandler::applyStylesheet(const TQString& text_) { if(!m_stylesheet) { myDebug() << "XSLTHandler::applyStylesheet() - null stylesheet pointer!" << endl; - return QString::null; + return TQString(); } m_docIn = xmlReadDoc(reinterpret_cast<xmlChar*>(text_.utf8().data()), NULL, NULL, xml_options); @@ -216,16 +216,16 @@ QString XSLTHandler::applyStylesheet(const QString& text_) { return process(); } -QString XSLTHandler::process() { +TQString XSLTHandler::process() { if(!m_docIn) { myDebug() << "XSLTHandler::process() - error parsing input string!" << endl; - return QString::null; + return TQString(); } - QMemArray<const char*> params(2*m_params.count() + 1); + TQMemArray<const char*> params(2*m_params.count() + 1); params[0] = NULL; - QMap<QCString, QCString>::ConstIterator it = m_params.constBegin(); - QMap<QCString, QCString>::ConstIterator end = m_params.constEnd(); + TQMap<TQCString, TQCString>::ConstIterator it = m_params.constBegin(); + TQMap<TQCString, TQCString>::ConstIterator end = m_params.constEnd(); for(uint i = 0; it != end; ++it) { params[i ] = qstrdup(it.key()); params[i+1] = qstrdup(it.data()); @@ -239,7 +239,7 @@ QString XSLTHandler::process() { } if(!m_docOut) { myDebug() << "XSLTHandler::applyStylesheet() - error applying stylesheet!" << endl; - return QString::null; + return TQString(); } XMLOutputBuffer output; @@ -253,13 +253,13 @@ QString XSLTHandler::process() { } //static -QDomDocument& XSLTHandler::setLocaleEncoding(QDomDocument& dom_) { - const QDomNodeList childs = dom_.documentElement().childNodes(); +TQDomDocument& XSLTHandler::setLocaleEncoding(TQDomDocument& dom_) { + const TQDomNodeList childs = dom_.documentElement().childNodes(); for(unsigned j = 0; j < childs.count(); ++j) { if(childs.item(j).isElement() && childs.item(j).nodeName() == Latin1Literal("xsl:output")) { - QDomElement e = childs.item(j).toElement(); - const QString encoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); - e.setAttribute(QString::fromLatin1("encoding"), encoding); + TQDomElement e = childs.item(j).toElement(); + const TQString encoding = TQString::tqfromLatin1(TQTextCodec::codecForLocale()->name()); + e.setAttribute(TQString::tqfromLatin1("encoding"), encoding); break; } } diff --git a/src/translators/xslthandler.h b/src/translators/xslthandler.h index f51b47c..a7f4a76 100644 --- a/src/translators/xslthandler.h +++ b/src/translators/xslthandler.h @@ -14,7 +14,7 @@ #ifndef XSLTHANDLER_H #define XSLTHANDLER_H -#include <qmap.h> +#include <tqmap.h> extern "C" { // for xmlDocPtr @@ -24,7 +24,7 @@ extern "C" { } class KURL; -class QDomDocument; +class TQDomDocument; namespace Tellico { @@ -43,16 +43,16 @@ public: ~XMLOutputBuffer(); bool isValid() const { return (m_buf != 0); } xmlOutputBuffer* buffer() const { return m_buf; } - QString result() const { return m_res; } + TQString result() const { return m_res; } private: xmlOutputBuffer* m_buf; - QString m_res; + TQString m_res; }; /** * @param xsltFile The XSLT file */ - XSLTHandler(const QCString& xsltFile); + XSLTHandler(const TQCString& xsltFile); /** * @param xsltURL The XSLT URL */ @@ -61,7 +61,7 @@ public: * @param xsltDoc The XSLT DOM document * @param xsltFile The XSLT file, should be a url? */ - XSLTHandler(const QDomDocument& xsltDoc, const QCString& xsltFile, bool translate=false); + XSLTHandler(const TQDomDocument& xsltDoc, const TQCString& xsltFile, bool translate=false); /** */ ~XSLTHandler(); @@ -73,17 +73,17 @@ public: * @param dom The XSLT DOM document * @param xsltFile The XSLT file, should be a url? */ - void setXSLTDoc(const QDomDocument& dom, const QCString& xsltFile, bool translate=false); + void setXSLTDoc(const TQDomDocument& dom, const TQCString& xsltFile, bool translate=false); /** * Adds a param */ - void addParam(const QCString& name, const QCString& value); + void addParam(const TQCString& name, const TQCString& value); /** * Adds a string param */ - void addStringParam(const QCString& name, const QCString& value); - void removeParam(const QCString& name); - const QCString& param(const QCString& name); + void addStringParam(const TQCString& name, const TQCString& value); + void removeParam(const TQCString& name); + const TQCString& param(const TQCString& name); /** * Processes text through the XSLT transformation. * @@ -91,19 +91,19 @@ public: * @param encodedUTF8 Whether the text is encoded in utf-8 or not * @return The transformed text */ - QString applyStylesheet(const QString& text); + TQString applyStylesheet(const TQString& text); - static QDomDocument& setLocaleEncoding(QDomDocument& dom); + static TQDomDocument& setLocaleEncoding(TQDomDocument& dom); private: void init(); - QString process(); + TQString process(); xsltStylesheetPtr m_stylesheet; xmlDocPtr m_docIn; xmlDocPtr m_docOut; - QMap<QCString, QCString> m_params; + TQMap<TQCString, TQCString> m_params; static int s_initCount; }; diff --git a/src/translators/xsltimporter.cpp b/src/translators/xsltimporter.cpp index 67f1fd2..62f7255 100644 --- a/src/translators/xsltimporter.cpp +++ b/src/translators/xsltimporter.cpp @@ -20,10 +20,10 @@ #include <klocale.h> #include <kurlrequester.h> -#include <qhbox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qgroupbox.h> +#include <tqhbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqgroupbox.h> #include <memory> @@ -39,9 +39,9 @@ static bool isUTF8(const KURL& url_) { } ref->open(); - QTextStream stream(ref->file()); - QString line = stream.readLine().lower(); - return line.find(QString::fromLatin1("utf-8")) > 0; + TQTextStream stream(ref->file()); + TQString line = stream.readLine().lower(); + return line.tqfind(TQString::tqfromLatin1("utf-8")) > 0; } } @@ -77,7 +77,7 @@ Tellico::Data::CollPtr XSLTImporter::collection() { return 0; } // kdDebug() << text() << endl; - QString str = handler.applyStylesheet(text()); + TQString str = handler.applyStylesheet(text()); // kdDebug() << str << endl; Import::TellicoImporter imp(str); @@ -86,22 +86,22 @@ Tellico::Data::CollPtr XSLTImporter::collection() { return m_coll; } -QWidget* XSLTImporter::widget(QWidget* parent_, const char* name_) { +TQWidget* XSLTImporter::widget(TQWidget* tqparent_, const char* name_) { // if the url has already been set, then there's no widget if(!m_xsltURL.isEmpty()) { return 0; } - 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::Vertical, i18n("XSLT Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Vertical, i18n("XSLT Options"), m_widget); l->addWidget(box); - (void) new QLabel(i18n("XSLT file:"), box); + (void) new TQLabel(i18n("XSLT file:"), box); m_URLRequester = new KURLRequester(box); - QString filter = i18n("*.xsl|XSL Files (*.xsl)") + QChar('\n'); + TQString filter = i18n("*.xsl|XSL Files (*.xsl)") + TQChar('\n'); filter += i18n("*|All Files"); m_URLRequester->setFilter(filter); diff --git a/src/translators/xsltimporter.h b/src/translators/xsltimporter.h index 578b552..16aa6d2 100644 --- a/src/translators/xsltimporter.h +++ b/src/translators/xsltimporter.h @@ -29,6 +29,7 @@ namespace Tellico { */ class XSLTImporter : public TextImporter { Q_OBJECT + TQ_OBJECT public: /** @@ -40,13 +41,13 @@ public: virtual Data::CollPtr collection(); /** */ - virtual QWidget* widget(QWidget* parent, const char* name=0); + virtual TQWidget* widget(TQWidget* tqparent, const char* name=0); void setXSLTURL(const KURL& url) { m_xsltURL = url; } private: Data::CollPtr m_coll; - QWidget* m_widget; + TQWidget* m_widget; KURLRequester* m_URLRequester; KURL m_xsltURL; }; |