diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
commit | 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch) | |
tree | 18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/fetch | |
parent | 1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff) | |
download | tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip |
TQt4 port tellico
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/fetch')
47 files changed, 2404 insertions, 2380 deletions
diff --git a/src/fetch/amazonfetcher.cpp b/src/fetch/amazonfetcher.cpp index 36c009f..fee207a 100644 --- a/src/fetch/amazonfetcher.cpp +++ b/src/fetch/amazonfetcher.cpp @@ -36,13 +36,13 @@ #include <kcombobox.h> #include <kaccelmanager.h> -#include <qdom.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> -#include <qcheckbox.h> -#include <qfile.h> -#include <qtextcodec.h> +#include <tqdom.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> +#include <tqfile.h> +#include <tqtextcodec.h> namespace { static const int AMAZON_RETURNS_PER_REQUEST = 10; @@ -82,10 +82,10 @@ const AmazonFetcher::SiteData& AmazonFetcher::siteData(int site_) { return dataVector[site_]; } -AmazonFetcher::AmazonFetcher(Site site_, QObject* parent_, const char* name_) - : Fetcher(parent_, name_), m_xsltHandler(0), m_site(site_), m_imageSize(MediumImage), - m_access(QString::fromLatin1(AMAZON_ACCESS_KEY)), - m_assoc(QString::fromLatin1(AMAZON_ASSOC_TOKEN)), m_addLinkField(true), m_limit(AMAZON_MAX_RETURNS_TOTAL), +AmazonFetcher::AmazonFetcher(Site site_, TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_xsltHandler(0), m_site(site_), m_imageSize(MediumImage), + m_access(TQString::tqfromLatin1(AMAZON_ACCESS_KEY)), + m_assoc(TQString::tqfromLatin1(AMAZON_ASSOC_TOKEN)), m_addLinkField(true), m_limit(AMAZON_MAX_RETURNS_TOTAL), m_countOffset(0), m_page(1), m_total(-1), m_numResults(0), m_job(0), m_started(false) { m_name = siteData(site_).title; } @@ -95,11 +95,11 @@ AmazonFetcher::~AmazonFetcher() { m_xsltHandler = 0; } -QString AmazonFetcher::defaultName() { +TQString AmazonFetcher::defaultName() { return i18n("Amazon.com Web Services"); } -QString AmazonFetcher::source() const { +TQString AmazonFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -113,7 +113,7 @@ bool AmazonFetcher::canFetch(int type) const { } void AmazonFetcher::readConfigHook(const KConfigGroup& config_) { - QString s = config_.readEntry("AccessKey"); + TQString s = config_.readEntry("AccessKey"); if(!s.isEmpty()) { m_access = s; } @@ -125,10 +125,10 @@ void AmazonFetcher::readConfigHook(const KConfigGroup& config_) { if(imageSize > -1) { m_imageSize = static_cast<ImageSize>(imageSize); } - m_fields = config_.readListEntry("Custom Fields", QString::fromLatin1("keyword")); + m_fields = config_.readListEntry("Custom Fields", TQString::tqfromLatin1("keyword")); } -void AmazonFetcher::search(FetchKey key_, const QString& value_) { +void AmazonFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_.stripWhiteSpace(); m_started = true; @@ -153,34 +153,34 @@ void AmazonFetcher::doSearch() { const SiteData& data = siteData(m_site); KURL u = data.url; - u.addQueryItem(QString::fromLatin1("Service"), QString::fromLatin1("AWSECommerceService")); - u.addQueryItem(QString::fromLatin1("AssociateTag"), m_assoc); - u.addQueryItem(QString::fromLatin1("AWSAccessKeyId"), m_access); - u.addQueryItem(QString::fromLatin1("Operation"), QString::fromLatin1("ItemSearch")); - u.addQueryItem(QString::fromLatin1("ResponseGroup"), QString::fromLatin1("Large")); - u.addQueryItem(QString::fromLatin1("ItemPage"), QString::number(m_page)); - u.addQueryItem(QString::fromLatin1("Version"), QString::fromLatin1("2007-10-29")); + u.addQueryItem(TQString::tqfromLatin1("Service"), TQString::tqfromLatin1("AWSECommerceService")); + u.addQueryItem(TQString::tqfromLatin1("AssociateTag"), m_assoc); + u.addQueryItem(TQString::tqfromLatin1("AWSAccessKeyId"), m_access); + u.addQueryItem(TQString::tqfromLatin1("Operation"), TQString::tqfromLatin1("ItemSearch")); + u.addQueryItem(TQString::tqfromLatin1("ResponseGroup"), TQString::tqfromLatin1("Large")); + u.addQueryItem(TQString::tqfromLatin1("ItemPage"), TQString::number(m_page)); + u.addQueryItem(TQString::tqfromLatin1("Version"), TQString::tqfromLatin1("2007-10-29")); const int type = Kernel::self()->collectionType(); switch(type) { case Data::Collection::Book: case Data::Collection::ComicBook: case Data::Collection::Bibtex: - u.addQueryItem(QString::fromLatin1("SearchIndex"), QString::fromLatin1("Books")); - u.addQueryItem(QString::fromLatin1("SortIndex"), QString::fromLatin1("relevancerank")); + u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Books")); + u.addQueryItem(TQString::tqfromLatin1("SortIndex"), TQString::tqfromLatin1("relevancerank")); break; case Data::Collection::Album: - u.addQueryItem(QString::fromLatin1("SearchIndex"), QString::fromLatin1("Music")); + u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Music")); break; case Data::Collection::Video: - u.addQueryItem(QString::fromLatin1("SearchIndex"), QString::fromLatin1("Video")); - u.addQueryItem(QString::fromLatin1("SortIndex"), QString::fromLatin1("relevancerank")); + u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Video")); + u.addQueryItem(TQString::tqfromLatin1("SortIndex"), TQString::tqfromLatin1("relevancerank")); break; case Data::Collection::Game: - u.addQueryItem(QString::fromLatin1("SearchIndex"), QString::fromLatin1("VideoGames")); + u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("VideoGames")); break; case Data::Collection::Coin: @@ -189,7 +189,7 @@ void AmazonFetcher::doSearch() { case Data::Collection::Base: case Data::Collection::Card: default: - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } @@ -199,48 +199,48 @@ void AmazonFetcher::doSearch() { // that utf8 DOES NOT WORK. So I'm arbitrarily using iso-8859-1, except for JP. // Why different for JP? Well, I've not received any bug reports from that direction yet -// QString value = KURL::decode_string(value_, 106); -// QString value = QString::fromLocal8Bit(value_.utf8()); - QString value = m_value; +// TQString value = KURL::decode_string(value_, 106); +// TQString value = TQString::fromLocal8Bit(value_.utf8()); + TQString value = m_value; // a mibenum of 106 is utf-8, 4 is iso-8859-1, 0 means use user's locale, int mib = m_site == AmazonFetcher::JP ? 106 : 4; switch(m_key) { case Title: - u.addQueryItem(QString::fromLatin1("Title"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Title"), value, mib); break; case Person: if(type == Data::Collection::Video) { - u.addQueryItem(QString::fromLatin1("Actor"), value, mib); - u.addQueryItem(QString::fromLatin1("Director"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Actor"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Director"), value, mib); } else if(type == Data::Collection::Album) { - u.addQueryItem(QString::fromLatin1("Artist"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Artist"), value, mib); } else if(type == Data::Collection::Game) { - u.addQueryItem(QString::fromLatin1("Manufacturer"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Manufacturer"), value, mib); } else { // books and bibtex - QString s = QString::fromLatin1("author:%1 or publisher:%2").arg(value, value); -// u.addQueryItem(QString::fromLatin1("Author"), value, mib); -// u.addQueryItem(QString::fromLatin1("Publisher"), value, mib); - u.addQueryItem(QString::fromLatin1("Power"), s, mib); + TQString s = TQString::tqfromLatin1("author:%1 or publisher:%2").tqarg(value, value); +// u.addQueryItem(TQString::tqfromLatin1("Author"), value, mib); +// u.addQueryItem(TQString::tqfromLatin1("Publisher"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Power"), s, mib); } break; case ISBN: { - u.removeQueryItem(QString::fromLatin1("Operation")); - u.addQueryItem(QString::fromLatin1("Operation"), QString::fromLatin1("ItemLookup")); + u.removeQueryItem(TQString::tqfromLatin1("Operation")); + u.addQueryItem(TQString::tqfromLatin1("Operation"), TQString::tqfromLatin1("ItemLookup")); - QString s = m_value; // not encValue!!! + TQString s = m_value; // not encValue!!! s.remove('-'); // ISBN only get digits or 'X', and multiple values are connected with "; " - QStringList isbns = QStringList::split(QString::fromLatin1("; "), s); + TQStringList isbns = TQStringList::split(TQString::tqfromLatin1("; "), s); // Amazon isbn13 search is still very flaky, so if possible, we're going to convert // all of them to isbn10. If we run into a 979 isbn13, then we're forced to do an // isbn13 search bool isbn13 = false; - for(QStringList::Iterator it = isbns.begin(); it != isbns.end(); ) { - if(m_value.startsWith(QString::fromLatin1("979"))) { + for(TQStringList::Iterator it = isbns.begin(); it != isbns.end(); ) { + if(m_value.startsWith(TQString::tqfromLatin1("979"))) { if(m_site == JP) { // never works for JP kdWarning() << "AmazonFetcher:doSearch() - ISBN-13 searching not implemented for Japan" << endl; isbns.remove(it); // automatically skips to next @@ -253,53 +253,53 @@ void AmazonFetcher::doSearch() { } // if we want isbn10, then convert all if(!isbn13) { - for(QStringList::Iterator it = isbns.begin(); it != isbns.end(); ++it) { + for(TQStringList::Iterator it = isbns.begin(); it != isbns.end(); ++it) { if((*it).length() > 12) { (*it) = ISBNValidator::isbn10(*it); (*it).remove('-'); } } // the default search is by ASIN, which prohibits SearchIndex - u.removeQueryItem(QString::fromLatin1("SearchIndex")); + u.removeQueryItem(TQString::tqfromLatin1("SearchIndex")); } // limit to first 10 while(isbns.size() > 10) { isbns.pop_back(); } - u.addQueryItem(QString::fromLatin1("ItemId"), isbns.join(QString::fromLatin1(","))); + u.addQueryItem(TQString::tqfromLatin1("ItemId"), isbns.join(TQString::tqfromLatin1(","))); if(isbn13) { - u.addQueryItem(QString::fromLatin1("IdType"), QString::fromLatin1("EAN")); + u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("EAN")); } } break; case UPC: { - u.removeQueryItem(QString::fromLatin1("Operation")); - u.addQueryItem(QString::fromLatin1("Operation"), QString::fromLatin1("ItemLookup")); + u.removeQueryItem(TQString::tqfromLatin1("Operation")); + u.addQueryItem(TQString::tqfromLatin1("Operation"), TQString::tqfromLatin1("ItemLookup")); // US allows UPC, all others are EAN if(m_site == US) { - u.addQueryItem(QString::fromLatin1("IdType"), QString::fromLatin1("UPC")); + u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("UPC")); } else { - u.addQueryItem(QString::fromLatin1("IdType"), QString::fromLatin1("EAN")); + u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("EAN")); } - QString s = m_value; // not encValue!!! + TQString s = m_value; // not encValue!!! s.remove('-'); // limit to first 10 - s.replace(QString::fromLatin1("; "), QString::fromLatin1(",")); + s.tqreplace(TQString::tqfromLatin1("; "), TQString::tqfromLatin1(",")); s = s.section(',', 0, 9); - u.addQueryItem(QString::fromLatin1("ItemId"), s); + u.addQueryItem(TQString::tqfromLatin1("ItemId"), s); } break; case Keyword: - u.addQueryItem(QString::fromLatin1("Keywords"), m_value, mib); + u.addQueryItem(TQString::tqfromLatin1("Keywords"), m_value, mib); break; case Raw: { - QString key = value.section('=', 0, 0).stripWhiteSpace(); - QString str = value.section('=', 1).stripWhiteSpace(); + TQString key = value.section('=', 0, 0).stripWhiteSpace(); + TQString str = value.section('=', 1).stripWhiteSpace(); u.addQueryItem(key, str, mib); } break; @@ -312,10 +312,10 @@ void AmazonFetcher::doSearch() { // myDebug() << "AmazonFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void AmazonFetcher::stop() { @@ -332,8 +332,8 @@ void AmazonFetcher::stop() { emit signalDone(this); } -void AmazonFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void AmazonFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -357,18 +357,18 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from amazonfetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test%1.xml").arg(m_page)); + TQFile f(TQString::tqfromLatin1("/tmp/test%1.xml").tqarg(m_page)); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif - QStringList errors; + TQStringList errors; if(m_total == -1) { - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, false)) { kdWarning() << "AmazonFetcher::slotComplete() - server did not return valid XML." << endl; stop(); @@ -377,31 +377,31 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { // find TotalResults element // it's in the first level under the root element //ItemSearchResponse/Items/TotalResults - QDomNode n = dom.documentElement().namedItem(QString::fromLatin1("Items")) - .namedItem(QString::fromLatin1("TotalResults")); - QDomElement e = n.toElement(); + TQDomNode n = dom.documentElement().namedItem(TQString::tqfromLatin1("Items")) + .namedItem(TQString::tqfromLatin1("TotalResults")); + TQDomElement e = n.toElement(); if(!e.isNull()) { m_total = e.text().toInt(); } - n = dom.documentElement().namedItem(QString::fromLatin1("Items")) - .namedItem(QString::fromLatin1("Request")) - .namedItem(QString::fromLatin1("Errors")); + n = dom.documentElement().namedItem(TQString::tqfromLatin1("Items")) + .namedItem(TQString::tqfromLatin1("Request")) + .namedItem(TQString::tqfromLatin1("Errors")); e = n.toElement(); if(!e.isNull()) { - QDomNodeList nodes = e.elementsByTagName(QString::fromLatin1("Error")); + TQDomNodeList nodes = e.elementsByTagName(TQString::tqfromLatin1("Error")); for(uint i = 0; i < nodes.count(); ++i) { - e = nodes.item(i).toElement().namedItem(QString::fromLatin1("Code")).toElement(); + e = nodes.item(i).toElement().namedItem(TQString::tqfromLatin1("Code")).toElement(); if(!e.isNull() && e.text() == Latin1Literal("AWS.ECommerceService.NoExactMatches")) { // no exact match, not a real error, so skip continue; } // for some reason, Amazon will return an error simply when a valid ISBN is not found // I really want to ignore that, so check the IsValid element in the Request element - QDomNode isValidNode = n.parentNode().namedItem(QString::fromLatin1("IsValid")); + TQDomNode isValidNode = n.tqparentNode().namedItem(TQString::tqfromLatin1("IsValid")); if(m_key == ISBN && isValidNode.toElement().text().lower() == Latin1Literal("true")) { continue; } - e = nodes.item(i).toElement().namedItem(QString::fromLatin1("Message")).toElement(); + e = nodes.item(i).toElement().namedItem(TQString::tqfromLatin1("Message")).toElement(); if(!e.isNull()) { errors << e.text(); } @@ -417,11 +417,11 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { } } -// QRegExp stripHTML(QString::fromLatin1("<.*>"), true); +// TQRegExp stripHTML(TQString::tqfromLatin1("<.*>"), true); // stripHTML.setMinimal(true); // assume amazon is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size())); + TQString str = m_xsltHandler->applyStylesheet(TQString::fromUtf8(m_data, m_data.size())); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); if(!coll) { @@ -432,12 +432,12 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { if(!m_addLinkField) { // remove amazon field if it's not to be added - coll->removeField(QString::fromLatin1("amazon")); + coll->removeField(TQString::tqfromLatin1("amazon")); } Data::EntryVec entries = coll->entries(); if(entries.isEmpty() && !errors.isEmpty()) { - for(QStringList::ConstIterator it = errors.constBegin(); it != errors.constEnd(); ++it) { + for(TQStringList::ConstIterator it = errors.constBegin(); it != errors.constEnd(); ++it) { myDebug() << "AmazonFetcher::" << *it << endl; } message(errors[0], MessageHandler::Error); @@ -460,64 +460,64 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { // special case book author // amazon is really bad about not putting spaces after periods if(coll->type() == Data::Collection::Book) { - QRegExp rx(QString::fromLatin1("\\.([^\\s])")); - QStringList values = entry->fields(QString::fromLatin1("author"), false); - for(QStringList::Iterator it = values.begin(); it != values.end(); ++it) { - (*it).replace(rx, QString::fromLatin1(". \\1")); + TQRegExp rx(TQString::tqfromLatin1("\\.([^\\s])")); + TQStringList values = entry->fields(TQString::tqfromLatin1("author"), false); + for(TQStringList::Iterator it = values.begin(); it != values.end(); ++it) { + (*it).tqreplace(rx, TQString::tqfromLatin1(". \\1")); } - entry->setField(QString::fromLatin1("author"), values.join(QString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("author"), values.join(TQString::tqfromLatin1("; "))); } // UK puts the year in the title for some reason if(m_site == UK && coll->type() == Data::Collection::Video) { - QRegExp rx(QString::fromLatin1("\\[(\\d{4})\\]")); - QString t = entry->title(); - if(t.find(rx) > -1) { - QString y = rx.cap(1); + TQRegExp rx(TQString::tqfromLatin1("\\[(\\d{4})\\]")); + TQString t = entry->title(); + if(t.tqfind(rx) > -1) { + TQString y = rx.cap(1); t.remove(rx).simplifyWhiteSpace(); - entry->setField(QString::fromLatin1("title"), t); - if(entry->field(QString::fromLatin1("year")).isEmpty()) { - entry->setField(QString::fromLatin1("year"), y); + entry->setField(TQString::tqfromLatin1("title"), t); + if(entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + entry->setField(TQString::tqfromLatin1("year"), y); } } } - QString desc; + TQString desc; switch(coll->type()) { case Data::Collection::Book: case Data::Collection::ComicBook: case Data::Collection::Bibtex: - desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("cr_year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("cr_year")); - } else if(!entry->field(QString::fromLatin1("pub_year")).isEmpty()){ - desc += QChar('/') + entry->field(QString::fromLatin1("pub_year")); + desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("cr_year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("cr_year")); + } else if(!entry->field(TQString::tqfromLatin1("pub_year")).isEmpty()){ + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("pub_year")); } break; case Data::Collection::Video: - desc = entry->field(QString::fromLatin1("studio")) - + QChar('/') - + entry->field(QString::fromLatin1("director")) - + QChar('/') - + entry->field(QString::fromLatin1("year")) - + QChar('/') - + entry->field(QString::fromLatin1("medium")); + desc = entry->field(TQString::tqfromLatin1("studio")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("director")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("medium")); break; case Data::Collection::Album: - desc = entry->field(QString::fromLatin1("artist")) - + QChar('/') - + entry->field(QString::fromLatin1("label")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("artist")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("label")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Game: - desc = entry->field(QString::fromLatin1("platform")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("platform")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; default: @@ -528,21 +528,21 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { // tentatively don't do this, looks like ECS 4 cleaned everything up /* if(coll->type() == Data::Collection::Video) { - QString plot = entry->field(QString::fromLatin1("plot")); + TQString plot = entry->field(TQString::tqfromLatin1("plot")); plot.remove(stripHTML); - entry->setField(QString::fromLatin1("plot"), plot); + entry->setField(TQString::tqfromLatin1("plot"), plot); } else if(coll->type() == Data::Collection::Game) { - QString desc = entry->field(QString::fromLatin1("description")); + TQString desc = entry->field(TQString::tqfromLatin1("description")); desc.remove(stripHTML); - entry->setField(QString::fromLatin1("description"), desc); + entry->setField(TQString::tqfromLatin1("description"), desc); } else { - QString comments = entry->field(QString::fromLatin1("comments")); + TQString comments = entry->field(TQString::tqfromLatin1("comments")); comments.remove(stripHTML); - entry->setField(QString::fromLatin1("comments"), comments); + entry->setField(TQString::tqfromLatin1("comments"), comments); } */ // myDebug() << "AmazonFetcher::slotComplete() - " << entry->title() << endl; - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); ++m_numResults; @@ -556,14 +556,14 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { // are there any additional results to get? m_hasMoreResults = m_page * AMAZON_RETURNS_PER_REQUEST < m_total; - const int currentTotal = QMIN(m_total, m_limit); + const int currentTotal = TQMIN(m_total, m_limit); if(m_page * AMAZON_RETURNS_PER_REQUEST < currentTotal) { int foundCount = (m_page-1) * AMAZON_RETURNS_PER_REQUEST + coll->entryCount(); - message(i18n("Results from %1: %2/%3").arg(source()).arg(foundCount).arg(m_total), MessageHandler::Status); + message(i18n("Results from %1: %2/%3").tqarg(source()).tqarg(foundCount).tqarg(m_total), MessageHandler::tqStatus); ++m_page; m_countOffset = 0; doSearch(); - } else if(m_value.contains(';') > 9) { + } else if(m_value.tqcontains(';') > 9) { search(m_key, m_value.section(';', 10)); } else { m_countOffset = m_entries.count() % AMAZON_RETURNS_PER_REQUEST; @@ -581,10 +581,10 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { return 0; } - QStringList defaultFields = customFields().keys(); - for(QStringList::Iterator it = defaultFields.begin(); it != defaultFields.end(); ++it) { - if(!m_fields.contains(*it)) { - entry->setField(*it, QString::null); + TQStringList defaultFields = customFields().keys(); + for(TQStringList::Iterator it = defaultFields.begin(); it != defaultFields.end(); ++it) { + if(!m_fields.tqcontains(*it)) { + entry->setField(*it, TQString()); } } @@ -595,44 +595,44 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { case Data::Collection::ComicBook: case Data::Collection::Bibtex: { - const QString keywords = QString::fromLatin1("keyword"); - QStringList oldWords = entry->fields(keywords, false); + const TQString keywords = TQString::tqfromLatin1("keyword"); + TQStringList oldWords = entry->fields(keywords, false); StringSet words; - for(QStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { + for(TQStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { // the amazon2tellico stylesheet separates keywords with '/' - QStringList nodes = QStringList::split('/', *it); - for(QStringList::Iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) { + TQStringList nodes = TQStringList::split('/', *it); + for(TQStringList::Iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) { if(*it2 == Latin1Literal("General") || *it2 == Latin1Literal("Subjects") || *it2 == Latin1Literal("Par prix") || // french stuff *it2 == Latin1Literal("Divers") || // french stuff - (*it2).startsWith(QChar('(')) || - (*it2).startsWith(QString::fromLatin1("Authors"))) { + (*it2).startsWith(TQChar('(')) || + (*it2).startsWith(TQString::tqfromLatin1("Authors"))) { continue; } words.add(*it2); } } - entry->setField(keywords, words.toList().join(QString::fromLatin1("; "))); + entry->setField(keywords, words.toList().join(TQString::tqfromLatin1("; "))); } - entry->setField(QString::fromLatin1("comments"), Tellico::decodeHTML(entry->field(QString::fromLatin1("comments")))); + entry->setField(TQString::tqfromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("comments")))); break; case Data::Collection::Video: { - const QString genres = QString::fromLatin1("genre"); - QStringList oldWords = entry->fields(genres, false); + const TQString genres = TQString::tqfromLatin1("genre"); + TQStringList oldWords = entry->fields(genres, false); StringSet words; // only care about genres that have "Genres" in the amazon response // and take the first word after that - for(QStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { - if((*it).find(QString::fromLatin1("Genres")) == -1) { + for(TQStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { + if((*it).tqfind(TQString::tqfromLatin1("Genres")) == -1) { continue; } // the amazon2tellico stylesheet separates words with '/' - QStringList nodes = QStringList::split('/', *it); - for(QStringList::Iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) { + TQStringList nodes = TQStringList::split('/', *it); + for(TQStringList::Iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) { if(*it2 != Latin1Literal("Genres")) { continue; } @@ -643,34 +643,34 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { break; // we're done } } - entry->setField(genres, words.toList().join(QString::fromLatin1("; "))); + entry->setField(genres, words.toList().join(TQString::tqfromLatin1("; "))); // language tracks get duplicated, too - QStringList langs = entry->fields(QString::fromLatin1("language"), false); + TQStringList langs = entry->fields(TQString::tqfromLatin1("language"), false); words.clear(); - for(QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it) { + for(TQStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it) { words.add(*it); } - entry->setField(QString::fromLatin1("language"), words.toList().join(QString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("language"), words.toList().join(TQString::tqfromLatin1("; "))); } - entry->setField(QString::fromLatin1("plot"), Tellico::decodeHTML(entry->field(QString::fromLatin1("plot")))); + entry->setField(TQString::tqfromLatin1("plot"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("plot")))); break; case Data::Collection::Album: { - const QString genres = QString::fromLatin1("genre"); - QStringList oldWords = entry->fields(genres, false); + const TQString genres = TQString::tqfromLatin1("genre"); + TQStringList oldWords = entry->fields(genres, false); StringSet words; // only care about genres that have "Styles" in the amazon response // and take the first word after that - for(QStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { - if((*it).find(QString::fromLatin1("Styles")) == -1) { + for(TQStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { + if((*it).tqfind(TQString::tqfromLatin1("Styles")) == -1) { continue; } // the amazon2tellico stylesheet separates words with '/' - QStringList nodes = QStringList::split('/', *it); + TQStringList nodes = TQStringList::split('/', *it); bool isStyle = false; - for(QStringList::Iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) { + for(TQStringList::Iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) { if(!isStyle) { if(*it2 == Latin1Literal("Styles")) { isStyle = true; @@ -682,13 +682,13 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { } } } - entry->setField(genres, words.toList().join(QString::fromLatin1("; "))); + entry->setField(genres, words.toList().join(TQString::tqfromLatin1("; "))); } - entry->setField(QString::fromLatin1("comments"), Tellico::decodeHTML(entry->field(QString::fromLatin1("comments")))); + entry->setField(TQString::tqfromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("comments")))); break; case Data::Collection::Game: - entry->setField(QString::fromLatin1("description"), Tellico::decodeHTML(entry->field(QString::fromLatin1("description")))); + entry->setField(TQString::tqfromLatin1("description"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("description")))); break; } @@ -697,26 +697,26 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { // also sometimes table fields have rows but no values Data::FieldVec fields = entry->collection()->fields(); - QRegExp blank(QString::fromLatin1("[\\s:;]+")); // only white space, column separators and row separators + TQRegExp blank(TQString::tqfromLatin1("[\\s:;]+")); // only white space, column separators and row separators for(Data::FieldVec::Iterator fIt = fields.begin(); fIt != fields.end(); ++fIt) { if(fIt->type() != Data::Field::Table) { continue; } if(blank.exactMatch(entry->field(fIt))) { - entry->setField(fIt, QString::null); + entry->setField(fIt, TQString()); } } KURL imageURL; switch(m_imageSize) { case SmallImage: - imageURL = entry->field(QString::fromLatin1("small-image")); + imageURL = entry->field(TQString::tqfromLatin1("small-image")); break; case MediumImage: - imageURL = entry->field(QString::fromLatin1("medium-image")); + imageURL = entry->field(TQString::tqfromLatin1("medium-image")); break; case LargeImage: - imageURL = entry->field(QString::fromLatin1("large-image")); + imageURL = entry->field(TQString::tqfromLatin1("large-image")); break; case NoImage: default: @@ -724,25 +724,25 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { } // myDebug() << "AmazonFetcher::fetchEntry() - grabbing " << imageURL.prettyURL() << endl; if(!imageURL.isEmpty()) { - QString id = ImageFactory::addImage(imageURL, true); + TQString id = ImageFactory::addImage(imageURL, true); // FIXME: need to add cover image field to bibtex collection if(id.isEmpty()) { message(i18n("The cover image could not be loaded."), MessageHandler::Warning); } else { // amazon serves up 1x1 gifs occasionally, but that's caught in the image constructor // all relevant collection types have cover fields - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } // don't want to show image urls in the fetch dialog - entry->setField(QString::fromLatin1("small-image"), QString::null); - entry->setField(QString::fromLatin1("medium-image"), QString::null); - entry->setField(QString::fromLatin1("large-image"), QString::null); + entry->setField(TQString::tqfromLatin1("small-image"), TQString()); + entry->setField(TQString::tqfromLatin1("medium-image"), TQString()); + entry->setField(TQString::tqfromLatin1("large-image"), TQString()); return entry; } void AmazonFetcher::initXSLTHandler() { - QString xsltfile = locate("appdata", QString::fromLatin1("amazon2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("amazon2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "AmazonFetcher::initXSLTHandler() - can not locate amazon2tellico.xsl." << endl; return; @@ -766,14 +766,14 @@ void AmazonFetcher::updateEntry(Data::EntryPtr entry_) { int type = entry_->collection()->type(); if(type == Data::Collection::Book || type == Data::Collection::ComicBook || type == Data::Collection::Bibtex) { - QString isbn = entry_->field(QString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { m_limit = 5; // no need for more search(Fetch::ISBN, isbn); return; } } else if(type == Data::Collection::Album) { - QString a = entry_->field(QString::fromLatin1("artist")); + TQString a = entry_->field(TQString::tqfromLatin1("artist")); if(!a.isEmpty()) { search(Fetch::Person, a); return; @@ -781,7 +781,7 @@ void AmazonFetcher::updateEntry(Data::EntryPtr entry_) { } // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -793,10 +793,10 @@ void AmazonFetcher::updateEntry(Data::EntryPtr entry_) { void AmazonFetcher::parseTitle(Data::EntryPtr entry, int collType) { Q_UNUSED(collType); - // assume that everything in brackets or parentheses is extra - QRegExp rx(QString::fromLatin1("[\\(\\[](.*)[\\)\\]]")); + // assume that everything in brackets or tqparentheses is extra + TQRegExp rx(TQString::tqfromLatin1("[\\(\\[](.*)[\\)\\]]")); rx.setMinimal(true); - QString title = entry->field(QString::fromLatin1("title")); + TQString title = entry->field(TQString::tqfromLatin1("title")); int pos = rx.search(title); while(pos > -1) { if(parseTitleToken(entry, rx.cap(1))) { @@ -805,47 +805,47 @@ void AmazonFetcher::parseTitle(Data::EntryPtr entry, int collType) { } pos = rx.search(title, pos+1); } - entry->setField(QString::fromLatin1("title"), title.stripWhiteSpace()); + entry->setField(TQString::tqfromLatin1("title"), title.stripWhiteSpace()); } -bool AmazonFetcher::parseTitleToken(Data::EntryPtr entry, const QString& token) { +bool AmazonFetcher::parseTitleToken(Data::EntryPtr entry, const TQString& token) { // if res = true, then the token gets removed from the title bool res = false; - if(token.find(QString::fromLatin1("widescreen"), 0, false /* case-insensitive*/) > -1 || - token.find(i18n("Widescreen"), 0, false) > -1) { - entry->setField(QString::fromLatin1("widescreen"), QString::fromLatin1("true")); + if(token.tqfind(TQString::tqfromLatin1("widescreen"), 0, false /* case-insensitive*/) > -1 || + token.tqfind(i18n("Widescreen"), 0, false) > -1) { + entry->setField(TQString::tqfromLatin1("widescreen"), TQString::tqfromLatin1("true")); // res = true; leave it in the title - } else if(token.find(QString::fromLatin1("full screen"), 0, false) > -1) { + } else if(token.tqfind(TQString::tqfromLatin1("full screen"), 0, false) > -1) { // skip, but go ahead and remove from title res = true; } - if(token.find(QString::fromLatin1("blu-ray"), 0, false) > -1) { - entry->setField(QString::fromLatin1("medium"), i18n("Blu-ray")); + if(token.tqfind(TQString::tqfromLatin1("blu-ray"), 0, false) > -1) { + entry->setField(TQString::tqfromLatin1("medium"), i18n("Blu-ray")); res = true; - } else if(token.find(QString::fromLatin1("hd dvd"), 0, false) > -1) { - entry->setField(QString::fromLatin1("medium"), i18n("HD DVD")); + } else if(token.tqfind(TQString::tqfromLatin1("hd dvd"), 0, false) > -1) { + entry->setField(TQString::tqfromLatin1("medium"), i18n("HD DVD")); res = true; } - if(token.find(QString::fromLatin1("director's cut"), 0, false) > -1 || - token.find(i18n("Director's Cut"), 0, false) > -1) { - entry->setField(QString::fromLatin1("directors-cut"), QString::fromLatin1("true")); + if(token.tqfind(TQString::tqfromLatin1("director's cut"), 0, false) > -1 || + token.tqfind(i18n("Director's Cut"), 0, false) > -1) { + entry->setField(TQString::tqfromLatin1("directors-cut"), TQString::tqfromLatin1("true")); // res = true; leave it in the title } return res; } -Tellico::Fetch::ConfigWidget* AmazonFetcher::configWidget(QWidget* parent_) const { - return new AmazonFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* AmazonFetcher::configWidget(TQWidget* tqparent_) const { + return new AmazonFetcher::ConfigWidget(tqparent_, this); } -AmazonFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const AmazonFetcher* fetcher_/*=0*/) - : Fetch::ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget(), 4, 2); +AmazonFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const AmazonFetcher* fetcher_/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 4, 2); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - QLabel* label = new QLabel(i18n("Co&untry: "), optionsWidget()); + TQLabel* label = new TQLabel(i18n("Co&untry: "), optionsWidget()); l->addWidget(label, ++row, 0); m_siteCombo = new GUI::ComboBox(optionsWidget()); m_siteCombo->insertItem(i18n("United States"), US); @@ -854,39 +854,39 @@ AmazonFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const AmazonFetcher* m_siteCombo->insertItem(i18n("Japan"), JP); m_siteCombo->insertItem(i18n("France"), FR); m_siteCombo->insertItem(i18n("Canada"), CA); - connect(m_siteCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); - connect(m_siteCombo, SIGNAL(activated(int)), SLOT(slotSiteChanged())); + connect(m_siteCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); + connect(m_siteCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSiteChanged())); l->addWidget(m_siteCombo, row, 1); - QString w = i18n("Amazon.com provides data from several different localized sites. Choose the one " + TQString w = i18n("Amazon.com provides data from several different localized sites. Choose the one " "you wish to use for this data source."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_siteCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_siteCombo, w); label->setBuddy(m_siteCombo); - label = new QLabel(i18n("&Image size: "), optionsWidget()); + label = new TQLabel(i18n("&Image size: "), optionsWidget()); l->addWidget(label, ++row, 0); m_imageCombo = new GUI::ComboBox(optionsWidget()); m_imageCombo->insertItem(i18n("Small Image"), SmallImage); m_imageCombo->insertItem(i18n("Medium Image"), MediumImage); m_imageCombo->insertItem(i18n("Large Image"), LargeImage); m_imageCombo->insertItem(i18n("No Image"), NoImage); - connect(m_imageCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); + connect(m_imageCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_imageCombo, row, 1); w = i18n("The cover image may be downloaded as well. However, too many large images in the " "collection may degrade performance."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_imageCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_imageCombo, w); label->setBuddy(m_imageCombo); - label = new QLabel(i18n("&Associate's ID: "), optionsWidget()); + label = new TQLabel(i18n("&Associate's ID: "), optionsWidget()); l->addWidget(label, ++row, 0); m_assocEdit = new KLineEdit(optionsWidget()); - connect(m_assocEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_assocEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_assocEdit, row, 1); w = i18n("The associate's id identifies the person accessing the Amazon.com Web Services, and is included " "in any links to the Amazon.com site."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_assocEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_assocEdit, w); label->setBuddy(m_assocEdit); l->setRowStretch(++row, 10); @@ -896,11 +896,11 @@ AmazonFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const AmazonFetcher* m_assocEdit->setText(fetcher_->m_assoc); m_imageCombo->setCurrentData(fetcher_->m_imageSize); } else { // defaults - m_assocEdit->setText(QString::fromLatin1(AMAZON_ASSOC_TOKEN)); + m_assocEdit->setText(TQString::tqfromLatin1(AMAZON_ASSOC_TOKEN)); m_imageCombo->setCurrentData(MediumImage); } - addFieldsWidget(AmazonFetcher::customFields(), fetcher_ ? fetcher_->m_fields : QStringList()); + addFieldsWidget(AmazonFetcher::customFields(), fetcher_ ? fetcher_->m_fields : TQStringList()); KAcceleratorManager::manage(optionsWidget()); } @@ -908,7 +908,7 @@ AmazonFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const AmazonFetcher* void AmazonFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { int n = m_siteCombo->currentData().toInt(); config_.writeEntry("Site", n); - QString s = m_assocEdit->text().stripWhiteSpace(); + TQString s = m_assocEdit->text().stripWhiteSpace(); if(!s.isEmpty()) { config_.writeEntry("AssocToken", s); } @@ -919,7 +919,7 @@ void AmazonFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { slotSetModified(false); } -QString AmazonFetcher::ConfigWidget::preferredName() const { +TQString AmazonFetcher::ConfigWidget::preferredName() const { return AmazonFetcher::siteData(m_siteCombo->currentData().toInt()).title; } @@ -930,7 +930,7 @@ void AmazonFetcher::ConfigWidget::slotSiteChanged() { //static Tellico::StringMap AmazonFetcher::customFields() { StringMap map; - map[QString::fromLatin1("keyword")] = i18n("Keywords"); + map[TQString::tqfromLatin1("keyword")] = i18n("Keywords"); return map; } diff --git a/src/fetch/amazonfetcher.h b/src/fetch/amazonfetcher.h index 05df8d7..ed7b97a 100644 --- a/src/fetch/amazonfetcher.h +++ b/src/fetch/amazonfetcher.h @@ -20,13 +20,13 @@ #include <kurl.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> class KLineEdit; -class QCheckBox; -class QLabel; +class TQCheckBox; +class TQLabel; namespace KIO { class Job; @@ -48,6 +48,7 @@ namespace Tellico { */ class AmazonFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: enum Site { @@ -67,12 +68,12 @@ public: NoImage=3 }; - AmazonFetcher(Site site, QObject* parent, const char* name = 0); + AmazonFetcher(Site site, TQObject* tqparent, const char* name = 0); virtual ~AmazonFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); // amazon can search title, person, isbn, or keyword. No Raw for now. virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == ISBN || k == UPC || k == Keyword; } @@ -85,7 +86,7 @@ public: virtual void updateEntry(Data::EntryPtr entry); struct SiteData { - QString title; + TQString title; KURL url; }; static const SiteData& siteData(int site); @@ -93,56 +94,57 @@ public: /** * Returns a widget for modifying the fetcher's config. */ - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const ; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const ; static StringMap customFields(); class ConfigWidget; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: void initXSLTHandler(); void doSearch(); void parseTitle(Data::EntryPtr entry, int collType); - bool parseTitleToken(Data::EntryPtr entry, const QString& token); + bool parseTitleToken(Data::EntryPtr entry, const TQString& token); XSLTHandler* m_xsltHandler; Site m_site; ImageSize m_imageSize; - QString m_access; - QString m_assoc; + TQString m_access; + TQString m_assoc; bool m_addLinkField; int m_limit; int m_countOffset; - QByteArray m_data; + TQByteArray m_data; int m_page; int m_total; int m_numResults; - QMap<int, Data::EntryPtr> m_entries; // they get modified after collection is created, so can't be const - QGuardedPtr<KIO::Job> m_job; + TQMap<int, Data::EntryPtr> m_entries; // they get modified after collection is created, so can't be const + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; - QStringList m_fields; + TQStringList m_fields; }; class AmazonFetcher::ConfigWidget : public Fetch::ConfigWidget { Q_OBJECT + TQ_OBJECT public: - ConfigWidget(QWidget* parent_, const AmazonFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const AmazonFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; private slots: void slotSiteChanged(); diff --git a/src/fetch/animenfofetcher.cpp b/src/fetch/animenfofetcher.cpp index 728c583..3a93281 100644 --- a/src/fetch/animenfofetcher.cpp +++ b/src/fetch/animenfofetcher.cpp @@ -26,10 +26,10 @@ #include <kconfig.h> #include <kio/job.h> -#include <qregexp.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qfile.h> +#include <tqregexp.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqfile.h> //#define ANIMENFO_TEST @@ -39,15 +39,15 @@ namespace { using Tellico::Fetch::AnimeNfoFetcher; -AnimeNfoFetcher::AnimeNfoFetcher(QObject* parent_, const char* name_ /*=0*/) - : Fetcher(parent_, name_), m_started(false) { +AnimeNfoFetcher::AnimeNfoFetcher(TQObject* tqparent_, const char* name_ /*=0*/) + : Fetcher(tqparent_, name_), m_started(false) { } -QString AnimeNfoFetcher::defaultName() { - return QString::fromLatin1("AnimeNfo.com"); +TQString AnimeNfoFetcher::defaultName() { + return TQString::tqfromLatin1("AnimeNfo.com"); } -QString AnimeNfoFetcher::source() const { +TQString AnimeNfoFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -59,27 +59,27 @@ void AnimeNfoFetcher::readConfigHook(const KConfigGroup& config_) { Q_UNUSED(config_); } -void AnimeNfoFetcher::search(FetchKey key_, const QString& value_) { +void AnimeNfoFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; m_matches.clear(); #ifdef ANIMENFO_TEST - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/animenfo.html")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/animenfo.html")); #else - KURL u(QString::fromLatin1(ANIMENFO_BASE_URL)); - u.addQueryItem(QString::fromLatin1("action"), QString::fromLatin1("Go")); - u.addQueryItem(QString::fromLatin1("option"), QString::fromLatin1("keywords")); - u.addQueryItem(QString::fromLatin1("queryin"), QString::fromLatin1("anime_titles")); + KURL u(TQString::tqfromLatin1(ANIMENFO_BASE_URL)); + u.addQueryItem(TQString::tqfromLatin1("action"), TQString::tqfromLatin1("Go")); + u.addQueryItem(TQString::tqfromLatin1("option"), TQString::tqfromLatin1("keywords")); + u.addQueryItem(TQString::tqfromLatin1("queryin"), TQString::tqfromLatin1("anime_titles")); if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } switch(key_) { case Keyword: - u.addQueryItem(QString::fromLatin1("query"), value_); + u.addQueryItem(TQString::tqfromLatin1("query"), value_); break; default: @@ -91,10 +91,10 @@ void AnimeNfoFetcher::search(FetchKey key_, const QString& value_) { // myDebug() << "AnimeNfoFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void AnimeNfoFetcher::stop() { @@ -111,8 +111,8 @@ void AnimeNfoFetcher::stop() { emit signalDone(this); } -void AnimeNfoFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void AnimeNfoFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -133,28 +133,28 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { return; } - QString s = Tellico::decodeHTML(QString(m_data)); + TQString s = Tellico::decodeHTML(TQString(m_data)); - QRegExp infoRx(QString::fromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[\"'][^>]*>(.*)</td>"), false); + TQRegExp infoRx(TQString::tqfromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[\"'][^>]*>(.*)</td>"), false); infoRx.setMinimal(true); - QRegExp anchorRx(QString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); anchorRx.setMinimal(true); - QRegExp yearRx(QString::fromLatin1("\\d{4}"), false); + TQRegExp yearRx(TQString::tqfromLatin1("\\d{4}"), false); // search page comes in groups of threes int n = 0; - QString u, t, y; + TQString u, t, y; for(int pos = infoRx.search(s); m_started && pos > -1; pos = infoRx.search(s, pos+1)) { if(n == 0 && !u.isEmpty()) { - SearchResult* r = new SearchResult(this, t, y, QString()); + SearchResult* r = new SearchResult(this, t, y, TQString()); emit signalResultFound(r); #ifdef ANIMENFO_TEST - KURL url = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/animetitle.html")); + KURL url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/animetitle.html")); #else - KURL url(QString::fromLatin1(ANIMENFO_BASE_URL), u); - url.setQuery(QString::null); + KURL url(TQString::tqfromLatin1(ANIMENFO_BASE_URL), u); + url.setQuery(TQString()); #endif m_matches.insert(r->uid, url); @@ -187,10 +187,10 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { // grab last response #ifndef ANIMENFO_TEST if(!u.isEmpty()) { - SearchResult* r = new SearchResult(this, t, y, QString()); + SearchResult* r = new SearchResult(this, t, y, TQString()); emit signalResultFound(r); - KURL url(QString::fromLatin1(ANIMENFO_BASE_URL), u); - url.setQuery(QString::null); + KURL url(TQString::tqfromLatin1(ANIMENFO_BASE_URL), u); + url.setQuery(TQString()); m_matches.insert(r->uid, url); } #endif @@ -210,7 +210,7 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { return 0; } - QString results = Tellico::decodeHTML(FileHandler::readTextFile(url, true)); + TQString results = Tellico::decodeHTML(FileHandler::readTextFile(url, true)); if(results.isEmpty()) { myDebug() << "AnimeNfoFetcher::fetchEntry() - no text results" << endl; return 0; @@ -218,10 +218,10 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { #if 0 kdWarning() << "Remove debug from animenfofetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.html")); + TQFile f(TQString::tqfromLatin1("/tmp/test.html")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); t << results; } f.close(); @@ -236,64 +236,64 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { return entry; } -Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const QString& str_) { +Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { // myDebug() << "AnimeNfoFetcher::parseEntry()" << endl; // class might be anime_info_top - QRegExp infoRx(QString::fromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[^>]*>(.*)</td>"), false); + TQRegExp infoRx(TQString::tqfromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[^>]*>(.*)</td>"), false); infoRx.setMinimal(true); - QRegExp tagRx(QString::fromLatin1("<.*>")); + TQRegExp tagRx(TQString::tqfromLatin1("<.*>")); tagRx.setMinimal(true); - QRegExp anchorRx(QString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); anchorRx.setMinimal(true); - QRegExp jsRx(QString::fromLatin1("<script.*</script>"), false); + TQRegExp jsRx(TQString::tqfromLatin1("<script.*</script>"), false); jsRx.setMinimal(true); - QString s = str_; + TQString s = str_; s.remove(jsRx); Data::CollPtr coll = new Data::VideoCollection(true); // add new fields - Data::FieldPtr f = new Data::Field(QString::fromLatin1("origtitle"), i18n("Original Title")); + Data::FieldPtr f = new Data::Field(TQString::tqfromLatin1("origtitle"), i18n("Original Title")); coll->addField(f); - f = new Data::Field(QString::fromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table); + f = new Data::Field(TQString::tqfromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table); f->setFormatFlag(Data::Field::FormatTitle); coll->addField(f); - f = new Data::Field(QString::fromLatin1("distributor"), i18n("Distributor")); + f = new Data::Field(TQString::tqfromLatin1("distributor"), i18n("Distributor")); f->setCategory(i18n("Other People")); f->setFlags(Data::Field::AllowCompletion | Data::Field::AllowMultiple | Data::Field::AllowGrouped); f->setFormatFlag(Data::Field::FormatPlain); coll->addField(f); - f = new Data::Field(QString::fromLatin1("episodes"), i18n("Episodes"), Data::Field::Number); + f = new Data::Field(TQString::tqfromLatin1("episodes"), i18n("Episodes"), Data::Field::Number); f->setCategory(i18n("Features")); coll->addField(f); // map captions in HTML to field names - QMap<QString, QString> fieldMap; - fieldMap.insert(QString::fromLatin1("Title"), QString::fromLatin1("title")); - fieldMap.insert(QString::fromLatin1("Japanese Title"), QString::fromLatin1("origtitle")); - fieldMap.insert(QString::fromLatin1("Total Episodes"), QString::fromLatin1("episodes")); - fieldMap.insert(QString::fromLatin1("Genres"), QString::fromLatin1("genre")); - fieldMap.insert(QString::fromLatin1("Year Published"), QString::fromLatin1("year")); - fieldMap.insert(QString::fromLatin1("Studio"), QString::fromLatin1("studio")); - fieldMap.insert(QString::fromLatin1("US Distribution"), QString::fromLatin1("distributor")); + TQMap<TQString, TQString> fieldMap; + fieldMap.insert(TQString::tqfromLatin1("Title"), TQString::tqfromLatin1("title")); + fieldMap.insert(TQString::tqfromLatin1("Japanese Title"), TQString::tqfromLatin1("origtitle")); + fieldMap.insert(TQString::tqfromLatin1("Total Episodes"), TQString::tqfromLatin1("episodes")); + fieldMap.insert(TQString::tqfromLatin1("Genres"), TQString::tqfromLatin1("genre")); + fieldMap.insert(TQString::tqfromLatin1("Year Published"), TQString::tqfromLatin1("year")); + fieldMap.insert(TQString::tqfromLatin1("Studio"), TQString::tqfromLatin1("studio")); + fieldMap.insert(TQString::tqfromLatin1("US Distribution"), TQString::tqfromLatin1("distributor")); Data::EntryPtr entry = new Data::Entry(coll); int n = 0; - QString key, value; + TQString key, value; int oldpos = -1; for(int pos = infoRx.search(s); pos > -1; pos = infoRx.search(s, pos+1)) { if(n == 0 && !key.isEmpty()) { - if(fieldMap.contains(key)) { + if(fieldMap.tqcontains(key)) { value = value.simplifyWhiteSpace(); if(value.length() > 2) { // might be "-" if(key == Latin1Literal("Genres")) { - entry->setField(fieldMap[key], QStringList::split(QRegExp(QString::fromLatin1("\\s*,\\s*")), - value).join(QString::fromLatin1("; "))); + entry->setField(fieldMap[key], TQStringList::split(TQRegExp(TQString::tqfromLatin1("\\s*,\\s*")), + value).join(TQString::tqfromLatin1("; "))); } else { entry->setField(fieldMap[key], value); } @@ -315,44 +315,44 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const QString& str_) { } // image - QRegExp imgRx(QString::fromLatin1("<img\\s+[^>]*src\\s*=\\s*[\"']([^>]*)[\"']\\s+[^>]*alt\\s*=\\s*[\"']%1[\"']") - .arg(entry->field(QString::fromLatin1("title"))), false); + TQRegExp imgRx(TQString::tqfromLatin1("<img\\s+[^>]*src\\s*=\\s*[\"']([^>]*)[\"']\\s+[^>]*alt\\s*=\\s*[\"']%1[\"']") + .tqarg(entry->field(TQString::tqfromLatin1("title"))), false); imgRx.setMinimal(true); int pos = imgRx.search(s); if(pos > -1) { - KURL imgURL(QString::fromLatin1(ANIMENFO_BASE_URL), imgRx.cap(1)); - QString id = ImageFactory::addImage(imgURL, true); + KURL imgURL(TQString::tqfromLatin1(ANIMENFO_BASE_URL), imgRx.cap(1)); + TQString id = ImageFactory::addImage(imgURL, true); if(!id.isEmpty()) { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } // now look for alternative titles and plot - const QString a = QString::fromLatin1("Alternative titles"); - pos = s.find(a, oldpos+1, false); + const TQString a = TQString::tqfromLatin1("Alternative titles"); + pos = s.tqfind(a, oldpos+1, false); if(pos > -1) { pos += a.length(); } int pos2 = -1; if(pos > -1) { - pos2 = s.find(QString::fromLatin1("Description"), pos+1, true); + pos2 = s.tqfind(TQString::tqfromLatin1("Description"), pos+1, true); if(pos2 > -1) { value = s.mid(pos, pos2-pos).remove(tagRx).simplifyWhiteSpace(); - entry->setField(QString::fromLatin1("alttitle"), value); + entry->setField(TQString::tqfromLatin1("alttitle"), value); } } - QRegExp descRx(QString::fromLatin1("class\\s*=\\s*[\"']description[\"'][^>]*>(.*)<"), false); + TQRegExp descRx(TQString::tqfromLatin1("class\\s*=\\s*[\"']description[\"'][^>]*>(.*)<"), false); descRx.setMinimal(true); - pos = descRx.search(s, QMAX(pos, pos2)); + pos = descRx.search(s, TQMAX(pos, pos2)); if(pos > -1) { - entry->setField(QString::fromLatin1("plot"), descRx.cap(1).simplifyWhiteSpace()); + entry->setField(TQString::tqfromLatin1("plot"), descRx.cap(1).simplifyWhiteSpace()); } return entry; } void AnimeNfoFetcher::updateEntry(Data::EntryPtr entry_) { - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Keyword, t); return; @@ -360,18 +360,18 @@ void AnimeNfoFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* AnimeNfoFetcher::configWidget(QWidget* parent_) const { - return new AnimeNfoFetcher::ConfigWidget(parent_); +Tellico::Fetch::ConfigWidget* AnimeNfoFetcher::configWidget(TQWidget* tqparent_) const { + return new AnimeNfoFetcher::ConfigWidget(tqparent_); } -AnimeNfoFetcher::ConfigWidget::ConfigWidget(QWidget* parent_) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +AnimeNfoFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } -QString AnimeNfoFetcher::ConfigWidget::preferredName() const { +TQString AnimeNfoFetcher::ConfigWidget::preferredName() const { return AnimeNfoFetcher::defaultName(); } diff --git a/src/fetch/animenfofetcher.h b/src/fetch/animenfofetcher.h index 7e4028e..df43b87 100644 --- a/src/fetch/animenfofetcher.h +++ b/src/fetch/animenfofetcher.h @@ -17,8 +17,8 @@ #include "fetcher.h" #include "configwidget.h" -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace KIO { class Job; @@ -34,14 +34,15 @@ namespace Tellico { */ class AnimeNfoFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - AnimeNfoFetcher(QObject* parent, const char* name = 0); + AnimeNfoFetcher(TQObject* tqparent, const char* name = 0); virtual ~AnimeNfoFetcher() {} - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); // only keyword search virtual bool canSearch(FetchKey k) const { return k == Keyword; } virtual void stop(); @@ -52,33 +53,33 @@ public: virtual void updateEntry(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_); + ConfigWidget(TQWidget* tqparent_); virtual void saveConfig(KConfigGroup&) {} - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: - Data::EntryPtr parseEntry(const QString& str); + Data::EntryPtr parseEntry(const TQString& str); - QByteArray m_data; + TQByteArray m_data; int m_total; - QMap<int, Data::EntryPtr> m_entries; - QMap<int, KURL> m_matches; - QGuardedPtr<KIO::Job> m_job; + TQMap<int, Data::EntryPtr> m_entries; + TQMap<int, KURL> m_matches; + TQGuardedPtr<KIO::Job> m_job; bool m_started; -// QStringList m_fields; +// TQStringList m_fields; }; } // end namespace diff --git a/src/fetch/arxivfetcher.cpp b/src/fetch/arxivfetcher.cpp index 442ef30..b176d88 100644 --- a/src/fetch/arxivfetcher.cpp +++ b/src/fetch/arxivfetcher.cpp @@ -27,9 +27,9 @@ #include <kstandarddirs.h> #include <kconfig.h> -#include <qdom.h> -#include <qlabel.h> -#include <qlayout.h> +#include <tqdom.h> +#include <tqlabel.h> +#include <tqlayout.h> //#define ARXIV_TEST @@ -40,8 +40,8 @@ namespace { using Tellico::Fetch::ArxivFetcher; -ArxivFetcher::ArxivFetcher(QObject* parent_) - : Fetcher(parent_), m_xsltHandler(0), m_start(0), m_job(0), m_started(false) { +ArxivFetcher::ArxivFetcher(TQObject* tqparent_) + : Fetcher(tqparent_), m_xsltHandler(0), m_start(0), m_job(0), m_started(false) { } ArxivFetcher::~ArxivFetcher() { @@ -49,11 +49,11 @@ ArxivFetcher::~ArxivFetcher() { m_xsltHandler = 0; } -QString ArxivFetcher::defaultName() { +TQString ArxivFetcher::defaultName() { return i18n("arXiv.org"); } -QString ArxivFetcher::source() const { +TQString ArxivFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -64,7 +64,7 @@ bool ArxivFetcher::canFetch(int type) const { void ArxivFetcher::readConfigHook(const KConfigGroup&) { } -void ArxivFetcher::search(FetchKey key_, const QString& value_) { +void ArxivFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_.stripWhiteSpace(); m_started = true; @@ -80,7 +80,7 @@ void ArxivFetcher::continueSearch() { void ArxivFetcher::doSearch() { if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } @@ -96,10 +96,10 @@ void ArxivFetcher::doSearch() { } m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void ArxivFetcher::stop() { @@ -116,8 +116,8 @@ void ArxivFetcher::stop() { emit signalDone(this); } -void ArxivFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void ArxivFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -140,11 +140,11 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from arxivfetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif @@ -158,21 +158,21 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { } if(m_total == -1) { - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, true /*namespace*/)) { kdWarning() << "ArxivFetcher::slotComplete() - server did not return valid XML." << endl; return; } // total is top level element, with attribute totalResultsAvailable - QDomNodeList list = dom.elementsByTagNameNS(QString::fromLatin1("http://a9.com/-/spec/opensearch/1.1/"), - QString::fromLatin1("totalResults")); + TQDomNodeList list = dom.elementsByTagNameNS(TQString::tqfromLatin1("http://a9.com/-/spec/opensearch/1.1/"), + TQString::tqfromLatin1("totalResults")); if(list.count() > 0) { m_total = list.item(0).toElement().text().toInt(); } } // assume result is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size())); + TQString str = m_xsltHandler->applyStylesheet(TQString::fromUtf8(m_data, m_data.size())); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); @@ -188,13 +188,13 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -207,19 +207,19 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { Tellico::Data::EntryPtr ArxivFetcher::fetchEntry(uint uid_) { Data::EntryPtr entry = m_entries[uid_]; // if URL but no cover image, fetch it - if(!entry->field(QString::fromLatin1("url")).isEmpty()) { + if(!entry->field(TQString::tqfromLatin1("url")).isEmpty()) { Data::CollPtr coll = entry->collection(); - 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); } if(entry->field(field).isEmpty()) { - QPixmap pix = NetAccess::filePreview(entry->field(QString::fromLatin1("url"))); + TQPixmap pix = NetAccess::filePreview(entry->field(TQString::tqfromLatin1("url"))); if(!pix.isNull()) { - QString id = ImageFactory::addImage(pix, QString::fromLatin1("PNG")); + TQString id = ImageFactory::addImage(pix, TQString::tqfromLatin1("PNG")); if(!id.isEmpty()) { entry->setField(field, id); } @@ -230,7 +230,7 @@ Tellico::Data::EntryPtr ArxivFetcher::fetchEntry(uint uid_) { } void ArxivFetcher::initXSLTHandler() { - QString xsltfile = locate("appdata", QString::fromLatin1("arxiv2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("arxiv2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "ArxivFetcher::initXSLTHandler() - can not locate arxiv2tellico.xsl." << endl; return; @@ -249,34 +249,34 @@ void ArxivFetcher::initXSLTHandler() { } } -KURL ArxivFetcher::searchURL(FetchKey key_, const QString& value_) const { - KURL u(QString::fromLatin1(ARXIV_BASE_URL)); - u.addQueryItem(QString::fromLatin1("start"), QString::number(m_start)); - u.addQueryItem(QString::fromLatin1("max_results"), QString::number(ARXIV_RETURNS_PER_REQUEST)); +KURL ArxivFetcher::searchURL(FetchKey key_, const TQString& value_) const { + KURL u(TQString::tqfromLatin1(ARXIV_BASE_URL)); + u.addQueryItem(TQString::tqfromLatin1("start"), TQString::number(m_start)); + u.addQueryItem(TQString::tqfromLatin1("max_results"), TQString::number(ARXIV_RETURNS_PER_REQUEST)); // quotes should be used if spaces are present, just use all the time - QString quotedValue = '"' + value_ + '"'; + TQString quotedValue = '"' + value_ + '"'; switch(key_) { case Title: - u.addQueryItem(QString::fromLatin1("search_query"), QString::fromLatin1("ti:%1").arg(quotedValue)); + u.addQueryItem(TQString::tqfromLatin1("search_query"), TQString::tqfromLatin1("ti:%1").tqarg(quotedValue)); break; case Person: - u.addQueryItem(QString::fromLatin1("search_query"), QString::fromLatin1("au:%1").arg(quotedValue)); + u.addQueryItem(TQString::tqfromLatin1("search_query"), TQString::tqfromLatin1("au:%1").tqarg(quotedValue)); break; case Keyword: // keyword gets to use all the words without being quoted - u.addQueryItem(QString::fromLatin1("search_query"), QString::fromLatin1("all:%1").arg(value_)); + u.addQueryItem(TQString::tqfromLatin1("search_query"), TQString::tqfromLatin1("all:%1").tqarg(value_)); break; case ArxivID: { // remove prefix and/or version number - QString value = value_; - value.remove(QRegExp(QString::fromLatin1("^arxiv:"), false)); - value.remove(QRegExp(QString::fromLatin1("v\\d+$"))); - u.addQueryItem(QString::fromLatin1("search_query"), QString::fromLatin1("id:%1").arg(value)); + TQString value = value_; + value.remove(TQRegExp(TQString::tqfromLatin1("^arxiv:"), false)); + value.remove(TQRegExp(TQString::tqfromLatin1("v\\d+$"))); + u.addQueryItem(TQString::tqfromLatin1("search_query"), TQString::tqfromLatin1("id:%1").tqarg(value)); } break; @@ -286,21 +286,21 @@ KURL ArxivFetcher::searchURL(FetchKey key_, const QString& value_) const { } #ifdef ARXIV_TEST - u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/arxiv.xml")); + u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/arxiv.xml")); #endif myDebug() << "ArxivFetcher::search() - url: " << u.url() << endl; return u; } void ArxivFetcher::updateEntry(Data::EntryPtr entry_) { - QString id = entry_->field(QString::fromLatin1("arxiv")); + TQString id = entry_->field(TQString::tqfromLatin1("arxiv")); if(!id.isEmpty()) { search(Fetch::ArxivID, id); return; } // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -314,13 +314,13 @@ void ArxivFetcher::updateEntrySynchronous(Data::EntryPtr entry) { if(!entry) { return; } - QString arxiv = entry->field(QString::fromLatin1("arxiv")); + TQString arxiv = entry->field(TQString::tqfromLatin1("arxiv")); if(arxiv.isEmpty()) { return; } KURL u = searchURL(ArxivID, arxiv); - QString xml = FileHandler::readTextFile(u, true, true); + TQString xml = FileHandler::readTextFile(u, true, true); if(xml.isEmpty()) { return; } @@ -333,33 +333,33 @@ void ArxivFetcher::updateEntrySynchronous(Data::EntryPtr entry) { } // assume result is always utf-8 - QString str = m_xsltHandler->applyStylesheet(xml); + TQString str = m_xsltHandler->applyStylesheet(xml); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); if(coll && coll->entryCount() > 0) { myLog() << "ArxivFetcher::updateEntrySynchronous() - found Arxiv result, merging" << endl; Data::Collection::mergeEntry(entry, coll->entries().front(), false /*overwrite*/); // the arxiv id might have a version# - entry->setField(QString::fromLatin1("arxiv"), - coll->entries().front()->field(QString::fromLatin1("arxiv"))); + entry->setField(TQString::tqfromLatin1("arxiv"), + coll->entries().front()->field(TQString::tqfromLatin1("arxiv"))); } } -Tellico::Fetch::ConfigWidget* ArxivFetcher::configWidget(QWidget* parent_) const { - return new ArxivFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* ArxivFetcher::configWidget(TQWidget* tqparent_) const { + return new ArxivFetcher::ConfigWidget(tqparent_, this); } -ArxivFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ArxivFetcher*) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +ArxivFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const ArxivFetcher*) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } void ArxivFetcher::ConfigWidget::saveConfig(KConfigGroup&) { } -QString ArxivFetcher::ConfigWidget::preferredName() const { +TQString ArxivFetcher::ConfigWidget::preferredName() const { return ArxivFetcher::defaultName(); } diff --git a/src/fetch/arxivfetcher.h b/src/fetch/arxivfetcher.h index bce5f9d..be64c0e 100644 --- a/src/fetch/arxivfetcher.h +++ b/src/fetch/arxivfetcher.h @@ -20,8 +20,8 @@ #include <kio/job.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace Tellico { @@ -34,14 +34,15 @@ namespace Tellico { */ class ArxivFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - ArxivFetcher(QObject* parent); + ArxivFetcher(TQObject* tqparent); ~ArxivFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == Keyword || k == ArxivID; } @@ -54,37 +55,37 @@ public: virtual void updateEntry(Data::EntryPtr entry); virtual void updateEntrySynchronous(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const ArxivFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const ArxivFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: void initXSLTHandler(); - KURL searchURL(FetchKey key, const QString& value) const; + KURL searchURL(FetchKey key, const TQString& value) const; void doSearch(); XSLTHandler* m_xsltHandler; int m_start; int m_total; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; }; diff --git a/src/fetch/bibsonomyfetcher.cpp b/src/fetch/bibsonomyfetcher.cpp index faa48a4..b2e7d2e 100644 --- a/src/fetch/bibsonomyfetcher.cpp +++ b/src/fetch/bibsonomyfetcher.cpp @@ -24,8 +24,8 @@ #include <klocale.h> -#include <qlabel.h> -#include <qlayout.h> +#include <tqlabel.h> +#include <tqlayout.h> namespace { // always bibtex @@ -35,18 +35,18 @@ namespace { using Tellico::Fetch::BibsonomyFetcher; -BibsonomyFetcher::BibsonomyFetcher(QObject* parent_) - : Fetcher(parent_), m_job(0), m_started(false) { +BibsonomyFetcher::BibsonomyFetcher(TQObject* tqparent_) + : Fetcher(tqparent_), m_job(0), m_started(false) { } BibsonomyFetcher::~BibsonomyFetcher() { } -QString BibsonomyFetcher::defaultName() { - return QString::fromLatin1("Bibsonomy"); +TQString BibsonomyFetcher::defaultName() { + return TQString::tqfromLatin1("Bibsonomy"); } -QString BibsonomyFetcher::source() const { +TQString BibsonomyFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -57,13 +57,13 @@ bool BibsonomyFetcher::canFetch(int type) const { void BibsonomyFetcher::readConfigHook(const KConfigGroup&) { } -void BibsonomyFetcher::search(FetchKey key_, const QString& value_) { +void BibsonomyFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_.stripWhiteSpace(); m_started = true; if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } @@ -79,10 +79,10 @@ void BibsonomyFetcher::search(FetchKey key_, const QString& value_) { } m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void BibsonomyFetcher::stop() { @@ -99,8 +99,8 @@ void BibsonomyFetcher::stop() { emit signalDone(this); } -void BibsonomyFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void BibsonomyFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -121,7 +121,7 @@ void BibsonomyFetcher::slotComplete(KIO::Job* job_) { return; } - Import::BibtexImporter imp(QString::fromUtf8(m_data, m_data.size())); + Import::BibtexImporter imp(TQString::fromUtf8(m_data, m_data.size())); Data::CollPtr coll = imp.collection(); if(!coll) { @@ -136,13 +136,13 @@ void BibsonomyFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -154,17 +154,17 @@ Tellico::Data::EntryPtr BibsonomyFetcher::fetchEntry(uint uid_) { return m_entries[uid_]; } -KURL BibsonomyFetcher::searchURL(FetchKey key_, const QString& value_) const { - KURL u(QString::fromLatin1(BIBSONOMY_BASE_URL)); - u.setPath(QString::fromLatin1("/bib/")); +KURL BibsonomyFetcher::searchURL(FetchKey key_, const TQString& value_) const { + KURL u(TQString::tqfromLatin1(BIBSONOMY_BASE_URL)); + u.setPath(TQString::tqfromLatin1("/bib/")); switch(key_) { case Person: - u.addPath(QString::fromLatin1("author/%1").arg(value_)); + u.addPath(TQString::tqfromLatin1("author/%1").tqarg(value_)); break; case Keyword: - u.addPath(QString::fromLatin1("search/%1").arg(value_)); + u.addPath(TQString::tqfromLatin1("search/%1").tqarg(value_)); break; default: @@ -172,13 +172,13 @@ KURL BibsonomyFetcher::searchURL(FetchKey key_, const QString& value_) const { return KURL(); } - u.addQueryItem(QString::fromLatin1("items"), QString::number(BIBSONOMY_MAX_RESULTS)); + u.addQueryItem(TQString::tqfromLatin1("items"), TQString::number(BIBSONOMY_MAX_RESULTS)); myDebug() << "BibsonomyFetcher::search() - url: " << u.url() << endl; return u; } void BibsonomyFetcher::updateEntry(Data::EntryPtr entry_) { - QString title = entry_->field(QString::fromLatin1("title")); + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { search(Fetch::Keyword, title); return; @@ -188,21 +188,21 @@ void BibsonomyFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* BibsonomyFetcher::configWidget(QWidget* parent_) const { - return new BibsonomyFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* BibsonomyFetcher::configWidget(TQWidget* tqparent_) const { + return new BibsonomyFetcher::ConfigWidget(tqparent_, this); } -BibsonomyFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const BibsonomyFetcher*) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +BibsonomyFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const BibsonomyFetcher*) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } void BibsonomyFetcher::ConfigWidget::saveConfig(KConfigGroup&) { } -QString BibsonomyFetcher::ConfigWidget::preferredName() const { +TQString BibsonomyFetcher::ConfigWidget::preferredName() const { return BibsonomyFetcher::defaultName(); } diff --git a/src/fetch/bibsonomyfetcher.h b/src/fetch/bibsonomyfetcher.h index fc59928..530e286 100644 --- a/src/fetch/bibsonomyfetcher.h +++ b/src/fetch/bibsonomyfetcher.h @@ -20,8 +20,8 @@ #include <kio/job.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace Tellico { namespace Fetch { @@ -31,14 +31,15 @@ namespace Tellico { */ class BibsonomyFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - BibsonomyFetcher(QObject* parent); + BibsonomyFetcher(TQObject* tqparent); ~BibsonomyFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual bool canSearch(FetchKey k) const { return k == Person || k == Keyword; } virtual void stop(); @@ -49,31 +50,31 @@ public: virtual void updateEntry(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const BibsonomyFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const BibsonomyFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: - KURL searchURL(FetchKey key, const QString& value) const; + KURL searchURL(FetchKey key, const TQString& value) const; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; }; diff --git a/src/fetch/citebasefetcher.cpp b/src/fetch/citebasefetcher.cpp index 798d690..177530c 100644 --- a/src/fetch/citebasefetcher.cpp +++ b/src/fetch/citebasefetcher.cpp @@ -24,8 +24,8 @@ #include <klocale.h> -#include <qlabel.h> -#include <qlayout.h> +#include <tqlabel.h> +#include <tqlayout.h> // #define CITEBASE_TEST @@ -36,18 +36,18 @@ namespace { using Tellico::Fetch::CitebaseFetcher; -CitebaseFetcher::CitebaseFetcher(QObject* parent_) - : Fetcher(parent_), m_job(0), m_started(false) { +CitebaseFetcher::CitebaseFetcher(TQObject* tqparent_) + : Fetcher(tqparent_), m_job(0), m_started(false) { } CitebaseFetcher::~CitebaseFetcher() { } -QString CitebaseFetcher::defaultName() { - return QString::fromLatin1("Citebase"); +TQString CitebaseFetcher::defaultName() { + return TQString::tqfromLatin1("Citebase"); } -QString CitebaseFetcher::source() const { +TQString CitebaseFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -58,13 +58,13 @@ bool CitebaseFetcher::canFetch(int type) const { void CitebaseFetcher::readConfigHook(const KConfigGroup&) { } -void CitebaseFetcher::search(FetchKey key_, const QString& value_) { +void CitebaseFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_.stripWhiteSpace(); m_started = true; if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } @@ -80,10 +80,10 @@ void CitebaseFetcher::search(FetchKey key_, const QString& value_) { } m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void CitebaseFetcher::stop() { @@ -100,8 +100,8 @@ void CitebaseFetcher::stop() { emit signalDone(this); } -void CitebaseFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void CitebaseFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -124,16 +124,16 @@ void CitebaseFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from citebasefetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.bib")); + TQFile f(TQString::tqfromLatin1("/tmp/test.bib")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif - Import::BibtexImporter imp(QString::fromUtf8(m_data, m_data.size())); + Import::BibtexImporter imp(TQString::fromUtf8(m_data, m_data.size())); Data::CollPtr coll = imp.collection(); if(!coll) { @@ -148,13 +148,13 @@ void CitebaseFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -166,17 +166,17 @@ Tellico::Data::EntryPtr CitebaseFetcher::fetchEntry(uint uid_) { return m_entries[uid_]; } -KURL CitebaseFetcher::searchURL(FetchKey key_, const QString& value_) const { - KURL u(QString::fromLatin1(CITEBASE_BASE_URL)); +KURL CitebaseFetcher::searchURL(FetchKey key_, const TQString& value_) const { + KURL u(TQString::tqfromLatin1(CITEBASE_BASE_URL)); switch(key_) { case ArxivID: { // remove prefix and/or version number - QString value = value_; - value.remove(QRegExp(QString::fromLatin1("^arxiv:"), false)); - value.remove(QRegExp(QString::fromLatin1("v\\d+$"))); - u.addQueryItem(QString::fromLatin1("rft_id"), QString::fromLatin1("oai:arXiv.org:%1").arg(value)); + TQString value = value_; + value.remove(TQRegExp(TQString::tqfromLatin1("^arxiv:"), false)); + value.remove(TQRegExp(TQString::tqfromLatin1("v\\d+$"))); + u.addQueryItem(TQString::tqfromLatin1("rft_id"), TQString::tqfromLatin1("oai:arXiv.org:%1").tqarg(value)); } break; @@ -186,14 +186,14 @@ KURL CitebaseFetcher::searchURL(FetchKey key_, const QString& value_) const { } #ifdef CITEBASE_TEST - u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/citebase.bib")); + u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/citebase.bib")); #endif myDebug() << "CitebaseFetcher::search() - url: " << u.url() << endl; return u; } void CitebaseFetcher::updateEntry(Data::EntryPtr entry_) { - QString arxiv = entry_->field(QString::fromLatin1("arxiv")); + TQString arxiv = entry_->field(TQString::tqfromLatin1("arxiv")); if(!arxiv.isEmpty()) { search(Fetch::ArxivID, arxiv); return; @@ -207,13 +207,13 @@ void CitebaseFetcher::updateEntrySynchronous(Data::EntryPtr entry) { if(!entry) { return; } - QString arxiv = entry->field(QString::fromLatin1("arxiv")); + TQString arxiv = entry->field(TQString::tqfromLatin1("arxiv")); if(arxiv.isEmpty()) { return; } KURL u = searchURL(ArxivID, arxiv); - QString bibtex = FileHandler::readTextFile(u, true); + TQString bibtex = FileHandler::readTextFile(u, true); if(bibtex.isEmpty()) { return; } @@ -227,21 +227,21 @@ void CitebaseFetcher::updateEntrySynchronous(Data::EntryPtr entry) { } } -Tellico::Fetch::ConfigWidget* CitebaseFetcher::configWidget(QWidget* parent_) const { - return new CitebaseFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* CitebaseFetcher::configWidget(TQWidget* tqparent_) const { + return new CitebaseFetcher::ConfigWidget(tqparent_, this); } -CitebaseFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const CitebaseFetcher*) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +CitebaseFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const CitebaseFetcher*) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } void CitebaseFetcher::ConfigWidget::saveConfig(KConfigGroup&) { } -QString CitebaseFetcher::ConfigWidget::preferredName() const { +TQString CitebaseFetcher::ConfigWidget::preferredName() const { return CitebaseFetcher::defaultName(); } diff --git a/src/fetch/citebasefetcher.h b/src/fetch/citebasefetcher.h index a292107..b91433b 100644 --- a/src/fetch/citebasefetcher.h +++ b/src/fetch/citebasefetcher.h @@ -20,8 +20,8 @@ #include <kio/job.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace Tellico { namespace Fetch { @@ -31,14 +31,15 @@ namespace Tellico { */ class CitebaseFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - CitebaseFetcher(QObject* parent); + CitebaseFetcher(TQObject* tqparent); ~CitebaseFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual bool canSearch(FetchKey k) const { return k == ArxivID; } virtual void stop(); @@ -50,31 +51,31 @@ public: virtual void updateEntry(Data::EntryPtr entry); virtual void updateEntrySynchronous(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const CitebaseFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const CitebaseFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: - KURL searchURL(FetchKey key, const QString& value) const; + KURL searchURL(FetchKey key, const TQString& value) const; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; }; diff --git a/src/fetch/configwidget.cpp b/src/fetch/configwidget.cpp index c7b3b59..3ceeea3 100644 --- a/src/fetch/configwidget.cpp +++ b/src/fetch/configwidget.cpp @@ -17,35 +17,35 @@ #include <klocale.h> #include <kaccelmanager.h> -#include <qvgroupbox.h> -#include <qlayout.h> +#include <tqvgroupbox.h> +#include <tqlayout.h> using Tellico::Fetch::ConfigWidget; -ConfigWidget::ConfigWidget(QWidget* parent_) : QWidget(parent_), m_modified(false), m_accepted(false) { - QHBoxLayout* boxLayout = new QHBoxLayout(this); +ConfigWidget::ConfigWidget(TQWidget* tqparent_) : TQWidget(tqparent_), m_modified(false), m_accepted(false) { + TQHBoxLayout* boxLayout = new TQHBoxLayout(this); boxLayout->setSpacing(10); - QGroupBox* vbox = new QVGroupBox(i18n("Source Options"), this); + TQGroupBox* vbox = new TQVGroupBox(i18n("Source Options"), this); boxLayout->addWidget(vbox, 10 /*stretch*/); - m_optionsWidget = new QWidget(vbox); + m_optionsWidget = new TQWidget(vbox); } -void ConfigWidget::addFieldsWidget(const StringMap& customFields_, const QStringList& fieldsToAdd_) { +void ConfigWidget::addFieldsWidget(const StringMap& customFields_, const TQStringList& fieldsToAdd_) { if(customFields_.isEmpty()) { return; } - QVGroupBox* box = new QVGroupBox(i18n("Available Fields"), this); - static_cast<QBoxLayout*>(layout())->addWidget(box); + TQVGroupBox* box = new TQVGroupBox(i18n("Available Fields"), this); + static_cast<TQBoxLayout*>(tqlayout())->addWidget(box); for(StringMap::ConstIterator it = customFields_.begin(); it != customFields_.end(); ++it) { - QCheckBox* cb = new QCheckBox(it.data(), box); + TQCheckBox* cb = new TQCheckBox(it.data(), box); m_fields.insert(it.key(), cb); - if(fieldsToAdd_.contains(it.key())) { + if(fieldsToAdd_.tqcontains(it.key())) { cb->setChecked(true); } - connect(cb, SIGNAL(clicked()), SLOT(slotSetModified())); + connect(cb, TQT_SIGNAL(clicked()), TQT_SLOT(slotSetModified())); } KAcceleratorManager::manage(this); @@ -54,13 +54,13 @@ void ConfigWidget::addFieldsWidget(const StringMap& customFields_, const QString } void ConfigWidget::saveFieldsConfig(KConfigGroup& config_) const { - QStringList fields; - for(QDictIterator<QCheckBox> it(m_fields); it.current(); ++it) { + TQStringList fields; + for(TQDictIterator<TQCheckBox> it(m_fields); it.current(); ++it) { if(it.current()->isChecked()) { fields << it.currentKey(); } } - config_.writeEntry(QString::fromLatin1("Custom Fields"), fields); + config_.writeEntry(TQString::tqfromLatin1("Custom Fields"), fields); } #include "configwidget.moc" diff --git a/src/fetch/configwidget.h b/src/fetch/configwidget.h index 9f18f83..f0a981c 100644 --- a/src/fetch/configwidget.h +++ b/src/fetch/configwidget.h @@ -16,12 +16,12 @@ #include "../datavectors.h" -#include <qwidget.h> -#include <qdict.h> -#include <qcheckbox.h> +#include <tqwidget.h> +#include <tqdict.h> +#include <tqcheckbox.h> class KConfigGroup; -class QStringList; +class TQStringList; namespace Tellico { namespace Fetch { @@ -29,11 +29,12 @@ namespace Tellico { /** * @author Robby Stephenson */ -class ConfigWidget : public QWidget { +class ConfigWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - ConfigWidget(QWidget* parent); + ConfigWidget(TQWidget* tqparent); virtual ~ConfigWidget() {} void setAccepted(bool accepted_) { m_accepted = accepted_; } @@ -52,24 +53,24 @@ public: * class than in the Fetcher class itself */ virtual void removed() {} - virtual QString preferredName() const = 0; + virtual TQString preferredName() const = 0; signals: - void signalName(const QString& name); + void signalName(const TQString& name); public slots: void slotSetModified(bool modified_ = true) { m_modified = modified_; } protected: - QWidget* optionsWidget() { return m_optionsWidget; } - void addFieldsWidget(const StringMap& customFields, const QStringList& fieldsToAdd); + TQWidget* optionsWidget() { return m_optionsWidget; } + void addFieldsWidget(const StringMap& customFields, const TQStringList& fieldsToAdd); void saveFieldsConfig(KConfigGroup& config) const; private: bool m_modified; bool m_accepted; - QWidget* m_optionsWidget; - QDict<QCheckBox> m_fields; + TQWidget* m_optionsWidget; + TQDict<TQCheckBox> m_fields; }; } diff --git a/src/fetch/crossreffetcher.cpp b/src/fetch/crossreffetcher.cpp index 8c5d303..6840e6d 100644 --- a/src/fetch/crossreffetcher.cpp +++ b/src/fetch/crossreffetcher.cpp @@ -29,10 +29,10 @@ #include <klineedit.h> #include <kactivelabel.h> -#include <qlabel.h> -#include <qwhatsthis.h> -#include <qlayout.h> -#include <qfile.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqlayout.h> +#include <tqfile.h> // #define CROSSREF_TEST @@ -44,8 +44,8 @@ namespace { using Tellico::Fetch::CrossRefFetcher; -CrossRefFetcher::CrossRefFetcher(QObject* parent_) - : Fetcher(parent_), m_xsltHandler(0), m_job(0), m_started(false) { +CrossRefFetcher::CrossRefFetcher(TQObject* tqparent_) + : Fetcher(tqparent_), m_xsltHandler(0), m_job(0), m_started(false) { } CrossRefFetcher::~CrossRefFetcher() { @@ -53,11 +53,11 @@ CrossRefFetcher::~CrossRefFetcher() { m_xsltHandler = 0; } -QString CrossRefFetcher::defaultName() { - return QString::fromLatin1("CrossRef"); +TQString CrossRefFetcher::defaultName() { + return TQString::tqfromLatin1("CrossRef"); } -QString CrossRefFetcher::source() const { +TQString CrossRefFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -66,7 +66,7 @@ bool CrossRefFetcher::canFetch(int type) const { } void CrossRefFetcher::readConfigHook(const KConfigGroup& config_) { - QString s = config_.readEntry("User"); + TQString s = config_.readEntry("User"); if(!s.isEmpty()) { m_user = s; } @@ -76,19 +76,19 @@ void CrossRefFetcher::readConfigHook(const KConfigGroup& config_) { } } -void CrossRefFetcher::search(FetchKey key_, const QString& value_) { +void CrossRefFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_.stripWhiteSpace(); m_started = true; if(m_user.isEmpty() || m_password.isEmpty()) { - message(i18n("%1 requires a username and password.").arg(source()), MessageHandler::Warning); + message(i18n("%1 requires a username and password.").tqarg(source()), MessageHandler::Warning); stop(); return; } if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } @@ -104,10 +104,10 @@ void CrossRefFetcher::search(FetchKey key_, const QString& value_) { } m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void CrossRefFetcher::stop() { @@ -124,8 +124,8 @@ void CrossRefFetcher::stop() { emit signalDone(this); } -void CrossRefFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void CrossRefFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -148,11 +148,11 @@ void CrossRefFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from crossreffetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif @@ -166,7 +166,7 @@ void CrossRefFetcher::slotComplete(KIO::Job* job_) { } // assume result is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size())); + TQString str = m_xsltHandler->applyStylesheet(TQString::fromUtf8(m_data, m_data.size())); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); @@ -182,13 +182,13 @@ void CrossRefFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -199,19 +199,19 @@ void CrossRefFetcher::slotComplete(KIO::Job* job_) { Tellico::Data::EntryPtr CrossRefFetcher::fetchEntry(uint uid_) { Data::EntryPtr entry = m_entries[uid_]; // if URL but no cover image, fetch it - if(!entry->field(QString::fromLatin1("url")).isEmpty()) { + if(!entry->field(TQString::tqfromLatin1("url")).isEmpty()) { Data::CollPtr coll = entry->collection(); - 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); } if(entry->field(field).isEmpty()) { - QPixmap pix = NetAccess::filePreview(entry->field(QString::fromLatin1("url"))); + TQPixmap pix = NetAccess::filePreview(entry->field(TQString::tqfromLatin1("url"))); if(!pix.isNull()) { - QString id = ImageFactory::addImage(pix, QString::fromLatin1("PNG")); + TQString id = ImageFactory::addImage(pix, TQString::tqfromLatin1("PNG")); if(!id.isEmpty()) { entry->setField(field, id); } @@ -223,9 +223,9 @@ Tellico::Data::EntryPtr CrossRefFetcher::fetchEntry(uint uid_) { void CrossRefFetcher::initXSLTHandler() { #ifdef CROSSREF_USE_UNIXREF - QString xsltfile = locate("appdata", QString::fromLatin1("unixref2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("unixref2tellico.xsl")); #else - QString xsltfile = locate("appdata", QString::fromLatin1("crossref2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("crossref2tellico.xsl")); #endif if(xsltfile.isEmpty()) { kdWarning() << "CrossRefFetcher::initXSLTHandler() - can not locate xslt file." << endl; @@ -245,16 +245,16 @@ void CrossRefFetcher::initXSLTHandler() { } } -KURL CrossRefFetcher::searchURL(FetchKey key_, const QString& value_) const { - KURL u(QString::fromLatin1(CROSSREF_BASE_URL)); +KURL CrossRefFetcher::searchURL(FetchKey key_, const TQString& value_) const { + KURL u(TQString::tqfromLatin1(CROSSREF_BASE_URL)); #ifdef CROSSREF_USE_UNIXREF - u.addQueryItem(QString::fromLatin1("format"), QString::fromLatin1("unixref")); + u.addQueryItem(TQString::tqfromLatin1("format"), TQString::tqfromLatin1("unixref")); #endif - u.addQueryItem(QString::fromLatin1("req_dat"), QString::fromLatin1("ourl_%1:%2").arg(m_user, m_password)); + u.addQueryItem(TQString::tqfromLatin1("req_dat"), TQString::tqfromLatin1("ourl_%1:%2").tqarg(m_user, m_password)); switch(key_) { case DOI: - u.addQueryItem(QString::fromLatin1("rft_id"), QString::fromLatin1("info:doi/%1").arg(value_)); + u.addQueryItem(TQString::tqfromLatin1("rft_id"), TQString::tqfromLatin1("info:doi/%1").tqarg(value_)); break; default: @@ -263,14 +263,14 @@ KURL CrossRefFetcher::searchURL(FetchKey key_, const QString& value_) const { } #ifdef CROSSREF_TEST - u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/crossref.xml")); + u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/crossref.xml")); #endif myDebug() << "CrossRefFetcher::search() - url: " << u.url() << endl; return u; } void CrossRefFetcher::updateEntry(Data::EntryPtr entry_) { - QString doi = entry_->field(QString::fromLatin1("doi")); + TQString doi = entry_->field(TQString::tqfromLatin1("doi")); if(!doi.isEmpty()) { search(Fetch::DOI, doi); return; @@ -278,7 +278,7 @@ void CrossRefFetcher::updateEntry(Data::EntryPtr entry_) { #if 0 // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { m_limit = 10; // raise limit so more possibility of match search(Fetch::Title, t); @@ -298,13 +298,13 @@ void CrossRefFetcher::updateEntrySynchronous(Data::EntryPtr entry) { myDebug() << "CrossRefFetcher::updateEntrySynchronous() - username and password is required" << endl; return; } - QString doi = entry->field(QString::fromLatin1("doi")); + TQString doi = entry->field(TQString::tqfromLatin1("doi")); if(doi.isEmpty()) { return; } KURL u = searchURL(DOI, doi); - QString xml = FileHandler::readTextFile(u, true, true); + TQString xml = FileHandler::readTextFile(u, true, true); if(xml.isEmpty()) { return; } @@ -317,7 +317,7 @@ void CrossRefFetcher::updateEntrySynchronous(Data::EntryPtr entry) { } // assume result is always utf-8 - QString str = m_xsltHandler->applyStylesheet(xml); + TQString str = m_xsltHandler->applyStylesheet(xml); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); if(coll && coll->entryCount() > 0) { @@ -326,13 +326,13 @@ void CrossRefFetcher::updateEntrySynchronous(Data::EntryPtr entry) { } } -Tellico::Fetch::ConfigWidget* CrossRefFetcher::configWidget(QWidget* parent_) const { - return new CrossRefFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* CrossRefFetcher::configWidget(TQWidget* tqparent_) const { + return new CrossRefFetcher::ConfigWidget(tqparent_, this); } -CrossRefFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const CrossRefFetcher* fetcher_) - : Fetch::ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget(), 4, 2); +CrossRefFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const CrossRefFetcher* fetcher_) + : Fetch::ConfigWidget(tqparent_) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 4, 2); l->setSpacing(4); l->setColStretch(1, 10); @@ -347,26 +347,26 @@ CrossRefFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const CrossRefFetc ++row; l->addMultiCellWidget(al, row, row, 0, 1); // richtext gets weird with size - al->setMinimumWidth(al->sizeHint().width()); + al->setMinimumWidth(al->tqsizeHint().width()); - QLabel* label = new QLabel(i18n("&Username: "), optionsWidget()); + TQLabel* label = new TQLabel(i18n("&Username: "), optionsWidget()); l->addWidget(label, ++row, 0); m_userEdit = new KLineEdit(optionsWidget()); - connect(m_userEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_userEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_userEdit, row, 1); - QString w = i18n("A username and password is required to access the CrossRef service. The password is " + TQString w = i18n("A username and password is required to access the CrossRef service. The password is " "stored as plain text in the Tellico configuration file."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_userEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_userEdit, w); label->setBuddy(m_userEdit); - label = new QLabel(i18n("&Password: "), optionsWidget()); + label = new TQLabel(i18n("&Password: "), optionsWidget()); l->addWidget(label, ++row, 0); m_passEdit = new KLineEdit(optionsWidget()); - connect(m_passEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_passEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_passEdit, row, 1); - QWhatsThis::add(label, w); - QWhatsThis::add(m_passEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_passEdit, w); label->setBuddy(m_passEdit); if(fetcher_) { @@ -376,7 +376,7 @@ CrossRefFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const CrossRefFetc } void CrossRefFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { - QString s = m_userEdit->text(); + TQString s = m_userEdit->text(); config_.writeEntry("User", s); s = m_passEdit->text(); @@ -385,7 +385,7 @@ void CrossRefFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { slotSetModified(false); } -QString CrossRefFetcher::ConfigWidget::preferredName() const { +TQString CrossRefFetcher::ConfigWidget::preferredName() const { return CrossRefFetcher::defaultName(); } diff --git a/src/fetch/crossreffetcher.h b/src/fetch/crossreffetcher.h index 392d46a..7b502c6 100644 --- a/src/fetch/crossreffetcher.h +++ b/src/fetch/crossreffetcher.h @@ -20,8 +20,8 @@ #include <kio/job.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> class KLineEdit; @@ -36,14 +36,15 @@ namespace Tellico { */ class CrossRefFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - CrossRefFetcher(QObject* parent); + CrossRefFetcher(TQObject* tqparent); ~CrossRefFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual bool canSearch(FetchKey k) const { return k == DOI; } virtual void stop(); @@ -55,40 +56,40 @@ public: virtual void updateEntry(Data::EntryPtr entry); virtual void updateEntrySynchronous(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const CrossRefFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const CrossRefFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; private: KLineEdit* m_userEdit; KLineEdit* m_passEdit; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: void initXSLTHandler(); - KURL searchURL(FetchKey key, const QString& value) const; + KURL searchURL(FetchKey key, const TQString& value) const; XSLTHandler* m_xsltHandler; - QString m_user; - QString m_password; + TQString m_user; + TQString m_password; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; }; diff --git a/src/fetch/discogsfetcher.cpp b/src/fetch/discogsfetcher.cpp index 31a8bab..a92219a 100644 --- a/src/fetch/discogsfetcher.cpp +++ b/src/fetch/discogsfetcher.cpp @@ -27,10 +27,10 @@ #include <kconfig.h> #include <kio/job.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qfile.h> -#include <qwhatsthis.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqfile.h> +#include <tqwhatsthis.h> //#define DISCOGS_TEST @@ -42,10 +42,10 @@ namespace { using Tellico::Fetch::DiscogsFetcher; -DiscogsFetcher::DiscogsFetcher(QObject* parent_, const char* name_) - : Fetcher(parent_, name_), m_xsltHandler(0), +DiscogsFetcher::DiscogsFetcher(TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_xsltHandler(0), m_limit(DISCOGS_MAX_RETURNS_TOTAL), m_job(0), m_started(false), - m_apiKey(QString::fromLatin1(DISCOGS_API_KEY)) { + m_apiKey(TQString::tqfromLatin1(DISCOGS_API_KEY)) { } DiscogsFetcher::~DiscogsFetcher() { @@ -53,11 +53,11 @@ DiscogsFetcher::~DiscogsFetcher() { m_xsltHandler = 0; } -QString DiscogsFetcher::defaultName() { +TQString DiscogsFetcher::defaultName() { return i18n("Discogs Audio Search"); } -QString DiscogsFetcher::source() const { +TQString DiscogsFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -66,7 +66,7 @@ bool DiscogsFetcher::canFetch(int type) const { } void DiscogsFetcher::readConfigHook(const KConfigGroup& config_) { - QString k = config_.readEntry("API Key"); + TQString k = config_.readEntry("API Key"); if(!k.isEmpty()) { m_apiKey = k; } @@ -74,7 +74,7 @@ void DiscogsFetcher::readConfigHook(const KConfigGroup& config_) { m_fields = config_.readListEntry("Custom Fields"); } -void DiscogsFetcher::search(FetchKey key_, const QString& value_) { +void DiscogsFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_; m_started = true; @@ -89,31 +89,31 @@ void DiscogsFetcher::continueSearch() { } void DiscogsFetcher::doSearch() { - KURL u(QString::fromLatin1(DISCOGS_API_URL)); - u.addQueryItem(QString::fromLatin1("f"), QString::fromLatin1("xml")); - u.addQueryItem(QString::fromLatin1("api_key"), m_apiKey); + KURL u(TQString::tqfromLatin1(DISCOGS_API_URL)); + u.addQueryItem(TQString::tqfromLatin1("f"), TQString::tqfromLatin1("xml")); + u.addQueryItem(TQString::tqfromLatin1("api_key"), m_apiKey); if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } switch(m_key) { case Title: - u.setPath(QString::fromLatin1("/search")); - u.addQueryItem(QString::fromLatin1("q"), m_value); - u.addQueryItem(QString::fromLatin1("type"), QString::fromLatin1("release")); + u.setPath(TQString::tqfromLatin1("/search")); + u.addQueryItem(TQString::tqfromLatin1("q"), m_value); + u.addQueryItem(TQString::tqfromLatin1("type"), TQString::tqfromLatin1("release")); break; case Person: - u.setPath(QString::fromLatin1("/artist/%1").arg(m_value)); + u.setPath(TQString::tqfromLatin1("/artist/%1").tqarg(m_value)); break; case Keyword: - u.setPath(QString::fromLatin1("/search")); - u.addQueryItem(QString::fromLatin1("q"), m_value); - u.addQueryItem(QString::fromLatin1("type"), QString::fromLatin1("all")); + u.setPath(TQString::tqfromLatin1("/search")); + u.addQueryItem(TQString::tqfromLatin1("q"), m_value); + u.addQueryItem(TQString::tqfromLatin1("type"), TQString::tqfromLatin1("all")); break; default: @@ -123,15 +123,15 @@ void DiscogsFetcher::doSearch() { } #ifdef DISCOGS_TEST - u = KURL(QString::fromLatin1("/home/robby/discogs-results.xml")); + u = KURL(TQString::tqfromLatin1("/home/robby/discogs-results.xml")); #endif // myDebug() << "DiscogsFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void DiscogsFetcher::stop() { @@ -147,8 +147,8 @@ void DiscogsFetcher::stop() { emit signalDone(this); } -void DiscogsFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void DiscogsFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -168,11 +168,11 @@ void DiscogsFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from discogsfetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif @@ -186,23 +186,23 @@ void DiscogsFetcher::slotComplete(KIO::Job* job_) { } if(m_total == -1) { - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, false)) { kdWarning() << "DiscogsFetcher::slotComplete() - server did not return valid XML." << endl; return; } // total is /resp/searchresults/@numResults - QDomNode n = dom.documentElement().namedItem(QString::fromLatin1("resp")) - .namedItem(QString::fromLatin1("searchresults")); - QDomElement e = n.toElement(); + TQDomNode n = dom.documentElement().namedItem(TQString::tqfromLatin1("resp")) + .namedItem(TQString::tqfromLatin1("searchresults")); + TQDomElement e = n.toElement(); if(!e.isNull()) { - m_total = e.attribute(QString::fromLatin1("numResults")).toInt(); + m_total = e.attribute(TQString::tqfromLatin1("numResults")).toInt(); myDebug() << "total = " << m_total; } } // assume discogs is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size())); + TQString str = m_xsltHandler->applyStylesheet(TQString::fromUtf8(m_data, m_data.size())); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); if(!coll) { @@ -218,11 +218,11 @@ void DiscogsFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("artist")) - + QChar('/') - + entry->field(QString::fromLatin1("label")); + TQString desc = entry->field(TQString::tqfromLatin1("artist")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("label")); - SearchResult* r = new SearchResult(this, entry->title(), desc, QString()); + SearchResult* r = new SearchResult(this, entry->title(), desc, TQString()); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -241,35 +241,35 @@ Tellico::Data::EntryPtr DiscogsFetcher::fetchEntry(uint uid_) { } // one way we tell if this entry has been fully initialized is to // check for a cover image - if(!entry->field(QString::fromLatin1("cover")).isEmpty()) { + if(!entry->field(TQString::tqfromLatin1("cover")).isEmpty()) { myLog() << "DiscogsFetcher::fetchEntry() - already downloaded " << entry->title() << endl; return entry; } - QString release = entry->field(QString::fromLatin1("discogs-id")); + TQString release = entry->field(TQString::tqfromLatin1("discogs-id")); if(release.isEmpty()) { myDebug() << "DiscogsFetcher::fetchEntry() - no discogs release found" << endl; return entry; } #ifdef DISCOGS_TEST - KURL u(QString::fromLatin1("/home/robby/discogs-release.xml")); + KURL u(TQString::tqfromLatin1("/home/robby/discogs-release.xml")); #else - KURL u(QString::fromLatin1(DISCOGS_API_URL)); - u.setPath(QString::fromLatin1("/release/%1").arg(release)); - u.addQueryItem(QString::fromLatin1("f"), QString::fromLatin1("xml")); - u.addQueryItem(QString::fromLatin1("api_key"), m_apiKey); + KURL u(TQString::tqfromLatin1(DISCOGS_API_URL)); + u.setPath(TQString::tqfromLatin1("/release/%1").tqarg(release)); + u.addQueryItem(TQString::tqfromLatin1("f"), TQString::tqfromLatin1("xml")); + u.addQueryItem(TQString::tqfromLatin1("api_key"), m_apiKey); #endif // myDebug() << "DiscogsFetcher::fetchEntry() - url: " << u << endl; // quiet, utf8, allowCompressed - QString output = FileHandler::readTextFile(u, true, true, true); + TQString output = FileHandler::readTextFile(u, true, true, true); #if 0 kdWarning() << "Remove output debug from discogsfetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); t << output; } f.close(); @@ -289,21 +289,21 @@ Tellico::Data::EntryPtr DiscogsFetcher::fetchEntry(uint uid_) { const StringMap customFields = this->customFields(); for(StringMap::ConstIterator it = customFields.begin(); it != customFields.end(); ++it) { - if(!m_fields.contains(it.key())) { + if(!m_fields.tqcontains(it.key())) { coll->removeField(it.key()); } } // don't want to include id - coll->removeField(QString::fromLatin1("discogs-id")); + coll->removeField(TQString::tqfromLatin1("discogs-id")); entry = coll->entries().front(); - m_entries.replace(uid_, entry); + m_entries.tqreplace(uid_, entry); return entry; } void DiscogsFetcher::initXSLTHandler() { - QString xsltfile = locate("appdata", QString::fromLatin1("discogs2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("discogs2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "DiscogsFetcher::initXSLTHandler() - can not locate discogs2tellico.xsl." << endl; return; @@ -325,14 +325,14 @@ void DiscogsFetcher::initXSLTHandler() { void DiscogsFetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "DiscogsFetcher::updateEntry()" << endl; - QString value; - QString title = entry_->field(QString::fromLatin1("title")); + TQString value; + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { search(Title, value); return; } - QString artist = entry_->field(QString::fromLatin1("artist")); + TQString artist = entry_->field(TQString::tqfromLatin1("artist")); if(!artist.isEmpty()) { search(Person, artist); return; @@ -342,53 +342,53 @@ void DiscogsFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* DiscogsFetcher::configWidget(QWidget* parent_) const { - return new DiscogsFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* DiscogsFetcher::configWidget(TQWidget* tqparent_) const { + return new DiscogsFetcher::ConfigWidget(tqparent_, this); } -DiscogsFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const DiscogsFetcher* fetcher_) - : Fetch::ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget(), 2, 2); +DiscogsFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const DiscogsFetcher* fetcher_) + : Fetch::ConfigWidget(tqparent_) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 2, 2); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - QLabel* label = new QLabel(i18n("API &key: "), optionsWidget()); + TQLabel* label = new TQLabel(i18n("API &key: "), optionsWidget()); l->addWidget(label, ++row, 0); m_apiKeyEdit = new KLineEdit(optionsWidget()); - connect(m_apiKeyEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_apiKeyEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_apiKeyEdit, row, 1); - QString w = i18n("With your discogs.com account you receive an API key for the usage of their XML-based interface " + TQString w = i18n("With your discogs.com account you receive an API key for the usage of their XML-based interface " "(See http://www.discogs.com/help/api)."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_apiKeyEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_apiKeyEdit, w); label->setBuddy(m_apiKeyEdit); - m_fetchImageCheck = new QCheckBox(i18n("Download cover &image"), optionsWidget()); - connect(m_fetchImageCheck, SIGNAL(clicked()), SLOT(slotSetModified())); + m_fetchImageCheck = new TQCheckBox(i18n("Download cover &image"), optionsWidget()); + connect(m_fetchImageCheck, TQT_SIGNAL(clicked()), TQT_SLOT(slotSetModified())); ++row; l->addMultiCellWidget(m_fetchImageCheck, row, row, 0, 1); w = i18n("The cover image may be downloaded as well. However, too many large images in the " "collection may degrade performance."); - QWhatsThis::add(m_fetchImageCheck, w); + TQWhatsThis::add(m_fetchImageCheck, w); l->setRowStretch(++row, 10); // now add additional fields widget - addFieldsWidget(DiscogsFetcher::customFields(), fetcher_ ? fetcher_->m_fields : QStringList()); + addFieldsWidget(DiscogsFetcher::customFields(), fetcher_ ? fetcher_->m_fields : TQStringList()); if(fetcher_) { m_apiKeyEdit->setText(fetcher_->m_apiKey); m_fetchImageCheck->setChecked(fetcher_->m_fetchImages); } else { - m_apiKeyEdit->setText(QString::fromLatin1(DISCOGS_API_KEY)); + m_apiKeyEdit->setText(TQString::tqfromLatin1(DISCOGS_API_KEY)); m_fetchImageCheck->setChecked(true); } } void DiscogsFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { - QString apiKey = m_apiKeyEdit->text().stripWhiteSpace(); + TQString apiKey = m_apiKeyEdit->text().stripWhiteSpace(); if(!apiKey.isEmpty()) { config_.writeEntry("API Key", apiKey); } @@ -398,15 +398,15 @@ void DiscogsFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { slotSetModified(false); } -QString DiscogsFetcher::ConfigWidget::preferredName() const { +TQString DiscogsFetcher::ConfigWidget::preferredName() const { return DiscogsFetcher::defaultName(); } Tellico::StringMap DiscogsFetcher::customFields() { StringMap map; - map[QString::fromLatin1("producer")] = i18n("Producer"); - map[QString::fromLatin1("nationality")] = i18n("Nationality"); - map[QString::fromLatin1("discogs")] = i18n("Discogs Link"); + map[TQString::tqfromLatin1("producer")] = i18n("Producer"); + map[TQString::tqfromLatin1("nationality")] = i18n("Nationality"); + map[TQString::tqfromLatin1("discogs")] = i18n("Discogs Link"); return map; } diff --git a/src/fetch/discogsfetcher.h b/src/fetch/discogsfetcher.h index ac8c1b8..cddb0b1 100644 --- a/src/fetch/discogsfetcher.h +++ b/src/fetch/discogsfetcher.h @@ -23,9 +23,9 @@ namespace Tellico { #include "../datavectors.h" #include <klineedit.h> -#include <qdom.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqdom.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace KIO { class Job; @@ -41,20 +41,21 @@ namespace Tellico { */ class DiscogsFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: /** */ - DiscogsFetcher(QObject* parent, const char* name = 0); + DiscogsFetcher(TQObject* tqparent, const char* name = 0); /** */ virtual ~DiscogsFetcher(); /** */ - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); // amazon can search title or person virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == Keyword; } @@ -69,25 +70,25 @@ public: /** * Returns a widget for modifying the fetcher's config. */ - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; static StringMap customFields(); class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const DiscogsFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const DiscogsFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup&); - virtual QString preferredName() const; + virtual TQString preferredName() const; private: KLineEdit *m_apiKeyEdit; - QCheckBox* m_fetchImageCheck; + TQCheckBox* m_fetchImageCheck; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: @@ -99,17 +100,17 @@ private: int m_start; int m_total; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; bool m_fetchImages; - QString m_apiKey; - QStringList m_fields; + TQString m_apiKey; + TQStringList m_fields; }; } // end namespace diff --git a/src/fetch/entrezfetcher.cpp b/src/fetch/entrezfetcher.cpp index 14b9e20..83fee42 100644 --- a/src/fetch/entrezfetcher.cpp +++ b/src/fetch/entrezfetcher.cpp @@ -26,10 +26,10 @@ #include <kstandarddirs.h> #include <kio/job.h> -#include <qdom.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qfile.h> +#include <tqdom.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqfile.h> //#define ENTREZ_TEST @@ -45,18 +45,18 @@ namespace { using Tellico::Fetch::EntrezFetcher; -EntrezFetcher::EntrezFetcher(QObject* parent_, const char* name_) : Fetcher(parent_, name_), m_xsltHandler(0), +EntrezFetcher::EntrezFetcher(TQObject* tqparent_, const char* name_) : Fetcher(tqparent_, name_), m_xsltHandler(0), m_step(Begin), m_started(false) { } EntrezFetcher::~EntrezFetcher() { } -QString EntrezFetcher::defaultName() { +TQString EntrezFetcher::defaultName() { return i18n("Entrez Database"); } -QString EntrezFetcher::source() const { +TQString EntrezFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -65,14 +65,14 @@ bool EntrezFetcher::canFetch(int type) const { } void EntrezFetcher::readConfigHook(const KConfigGroup& config_) { - QString s = config_.readEntry("Database", QString::fromLatin1(ENTREZ_DEFAULT_DATABASE)); // default to pubmed + TQString s = config_.readEntry("Database", TQString::tqfromLatin1(ENTREZ_DEFAULT_DATABASE)); // default to pubmed if(!s.isEmpty()) { m_dbname = s; } m_fields = config_.readListEntry("Custom Fields"); } -void EntrezFetcher::search(FetchKey key_, const QString& value_) { +void EntrezFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; m_start = 1; m_total = -1; @@ -84,36 +84,36 @@ void EntrezFetcher::search(FetchKey key_, const QString& value_) { return; } if(m_dbname.isEmpty()) { - m_dbname = QString::fromLatin1(ENTREZ_DEFAULT_DATABASE); + m_dbname = TQString::tqfromLatin1(ENTREZ_DEFAULT_DATABASE); } #ifdef ENTREZ_TEST - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/esearch.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/esearch.xml")); #else - KURL u(QString::fromLatin1(ENTREZ_BASE_URL)); - u.addPath(QString::fromLatin1(ENTREZ_SEARCH_CGI)); - u.addQueryItem(QString::fromLatin1("tool"), QString::fromLatin1("Tellico")); - u.addQueryItem(QString::fromLatin1("retmode"), QString::fromLatin1("xml")); - u.addQueryItem(QString::fromLatin1("usehistory"), QString::fromLatin1("y")); - u.addQueryItem(QString::fromLatin1("retmax"), QString::fromLatin1("1")); // we're just getting the count - u.addQueryItem(QString::fromLatin1("db"), m_dbname); - u.addQueryItem(QString::fromLatin1("term"), value_); + KURL u(TQString::tqfromLatin1(ENTREZ_BASE_URL)); + u.addPath(TQString::tqfromLatin1(ENTREZ_SEARCH_CGI)); + u.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico")); + u.addQueryItem(TQString::tqfromLatin1("retmode"), TQString::tqfromLatin1("xml")); + u.addQueryItem(TQString::tqfromLatin1("usehistory"), TQString::tqfromLatin1("y")); + u.addQueryItem(TQString::tqfromLatin1("retmax"), TQString::tqfromLatin1("1")); // we're just getting the count + u.addQueryItem(TQString::tqfromLatin1("db"), m_dbname); + u.addQueryItem(TQString::tqfromLatin1("term"), value_); switch(key_) { case Title: - u.addQueryItem(QString::fromLatin1("field"), QString::fromLatin1("titl")); + u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("titl")); break; case Person: - u.addQueryItem(QString::fromLatin1("field"), QString::fromLatin1("auth")); + u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("auth")); break; case Keyword: // for Tellico Keyword searches basically mean search for any field matching -// u.addQueryItem(QString::fromLatin1("field"), QString::fromLatin1("word")); +// u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("word")); break; case PubmedID: - u.addQueryItem(QString::fromLatin1("field"), QString::fromLatin1("pmid")); + u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("pmid")); break; case DOI: @@ -131,10 +131,10 @@ void EntrezFetcher::search(FetchKey key_, const QString& value_) { m_step = Search; // myLog() << "EntrezFetcher::doSearch() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void EntrezFetcher::continueSearch() { @@ -156,8 +156,8 @@ void EntrezFetcher::stop() { emit signalDone(this); } -void EntrezFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void EntrezFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -179,11 +179,11 @@ void EntrezFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from entrezfetcher.cpp: " << __LINE__ << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif @@ -205,7 +205,7 @@ void EntrezFetcher::slotComplete(KIO::Job* job_) { } void EntrezFetcher::searchResults() { - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, false)) { kdWarning() << "EntrezFetcher::searchResults() - server did not return valid XML." << endl; stop(); @@ -213,8 +213,8 @@ void EntrezFetcher::searchResults() { } // find Count, QueryKey, and WebEnv elements int count = 0; - for(QDomNode n = dom.documentElement().firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement e = n.toElement(); + for(TQDomNode n = dom.documentElement().firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement e = n.toElement(); if(e.isNull()) { continue; } @@ -239,71 +239,71 @@ void EntrezFetcher::searchResults() { void EntrezFetcher::doSummary() { #ifdef ENTREZ_TEST - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/esummary.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/esummary.xml")); #else - KURL u(QString::fromLatin1(ENTREZ_BASE_URL)); - u.addPath(QString::fromLatin1(ENTREZ_SUMMARY_CGI)); - u.addQueryItem(QString::fromLatin1("tool"), QString::fromLatin1("Tellico")); - u.addQueryItem(QString::fromLatin1("retmode"), QString::fromLatin1("xml")); - u.addQueryItem(QString::fromLatin1("retstart"), QString::number(m_start)); - u.addQueryItem(QString::fromLatin1("retmax"), QString::number(QMIN(m_total-m_start-1, ENTREZ_MAX_RETURNS_TOTAL))); - u.addQueryItem(QString::fromLatin1("usehistory"), QString::fromLatin1("y")); - u.addQueryItem(QString::fromLatin1("db"), m_dbname); - u.addQueryItem(QString::fromLatin1("query_key"), m_queryKey); - u.addQueryItem(QString::fromLatin1("WebEnv"), m_webEnv); + KURL u(TQString::tqfromLatin1(ENTREZ_BASE_URL)); + u.addPath(TQString::tqfromLatin1(ENTREZ_SUMMARY_CGI)); + u.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico")); + u.addQueryItem(TQString::tqfromLatin1("retmode"), TQString::tqfromLatin1("xml")); + u.addQueryItem(TQString::tqfromLatin1("retstart"), TQString::number(m_start)); + u.addQueryItem(TQString::tqfromLatin1("retmax"), TQString::number(TQMIN(m_total-m_start-1, ENTREZ_MAX_RETURNS_TOTAL))); + u.addQueryItem(TQString::tqfromLatin1("usehistory"), TQString::tqfromLatin1("y")); + u.addQueryItem(TQString::tqfromLatin1("db"), m_dbname); + u.addQueryItem(TQString::tqfromLatin1("query_key"), m_queryKey); + u.addQueryItem(TQString::tqfromLatin1("WebEnv"), m_webEnv); #endif m_step = Summary; // myLog() << "EntrezFetcher::searchResults() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void EntrezFetcher::summaryResults() { - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, false)) { kdWarning() << "EntrezFetcher::summaryResults() - server did not return valid XML." << endl; stop(); return; } // top child is eSummaryResult - // all children are DocSum - for(QDomNode n = dom.documentElement().firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement e = n.toElement(); + // all tqchildren are DocSum + for(TQDomNode n = dom.documentElement().firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement e = n.toElement(); if(e.isNull() || e.tagName() != Latin1Literal("DocSum")) { continue; } - QDomNodeList nodes = e.elementsByTagName(QString::fromLatin1("Id")); + TQDomNodeList nodes = e.elementsByTagName(TQString::tqfromLatin1("Id")); if(nodes.count() == 0) { myDebug() << "EntrezFetcher::summaryResults() - no Id elements" << endl; continue; } int id = nodes.item(0).toElement().text().toInt(); - QString title, pubdate, authors; - nodes = e.elementsByTagName(QString::fromLatin1("Item")); + TQString title, pubdate, authors; + nodes = e.elementsByTagName(TQString::tqfromLatin1("Item")); for(uint j = 0; j < nodes.count(); ++j) { - if(nodes.item(j).toElement().attribute(QString::fromLatin1("Name")) == Latin1Literal("Title")) { + if(nodes.item(j).toElement().attribute(TQString::tqfromLatin1("Name")) == Latin1Literal("Title")) { title = nodes.item(j).toElement().text(); - } else if(nodes.item(j).toElement().attribute(QString::fromLatin1("Name")) == Latin1Literal("PubDate")) { + } else if(nodes.item(j).toElement().attribute(TQString::tqfromLatin1("Name")) == Latin1Literal("PubDate")) { pubdate = nodes.item(j).toElement().text(); - } else if(nodes.item(j).toElement().attribute(QString::fromLatin1("Name")) == Latin1Literal("AuthorList")) { - QStringList list; - for(QDomNode aNode = nodes.item(j).firstChild(); !aNode.isNull(); aNode = aNode.nextSibling()) { - // lazy, assume all children Items are authors + } else if(nodes.item(j).toElement().attribute(TQString::tqfromLatin1("Name")) == Latin1Literal("AuthorList")) { + TQStringList list; + for(TQDomNode aNode = nodes.item(j).firstChild(); !aNode.isNull(); aNode = aNode.nextSibling()) { + // lazy, assume all tqchildren Items are authors if(aNode.nodeName() == Latin1Literal("Item")) { list << aNode.toElement().text(); } } - authors = list.join(QString::fromLatin1("; ")); + authors = list.join(TQString::tqfromLatin1("; ")); } if(!title.isEmpty() && !pubdate.isEmpty() && !authors.isEmpty()) { break; // done now } } - SearchResult* r = new SearchResult(this, title, pubdate + '/' + authors, QString()); + SearchResult* r = new SearchResult(this, title, pubdate + '/' + authors, TQString()); m_matches.insert(r->uid, id); emit signalResultFound(r); } @@ -319,7 +319,7 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { return entry; } - if(!m_matches.contains(uid_)) { + if(!m_matches.tqcontains(uid_)) { return 0; } @@ -333,33 +333,33 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { int id = m_matches[uid_]; #ifdef ENTREZ_TEST - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/pubmed.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/pubmed.xml")); #else - KURL u(QString::fromLatin1(ENTREZ_BASE_URL)); - u.addPath(QString::fromLatin1(ENTREZ_FETCH_CGI)); - u.addQueryItem(QString::fromLatin1("tool"), QString::fromLatin1("Tellico")); - u.addQueryItem(QString::fromLatin1("retmode"), QString::fromLatin1("xml")); - u.addQueryItem(QString::fromLatin1("rettype"), QString::fromLatin1("abstract")); - u.addQueryItem(QString::fromLatin1("db"), m_dbname); - u.addQueryItem(QString::fromLatin1("id"), QString::number(id)); + KURL u(TQString::tqfromLatin1(ENTREZ_BASE_URL)); + u.addPath(TQString::tqfromLatin1(ENTREZ_FETCH_CGI)); + u.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico")); + u.addQueryItem(TQString::tqfromLatin1("retmode"), TQString::tqfromLatin1("xml")); + u.addQueryItem(TQString::tqfromLatin1("rettype"), TQString::tqfromLatin1("abstract")); + u.addQueryItem(TQString::tqfromLatin1("db"), m_dbname); + u.addQueryItem(TQString::tqfromLatin1("id"), TQString::number(id)); #endif // now it's sychronous, and we know that it's utf8 - QString xmlOutput = FileHandler::readTextFile(u, false /*quiet*/, true /*utf8*/); + TQString xmlOutput = FileHandler::readTextFile(u, false /*quiet*/, true /*utf8*/); if(xmlOutput.isEmpty()) { kdWarning() << "EntrezFetcher::fetchEntry() - unable to download " << u << endl; return 0; } #if 0 kdWarning() << "EntrezFetcher::fetchEntry() - turn me off!" << endl; - QFile f1(QString::fromLatin1("/tmp/test-entry.xml")); + TQFile f1(TQString::tqfromLatin1("/tmp/test-entry.xml")); if(f1.open(IO_WriteOnly)) { - QTextStream t(&f1); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f1); + t.setEncoding(TQTextStream::UnicodeUTF8); t << xmlOutput; } f1.close(); #endif - QString str = m_xsltHandler->applyStylesheet(xmlOutput); + TQString str = m_xsltHandler->applyStylesheet(xmlOutput); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); if(!coll) { @@ -376,40 +376,40 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { Data::EntryPtr e = coll->entries().front(); // try to get a link, but only if necessary - if(m_fields.contains(QString::fromLatin1("url"))) { - KURL link(QString::fromLatin1(ENTREZ_BASE_URL)); - link.addPath(QString::fromLatin1(ENTREZ_LINK_CGI)); - link.addQueryItem(QString::fromLatin1("tool"), QString::fromLatin1("Tellico")); - link.addQueryItem(QString::fromLatin1("cmd"), QString::fromLatin1("llinks")); - link.addQueryItem(QString::fromLatin1("db"), m_dbname); - link.addQueryItem(QString::fromLatin1("dbfrom"), m_dbname); - link.addQueryItem(QString::fromLatin1("id"), QString::number(id)); - - QDomDocument linkDom = FileHandler::readXMLFile(link, false /* namespace */, true /* quiet */); + if(m_fields.tqcontains(TQString::tqfromLatin1("url"))) { + KURL link(TQString::tqfromLatin1(ENTREZ_BASE_URL)); + link.addPath(TQString::tqfromLatin1(ENTREZ_LINK_CGI)); + link.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico")); + link.addQueryItem(TQString::tqfromLatin1("cmd"), TQString::tqfromLatin1("llinks")); + link.addQueryItem(TQString::tqfromLatin1("db"), m_dbname); + link.addQueryItem(TQString::tqfromLatin1("dbfrom"), m_dbname); + link.addQueryItem(TQString::tqfromLatin1("id"), TQString::number(id)); + + TQDomDocument linkDom = FileHandler::readXMLFile(link, false /* namespace */, true /* quiet */); // need eLinkResult/LinkSet/IdUrlList/IdUrlSet/ObjUrl/Url - QDomNode linkNode = linkDom.namedItem(QString::fromLatin1("eLinkResult")) - .namedItem(QString::fromLatin1("LinkSet")) - .namedItem(QString::fromLatin1("IdUrlList")) - .namedItem(QString::fromLatin1("IdUrlSet")) - .namedItem(QString::fromLatin1("ObjUrl")) - .namedItem(QString::fromLatin1("Url")); + TQDomNode linkNode = linkDom.namedItem(TQString::tqfromLatin1("eLinkResult")) + .namedItem(TQString::tqfromLatin1("LinkSet")) + .namedItem(TQString::tqfromLatin1("IdUrlList")) + .namedItem(TQString::tqfromLatin1("IdUrlSet")) + .namedItem(TQString::tqfromLatin1("ObjUrl")) + .namedItem(TQString::tqfromLatin1("Url")); if(!linkNode.isNull()) { - QString u = linkNode.toElement().text(); + TQString u = linkNode.toElement().text(); // myDebug() << u << endl; if(!u.isEmpty()) { - if(!coll->hasField(QString::fromLatin1("url"))) { - Data::FieldPtr field = new Data::Field(QString::fromLatin1("url"), i18n("URL"), Data::Field::URL); + if(!coll->hasField(TQString::tqfromLatin1("url"))) { + Data::FieldPtr field = new Data::Field(TQString::tqfromLatin1("url"), i18n("URL"), Data::Field::URL); field->setCategory(i18n("Miscellaneous")); coll->addField(field); } - e->setField(QString::fromLatin1("url"), u); + e->setField(TQString::tqfromLatin1("url"), u); } } } const StringMap customFields = EntrezFetcher::customFields(); for(StringMap::ConstIterator it = customFields.begin(); it != customFields.end(); ++it) { - if(!m_fields.contains(it.key())) { + if(!m_fields.tqcontains(it.key())) { coll->removeField(it.key()); } } @@ -419,7 +419,7 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { } void EntrezFetcher::initXSLTHandler() { - QString xsltfile = locate("appdata", QString::fromLatin1("pubmed2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("pubmed2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "EntrezFetcher::initXSLTHandler() - can not locate pubmed2tellico.xsl." << endl; return; @@ -441,19 +441,19 @@ void EntrezFetcher::initXSLTHandler() { void EntrezFetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "EntrezFetcher::updateEntry()" << endl; - QString s = entry_->field(QString::fromLatin1("pmid")); + TQString s = entry_->field(TQString::tqfromLatin1("pmid")); if(!s.isEmpty()) { search(PubmedID, s); return; } - s = entry_->field(QString::fromLatin1("doi")); + s = entry_->field(TQString::tqfromLatin1("doi")); if(!s.isEmpty()) { search(DOI, s); return; } - s = entry_->field(QString::fromLatin1("title")); + s = entry_->field(TQString::tqfromLatin1("title")); if(!s.isEmpty()) { search(Title, s); return; @@ -463,18 +463,18 @@ void EntrezFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* EntrezFetcher::configWidget(QWidget* parent_) const { - return new EntrezFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* EntrezFetcher::configWidget(TQWidget* tqparent_) const { + return new EntrezFetcher::ConfigWidget(tqparent_, this); } -EntrezFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const EntrezFetcher* fetcher_/*=0*/) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +EntrezFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const EntrezFetcher* fetcher_/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); // now add additional fields widget - addFieldsWidget(EntrezFetcher::customFields(), fetcher_ ? fetcher_->m_fields : QStringList()); + addFieldsWidget(EntrezFetcher::customFields(), fetcher_ ? fetcher_->m_fields : TQStringList()); } void EntrezFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { @@ -482,16 +482,16 @@ void EntrezFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { slotSetModified(false); } -QString EntrezFetcher::ConfigWidget::preferredName() const { +TQString EntrezFetcher::ConfigWidget::preferredName() const { return EntrezFetcher::defaultName(); } //static Tellico::StringMap EntrezFetcher::customFields() { StringMap map; - map[QString::fromLatin1("institution")] = i18n("Institution"); - map[QString::fromLatin1("abstract")] = i18n("Abstract"); - map[QString::fromLatin1("url")] = i18n("URL"); + map[TQString::tqfromLatin1("institution")] = i18n("Institution"); + map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); + map[TQString::tqfromLatin1("url")] = i18n("URL"); return map; } diff --git a/src/fetch/entrezfetcher.h b/src/fetch/entrezfetcher.h index c8aac49..bd94fdc 100644 --- a/src/fetch/entrezfetcher.h +++ b/src/fetch/entrezfetcher.h @@ -22,8 +22,8 @@ namespace Tellico { #include "configwidget.h" #include "../datavectors.h" -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace KIO { class Job; @@ -37,18 +37,19 @@ namespace Tellico { */ class EntrezFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - EntrezFetcher(QObject* parent, const char* name=0); + EntrezFetcher(TQObject* tqparent, const char* name=0); /** */ virtual ~EntrezFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } // pubmed can search title, person, and keyword virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == Keyword || k == Raw || k == PubmedID || k == DOI; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); virtual void stop(); virtual Data::EntryPtr fetchEntry(uint uid); @@ -56,22 +57,22 @@ public: virtual bool canFetch(int type) const; virtual void readConfigHook(const KConfigGroup& config); virtual void updateEntry(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; static StringMap customFields(); class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const EntrezFetcher* fetcher=0); + ConfigWidget(TQWidget* tqparent_, const EntrezFetcher* fetcher=0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: @@ -89,22 +90,22 @@ private: }; XSLTHandler* m_xsltHandler; - QString m_dbname; + TQString m_dbname; int m_start; int m_total; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; // map from search result id to entry - QMap<int, int> m_matches; // search result id to pubmed id - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; // map from search result id to entry + TQMap<int, int> m_matches; // search result id to pubmed id + TQGuardedPtr<KIO::Job> m_job; - QString m_queryKey; - QString m_webEnv; + TQString m_queryKey; + TQString m_webEnv; Step m_step; bool m_started; - QStringList m_fields; + TQStringList m_fields; }; } // end namespace diff --git a/src/fetch/execexternalfetcher.cpp b/src/fetch/execexternalfetcher.cpp index 07b99d8..88f8cd5 100644 --- a/src/fetch/execexternalfetcher.cpp +++ b/src/fetch/execexternalfetcher.cpp @@ -31,38 +31,38 @@ #include <kurlrequester.h> #include <kaccelmanager.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> -#include <qregexp.h> -#include <qvgroupbox.h> -#include <qfile.h> // needed for QFile::remove +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqregexp.h> +#include <tqvgroupbox.h> +#include <tqfile.h> // needed for TQFile::remove using Tellico::Fetch::ExecExternalFetcher; -QStringList ExecExternalFetcher::parseArguments(const QString& str_) { +TQStringList ExecExternalFetcher::parseArguments(const TQString& str_) { // matching escaped quotes is too hard... :( -// QRegExp quotes(QString::fromLatin1("[^\\\\](['\"])(.*[^\\\\])\\1")); - QRegExp quotes(QString::fromLatin1("(['\"])(.*)\\1")); +// TQRegExp quotes(TQString::tqfromLatin1("[^\\\\](['\"])(.*[^\\\\])\\1")); + TQRegExp quotes(TQString::tqfromLatin1("(['\"])(.*)\\1")); quotes.setMinimal(true); - QRegExp spaces(QString::fromLatin1("\\s+")); + TQRegExp spaces(TQString::tqfromLatin1("\\s+")); spaces.setMinimal(true); - QStringList args; + TQStringList args; int pos = 0; for(int nextPos = quotes.search(str_); nextPos > -1; pos = nextPos+1, nextPos = quotes.search(str_, pos)) { // a non-quotes arguments runs from pos to nextPos - args += QStringList::split(spaces, str_.mid(pos, nextPos-pos)); + args += TQStringList::split(spaces, str_.mid(pos, nextPos-pos)); // move nextpos marker to end of match pos = quotes.pos(2); // skip quotation mark nextPos += quotes.matchedLength(); args += str_.mid(pos, nextPos-pos-1); } // catch the end stuff - args += QStringList::split(spaces, str_.mid(pos)); + args += TQStringList::split(spaces, str_.mid(pos)); #if 0 - for(QStringList::ConstIterator it = args.begin(); it != args.end(); ++it) { + for(TQStringList::ConstIterator it = args.begin(); it != args.end(); ++it) { myDebug() << *it << endl; } #endif @@ -70,7 +70,7 @@ QStringList ExecExternalFetcher::parseArguments(const QString& str_) { return args; } -ExecExternalFetcher::ExecExternalFetcher(QObject* parent_, const char* name_/*=0*/) : Fetcher(parent_, name_), +ExecExternalFetcher::ExecExternalFetcher(TQObject* tqparent_, const char* name_/*=0*/) : Fetcher(tqparent_, name_), m_started(false), m_collType(-1), m_formatType(-1), m_canUpdate(false), m_process(0), m_deleteOnRemove(false) { } @@ -78,11 +78,11 @@ ExecExternalFetcher::~ExecExternalFetcher() { stop(); } -QString ExecExternalFetcher::defaultName() { +TQString ExecExternalFetcher::defaultName() { return i18n("External Application"); } -QString ExecExternalFetcher::source() const { +TQString ExecExternalFetcher::source() const { return m_name; } @@ -91,21 +91,21 @@ bool ExecExternalFetcher::canFetch(int type_) const { } void ExecExternalFetcher::readConfigHook(const KConfigGroup& config_) { - QString s = config_.readPathEntry("ExecPath"); + TQString s = config_.readPathEntry("ExecPath"); if(!s.isEmpty()) { m_path = s; } - QValueList<int> il; + TQValueList<int> il; if(config_.hasKey("ArgumentKeys")) { il = config_.readIntListEntry("ArgumentKeys"); } else { il.append(Keyword); } - QStringList sl = config_.readListEntry("Arguments"); + TQStringList sl = config_.readListEntry("Arguments"); if(il.count() != sl.count()) { kdWarning() << "ExecExternalFetcher::readConfig() - unequal number of arguments and keys" << endl; } - int n = QMIN(il.count(), sl.count()); + int n = TQMIN(il.count(), sl.count()); for(int i = 0; i < n; ++i) { m_args[static_cast<FetchKey>(il[i])] = sl[i]; } @@ -121,10 +121,10 @@ void ExecExternalFetcher::readConfigHook(const KConfigGroup& config_) { m_newStuffName = config_.readEntry("NewStuffName"); } -void ExecExternalFetcher::search(FetchKey key_, const QString& value_) { +void ExecExternalFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; - if(!m_args.contains(key_)) { + if(!m_args.tqcontains(key_)) { stop(); return; } @@ -134,22 +134,22 @@ void ExecExternalFetcher::search(FetchKey key_, const QString& value_) { // the search value needs to be enclosed in quotation marks // but first check to make sure the user didn't do that already // AND the "%1" wasn't used in the settings - QString value = value_; + TQString value = value_; if(key_ == ISBN) { value.remove('-'); // remove hyphens from isbn values // shouldn't hurt and might keep from confusing stupid search sources } - QRegExp rx1(QString::fromLatin1("['\"].*\\1")); + TQRegExp rx1(TQString::tqfromLatin1("['\"].*\\1")); if(!rx1.exactMatch(value)) { value.prepend('"').append('"'); } - QString args = m_args[key_]; - QRegExp rx2(QString::fromLatin1("['\"]%1\\1")); - args.replace(rx2, QString::fromLatin1("%1")); - startSearch(parseArguments(args.arg(value))); // replace %1 with search value + TQString args = m_args[key_]; + TQRegExp rx2(TQString::tqfromLatin1("['\"]%1\\1")); + args.tqreplace(rx2, TQString::tqfromLatin1("%1")); + startSearch(parseArguments(args.tqarg(value))); // tqreplace %1 with search value } -void ExecExternalFetcher::startSearch(const QStringList& args_) { +void ExecExternalFetcher::startSearch(const TQStringList& args_) { if(m_path.isEmpty()) { stop(); return; @@ -157,15 +157,15 @@ void ExecExternalFetcher::startSearch(const QStringList& args_) { #if 0 myDebug() << m_path << endl; - for(QStringList::ConstIterator it = args_.begin(); it != args_.end(); ++it) { + for(TQStringList::ConstIterator it = args_.begin(); it != args_.end(); ++it) { myDebug() << " " << *it << endl; } #endif 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 << m_path << args_; if(!m_process->start(KProcess::NotifyOnExit, KProcess::AllOutput)) { myDebug() << "ExecExternalFetcher::startSearch() - process failed to start" << endl; @@ -189,15 +189,15 @@ void ExecExternalFetcher::stop() { } void ExecExternalFetcher::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 ExecExternalFetcher::slotError(KProcess*, char* buffer_, int len_) { - GUI::CursorSaver cs(Qt::arrowCursor); - QString msg = QString::fromLocal8Bit(buffer_, len_); - msg.prepend(source() + QString::fromLatin1(": ")); - if(msg.endsWith(QChar('\n'))) { + GUI::CursorSaver cs(TQt::arrowCursor); + TQString msg = TQString::fromLocal8Bit(buffer_, len_); + msg.prepend(source() + TQString::tqfromLatin1(": ")); + if(msg.endsWith(TQChar('\n'))) { msg.truncate(msg.length()-1); } myDebug() << "ExecExternalFetcher::slotError() - " << msg << endl; @@ -209,13 +209,13 @@ void ExecExternalFetcher::slotProcessExited(KProcess*) { if(!m_process->normalExit() || m_process->exitStatus()) { myDebug() << "ExecExternalFetcher::slotProcessExited() - "<< source() << ": process did not exit successfully" << endl; if(!m_errors.isEmpty()) { - message(m_errors.join(QChar('\n')), MessageHandler::Error); + message(m_errors.join(TQChar('\n')), MessageHandler::Error); } stop(); return; } if(!m_errors.isEmpty()) { - message(m_errors.join(QChar('\n')), MessageHandler::Warning); + message(m_errors.join(TQChar('\n')), MessageHandler::Warning); } if(m_data.isEmpty()) { @@ -231,11 +231,11 @@ void ExecExternalFetcher::slotProcessExited(KProcess*) { return; } - imp->setText(QString::fromUtf8(m_data, m_data.size())); + imp->setText(TQString::fromUtf8(m_data, m_data.size())); Data::CollPtr coll = imp->collection(); if(!coll) { if(!imp->statusMessage().isEmpty()) { - message(imp->statusMessage(), MessageHandler::Status); + message(imp->statusMessage(), MessageHandler::tqStatus); } myDebug() << "ExecExternalFetcher::slotProcessExited() - "<< source() << ": no collection pointer" << endl; delete imp; @@ -252,60 +252,60 @@ void ExecExternalFetcher::slotProcessExited(KProcess*) { Data::EntryVec entries = coll->entries(); for(Data::EntryVec::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - QString desc; + TQString desc; switch(coll->type()) { case Data::Collection::Book: case Data::Collection::Bibtex: - desc = entry->field(QString::fromLatin1("author")) - + QChar('/') - + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("cr_year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("cr_year")); - } else if(!entry->field(QString::fromLatin1("pub_year")).isEmpty()){ - desc += QChar('/') + entry->field(QString::fromLatin1("pub_year")); + desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("cr_year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("cr_year")); + } else if(!entry->field(TQString::tqfromLatin1("pub_year")).isEmpty()){ + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("pub_year")); } break; case Data::Collection::Video: - desc = entry->field(QString::fromLatin1("studio")) - + QChar('/') - + entry->field(QString::fromLatin1("director")) - + QChar('/') - + entry->field(QString::fromLatin1("year")) - + QChar('/') - + entry->field(QString::fromLatin1("medium")); + desc = entry->field(TQString::tqfromLatin1("studio")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("director")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("medium")); break; case Data::Collection::Album: - desc = entry->field(QString::fromLatin1("artist")) - + QChar('/') - + entry->field(QString::fromLatin1("label")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("artist")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("label")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Game: - desc = entry->field(QString::fromLatin1("platform")); + desc = entry->field(TQString::tqfromLatin1("platform")); break; case Data::Collection::ComicBook: - desc = entry->field(QString::fromLatin1("publisher")) - + QChar('/') - + entry->field(QString::fromLatin1("pub_year")); + desc = entry->field(TQString::tqfromLatin1("publisher")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("pub_year")); break; case Data::Collection::BoardGame: - desc = entry->field(QString::fromLatin1("designer")) - + QChar('/') - + entry->field(QString::fromLatin1("publisher")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("designer")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("publisher")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; default: break; } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, entry); emit signalResultFound(r); } @@ -324,36 +324,36 @@ void ExecExternalFetcher::updateEntry(Data::EntryPtr entry_) { m_started = true; Data::ConstEntryPtr e(entry_.data()); - QStringList args = parseArguments(m_updateArgs); - for(QStringList::Iterator it = args.begin(); it != args.end(); ++it) { + TQStringList args = parseArguments(m_updateArgs); + for(TQStringList::Iterator it = args.begin(); it != args.end(); ++it) { *it = Data::Entry::dependentValue(e, *it, false); } startSearch(args); } -Tellico::Fetch::ConfigWidget* ExecExternalFetcher::configWidget(QWidget* parent_) const { - return new ExecExternalFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* ExecExternalFetcher::configWidget(TQWidget* tqparent_) const { + return new ExecExternalFetcher::ConfigWidget(tqparent_, this); } -ExecExternalFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ExecExternalFetcher* fetcher_/*=0*/) - : Fetch::ConfigWidget(parent_), m_deleteOnRemove(false) { - QGridLayout* l = new QGridLayout(optionsWidget(), 5, 2); +ExecExternalFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const ExecExternalFetcher* fetcher_/*=0*/) + : Fetch::ConfigWidget(tqparent_), m_deleteOnRemove(false) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 5, 2); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - QLabel* label = new QLabel(i18n("Collection &type:"), optionsWidget()); + TQLabel* label = new TQLabel(i18n("Collection &type:"), optionsWidget()); l->addWidget(label, ++row, 0); m_collCombo = new GUI::CollectionTypeCombo(optionsWidget()); - connect(m_collCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); + connect(m_collCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_collCombo, row, 1); - QString w = i18n("Set the collection type of the data returned from the external application."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_collCombo, w); + TQString w = i18n("Set the collection type of the data returned from the external application."); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_collCombo, w); label->setBuddy(m_collCombo); - label = new QLabel(i18n("&Result type: "), optionsWidget()); + label = new TQLabel(i18n("&Result type: "), optionsWidget()); l->addWidget(label, ++row, 0); m_formatCombo = new GUI::ComboBox(optionsWidget()); Import::FormatMap formatMap = ImportDialog::formatMap(); @@ -362,30 +362,30 @@ ExecExternalFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ExecExte m_formatCombo->insertItem(it.data(), it.key()); } } - connect(m_formatCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); + connect(m_formatCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_formatCombo, row, 1); w = i18n("Set the result type of the data returned from the external application."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_formatCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_formatCombo, w); label->setBuddy(m_formatCombo); - label = new QLabel(i18n("Application &path: "), optionsWidget()); + label = new TQLabel(i18n("Application &path: "), optionsWidget()); l->addWidget(label, ++row, 0); m_pathEdit = new KURLRequester(optionsWidget()); - connect(m_pathEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_pathEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_pathEdit, row, 1); w = i18n("Set the path of the application to run that should output a valid Tellico data file."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_pathEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_pathEdit, w); label->setBuddy(m_pathEdit); w = i18n("Select the search keys supported by the data source."); - QString w2 = i18n("Add any arguments that may be needed. <b>%1</b> will be replaced by the search term."); - QVGroupBox* box = new QVGroupBox(i18n("Arguments"), optionsWidget()); + TQString w2 = i18n("Add any arguments that may be needed. <b>%1</b> will be replaced by the search term."); + TQVGroupBox* box = new TQVGroupBox(i18n("Arguments"), optionsWidget()); ++row; l->addMultiCellWidget(box, row, row, 0, 1); - QWidget* grid = new QWidget(box); - QGridLayout* gridLayout = new QGridLayout(grid); + TQWidget* grid = new TQWidget(box); + TQGridLayout* gridLayout = new TQGridLayout(grid); gridLayout->setSpacing(2); row = -1; const Fetch::KeyMap keyMap = Fetch::Manager::self()->keyMap(); @@ -394,15 +394,15 @@ ExecExternalFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ExecExte if(key == Raw) { continue; } - QCheckBox* cb = new QCheckBox(it.data(), grid); + TQCheckBox* cb = new TQCheckBox(it.data(), grid); gridLayout->addWidget(cb, ++row, 0); m_cbDict.insert(key, cb); GUI::LineEdit* le = new GUI::LineEdit(grid); - le->setHint(QString::fromLatin1("%1")); // for example - le->completionObject()->addItem(QString::fromLatin1("%1")); + le->setHint(TQString::tqfromLatin1("%1")); // for example + le->completionObject()->addItem(TQString::tqfromLatin1("%1")); gridLayout->addWidget(le, row, 1); m_leDict.insert(key, le); - if(fetcher_ && fetcher_->m_args.contains(key)) { + if(fetcher_ && fetcher_->m_args.tqcontains(key)) { cb->setChecked(true); le->setEnabled(true); le->setText(fetcher_->m_args[key]); @@ -410,23 +410,23 @@ ExecExternalFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ExecExte cb->setChecked(false); le->setEnabled(false); } - connect(cb, SIGNAL(toggled(bool)), le, SLOT(setEnabled(bool))); - QWhatsThis::add(cb, w); - QWhatsThis::add(le, w2); + connect(cb, TQT_SIGNAL(toggled(bool)), le, TQT_SLOT(setEnabled(bool))); + TQWhatsThis::add(cb, w); + TQWhatsThis::add(le, w2); } - m_cbUpdate = new QCheckBox(i18n("Update"), grid); + m_cbUpdate = new TQCheckBox(i18n("Update"), grid); gridLayout->addWidget(m_cbUpdate, ++row, 0); m_leUpdate = new GUI::LineEdit(grid); - m_leUpdate->setHint(QString::fromLatin1("%{title}")); // for example - m_leUpdate->completionObject()->addItem(QString::fromLatin1("%{title}")); - m_leUpdate->completionObject()->addItem(QString::fromLatin1("%{isbn}")); + m_leUpdate->setHint(TQString::tqfromLatin1("%{title}")); // for example + m_leUpdate->completionObject()->addItem(TQString::tqfromLatin1("%{title}")); + m_leUpdate->completionObject()->addItem(TQString::tqfromLatin1("%{isbn}")); gridLayout->addWidget(m_leUpdate, row, 1); /* TRANSLATORS: Do not translate %{author}. */ w2 = i18n("<p>Enter the arguments which should be used to search for available updates to an entry.</p><p>" "The format is the same as for <i>Dependent</i> fields, where field values " "are contained inside braces, such as <i>%{author}</i>. See the documentation for details.</p>"); - QWhatsThis::add(m_cbUpdate, w); - QWhatsThis::add(m_leUpdate, w2); + TQWhatsThis::add(m_cbUpdate, w); + TQWhatsThis::add(m_leUpdate, w2); if(fetcher_ && fetcher_->m_canUpdate) { m_cbUpdate->setChecked(true); m_leUpdate->setEnabled(true); @@ -435,7 +435,7 @@ ExecExternalFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ExecExte m_cbUpdate->setChecked(false); m_leUpdate->setEnabled(false); } - connect(m_cbUpdate, SIGNAL(toggled(bool)), m_leUpdate, SLOT(setEnabled(bool))); + connect(m_cbUpdate, TQT_SIGNAL(toggled(bool)), m_leUpdate, TQT_SLOT(setEnabled(bool))); l->setRowStretch(++row, 1); @@ -462,25 +462,25 @@ ExecExternalFetcher::ConfigWidget::~ConfigWidget() { void ExecExternalFetcher::ConfigWidget::readConfig(KConfig* config_) { m_pathEdit->setURL(config_->readPathEntry("ExecPath")); - QValueList<int> argKeys = config_->readIntListEntry("ArgumentKeys"); - QStringList argValues = config_->readListEntry("Arguments"); + TQValueList<int> argKeys = config_->readIntListEntry("ArgumentKeys"); + TQStringList argValues = config_->readListEntry("Arguments"); if(argKeys.count() != argValues.count()) { kdWarning() << "ExecExternalFetcher::ConfigWidget::readConfig() - unequal number of arguments and keys" << endl; } - int n = QMIN(argKeys.count(), argValues.count()); - QMap<FetchKey, QString> args; + int n = TQMIN(argKeys.count(), argValues.count()); + TQMap<FetchKey, TQString> args; for(int i = 0; i < n; ++i) { args[static_cast<FetchKey>(argKeys[i])] = argValues[i]; } - for(QValueList<int>::Iterator it = argKeys.begin(); it != argKeys.end(); ++it) { + for(TQValueList<int>::Iterator it = argKeys.begin(); it != argKeys.end(); ++it) { if(*it == Raw) { continue; } FetchKey key = static_cast<FetchKey>(*it); - QCheckBox* cb = m_cbDict[key]; + TQCheckBox* cb = m_cbDict[key]; KLineEdit* le = m_leDict[key]; if(cb && le) { - if(args.contains(key)) { + if(args.tqcontains(key)) { cb->setChecked(true); le->setEnabled(true); le->setText(args[key]); @@ -514,13 +514,13 @@ void ExecExternalFetcher::ConfigWidget::readConfig(KConfig* config_) { } void ExecExternalFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { - QString s = m_pathEdit->url(); + TQString s = m_pathEdit->url(); if(!s.isEmpty()) { config_.writePathEntry("ExecPath", s); } - QValueList<int> keys; - QStringList args; - for(QIntDictIterator<QCheckBox> it(m_cbDict); it.current(); ++it) { + TQValueList<int> keys; + TQStringList args; + for(TQIntDictIterator<TQCheckBox> it(m_cbDict); it.current(); ++it) { if(it.current()->isChecked()) { keys << it.currentKey(); args << m_leDict[it.currentKey()]->text(); @@ -549,12 +549,12 @@ void ExecExternalFetcher::ConfigWidget::removed() { return; } if(!m_newStuffName.isEmpty()) { - NewStuff::Manager man(this); + NewStuff::Manager man(TQT_TQOBJECT(this)); man.removeScript(m_newStuffName); } } -QString ExecExternalFetcher::ConfigWidget::preferredName() const { +TQString ExecExternalFetcher::ConfigWidget::preferredName() const { return m_name.isEmpty() ? ExecExternalFetcher::defaultName() : m_name; } diff --git a/src/fetch/execexternalfetcher.h b/src/fetch/execexternalfetcher.h index bdc2a40..49a16d0 100644 --- a/src/fetch/execexternalfetcher.h +++ b/src/fetch/execexternalfetcher.h @@ -18,14 +18,14 @@ #include "configwidget.h" #include "../datavectors.h" -#include <qintdict.h> +#include <tqintdict.h> class KProcess; class KURLRequester; class KLineEdit; class KComboBox; -class QCheckBox; +class TQCheckBox; namespace Tellico { namespace GUI { @@ -40,52 +40,53 @@ namespace Tellico { */ class ExecExternalFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - ExecExternalFetcher(QObject* parent, const char* name=0); + ExecExternalFetcher(TQObject* tqparent, const char* name=0); /** */ virtual ~ExecExternalFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual bool canSearch(FetchKey k) const { return m_args.contains(k); } + virtual bool canSearch(FetchKey k) const { return m_args.tqcontains(k); } virtual bool canUpdate() const { return m_canUpdate; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void updateEntry(Data::EntryPtr entry); virtual void stop(); virtual Data::EntryPtr fetchEntry(uint uid); virtual Type type() const { return ExecExternal; } virtual bool canFetch(int type) const; virtual void readConfigHook(const KConfigGroup& config); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; - const QString& execPath() const { return m_path; } + const TQString& execPath() const { return m_path; } class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent = 0, const ExecExternalFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent = 0, const ExecExternalFetcher* fetcher = 0); ~ConfigWidget(); void readConfig(KConfig* config); virtual void saveConfig(KConfigGroup& config); virtual void removed(); - virtual QString preferredName() const; + virtual TQString preferredName() const; private: bool m_deleteOnRemove : 1; - QString m_name, m_newStuffName; + TQString m_name, m_newStuffName; KURLRequester* m_pathEdit; GUI::CollectionTypeCombo* m_collCombo; GUI::ComboBox* m_formatCombo; - QIntDict<QCheckBox> m_cbDict; - QIntDict<GUI::LineEdit> m_leDict; - QCheckBox* m_cbUpdate; + TQIntDict<TQCheckBox> m_cbDict; + TQIntDict<GUI::LineEdit> m_leDict; + TQCheckBox* m_cbUpdate; GUI::LineEdit* m_leUpdate; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: void slotData(KProcess* proc, char* buffer, int len); @@ -93,23 +94,23 @@ private slots: void slotProcessExited(KProcess* proc); private: - static QStringList parseArguments(const QString& str); + static TQStringList parseArguments(const TQString& str); - void startSearch(const QStringList& args); + void startSearch(const TQStringList& args); bool m_started; int m_collType; int m_formatType; - QString m_path; - QMap<FetchKey, QString> m_args; + TQString m_path; + TQMap<FetchKey, TQString> m_args; bool m_canUpdate : 1; - QString m_updateArgs; + TQString m_updateArgs; KProcess* m_process; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; // map from search result id to entry - QStringList m_errors; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; // map from search result id to entry + TQStringList m_errors; bool m_deleteOnRemove : 1; - QString m_newStuffName; + TQString m_newStuffName; }; } // end namespace diff --git a/src/fetch/fetcher.cpp b/src/fetch/fetcher.cpp index 3bc7749..712ea96 100644 --- a/src/fetch/fetcher.cpp +++ b/src/fetch/fetcher.cpp @@ -26,10 +26,10 @@ Fetcher::~Fetcher() { saveConfigHook(config); } -void Fetcher::readConfig(const KConfigGroup& config_, const QString& groupName_) { +void Fetcher::readConfig(const KConfigGroup& config_, const TQString& groupName_) { m_configGroup = groupName_; - QString s = config_.readEntry("Name"); + TQString s = config_.readEntry("Name"); if(!s.isEmpty()) { m_name = s; } @@ -38,13 +38,13 @@ void Fetcher::readConfig(const KConfigGroup& config_, const QString& groupName_) readConfigHook(config_); } -void Fetcher::message(const QString& message_, int type_) const { +void Fetcher::message(const TQString& message_, int type_) const { if(m_messager) { m_messager->send(message_, static_cast<MessageHandler::Type>(type_)); } } -void Fetcher::infoList(const QString& message_, const QStringList& list_) const { +void Fetcher::infoList(const TQString& message_, const TQStringList& list_) const { if(m_messager) { m_messager->infoList(message_, list_); } diff --git a/src/fetch/fetcher.h b/src/fetch/fetcher.h index 0d2496e..09f5b2c 100644 --- a/src/fetch/fetcher.h +++ b/src/fetch/fetcher.h @@ -19,8 +19,8 @@ #include <kapplication.h> // for KApplication::random() -#include <qobject.h> -#include <qstring.h> +#include <tqobject.h> +#include <tqstring.h> class KConfigGroup; @@ -35,8 +35,9 @@ namespace Tellico { * * @author Robby Stephenson */ -class Fetcher : public QObject, public KShared { +class Fetcher : public TQObject, public KShared { Q_OBJECT + TQ_OBJECT public: typedef KSharedPtr<Fetcher> Ptr; @@ -44,7 +45,7 @@ public: /** */ - Fetcher(QObject* parent, const char* name = 0) : QObject(parent, name), KShared(), + Fetcher(TQObject* tqparent, const char* name = 0) : TQObject(tqparent, name), KShared(), m_updateOverwrite(false), m_hasMoreResults(false), m_messager(0) {} /** @@ -68,7 +69,7 @@ public: /** * Returns the name of the data source, as defined by the user. */ - virtual QString source() const = 0; + virtual TQString source() const = 0; /** * Returns whether the fetcher will overwite existing info when updating */ @@ -76,7 +77,7 @@ public: /** * Starts a search, using a key and value. */ - virtual void search(FetchKey key, const QString& value) = 0; + virtual void search(FetchKey key, const TQString& value) = 0; virtual void continueSearch() {} virtual void updateEntry(Data::EntryPtr); // mopst fetchers won't support this. it's particular useful for text fetchers @@ -103,25 +104,25 @@ public: MessageHandler* messageHandler() const { return m_messager; } /** */ - void message(const QString& message, int type) const; - void infoList(const QString& message, const QStringList& list) const; + void message(const TQString& message, int type) const; + void infoList(const TQString& message, const TQStringList& list) const; /** * Reads the config for the widget, given a config group. */ - void readConfig(const KConfigGroup& config, const QString& groupName); + void readConfig(const KConfigGroup& config, const TQString& groupName); /** * Returns a widget for modifying the fetcher's config. */ - virtual ConfigWidget* configWidget(QWidget* parent) const = 0; + virtual ConfigWidget* configWidget(TQWidget* tqparent) const = 0; signals: -// void signalStatus(const QString& status); +// void signaltqStatus(const TQString& status); void signalResultFound(Tellico::Fetch::SearchResult* result); void signalDone(Tellico::Fetch::Fetcher::Ptr); protected: - QString m_name; + TQString m_name; bool m_updateOverwrite : 1; bool m_hasMoreResults : 1; @@ -130,19 +131,19 @@ private: virtual void saveConfigHook(KConfigGroup&) {} MessageHandler* m_messager; - QString m_configGroup; + TQString m_configGroup; }; class SearchResult { public: - SearchResult(Fetcher::Ptr f, const QString& t, const QString& d, const QString& i) + SearchResult(Fetcher::Ptr f, const TQString& t, const TQString& d, const TQString& i) : uid(KApplication::random()), fetcher(f), title(t), desc(d), isbn(i) {} Data::EntryPtr fetchEntry(); uint uid; Fetcher::Ptr fetcher; - QString title; - QString desc; - QString isbn; + TQString title; + TQString desc; + TQString isbn; }; } // end namespace diff --git a/src/fetch/fetchmanager.cpp b/src/fetch/fetchmanager.cpp index 84f4f39..f7bc4c3 100644 --- a/src/fetch/fetchmanager.cpp +++ b/src/fetch/fetchmanager.cpp @@ -56,8 +56,8 @@ #include <ktempfile.h> #include <kio/netaccess.h> -#include <qfileinfo.h> -#include <qdir.h> +#include <tqfileinfo.h> +#include <tqdir.h> #define LOAD_ICON(name, group, size) \ KGlobal::iconLoader()->loadIcon(name, static_cast<KIcon::Group>(group), size_) @@ -65,11 +65,11 @@ using Tellico::Fetch::Manager; Manager* Manager::s_self = 0; -Manager::Manager() : QObject(), m_currentFetcherIndex(-1), m_messager(new ManagerMessage()), +Manager::Manager() : TQObject(), m_currentFetcherIndex(-1), m_messager(new ManagerMessage()), m_count(0), m_loadDefaults(false) { loadFetchers(); -// m_keyMap.insert(FetchFirst, QString::null); +// m_keyMap.insert(FetchFirst, TQString()); m_keyMap.insert(Title, i18n("Title")); m_keyMap.insert(Person, i18n("Person")); m_keyMap.insert(ISBN, i18n("ISBN")); @@ -81,7 +81,7 @@ Manager::Manager() : QObject(), m_currentFetcherIndex(-1), m_messager(new Manage // to keep from having a new i18n string, just remove octothorpe m_keyMap.insert(LCCN, i18n("LCCN#").remove('#')); m_keyMap.insert(Raw, i18n("Raw Query")); -// m_keyMap.insert(FetchLast, QString::null); +// m_keyMap.insert(FetchLast, TQString()); } Manager::~Manager() { @@ -94,11 +94,11 @@ void Manager::loadFetchers() { m_configMap.clear(); KConfig* config = KGlobal::config(); - if(config->hasGroup(QString::fromLatin1("Data Sources"))) { - KConfigGroup configGroup(config, QString::fromLatin1("Data Sources")); + if(config->hasGroup(TQString::tqfromLatin1("Data Sources"))) { + KConfigGroup configGroup(config, TQString::tqfromLatin1("Data Sources")); int nSources = configGroup.readNumEntry("Sources Count", 0); for(int i = 0; i < nSources; ++i) { - QString group = QString::fromLatin1("Data Source %1").arg(i); + TQString group = TQString::tqfromLatin1("Data Source %1").tqarg(i); Fetcher::Ptr f = createFetcher(config, group); if(f) { m_configMap.insert(f, group); @@ -123,7 +123,7 @@ Tellico::Fetch::FetcherVec Manager::fetchers(int type_) { return vec; } -Tellico::Fetch::KeyMap Manager::keyMap(const QString& source_) const { +Tellico::Fetch::KeyMap Manager::keyMap(const TQString& source_) const { // an empty string means return all if(source_.isEmpty()) { return m_keyMap; @@ -151,7 +151,7 @@ Tellico::Fetch::KeyMap Manager::keyMap(const QString& source_) const { return map; } -void Manager::startSearch(const QString& source_, FetchKey key_, const QString& value_) { +void Manager::startSearch(const TQString& source_, FetchKey key_, const TQString& value_) { if(value_.isEmpty()) { emit signalDone(); return; @@ -163,10 +163,10 @@ void Manager::startSearch(const QString& source_, FetchKey key_, const QString& for(FetcherVec::Iterator it = m_fetchers.begin(); it != m_fetchers.end(); ++it, ++i) { if(source_ == it->source()) { ++m_count; // Fetcher::search() might emit done(), so increment before calling search() - connect(it.data(), SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), - SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); - connect(it.data(), SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), - SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); + connect(it.data(), TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), + TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); + connect(it.data(), TQT_SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), + TQT_SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); it->search(key_, value_); m_currentFetcherIndex = i; break; @@ -183,10 +183,10 @@ void Manager::continueSearch() { Fetcher::Ptr f = m_fetchers[m_currentFetcherIndex]; if(f && f->hasMoreResults()) { ++m_count; - connect(f, SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), - SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); - connect(f, SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), - SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); + connect(f, TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), + TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); + connect(f, TQT_SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), + TQT_SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); f->continueSearch(); } else { emit signalDone(); @@ -217,7 +217,7 @@ void Manager::stop() { } void Manager::slotFetcherDone(Fetcher::Ptr fetcher_) { -// myDebug() << "Manager::slotFetcherDone() - " << (fetcher_ ? fetcher_->source() : QString::null) +// myDebug() << "Manager::slotFetcherDone() - " << (fetcher_ ? fetcher_->source() : TQString()) // << " :" << m_count << endl; fetcher_->disconnect(); // disconnect all signals --m_count; @@ -235,7 +235,7 @@ bool Manager::canFetch() const { return false; } -Tellico::Fetch::Fetcher::Ptr Manager::createFetcher(KConfig* config_, const QString& group_) { +Tellico::Fetch::Fetcher::Ptr Manager::createFetcher(KConfig* config_, const TQString& group_) { if(!config_->hasGroup(group_)) { myDebug() << "Manager::createFetcher() - no config group for " << group_ << endl; return 0; @@ -359,7 +359,7 @@ Tellico::Fetch::FetcherVec Manager::defaultFetchers() { vec.append(new GoogleScholarFetcher(this)); vec.append(new DiscogsFetcher(this)); // only add IBS if user includes italian - if(KGlobal::locale()->languagesTwoAlpha().contains(QString::fromLatin1("it"))) { + if(KGlobal::locale()->languagesTwoAlpha().tqcontains(TQString::tqfromLatin1("it"))) { vec.append(new IBSFetcher(this)); } return vec; @@ -374,7 +374,7 @@ Tellico::Fetch::FetcherVec Manager::createUpdateFetchers(int collType_) { KConfigGroup config(KGlobal::config(), "Data Sources"); int nSources = config.readNumEntry("Sources Count", 0); for(int i = 0; i < nSources; ++i) { - QString group = QString::fromLatin1("Data Source %1").arg(i); + TQString group = TQString::tqfromLatin1("Data Source %1").tqarg(i); // needs the KConfig* Fetcher::Ptr f = createFetcher(KGlobal::config(), group); if(f && f->canFetch(collType_) && f->canUpdate()) { @@ -396,7 +396,7 @@ Tellico::Fetch::FetcherVec Manager::createUpdateFetchers(int collType_, FetchKey return fetchers; } -Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const QString& source_) { +Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const TQString& source_) { Fetcher::Ptr fetcher = 0; // creates new fetchers FetcherVec fetchers = createUpdateFetchers(collType_); @@ -409,8 +409,8 @@ Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const Q return fetcher; } -void Manager::updateStatus(const QString& message_) { - emit signalStatus(message_); +void Manager::updatetqStatus(const TQString& message_) { + emit signaltqStatus(message_); } Tellico::Fetch::TypePairList Manager::typeList() { @@ -440,11 +440,11 @@ Tellico::Fetch::TypePairList Manager::typeList() { list.append(TypePair(DiscogsFetcher::defaultName(), Discogs)); // now find all the scripts distributed with tellico - QStringList files = KGlobal::dirs()->findAllResources("appdata", QString::fromLatin1("data-sources/*.spec"), + TQStringList files = KGlobal::dirs()->findAllResources("appdata", TQString::tqfromLatin1("data-sources/*.spec"), false, true); - for(QStringList::Iterator it = files.begin(); it != files.end(); ++it) { + for(TQStringList::Iterator it = files.begin(); it != files.end(); ++it) { KConfig spec(*it, false, false); - QString name = spec.readEntry("Name"); + TQString name = spec.readEntry("Name"); if(name.isEmpty()) { myDebug() << "Fetch::Manager::typeList() - no Name for " << *it << endl; continue; @@ -463,33 +463,33 @@ Tellico::Fetch::TypePairList Manager::typeList() { // called when creating a new fetcher -Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* parent_, Type type_, const QString& name_) { +Tellico::Fetch::ConfigWidget* Manager::configWidget(TQWidget* tqparent_, Type type_, const TQString& name_) { ConfigWidget* w = 0; switch(type_) { #ifdef AMAZON_SUPPORT case Amazon: - w = new AmazonFetcher::ConfigWidget(parent_); + w = new AmazonFetcher::ConfigWidget(tqparent_); break; #endif #ifdef IMDB_SUPPORT case IMDB: - w = new IMDBFetcher::ConfigWidget(parent_); + w = new IMDBFetcher::ConfigWidget(tqparent_); break; #endif #ifdef HAVE_YAZ case Z3950: - w = new Z3950Fetcher::ConfigWidget(parent_); + w = new Z3950Fetcher::ConfigWidget(tqparent_); break; #endif case SRU: - w = new SRUConfigWidget(parent_); + w = new SRUConfigWidget(tqparent_); break; case Entrez: - w = new EntrezFetcher::ConfigWidget(parent_); + w = new EntrezFetcher::ConfigWidget(tqparent_); break; case ExecExternal: - w = new ExecExternalFetcher::ConfigWidget(parent_); - if(!name_.isEmpty() && m_scriptMap.contains(name_)) { + w = new ExecExternalFetcher::ConfigWidget(tqparent_); + if(!name_.isEmpty() && m_scriptMap.tqcontains(name_)) { // bundledScriptHasExecPath() actually needs to write the exec path // back to the config so the configWidget can read it. But if the spec file // is not readablle, that doesn't work. So work around it with a copy to a temp file @@ -512,37 +512,37 @@ Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* parent_, Type type_ } break; case Yahoo: - w = new YahooFetcher::ConfigWidget(parent_); + w = new YahooFetcher::ConfigWidget(tqparent_); break; case AnimeNfo: - w = new AnimeNfoFetcher::ConfigWidget(parent_); + w = new AnimeNfoFetcher::ConfigWidget(tqparent_); break; case IBS: - w = new IBSFetcher::ConfigWidget(parent_); + w = new IBSFetcher::ConfigWidget(tqparent_); break; case ISBNdb: - w = new ISBNdbFetcher::ConfigWidget(parent_); + w = new ISBNdbFetcher::ConfigWidget(tqparent_); break; case GCstarPlugin: - w = new GCstarPluginFetcher::ConfigWidget(parent_); + w = new GCstarPluginFetcher::ConfigWidget(tqparent_); break; case CrossRef: - w = new CrossRefFetcher::ConfigWidget(parent_); + w = new CrossRefFetcher::ConfigWidget(tqparent_); break; case Arxiv: - w = new ArxivFetcher::ConfigWidget(parent_); + w = new ArxivFetcher::ConfigWidget(tqparent_); break; case Citebase: - w = new CitebaseFetcher::ConfigWidget(parent_); + w = new CitebaseFetcher::ConfigWidget(tqparent_); break; case Bibsonomy: - w = new BibsonomyFetcher::ConfigWidget(parent_); + w = new BibsonomyFetcher::ConfigWidget(tqparent_); break; case GoogleScholar: - w = new GoogleScholarFetcher::ConfigWidget(parent_); + w = new GoogleScholarFetcher::ConfigWidget(tqparent_); break; case Discogs: - w = new DiscogsFetcher::ConfigWidget(parent_); + w = new DiscogsFetcher::ConfigWidget(tqparent_); break; case Unknown: kdWarning() << "Fetch::Manager::configWidget() - no widget defined for type = " << type_ << endl; @@ -551,7 +551,7 @@ Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* parent_, Type type_ } // static -QString Manager::typeName(Fetch::Type type_) { +TQString Manager::typeName(Fetch::Type type_) { switch(type_) { #ifdef AMAZON_SUPPORT case Amazon: return AmazonFetcher::defaultName(); @@ -579,17 +579,17 @@ QString Manager::typeName(Fetch::Type type_) { case Unknown: break; } myWarning() << "Manager::typeName() - none found for " << type_ << endl; - return QString::null; + return TQString(); } -QPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size_) { +TQPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size_) { #ifdef HAVE_YAZ if(fetcher_->type() == Fetch::Z3950) { const Fetch::Z3950Fetcher* f = static_cast<const Fetch::Z3950Fetcher*>(fetcher_.data()); KURL u; - u.setProtocol(QString::fromLatin1("http")); + u.setProtocol(TQString::tqfromLatin1("http")); u.setHost(f->host()); - QString icon = favIcon(u); + TQString icon = favIcon(u); if(u.isValid() && !icon.isEmpty()) { return LOAD_ICON(icon, group_, size_); } @@ -597,21 +597,21 @@ QPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size #endif if(fetcher_->type() == Fetch::ExecExternal) { const Fetch::ExecExternalFetcher* f = static_cast<const Fetch::ExecExternalFetcher*>(fetcher_.data()); - const QString p = f->execPath(); + const TQString p = f->execPath(); KURL u; - if(p.find(QString::fromLatin1("allocine")) > -1) { - u = QString::fromLatin1("http://www.allocine.fr"); - } else if(p.find(QString::fromLatin1("ministerio_de_cultura")) > -1) { - u = QString::fromLatin1("http://www.mcu.es"); - } else if(p.find(QString::fromLatin1("dark_horse_comics")) > -1) { - u = QString::fromLatin1("http://www.darkhorse.com"); - } else if(p.find(QString::fromLatin1("boardgamegeek")) > -1) { - u = QString::fromLatin1("http://www.boardgamegeek.com"); - } else if(f->source().find(QString::fromLatin1("amarok"), 0, false /*case-sensitive*/) > -1) { - return LOAD_ICON(QString::fromLatin1("amarok"), group_, size_); + if(p.tqfind(TQString::tqfromLatin1("allocine")) > -1) { + u = TQString::tqfromLatin1("http://www.allocine.fr"); + } else if(p.tqfind(TQString::tqfromLatin1("ministerio_de_cultura")) > -1) { + u = TQString::tqfromLatin1("http://www.mcu.es"); + } else if(p.tqfind(TQString::tqfromLatin1("dark_horse_comics")) > -1) { + u = TQString::tqfromLatin1("http://www.darkhorse.com"); + } else if(p.tqfind(TQString::tqfromLatin1("boardgamegeek")) > -1) { + u = TQString::tqfromLatin1("http://www.boardgamegeek.com"); + } else if(f->source().tqfind(TQString::tqfromLatin1("amarok"), 0, false /*case-sensitive*/) > -1) { + return LOAD_ICON(TQString::tqfromLatin1("amarok"), group_, size_); } if(!u.isEmpty() && u.isValid()) { - QString icon = favIcon(u); + TQString icon = favIcon(u); if(!icon.isEmpty()) { return LOAD_ICON(icon, group_, size_); } @@ -620,21 +620,21 @@ QPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size return fetcherIcon(fetcher_->type(), group_); } -QPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { - QString name; +TQPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { + TQString name; switch(type_) { case Amazon: name = favIcon("http://amazon.com"); break; case IMDB: name = favIcon("http://imdb.com"); break; case Z3950: - name = QString::fromLatin1("network"); break; // rather arbitrary + name = TQString::tqfromLatin1("network"); break; // rather arbitrary case SRU: - name = QString::fromLatin1("network_local"); break; // just to be different than z3950 + name = TQString::tqfromLatin1("network_local"); break; // just to be different than z3950 case Entrez: name = favIcon("http://www.ncbi.nlm.nih.gov"); break; case ExecExternal: - name = QString::fromLatin1("exec"); break; + name = TQString::tqfromLatin1("exec"); break; case Yahoo: name = favIcon("http://yahoo.com"); break; case AnimeNfo: @@ -644,7 +644,7 @@ QPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { case ISBNdb: name = favIcon("http://isbndb.com"); break; case GCstarPlugin: - name = QString::fromLatin1("gcstar"); break; + name = TQString::tqfromLatin1("gcstar"); break; case CrossRef: name = favIcon("http://crossref.org"); break; case Arxiv: @@ -661,13 +661,13 @@ QPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { kdWarning() << "Fetch::Manager::fetcherIcon() - no pixmap defined for type = " << type_ << endl; } - return name.isEmpty() ? QPixmap() : LOAD_ICON(name, group_, size_); + return name.isEmpty() ? TQPixmap() : LOAD_ICON(name, group_, size_); } -QString Manager::favIcon(const KURL& url_) { +TQString Manager::favIcon(const KURL& url_) { DCOPRef kded("kded", "favicons"); DCOPReply reply = kded.call("iconForURL(KURL)", url_); - QString iconName = reply.isValid() ? reply : QString(); + TQString iconName = reply.isValid() ? reply : TQString(); if(!iconName.isEmpty()) { return iconName; } else { @@ -677,15 +677,15 @@ QString Manager::favIcon(const KURL& url_) { return KMimeType::iconForURL(url_); } -bool Manager::bundledScriptHasExecPath(const QString& specFile_, KConfig* config_) { +bool Manager::bundledScriptHasExecPath(const TQString& specFile_, KConfig* config_) { // make sure ExecPath is set and executable // for the bundled scripts, either the exec name is not set, in which case it is the // name of the spec file, minus the .spec, or the exec is set, and is local to the dir // if not, look for it - QString exec = config_->readPathEntry("ExecPath"); - QFileInfo specInfo(specFile_), execInfo(exec); + TQString exec = config_->readPathEntry("ExecPath"); + TQFileInfo specInfo(specFile_), execInfo(exec); if(exec.isEmpty() || !execInfo.exists()) { - exec = specInfo.dirPath(true) + QDir::separator() + specInfo.baseName(true); // remove ".spec" + exec = specInfo.dirPath(true) + TQDir::separator() + specInfo.baseName(true); // remove ".spec" } else if(execInfo.isRelative()) { exec = specInfo.dirPath(true) + exec; } else if(!execInfo.isExecutable()) { diff --git a/src/fetch/fetchmanager.h b/src/fetch/fetchmanager.h index 7036d71..c43b997 100644 --- a/src/fetch/fetchmanager.h +++ b/src/fetch/fetchmanager.h @@ -27,15 +27,15 @@ namespace Tellico { #include <ksortablevaluelist.h> -#include <qobject.h> -#include <qmap.h> +#include <tqobject.h> +#include <tqmap.h> namespace Tellico { namespace Fetch { -typedef KSortableItem<Type, QString> TypePair; // fetcher info, type and name of type -typedef KSortableValueList<Type, QString> TypePairList; -typedef QMap<FetchKey, QString> KeyMap; // map key type to name of key +typedef KSortableItem<Type, TQString> TypePair; // fetcher info, type and name of type +typedef KSortableValueList<Type, TQString> TypePairList; +typedef TQMap<FetchKey, TQString> KeyMap; // map key type to name of key typedef Vector<Fetcher> FetcherVec; /** @@ -43,16 +43,17 @@ typedef Vector<Fetcher> FetcherVec; * * @author Robby Stephenson */ -class Manager : public QObject { +class Manager : public TQObject { Q_OBJECT + TQ_OBJECT public: static Manager* self() { if(!s_self) s_self = new Manager(); return s_self; } ~Manager(); - KeyMap keyMap(const QString& source = QString::null) const; - void startSearch(const QString& source, FetchKey key, const QString& value); + KeyMap keyMap(const TQString& source = TQString()) const; + void startSearch(const TQString& source, FetchKey key, const TQString& value); void continueSearch(); void stop(); bool canFetch() const; @@ -61,19 +62,19 @@ public: const FetcherVec& fetchers() const { return m_fetchers; } FetcherVec fetchers(int type); TypePairList typeList(); - ConfigWidget* configWidget(QWidget* parent, Type type, const QString& name); + ConfigWidget* configWidget(TQWidget* tqparent, Type type, const TQString& name); // create fetcher for updating an entry FetcherVec createUpdateFetchers(int collType); FetcherVec createUpdateFetchers(int collType, FetchKey key); - Fetcher::Ptr createUpdateFetcher(int collType, const QString& source); + Fetcher::Ptr createUpdateFetcher(int collType, const TQString& source); - static QString typeName(Type type); - static QPixmap fetcherIcon(Fetch::Type type, int iconGroup=3 /*Small*/, int size=0 /* default */); - static QPixmap fetcherIcon(Fetch::Fetcher::CPtr ptr, int iconGroup=3 /*Small*/, int size=0 /* default*/); + static TQString typeName(Type type); + static TQPixmap fetcherIcon(Fetch::Type type, int iconGroup=3 /*Small*/, int size=0 /* default */); + static TQPixmap fetcherIcon(Fetch::Fetcher::CPtr ptr, int iconGroup=3 /*Small*/, int size=0 /* default*/); signals: - void signalStatus(const QString& status); + void signaltqStatus(const TQString& status); void signalResultFound(Tellico::Fetch::SearchResult* result); void signalDone(); @@ -85,17 +86,17 @@ private: static Manager* s_self; Manager(); - Fetcher::Ptr createFetcher(KConfig* config, const QString& configGroup); + Fetcher::Ptr createFetcher(KConfig* config, const TQString& configGroup); FetcherVec defaultFetchers(); - void updateStatus(const QString& message); + void updatetqStatus(const TQString& message); - static QString favIcon(const KURL& url); - static bool bundledScriptHasExecPath(const QString& specFile, KConfig* config); + static TQString favIcon(const KURL& url); + static bool bundledScriptHasExecPath(const TQString& specFile, KConfig* config); FetcherVec m_fetchers; int m_currentFetcherIndex; KeyMap m_keyMap; - typedef QMap<Fetcher::Ptr, QString> ConfigMap; + typedef TQMap<Fetcher::Ptr, TQString> ConfigMap; ConfigMap m_configMap; StringMap m_scriptMap; ManagerMessage* m_messager; diff --git a/src/fetch/gcstarpluginfetcher.cpp b/src/fetch/gcstarpluginfetcher.cpp index 4bffed7..3129c78 100644 --- a/src/fetch/gcstarpluginfetcher.cpp +++ b/src/fetch/gcstarpluginfetcher.cpp @@ -31,10 +31,10 @@ #include <kstandarddirs.h> #include <kaccelmanager.h> -#include <qdir.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> +#include <tqdir.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> using Tellico::Fetch::GCstarPluginFetcher; @@ -43,25 +43,25 @@ GCstarPluginFetcher::PluginParse GCstarPluginFetcher::pluginParse = NotYet; //static GCstarPluginFetcher::PluginList GCstarPluginFetcher::plugins(int collType_) { - if(!pluginMap.contains(collType_)) { + if(!pluginMap.tqcontains(collType_)) { GUI::CursorSaver cs; - QString gcstar = KStandardDirs::findExe(QString::fromLatin1("gcstar")); + TQString gcstar = KStandardDirs::findExe(TQString::tqfromLatin1("gcstar")); if(pluginParse == NotYet) { KProcIO proc; - proc << gcstar << QString::fromLatin1("--version"); + proc << gcstar << TQString::tqfromLatin1("--version"); // wait 5 seconds at most, just a sanity thing, never want to block completely if(proc.start(KProcess::Block) && proc.wait(5)) { - QString output; + TQString output; proc.readln(output); if(!output.isEmpty()) { // always going to be x.y[.z] ? - QRegExp versionRx(QString::fromLatin1("(\\d+)\\.(\\d+)(?:\\.(\\d+))?")); + TQRegExp versionRx(TQString::tqfromLatin1("(\\d+)\\.(\\d+)(?:\\.(\\d+))?")); if(versionRx.search(output) > -1) { int x = versionRx.cap(1).toInt(); int y = versionRx.cap(2).toInt(); int z = versionRx.cap(3).toInt(); // ok to be empty - myDebug() << QString::fromLatin1("GCstarPluginFetcher() - found %1.%2.%3").arg(x).arg(y).arg(z) << endl; + myDebug() << TQString::tqfromLatin1("GCstarPluginFetcher() - found %1.%2.%3").tqarg(x).tqarg(y).tqarg(z) << endl; // --list-plugins argument was added for 1.3 release pluginParse = (x >= 1 && y >=3) ? New : Old; } @@ -80,13 +80,13 @@ GCstarPluginFetcher::PluginList GCstarPluginFetcher::plugins(int collType_) { } } - return pluginMap.contains(collType_) ? pluginMap[collType_] : GCstarPluginFetcher::PluginList(); + return pluginMap.tqcontains(collType_) ? pluginMap[collType_] : GCstarPluginFetcher::PluginList(); } -void GCstarPluginFetcher::readPluginsNew(int collType_, const QString& gcstar_) { +void GCstarPluginFetcher::readPluginsNew(int collType_, const TQString& gcstar_) { PluginList plugins; - QString gcstarCollection = gcstarType(collType_); + TQString gcstarCollection = gcstarType(collType_); if(gcstarCollection.isEmpty()) { pluginMap.insert(collType_, plugins); return; @@ -94,9 +94,9 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const QString& gcstar_) KProcIO proc; proc << gcstar_ - << QString::fromLatin1("-x") - << QString::fromLatin1("--list-plugins") - << QString::fromLatin1("--collection") << gcstarCollection; + << TQString::tqfromLatin1("-x") + << TQString::tqfromLatin1("--list-plugins") + << TQString::tqfromLatin1("--collection") << gcstarCollection; if(!proc.start(KProcess::Block)) { myWarning() << "GCstarPluginFetcher::readPluginsNew() - can't start" << endl; @@ -105,7 +105,7 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const QString& gcstar_) bool hasName = false; PluginInfo info; - QString line; + TQString line; for(int length = 0; length > -1; length = proc.readln(line)) { if(line.isEmpty()) { if(hasName) { @@ -117,10 +117,10 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const QString& gcstar_) // authors have \t at beginning line = line.stripWhiteSpace(); if(!hasName) { - info.insert(QString::fromLatin1("name"), line); + info.insert(TQString::tqfromLatin1("name"), line); hasName = true; } else { - info.insert(QString::fromLatin1("author"), line); + info.insert(TQString::tqfromLatin1("author"), line); } // myDebug() << line << endl; } @@ -129,34 +129,34 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const QString& gcstar_) pluginMap.insert(collType_, plugins); } -void GCstarPluginFetcher::readPluginsOld(int collType_, const QString& gcstar_) { - QDir dir(gcstar_, QString::fromLatin1("GC*.pm")); - dir.cd(QString::fromLatin1("../../lib/gcstar/GCPlugins/")); +void GCstarPluginFetcher::readPluginsOld(int collType_, const TQString& gcstar_) { + TQDir dir(gcstar_, TQString::tqfromLatin1("GC*.pm")); + dir.cd(TQString::tqfromLatin1("../../lib/gcstar/GCPlugins/")); - QRegExp rx(QString::fromLatin1("get(Name|Author|Lang)\\s*\\{\\s*return\\s+['\"](.+)['\"]")); + TQRegExp rx(TQString::tqfromLatin1("get(Name|Author|Lang)\\s*\\{\\s*return\\s+['\"](.+)['\"]")); rx.setMinimal(true); PluginList plugins; - QString dirName = gcstarType(collType_); + TQString dirName = gcstarType(collType_); if(dirName.isEmpty()) { pluginMap.insert(collType_, plugins); return; } - QStringList files = dir.entryList(); - for(QStringList::ConstIterator file = files.begin(); file != files.end(); ++file) { + TQStringList files = dir.entryList(); + for(TQStringList::ConstIterator file = files.begin(); file != files.end(); ++file) { KURL u; u.setPath(dir.filePath(*file)); PluginInfo info; - QString text = FileHandler::readTextFile(u); + TQString text = FileHandler::readTextFile(u); for(int pos = rx.search(text); pos > -1; pos = rx.search(text, pos+rx.matchedLength())) { info.insert(rx.cap(1).lower(), rx.cap(2)); } // only add if it has a name - if(info.contains(QString::fromLatin1("name"))) { + if(info.tqcontains(TQString::tqfromLatin1("name"))) { plugins << info; } } @@ -164,21 +164,21 @@ void GCstarPluginFetcher::readPluginsOld(int collType_, const QString& gcstar_) pluginMap.insert(collType_, plugins); } -QString GCstarPluginFetcher::gcstarType(int collType_) { +TQString GCstarPluginFetcher::gcstarType(int collType_) { switch(collType_) { - case Data::Collection::Book: return QString::fromLatin1("GCbooks"); - case Data::Collection::Video: return QString::fromLatin1("GCfilms"); - case Data::Collection::Game: return QString::fromLatin1("GCgames"); - case Data::Collection::Album: return QString::fromLatin1("GCmusics"); - case Data::Collection::Coin: return QString::fromLatin1("GCcoins"); - case Data::Collection::Wine: return QString::fromLatin1("GCwines"); - case Data::Collection::BoardGame: return QString::fromLatin1("GCboardgames"); + case Data::Collection::Book: return TQString::tqfromLatin1("GCbooks"); + case Data::Collection::Video: return TQString::tqfromLatin1("GCfilms"); + case Data::Collection::Game: return TQString::tqfromLatin1("GCgames"); + case Data::Collection::Album: return TQString::tqfromLatin1("GCmusics"); + case Data::Collection::Coin: return TQString::tqfromLatin1("GCcoins"); + case Data::Collection::Wine: return TQString::tqfromLatin1("GCwines"); + case Data::Collection::BoardGame: return TQString::tqfromLatin1("GCboardgames"); default: break; } - return QString(); + return TQString(); } -GCstarPluginFetcher::GCstarPluginFetcher(QObject* parent_, const char* name_/*=0*/) : Fetcher(parent_, name_), +GCstarPluginFetcher::GCstarPluginFetcher(TQObject* tqparent_, const char* name_/*=0*/) : Fetcher(tqparent_, name_), m_started(false), m_collType(-1), m_process(0) { } @@ -186,11 +186,11 @@ GCstarPluginFetcher::~GCstarPluginFetcher() { stop(); } -QString GCstarPluginFetcher::defaultName() { +TQString GCstarPluginFetcher::defaultName() { return i18n("GCstar Plugin"); } -QString GCstarPluginFetcher::source() const { +TQString GCstarPluginFetcher::source() const { return m_name; } @@ -203,7 +203,7 @@ void GCstarPluginFetcher::readConfigHook(const KConfigGroup& config_) { m_plugin = config_.readEntry("Plugin"); } -void GCstarPluginFetcher::search(FetchKey key_, const QString& value_) { +void GCstarPluginFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; m_data.truncate(0); @@ -213,14 +213,14 @@ void GCstarPluginFetcher::search(FetchKey key_, const QString& value_) { return; } - QString gcstar = KStandardDirs::findExe(QString::fromLatin1("gcstar")); + TQString gcstar = KStandardDirs::findExe(TQString::tqfromLatin1("gcstar")); if(gcstar.isEmpty()) { myWarning() << "GCstarPluginFetcher::search() - gcstar not found!" << endl; stop(); return; } - QString gcstarCollection = gcstarType(m_collType); + TQString gcstarCollection = gcstarType(m_collType); if(m_plugin.isEmpty()) { myWarning() << "GCstarPluginFetcher::search() - no plugin name! " << endl; @@ -229,16 +229,16 @@ void GCstarPluginFetcher::search(FetchKey key_, const QString& value_) { } 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*))); - QStringList args; - args << gcstar << QString::fromLatin1("-x") - << QString::fromLatin1("--collection") << gcstarCollection - << QString::fromLatin1("--export") << QString::fromLatin1("Tellico") - << QString::fromLatin1("--website") << m_plugin - << QString::fromLatin1("--download") << KProcess::quote(value_); - myLog() << "GCstarPluginFetcher::search() - " << args.join(QChar(' ')) << endl; + 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*))); + TQStringList args; + args << gcstar << TQString::tqfromLatin1("-x") + << TQString::tqfromLatin1("--collection") << gcstarCollection + << TQString::tqfromLatin1("--export") << TQString::tqfromLatin1("Tellico") + << TQString::tqfromLatin1("--website") << m_plugin + << TQString::tqfromLatin1("--download") << KProcess::quote(value_); + myLog() << "GCstarPluginFetcher::search() - " << args.join(TQChar(' ')) << endl; *m_process << args; if(!m_process->start(KProcess::NotifyOnExit, KProcess::AllOutput)) { myDebug() << "GCstarPluginFetcher::startSearch() - process failed to start" << endl; @@ -262,13 +262,13 @@ void GCstarPluginFetcher::stop() { } void GCstarPluginFetcher::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 GCstarPluginFetcher::slotError(KProcess*, char* buffer_, int len_) { - QString msg = QString::fromLocal8Bit(buffer_, len_); - msg.prepend(source() + QString::fromLatin1(": ")); + TQString msg = TQString::fromLocal8Bit(buffer_, len_); + msg.prepend(source() + TQString::tqfromLatin1(": ")); myDebug() << "GCstarPluginFetcher::slotError() - " << msg << endl; m_errors << msg; } @@ -278,13 +278,13 @@ void GCstarPluginFetcher::slotProcessExited(KProcess*) { if(!m_process->normalExit() || m_process->exitStatus()) { myDebug() << "GCstarPluginFetcher::slotProcessExited() - "<< source() << ": process did not exit successfully" << endl; if(!m_errors.isEmpty()) { - message(m_errors.join(QChar('\n')), MessageHandler::Error); + message(m_errors.join(TQChar('\n')), MessageHandler::Error); } stop(); return; } if(!m_errors.isEmpty()) { - message(m_errors.join(QChar('\n')), MessageHandler::Warning); + message(m_errors.join(TQChar('\n')), MessageHandler::Warning); } if(m_data.isEmpty()) { @@ -293,12 +293,12 @@ void GCstarPluginFetcher::slotProcessExited(KProcess*) { return; } - Import::TellicoImporter imp(QString::fromUtf8(m_data, m_data.size())); + Import::TellicoImporter imp(TQString::fromUtf8(m_data, m_data.size())); Data::CollPtr coll = imp.collection(); if(!coll) { if(!imp.statusMessage().isEmpty()) { - message(imp.statusMessage(), MessageHandler::Status); + message(imp.statusMessage(), MessageHandler::tqStatus); } myDebug() << "GCstarPluginFetcher::slotProcessExited() - "<< source() << ": no collection pointer" << endl; stop(); @@ -307,60 +307,60 @@ void GCstarPluginFetcher::slotProcessExited(KProcess*) { Data::EntryVec entries = coll->entries(); for(Data::EntryVec::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - QString desc; + TQString desc; switch(coll->type()) { case Data::Collection::Book: case Data::Collection::Bibtex: - desc = entry->field(QString::fromLatin1("author")) - + QChar('/') - + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("cr_year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("cr_year")); - } else if(!entry->field(QString::fromLatin1("pub_year")).isEmpty()){ - desc += QChar('/') + entry->field(QString::fromLatin1("pub_year")); + desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("cr_year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("cr_year")); + } else if(!entry->field(TQString::tqfromLatin1("pub_year")).isEmpty()){ + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("pub_year")); } break; case Data::Collection::Video: - desc = entry->field(QString::fromLatin1("studio")) - + QChar('/') - + entry->field(QString::fromLatin1("director")) - + QChar('/') - + entry->field(QString::fromLatin1("year")) - + QChar('/') - + entry->field(QString::fromLatin1("medium")); + desc = entry->field(TQString::tqfromLatin1("studio")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("director")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("medium")); break; case Data::Collection::Album: - desc = entry->field(QString::fromLatin1("artist")) - + QChar('/') - + entry->field(QString::fromLatin1("label")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("artist")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("label")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Game: - desc = entry->field(QString::fromLatin1("platform")); + desc = entry->field(TQString::tqfromLatin1("platform")); break; case Data::Collection::ComicBook: - desc = entry->field(QString::fromLatin1("publisher")) - + QChar('/') - + entry->field(QString::fromLatin1("pub_year")); + desc = entry->field(TQString::tqfromLatin1("publisher")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("pub_year")); break; case Data::Collection::BoardGame: - desc = entry->field(QString::fromLatin1("designer")) - + QChar('/') - + entry->field(QString::fromLatin1("publisher")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("designer")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("publisher")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; default: break; } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, entry); emit signalResultFound(r); } @@ -373,7 +373,7 @@ Tellico::Data::EntryPtr GCstarPluginFetcher::fetchEntry(uint uid_) { void GCstarPluginFetcher::updateEntry(Data::EntryPtr entry_) { // ry searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -383,48 +383,48 @@ void GCstarPluginFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* GCstarPluginFetcher::configWidget(QWidget* parent_) const { - return new GCstarPluginFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* GCstarPluginFetcher::configWidget(TQWidget* tqparent_) const { + return new GCstarPluginFetcher::ConfigWidget(tqparent_, this); } -GCstarPluginFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const GCstarPluginFetcher* fetcher_/*=0*/) - : Fetch::ConfigWidget(parent_), m_needPluginList(true) { - QGridLayout* l = new QGridLayout(optionsWidget(), 3, 4); +GCstarPluginFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const GCstarPluginFetcher* fetcher_/*=0*/) + : Fetch::ConfigWidget(tqparent_), m_needPluginList(true) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 3, 4); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - QLabel* label = new QLabel(i18n("Collection &type:"), optionsWidget()); + TQLabel* label = new TQLabel(i18n("Collection &type:"), optionsWidget()); l->addWidget(label, ++row, 0); m_collCombo = new GUI::CollectionTypeCombo(optionsWidget()); - connect(m_collCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); - connect(m_collCombo, SIGNAL(activated(int)), SLOT(slotTypeChanged())); + connect(m_collCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); + connect(m_collCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotTypeChanged())); l->addMultiCellWidget(m_collCombo, row, row, 1, 3); - QString w = i18n("Set the collection type of the data returned from the plugin."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_collCombo, w); + TQString w = i18n("Set the collection type of the data returned from the plugin."); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_collCombo, w); label->setBuddy(m_collCombo); - label = new QLabel(i18n("&Plugin: "), optionsWidget()); + label = new TQLabel(i18n("&Plugin: "), optionsWidget()); l->addWidget(label, ++row, 0); m_pluginCombo = new GUI::ComboBox(optionsWidget()); - connect(m_pluginCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); - connect(m_pluginCombo, SIGNAL(activated(int)), SLOT(slotPluginChanged())); + connect(m_pluginCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); + connect(m_pluginCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotPluginChanged())); l->addMultiCellWidget(m_pluginCombo, row, row, 1, 3); w = i18n("Select the GCstar plugin used for the data source."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_pluginCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_pluginCombo, w); label->setBuddy(m_pluginCombo); - label = new QLabel(i18n("Author: "), optionsWidget()); + label = new TQLabel(i18n("Author: "), optionsWidget()); l->addWidget(label, ++row, 0); - m_authorLabel = new QLabel(optionsWidget()); + m_authorLabel = new TQLabel(optionsWidget()); l->addWidget(m_authorLabel, row, 1); -// label = new QLabel(i18n("Language: "), optionsWidget()); +// label = new TQLabel(i18n("Language: "), optionsWidget()); // l->addWidget(label, row, 2); -// m_langLabel = new QLabel(optionsWidget()); +// m_langLabel = new TQLabel(optionsWidget()); // l->addWidget(m_langLabel, row, 3); if(fetcher_ && fetcher_->m_collType > -1) { @@ -448,17 +448,17 @@ void GCstarPluginFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { config_.writeEntry("Plugin", m_pluginCombo->currentText()); } -QString GCstarPluginFetcher::ConfigWidget::preferredName() const { - return QString::fromLatin1("GCstar - ") + m_pluginCombo->currentText(); +TQString GCstarPluginFetcher::ConfigWidget::preferredName() const { + return TQString::tqfromLatin1("GCstar - ") + m_pluginCombo->currentText(); } void GCstarPluginFetcher::ConfigWidget::slotTypeChanged() { int collType = m_collCombo->currentType(); m_pluginCombo->clear(); - QStringList pluginNames; + TQStringList pluginNames; GCstarPluginFetcher::PluginList list = GCstarPluginFetcher::plugins(collType); for(GCstarPluginFetcher::PluginList::ConstIterator it = list.begin(); it != list.end(); ++it) { - pluginNames << (*it)[QString::fromLatin1("name")].toString(); + pluginNames << (*it)[TQString::tqfromLatin1("name")].toString(); m_pluginCombo->insertItem(pluginNames.last(), *it); } slotPluginChanged(); @@ -467,12 +467,12 @@ void GCstarPluginFetcher::ConfigWidget::slotTypeChanged() { void GCstarPluginFetcher::ConfigWidget::slotPluginChanged() { PluginInfo info = m_pluginCombo->currentData().toMap(); - m_authorLabel->setText(info[QString::fromLatin1("author")].toString()); -// m_langLabel->setText(info[QString::fromLatin1("lang")].toString()); + m_authorLabel->setText(info[TQString::tqfromLatin1("author")].toString()); +// m_langLabel->setText(info[TQString::tqfromLatin1("lang")].toString()); emit signalName(preferredName()); } -void GCstarPluginFetcher::ConfigWidget::showEvent(QShowEvent*) { +void GCstarPluginFetcher::ConfigWidget::showEvent(TQShowEvent*) { if(m_needPluginList) { m_needPluginList = false; slotTypeChanged(); // update plugin combo box diff --git a/src/fetch/gcstarpluginfetcher.h b/src/fetch/gcstarpluginfetcher.h index 1994b58..0bda3b0 100644 --- a/src/fetch/gcstarpluginfetcher.h +++ b/src/fetch/gcstarpluginfetcher.h @@ -18,9 +18,9 @@ #include "configwidget.h" #include "../datavectors.h" -#include <qintdict.h> +#include <tqintdict.h> -class QLabel; +class TQLabel; class KProcess; namespace Tellico { @@ -35,31 +35,32 @@ namespace Tellico { */ class GCstarPluginFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - GCstarPluginFetcher(QObject* parent, const char* name=0); + GCstarPluginFetcher(TQObject* tqparent, const char* name=0); /** */ virtual ~GCstarPluginFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } virtual bool canSearch(FetchKey k) const { return k == Title; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void updateEntry(Data::EntryPtr entry); virtual void stop(); virtual Data::EntryPtr fetchEntry(uint uid); virtual Type type() const { return GCstarPlugin; } virtual bool canFetch(int type) const; virtual void readConfigHook(const KConfigGroup& config); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: void slotData(KProcess* proc, char* buffer, int len); @@ -68,51 +69,52 @@ private slots: private: // map Author, Name, Lang, etc... - typedef QMap<QString, QVariant> PluginInfo; - typedef QValueList<PluginInfo> PluginList; + typedef TQMap<TQString, TQVariant> PluginInfo; + typedef TQValueList<PluginInfo> PluginList; // map collection type to all available plugins - typedef QMap<int, PluginList> PluginMap; + typedef TQMap<int, PluginList> PluginMap; static PluginMap pluginMap; static PluginList plugins(int collType); // we need to keep track if we've searched for plugins yet and by what method enum PluginParse {NotYet, Old, New}; static PluginParse pluginParse; - static void readPluginsNew(int collType, const QString& exe); - static void readPluginsOld(int collType, const QString& exe); - static QString gcstarType(int collType); + static void readPluginsNew(int collType, const TQString& exe); + static void readPluginsOld(int collType, const TQString& exe); + static TQString gcstarType(int collType); bool m_started; int m_collType; - QString m_plugin; + TQString m_plugin; KProcess* m_process; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; // map from search result id to entry - QStringList m_errors; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; // map from search result id to entry + TQStringList m_errors; }; class GCstarPluginFetcher::ConfigWidget : public Fetch::ConfigWidget { Q_OBJECT + TQ_OBJECT public: - ConfigWidget(QWidget* parent, const GCstarPluginFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent, const GCstarPluginFetcher* fetcher = 0); ~ConfigWidget(); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; private slots: void slotTypeChanged(); void slotPluginChanged(); private: - void showEvent(QShowEvent* event); + void showEvent(TQShowEvent* event); bool m_needPluginList; - QString m_originalPluginName; + TQString m_originalPluginName; GUI::CollectionTypeCombo* m_collCombo; GUI::ComboBox* m_pluginCombo; - QLabel* m_authorLabel; - QLabel* m_langLabel; + TQLabel* m_authorLabel; + TQLabel* m_langLabel; }; } // end namespace diff --git a/src/fetch/googlescholarfetcher.cpp b/src/fetch/googlescholarfetcher.cpp index 21979c4..1d14043 100644 --- a/src/fetch/googlescholarfetcher.cpp +++ b/src/fetch/googlescholarfetcher.cpp @@ -24,8 +24,8 @@ #include <kconfig.h> #include <kio/job.h> -#include <qlabel.h> -#include <qlayout.h> +#include <tqlabel.h> +#include <tqlayout.h> namespace { static const int GOOGLE_MAX_RETURNS_TOTAL = 20; @@ -34,23 +34,23 @@ namespace { using Tellico::Fetch::GoogleScholarFetcher; -GoogleScholarFetcher::GoogleScholarFetcher(QObject* parent_, const char* name_) - : Fetcher(parent_, name_), +GoogleScholarFetcher::GoogleScholarFetcher(TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_limit(GOOGLE_MAX_RETURNS_TOTAL), m_start(0), m_job(0), m_started(false), m_cookieIsSet(false) { - m_bibtexRx = QRegExp(QString::fromLatin1("<a\\s.*href\\s*=\\s*\"([^>]*scholar\\.bib[^>]*)\"")); + m_bibtexRx = TQRegExp(TQString::tqfromLatin1("<a\\s.*href\\s*=\\s*\"([^>]*scholar\\.bib[^>]*)\"")); m_bibtexRx.setMinimal(true); } GoogleScholarFetcher::~GoogleScholarFetcher() { } -QString GoogleScholarFetcher::defaultName() { +TQString GoogleScholarFetcher::defaultName() { // no i18n - return QString::fromLatin1("Google Scholar"); + return TQString::tqfromLatin1("Google Scholar"); } -QString GoogleScholarFetcher::source() const { +TQString GoogleScholarFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -62,10 +62,10 @@ void GoogleScholarFetcher::readConfigHook(const KConfigGroup& config_) { Q_UNUSED(config_); } -void GoogleScholarFetcher::search(FetchKey key_, const QString& value_) { +void GoogleScholarFetcher::search(FetchKey key_, const TQString& value_) { if(!m_cookieIsSet) { // have to set preferences to have bibtex output - FileHandler::readTextFile(QString::fromLatin1("http://scholar.google.com/scholar_setprefs?num=100&scis=yes&scisf=4&submit=Save+Preferences"), true); + FileHandler::readTextFile(TQString::tqfromLatin1("http://scholar.google.com/scholar_setprefs?num=100&scis=yes&scisf=4&submit=Save+Preferences"), true); m_cookieIsSet = true; } m_key = key_; @@ -85,25 +85,25 @@ void GoogleScholarFetcher::doSearch() { // myDebug() << "GoogleScholarFetcher::search() - value = " << value_ << endl; if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } - KURL u(QString::fromLatin1(SCHOLAR_BASE_URL)); - u.addQueryItem(QString::fromLatin1("start"), QString::number(m_start)); + KURL u(TQString::tqfromLatin1(SCHOLAR_BASE_URL)); + u.addQueryItem(TQString::tqfromLatin1("start"), TQString::number(m_start)); switch(m_key) { case Title: - u.addQueryItem(QString::fromLatin1("q"), QString::fromLatin1("allintitle:%1").arg(m_value)); + u.addQueryItem(TQString::tqfromLatin1("q"), TQString::tqfromLatin1("allintitle:%1").tqarg(m_value)); break; case Keyword: - u.addQueryItem(QString::fromLatin1("q"), m_value); + u.addQueryItem(TQString::tqfromLatin1("q"), m_value); break; case Person: - u.addQueryItem(QString::fromLatin1("q"), QString::fromLatin1("author:%1").arg(m_value)); + u.addQueryItem(TQString::tqfromLatin1("q"), TQString::tqfromLatin1("author:%1").tqarg(m_value)); break; default: @@ -114,10 +114,10 @@ void GoogleScholarFetcher::doSearch() { // myDebug() << "GoogleScholarFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void GoogleScholarFetcher::stop() { @@ -133,8 +133,8 @@ void GoogleScholarFetcher::stop() { emit signalDone(this); } -void GoogleScholarFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void GoogleScholarFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -155,11 +155,11 @@ void GoogleScholarFetcher::slotComplete(KIO::Job* job_) { return; } - QString text = QString::fromUtf8(m_data, m_data.size()); - QString bibtex; + TQString text = TQString::fromUtf8(m_data, m_data.size()); + TQString bibtex; int count = 0; - for(int pos = text.find(m_bibtexRx); count < m_limit && pos > -1; pos = text.find(m_bibtexRx, pos+m_bibtexRx.matchedLength()), ++count) { - KURL bibtexUrl(QString::fromLatin1(SCHOLAR_BASE_URL), m_bibtexRx.cap(1)); + for(int pos = text.tqfind(m_bibtexRx); count < m_limit && pos > -1; pos = text.tqfind(m_bibtexRx, pos+m_bibtexRx.matchedLength()), ++count) { + KURL bibtexUrl(TQString::tqfromLatin1(SCHOLAR_BASE_URL), m_bibtexRx.cap(1)); // myDebug() << bibtexUrl << endl; bibtex += FileHandler::readTextFile(bibtexUrl, true); } @@ -179,13 +179,13 @@ void GoogleScholarFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -205,7 +205,7 @@ void GoogleScholarFetcher::updateEntry(Data::EntryPtr entry_) { // limit to top 5 results m_limit = 5; - QString title = entry_->field(QString::fromLatin1("title")); + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { search(Title, title); return; @@ -215,18 +215,18 @@ void GoogleScholarFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* GoogleScholarFetcher::configWidget(QWidget* parent_) const { - return new GoogleScholarFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* GoogleScholarFetcher::configWidget(TQWidget* tqparent_) const { + return new GoogleScholarFetcher::ConfigWidget(tqparent_, this); } -GoogleScholarFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const GoogleScholarFetcher*/*=0*/) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +GoogleScholarFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const GoogleScholarFetcher*/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } -QString GoogleScholarFetcher::ConfigWidget::preferredName() const { +TQString GoogleScholarFetcher::ConfigWidget::preferredName() const { return GoogleScholarFetcher::defaultName(); } diff --git a/src/fetch/googlescholarfetcher.h b/src/fetch/googlescholarfetcher.h index 4e15475..9391d1f 100644 --- a/src/fetch/googlescholarfetcher.h +++ b/src/fetch/googlescholarfetcher.h @@ -18,8 +18,8 @@ #include "configwidget.h" #include "../datavectors.h" -#include <qguardedptr.h> -#include <qregexp.h> +#include <tqguardedptr.h> +#include <tqregexp.h> namespace KIO { class Job; @@ -35,20 +35,21 @@ namespace Tellico { */ class GoogleScholarFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: /** */ - GoogleScholarFetcher(QObject* parent, const char* name = 0); + GoogleScholarFetcher(TQObject* tqparent, const char* name = 0); /** */ virtual ~GoogleScholarFetcher(); /** */ - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); // amazon can search title or person virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == Keyword; } @@ -63,20 +64,20 @@ public: /** * Returns a widget for modifying the fetcher's config. */ - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const GoogleScholarFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const GoogleScholarFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup&) {} - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: @@ -86,15 +87,15 @@ private: int m_start; int m_total; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; - QRegExp m_bibtexRx; + TQRegExp m_bibtexRx; bool m_cookieIsSet; }; diff --git a/src/fetch/ibsfetcher.cpp b/src/fetch/ibsfetcher.cpp index b11258b..855d2f0 100644 --- a/src/fetch/ibsfetcher.cpp +++ b/src/fetch/ibsfetcher.cpp @@ -26,10 +26,10 @@ #include <kconfig.h> #include <kio/job.h> -#include <qregexp.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qfile.h> +#include <tqregexp.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqfile.h> //#define IBS_TEST @@ -39,15 +39,15 @@ namespace { using Tellico::Fetch::IBSFetcher; -IBSFetcher::IBSFetcher(QObject* parent_, const char* name_ /*=0*/) - : Fetcher(parent_, name_), m_started(false) { +IBSFetcher::IBSFetcher(TQObject* tqparent_, const char* name_ /*=0*/) + : Fetcher(tqparent_, name_), m_started(false) { } -QString IBSFetcher::defaultName() { +TQString IBSFetcher::defaultName() { return i18n("Internet Bookshop (ibs.it)"); } -QString IBSFetcher::source() const { +TQString IBSFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -59,46 +59,46 @@ void IBSFetcher::readConfigHook(const KConfigGroup& config_) { Q_UNUSED(config_); } -void IBSFetcher::search(FetchKey key_, const QString& value_) { +void IBSFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; m_matches.clear(); #ifdef IBS_TEST - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/ibs.html")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/ibs.html")); #else - KURL u(QString::fromLatin1(IBS_BASE_URL)); + KURL u(TQString::tqfromLatin1(IBS_BASE_URL)); if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } switch(key_) { case Title: - u.addQueryItem(QString::fromLatin1("Type"), QString::fromLatin1("keyword")); - u.addQueryItem(QString::fromLatin1("T"), value_); + u.addQueryItem(TQString::tqfromLatin1("Type"), TQString::tqfromLatin1("keyword")); + u.addQueryItem(TQString::tqfromLatin1("T"), value_); break; case Person: - u.addQueryItem(QString::fromLatin1("Type"), QString::fromLatin1("keyword")); - u.addQueryItem(QString::fromLatin1("A"), value_); + u.addQueryItem(TQString::tqfromLatin1("Type"), TQString::tqfromLatin1("keyword")); + u.addQueryItem(TQString::tqfromLatin1("A"), value_); break; case ISBN: { - QString s = value_; + TQString s = value_; s.remove('-'); // limit to first isbn s = s.section(';', 0, 0); - u.setFileName(QString::fromLatin1("serdsp.asp")); - u.addQueryItem(QString::fromLatin1("isbn"), s); + u.setFileName(TQString::tqfromLatin1("serdsp.asp")); + u.addQueryItem(TQString::tqfromLatin1("isbn"), s); } break; case Keyword: - u.addQueryItem(QString::fromLatin1("Type"), QString::fromLatin1("keyword")); - u.addQueryItem(QString::fromLatin1("S"), value_); + u.addQueryItem(TQString::tqfromLatin1("Type"), TQString::tqfromLatin1("keyword")); + u.addQueryItem(TQString::tqfromLatin1("S"), value_); break; default: @@ -110,12 +110,12 @@ void IBSFetcher::search(FetchKey key_, const QString& value_) { // myDebug() << "IBSFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); if(key_ == ISBN) { - connect(m_job, SIGNAL(result(KIO::Job*)), SLOT(slotCompleteISBN(KIO::Job*))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotCompleteISBN(KIO::Job*))); } else { - connect(m_job, SIGNAL(result(KIO::Job*)), SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), TQT_SLOT(slotComplete(KIO::Job*))); } } @@ -133,8 +133,8 @@ void IBSFetcher::stop() { emit signalDone(this); } -void IBSFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void IBSFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -154,28 +154,28 @@ void IBSFetcher::slotComplete(KIO::Job* job_) { return; } - QString s = Tellico::decodeHTML(QString(m_data)); + TQString s = Tellico::decodeHTML(TQString(m_data)); // really specific regexp - QString pat = QString::fromLatin1("http://www.internetbookshop.it/code/"); - QRegExp anchorRx(QString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](") + - QRegExp::escape(pat) + - QString::fromLatin1("[^\"]*)\"[^>]*><b>([^<]+)<"), false); + TQString pat = TQString::tqfromLatin1("http://www.internetbookshop.it/code/"); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](") + + TQRegExp::escape(pat) + + TQString::tqfromLatin1("[^\"]*)\"[^>]*><b>([^<]+)<"), false); anchorRx.setMinimal(true); - QRegExp tagRx(QString::fromLatin1("<.*>")); + TQRegExp tagRx(TQString::tqfromLatin1("<.*>")); tagRx.setMinimal(true); - QString u, t, d; + TQString u, t, d; int pos2; for(int pos = anchorRx.search(s); m_started && pos > -1; pos = anchorRx.search(s, pos+anchorRx.matchedLength())) { if(!u.isEmpty()) { - SearchResult* r = new SearchResult(this, t, d, QString()); + SearchResult* r = new SearchResult(this, t, d, TQString()); emit signalResultFound(r); #ifdef IBS_TEST - KURL url = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/ibs2.html")); + KURL url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/ibs2.html")); #else - // the url probable contains & so be careful - KURL url = u.replace(QString::fromLatin1("&"), QChar('&')); + // the url probable tqcontains & so be careful + KURL url = u.tqreplace(TQString::tqfromLatin1("&"), TQChar('&')); #endif m_matches.insert(r->uid, url); @@ -185,9 +185,9 @@ void IBSFetcher::slotComplete(KIO::Job* job_) { } u = anchorRx.cap(1); t = anchorRx.cap(2); - pos2 = s.find(QString::fromLatin1("<br>"), pos, false); + pos2 = s.tqfind(TQString::tqfromLatin1("<br>"), pos, false); if(pos2 > -1) { - int pos3 = s.find(QString::fromLatin1("<br>"), pos2+1, false); + int pos3 = s.tqfind(TQString::tqfromLatin1("<br>"), pos2+1, false); if(pos3 > -1) { d = s.mid(pos2, pos3-pos2).remove(tagRx).simplifyWhiteSpace(); } @@ -195,9 +195,9 @@ void IBSFetcher::slotComplete(KIO::Job* job_) { } #ifndef IBS_TEST if(!u.isEmpty()) { - SearchResult* r = new SearchResult(this, t, d, QString()); + SearchResult* r = new SearchResult(this, t, d, TQString()); emit signalResultFound(r); - m_matches.insert(r->uid, u.replace(QString::fromLatin1("&"), QChar('&'))); + m_matches.insert(r->uid, u.tqreplace(TQString::tqfromLatin1("&"), TQChar('&'))); } #endif @@ -220,16 +220,16 @@ void IBSFetcher::slotCompleteISBN(KIO::Job* job_) { return; } - QString str = Tellico::decodeHTML(QString(m_data)); - if(str.find(QString::fromLatin1("Libro non presente"), 0, false /* cas-sensitive */) > -1) { + TQString str = Tellico::decodeHTML(TQString(m_data)); + if(str.tqfind(TQString::tqfromLatin1("Libro non presente"), 0, false /* cas-sensitive */) > -1) { stop(); return; } Data::EntryPtr entry = parseEntry(str); if(entry) { - QString desc = entry->field(QString::fromLatin1("author")) - + '/' + entry->field(QString::fromLatin1("publisher")); - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + '/' + entry->field(TQString::tqfromLatin1("publisher")); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); emit signalResultFound(r); m_matches.insert(r->uid, static_cast<KIO::TransferJob*>(job_)->url().url()); } @@ -250,7 +250,7 @@ Tellico::Data::EntryPtr IBSFetcher::fetchEntry(uint uid_) { return 0; } - QString results = Tellico::decodeHTML(FileHandler::readTextFile(url, true)); + TQString results = Tellico::decodeHTML(FileHandler::readTextFile(url, true)); if(results.isEmpty()) { myDebug() << "IBSFetcher::fetchEntry() - no text results" << endl; return 0; @@ -259,10 +259,10 @@ Tellico::Data::EntryPtr IBSFetcher::fetchEntry(uint uid_) { // myDebug() << url.url() << endl; #if 0 kdWarning() << "Remove debug from ibsfetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.html")); + TQFile f(TQString::tqfromLatin1("/tmp/test.html")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); t << results; } f.close(); @@ -277,13 +277,13 @@ Tellico::Data::EntryPtr IBSFetcher::fetchEntry(uint uid_) { return entry; } -Tellico::Data::EntryPtr IBSFetcher::parseEntry(const QString& str_) { +Tellico::Data::EntryPtr IBSFetcher::parseEntry(const TQString& str_) { // myDebug() << "IBSFetcher::parseEntry()" << endl; // class might be anime_info_top - QString pat = QString::fromLatin1("%1(?:<[^>]+>)+([^<>\\s][^<>]+)"); + TQString pat = TQString::tqfromLatin1("%1(?:<[^>]+>)+([^<>\\s][^<>]+)"); - QRegExp isbnRx(QString::fromLatin1("isbn=([\\dxX]{13})"), false); - QString isbn; + TQRegExp isbnRx(TQString::tqfromLatin1("isbn=([\\dxX]{13})"), false); + TQString isbn; int pos = isbnRx.search(str_); if(pos > -1) { isbn = isbnRx.cap(1); @@ -292,26 +292,26 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const QString& str_) { Data::CollPtr coll = new Data::BookCollection(true); // map captions in HTML to field names - QMap<QString, QString> fieldMap; - fieldMap.insert(QString::fromLatin1("Titolo"), QString::fromLatin1("title")); - fieldMap.insert(QString::fromLatin1("Autore"), QString::fromLatin1("author")); - fieldMap.insert(QString::fromLatin1("Anno"), QString::fromLatin1("pub_year")); - fieldMap.insert(QString::fromLatin1("Categoria"), QString::fromLatin1("genre")); - fieldMap.insert(QString::fromLatin1("Rilegatura"), QString::fromLatin1("binding")); - fieldMap.insert(QString::fromLatin1("Editore"), QString::fromLatin1("publisher")); - fieldMap.insert(QString::fromLatin1("Dati"), QString::fromLatin1("edition")); - - QRegExp pagesRx(QString::fromLatin1("(\\d+) p\\.(\\s*,\\s*)?")); + TQMap<TQString, TQString> fieldMap; + fieldMap.insert(TQString::tqfromLatin1("Titolo"), TQString::tqfromLatin1("title")); + fieldMap.insert(TQString::tqfromLatin1("Autore"), TQString::tqfromLatin1("author")); + fieldMap.insert(TQString::tqfromLatin1("Anno"), TQString::tqfromLatin1("pub_year")); + fieldMap.insert(TQString::tqfromLatin1("Categoria"), TQString::tqfromLatin1("genre")); + fieldMap.insert(TQString::tqfromLatin1("Rilegatura"), TQString::tqfromLatin1("binding")); + fieldMap.insert(TQString::tqfromLatin1("Editore"), TQString::tqfromLatin1("publisher")); + fieldMap.insert(TQString::tqfromLatin1("Dati"), TQString::tqfromLatin1("edition")); + + TQRegExp pagesRx(TQString::tqfromLatin1("(\\d+) p\\.(\\s*,\\s*)?")); Data::EntryPtr entry = new Data::Entry(coll); - for(QMap<QString, QString>::Iterator it = fieldMap.begin(); it != fieldMap.end(); ++it) { - QRegExp infoRx(pat.arg(it.key())); + for(TQMap<TQString, TQString>::Iterator it = fieldMap.begin(); it != fieldMap.end(); ++it) { + TQRegExp infoRx(pat.tqarg(it.key())); pos = infoRx.search(str_); if(pos > -1) { if(it.data() == Latin1Literal("edition")) { int pos2 = pagesRx.search(infoRx.cap(1)); if(pos2 > -1) { - entry->setField(QString::fromLatin1("pages"), pagesRx.cap(1)); + entry->setField(TQString::tqfromLatin1("pages"), pagesRx.cap(1)); entry->setField(it.data(), infoRx.cap(1).remove(pagesRx)); } else { entry->setField(it.data(), infoRx.cap(1)); @@ -324,70 +324,70 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const QString& str_) { // image if(!isbn.isEmpty()) { - entry->setField(QString::fromLatin1("isbn"), isbn); + entry->setField(TQString::tqfromLatin1("isbn"), isbn); #if 1 - QString imgURL = QString::fromLatin1("http://giotto.ibs.it/cop/copt13.asp?f=%1").arg(isbn); + TQString imgURL = TQString::tqfromLatin1("http://giotto.ibs.it/cop/copt13.asp?f=%1").tqarg(isbn); myLog() << "IBSFetcher() - cover = " << imgURL << endl; - QString id = ImageFactory::addImage(imgURL, true, QString::fromLatin1("http://internetbookshop.it")); + TQString id = ImageFactory::addImage(imgURL, true, TQString::tqfromLatin1("http://internetbookshop.it")); if(!id.isEmpty()) { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } #else - QRegExp imgRx(QString::fromLatin1("<img\\s+[^>]*\\s*src\\s*=\\s*\"(http://[^/]*\\.ibs\\.it/[^\"]+e=%1)").arg(isbn)); + TQRegExp imgRx(TQString::tqfromLatin1("<img\\s+[^>]*\\s*src\\s*=\\s*\"(http://[^/]*\\.ibs\\.it/[^\"]+e=%1)").tqarg(isbn)); imgRx.setMinimal(true); pos = imgRx.search(str_); if(pos > -1) { myLog() << "IBSFetcher() - cover = " << imgRx.cap(1) << endl; - QString id = ImageFactory::addImage(imgRx.cap(1), true, QString::fromLatin1("http://internetbookshop.it")); + TQString id = ImageFactory::addImage(imgRx.cap(1), true, TQString::tqfromLatin1("http://internetbookshop.it")); if(!id.isEmpty()) { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } #endif } // now look for description - QRegExp descRx(QString::fromLatin1("Descrizione(?:<[^>]+>)+([^<>\\s].+)</span>"), false); + TQRegExp descRx(TQString::tqfromLatin1("Descrizione(?:<[^>]+>)+([^<>\\s].+)</span>"), false); descRx.setMinimal(true); pos = descRx.search(str_); if(pos == -1) { - descRx.setPattern(QString::fromLatin1("In sintesi(?:<[^>]+>)+([^<>\\s].+)</span>")); + descRx.setPattern(TQString::tqfromLatin1("In sintesi(?:<[^>]+>)+([^<>\\s].+)</span>")); pos = descRx.search(str_); } if(pos > -1) { - Data::FieldPtr f = new Data::Field(QString::fromLatin1("plot"), i18n("Plot Summary"), Data::Field::Para); + Data::FieldPtr f = new Data::Field(TQString::tqfromLatin1("plot"), i18n("Plot Summary"), Data::Field::Para); coll->addField(f); entry->setField(f, descRx.cap(1).simplifyWhiteSpace()); } // IBS switches the surname and family name of the author - QStringList names = entry->fields(QString::fromLatin1("author"), false); + TQStringList names = entry->fields(TQString::tqfromLatin1("author"), false); if(!names.isEmpty() && !names[0].isEmpty()) { - for(QStringList::Iterator it = names.begin(); it != names.end(); ++it) { - if((*it).find(',') > -1) { + for(TQStringList::Iterator it = names.begin(); it != names.end(); ++it) { + if((*it).tqfind(',') > -1) { continue; // skip if it has a comma } - QStringList words = QStringList::split(' ', *it); + TQStringList words = TQStringList::split(' ', *it); if(words.isEmpty()) { continue; } // put first word in back words.append(words[0]); words.pop_front(); - *it = words.join(QChar(' ')); + *it = words.join(TQChar(' ')); } - entry->setField(QString::fromLatin1("author"), names.join(QString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("author"), names.join(TQString::tqfromLatin1("; "))); } return entry; } void IBSFetcher::updateEntry(Data::EntryPtr entry_) { - QString isbn = entry_->field(QString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -397,18 +397,18 @@ void IBSFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* IBSFetcher::configWidget(QWidget* parent_) const { - return new IBSFetcher::ConfigWidget(parent_); +Tellico::Fetch::ConfigWidget* IBSFetcher::configWidget(TQWidget* tqparent_) const { + return new IBSFetcher::ConfigWidget(tqparent_); } -IBSFetcher::ConfigWidget::ConfigWidget(QWidget* parent_) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +IBSFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } -QString IBSFetcher::ConfigWidget::preferredName() const { +TQString IBSFetcher::ConfigWidget::preferredName() const { return IBSFetcher::defaultName(); } diff --git a/src/fetch/ibsfetcher.h b/src/fetch/ibsfetcher.h index 39326b2..b607b3a 100644 --- a/src/fetch/ibsfetcher.h +++ b/src/fetch/ibsfetcher.h @@ -17,8 +17,8 @@ #include "fetcher.h" #include "configwidget.h" -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace KIO { class Job; @@ -34,14 +34,15 @@ namespace Tellico { */ class IBSFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - IBSFetcher(QObject* parent, const char* name = 0); + IBSFetcher(TQObject* tqparent, const char* name = 0); virtual ~IBSFetcher() {} - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); // can search title, person, isbn, or keyword. No UPC or Raw for now. virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == ISBN || k == Keyword; } virtual void stop(); @@ -52,34 +53,34 @@ public: virtual void updateEntry(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_); + ConfigWidget(TQWidget* tqparent_); virtual void saveConfig(KConfigGroup&) {} - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); void slotCompleteISBN(KIO::Job* job); private: - Data::EntryPtr parseEntry(const QString& str); + Data::EntryPtr parseEntry(const TQString& str); - QByteArray m_data; + TQByteArray m_data; int m_total; - QMap<int, Data::EntryPtr> m_entries; - QMap<int, KURL> m_matches; - QGuardedPtr<KIO::Job> m_job; + TQMap<int, Data::EntryPtr> m_entries; + TQMap<int, KURL> m_matches; + TQGuardedPtr<KIO::Job> m_job; bool m_started; -// QStringList m_fields; +// TQStringList m_fields; }; } // end namespace diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp index 1066177..5db3a49 100644 --- a/src/fetch/imdbfetcher.cpp +++ b/src/fetch/imdbfetcher.cpp @@ -29,53 +29,53 @@ #include <klineedit.h> #include <knuminput.h> -#include <qregexp.h> -#include <qfile.h> -#include <qmap.h> -#include <qvbox.h> -#include <qlabel.h> -#include <qlistbox.h> -#include <qwhatsthis.h> -#include <qlayout.h> -#include <qcheckbox.h> -#include <qvgroupbox.h> +#include <tqregexp.h> +#include <tqfile.h> +#include <tqmap.h> +#include <tqvbox.h> +#include <tqlabel.h> +#include <tqlistbox.h> +#include <tqwhatsthis.h> +#include <tqlayout.h> +#include <tqcheckbox.h> +#include <tqvgroupbox.h> //#define IMDB_TEST namespace { static const char* IMDB_SERVER = "akas.imdb.com"; static const uint IMDB_MAX_RESULTS = 20; - static const QString sep = QString::fromLatin1("; "); + static const TQString sep = TQString::tqfromLatin1("; "); } using Tellico::Fetch::IMDBFetcher; -QRegExp* IMDBFetcher::s_tagRx = 0; -QRegExp* IMDBFetcher::s_anchorRx = 0; -QRegExp* IMDBFetcher::s_anchorTitleRx = 0; -QRegExp* IMDBFetcher::s_anchorNameRx = 0; -QRegExp* IMDBFetcher::s_titleRx = 0; +TQRegExp* IMDBFetcher::s_tagRx = 0; +TQRegExp* IMDBFetcher::s_anchorRx = 0; +TQRegExp* IMDBFetcher::s_anchorTitleRx = 0; +TQRegExp* IMDBFetcher::s_anchorNameRx = 0; +TQRegExp* IMDBFetcher::s_titleRx = 0; // static void IMDBFetcher::initRegExps() { - s_tagRx = new QRegExp(QString::fromLatin1("<.*>")); + s_tagRx = new TQRegExp(TQString::tqfromLatin1("<.*>")); s_tagRx->setMinimal(true); - s_anchorRx = new QRegExp(QString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"[^<]*>([^<]*)</a>"), false); + s_anchorRx = new TQRegExp(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"[^<]*>([^<]*)</a>"), false); s_anchorRx->setMinimal(true); - s_anchorTitleRx = new QRegExp(QString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/title/[^\"]*)\"[^<]*>([^<]*)</a>"), false); + s_anchorTitleRx = new TQRegExp(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/title/[^\"]*)\"[^<]*>([^<]*)</a>"), false); s_anchorTitleRx->setMinimal(true); - s_anchorNameRx = new QRegExp(QString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/name/[^\"]*)\"[^<]*>([^<]*)</a>"), false); + s_anchorNameRx = new TQRegExp(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/name/[^\"]*)\"[^<]*>([^<]*)</a>"), false); s_anchorNameRx->setMinimal(true); - s_titleRx = new QRegExp(QString::fromLatin1("<title>(.*)</title>"), false); + s_titleRx = new TQRegExp(TQString::tqfromLatin1("<title>(.*)</title>"), false); s_titleRx->setMinimal(true); } -IMDBFetcher::IMDBFetcher(QObject* parent_, const char* name_) : Fetcher(parent_, name_), - m_job(0), m_started(false), m_fetchImages(true), m_host(QString::fromLatin1(IMDB_SERVER)), +IMDBFetcher::IMDBFetcher(TQObject* tqparent_, const char* name_) : Fetcher(tqparent_, name_), + m_job(0), m_started(false), m_fetchImages(true), m_host(TQString::tqfromLatin1(IMDB_SERVER)), m_limit(IMDB_MAX_RESULTS), m_countOffset(0) { if(!s_tagRx) { initRegExps(); @@ -85,11 +85,11 @@ IMDBFetcher::IMDBFetcher(QObject* parent_, const char* name_) : Fetcher(parent_, IMDBFetcher::~IMDBFetcher() { } -QString IMDBFetcher::defaultName() { +TQString IMDBFetcher::defaultName() { return i18n("Internet Movie Database"); } -QString IMDBFetcher::source() const { +TQString IMDBFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -98,7 +98,7 @@ bool IMDBFetcher::canFetch(int type) const { } void IMDBFetcher::readConfigHook(const KConfigGroup& config_) { - QString h = config_.readEntry("Host"); + TQString h = config_.readEntry("Host"); if(!h.isEmpty()) { m_host = h; } @@ -108,7 +108,7 @@ void IMDBFetcher::readConfigHook(const KConfigGroup& config_) { } // multiple values not supported -void IMDBFetcher::search(FetchKey key_, const QString& value_) { +void IMDBFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_; m_started = true; @@ -130,25 +130,25 @@ void IMDBFetcher::search(FetchKey key_, const QString& value_) { #ifdef IMDB_TEST if(m_key == Title) { - m_url = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/imdb-title.html")); + m_url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-title.html")); m_redirected = false; } else { - m_url = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/imdb-name.html")); + m_url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-name.html")); m_redirected = true; } #else m_url = KURL(); - m_url.setProtocol(QString::fromLatin1("http")); - m_url.setHost(m_host.isEmpty() ? QString::fromLatin1(IMDB_SERVER) : m_host); - m_url.setPath(QString::fromLatin1("/find")); + m_url.setProtocol(TQString::tqfromLatin1("http")); + m_url.setHost(m_host.isEmpty() ? TQString::tqfromLatin1(IMDB_SERVER) : m_host); + m_url.setPath(TQString::tqfromLatin1("/tqfind")); switch(key_) { case Title: - m_url.addQueryItem(QString::fromLatin1("s"), QString::fromLatin1("tt")); + m_url.addQueryItem(TQString::tqfromLatin1("s"), TQString::tqfromLatin1("tt")); break; case Person: - m_url.addQueryItem(QString::fromLatin1("s"), QString::fromLatin1("nm")); + m_url.addQueryItem(TQString::tqfromLatin1("s"), TQString::tqfromLatin1("nm")); break; default: @@ -159,18 +159,18 @@ void IMDBFetcher::search(FetchKey key_, const QString& value_) { // as far as I can tell, the url encoding should always be iso-8859-1 // not utf-8 - m_url.addQueryItem(QString::fromLatin1("q"), value_, 4 /* iso-8859-1 */); + m_url.addQueryItem(TQString::tqfromLatin1("q"), value_, 4 /* iso-8859-1 */); // myDebug() << "IMDBFetcher::search() url = " << m_url << endl; #endif m_job = KIO::get(m_url, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); - connect(m_job, SIGNAL(redirection(KIO::Job *, const KURL&)), - SLOT(slotRedirection(KIO::Job*, const KURL&))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(redirection(KIO::Job *, const KURL&)), + TQT_SLOT(slotRedirection(KIO::Job*, const KURL&))); } void IMDBFetcher::continueSearch() { @@ -217,8 +217,8 @@ void IMDBFetcher::stop() { emit signalDone(this); } -void IMDBFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void IMDBFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -260,15 +260,15 @@ void IMDBFetcher::slotComplete(KIO::Job* job_) { void IMDBFetcher::parseSingleTitleResult() { // myDebug() << "IMDBFetcher::parseSingleTitleResult()" << endl; - s_titleRx->search(Tellico::decodeHTML(QString(m_data))); - // split title at parenthesis - const QString cap1 = s_titleRx->cap(1); - int pPos = cap1.find('('); - // FIXME: maybe remove parentheses here? + s_titleRx->search(Tellico::decodeHTML(TQString(m_data))); + // split title at tqparenthesis + const TQString cap1 = s_titleRx->cap(1); + int pPos = cap1.tqfind('('); + // FIXME: maybe remove tqparentheses here? SearchResult* r = new SearchResult(this, pPos == -1 ? cap1 : cap1.left(pPos), - pPos == -1 ? QString::null : cap1.mid(pPos), - QString()); + pPos == -1 ? TQString() : cap1.mid(pPos), + TQString()); m_matches.insert(r->uid, m_url); emit signalResultFound(r); @@ -278,13 +278,13 @@ void IMDBFetcher::parseSingleTitleResult() { void IMDBFetcher::parseMultipleTitleResults() { // myDebug() << "IMDBFetcher::parseMultipleTitleResults()" << endl; - QString output = Tellico::decodeHTML(QString(m_data)); + TQString output = Tellico::decodeHTML(TQString(m_data)); // IMDb can return three title lists, popular, exact, and partial // the popular titles are in the first table, after the "Popular Results" text - int pos_popular = output.find(QString::fromLatin1("Popular Titles"), 0, false); - int pos_exact = output.find(QString::fromLatin1("Exact Matches"), QMAX(pos_popular, 0), false); - int pos_partial = output.find(QString::fromLatin1("Partial Matches"), QMAX(pos_exact, 0), false); + int pos_popular = output.tqfind(TQString::tqfromLatin1("Popular Titles"), 0, false); + int pos_exact = output.tqfind(TQString::tqfromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false); + int pos_partial = output.tqfind(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos_exact, 0), false); int end_popular = pos_exact; // keep track of where to end if(end_popular == -1) { end_popular = pos_partial == -1 ? output.length() : pos_partial; @@ -329,14 +329,14 @@ void IMDBFetcher::parseMultipleTitleResults() { stop(); } -void IMDBFetcher::parseTitleBlock(const QString& str_) { +void IMDBFetcher::parseTitleBlock(const TQString& str_) { if(str_.isEmpty()) { m_countOffset = 0; return; } // myDebug() << "IMDBFetcher::parseTitleBlock() - " << m_currentTitleBlock << endl; - QRegExp akaRx(QString::fromLatin1("aka (.*)(</li>|<br)"), false); + TQRegExp akaRx(TQString::tqfromLatin1("aka (.*)(</li>|<br)"), false); akaRx.setMinimal(true); m_hasMoreResults = false; @@ -344,29 +344,29 @@ void IMDBFetcher::parseTitleBlock(const QString& str_) { int count = 0; int start = s_anchorTitleRx->search(str_); while(m_started && start > -1) { - // split title at parenthesis - const QString cap1 = s_anchorTitleRx->cap(1); // the anchor url - const QString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); // the anchor text + // split title at tqparenthesis + const TQString cap1 = s_anchorTitleRx->cap(1); // the anchor url + const TQString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); // the anchor text start += s_anchorTitleRx->matchedLength(); - int pPos = cap2.find('('); // if it has parentheses, use that for description - QString desc; + int pPos = cap2.tqfind('('); // if it has tqparentheses, use that for description + TQString desc; if(pPos > -1) { - int pPos2 = cap2.find(')', pPos+1); + int pPos2 = cap2.tqfind(')', pPos+1); if(pPos2 > -1) { desc = cap2.mid(pPos+1, pPos2-pPos-1); } } else { - // parenthesis might be outside anchor tag + // tqparenthesis might be outside anchor tag int end = s_anchorTitleRx->search(str_, start); if(end == -1) { end = str_.length(); } - QString text = str_.mid(start, end-start); - pPos = text.find('('); + TQString text = str_.mid(start, end-start); + pPos = text.tqfind('('); if(pPos > -1) { - int pNewLine = text.find(QString::fromLatin1("<br")); + int pNewLine = text.tqfind(TQString::tqfromLatin1("<br")); if(pNewLine == -1 || pPos < pNewLine) { - int pPos2 = text.find(')', pPos); + int pPos2 = text.tqfind(')', pPos); desc = text.mid(pPos+1, pPos2-pPos-1); } pPos = -1; @@ -380,9 +380,9 @@ void IMDBFetcher::parseTitleBlock(const QString& str_) { int akaPos = akaRx.search(str_, start+1); if(akaPos > -1 && akaPos < end) { // limit to 50 chars - desc += QChar(' ') + akaRx.cap(1).stripWhiteSpace().remove(*s_tagRx); + desc += TQChar(' ') + akaRx.cap(1).stripWhiteSpace().remove(*s_tagRx); if(desc.length() > 50) { - desc = desc.left(50) + QString::fromLatin1("..."); + desc = desc.left(50) + TQString::tqfromLatin1("..."); } } @@ -399,9 +399,9 @@ void IMDBFetcher::parseTitleBlock(const QString& str_) { break; } - SearchResult* r = new SearchResult(this, pPos == -1 ? cap2 : cap2.left(pPos), desc, QString()); + SearchResult* r = new SearchResult(this, pPos == -1 ? cap2 : cap2.left(pPos), desc, TQString()); KURL u(m_url, cap1); - u.setQuery(QString::null); + u.setQuery(TQString()); m_matches.insert(r->uid, u); emit signalResultFound(r); ++count; @@ -417,7 +417,7 @@ void IMDBFetcher::parseSingleNameResult() { m_currentTitleBlock = SinglePerson; - QString output = Tellico::decodeHTML(QString(m_data)); + TQString output = Tellico::decodeHTML(TQString(m_data)); int pos = s_anchorTitleRx->search(output); if(pos == -1) { @@ -425,35 +425,35 @@ void IMDBFetcher::parseSingleNameResult() { return; } - QRegExp tvRegExp(QString::fromLatin1("TV\\sEpisode"), false); + TQRegExp tvRegExp(TQString::tqfromLatin1("TV\\sEpisode"), false); int len = 0; int count = 0; - QString desc; + TQString desc; for( ; m_started && pos > -1; pos = s_anchorTitleRx->search(output, pos+len)) { desc.truncate(0); bool isEpisode = false; len = s_anchorTitleRx->cap(0).length(); - // split title at parenthesis - const QString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); - int pPos = cap2.find('('); + // split title at tqparenthesis + const TQString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); + int pPos = cap2.tqfind('('); if(pPos > -1) { desc = cap2.mid(pPos); } else { // look until the next <a - int aPos = output.find(QString::fromLatin1("<a"), pos+len, false); + int aPos = output.tqfind(TQString::tqfromLatin1("<a"), pos+len, false); if(aPos == -1) { aPos = output.length(); } - QString tmp = output.mid(pos+len, aPos-pos-len); - if(tmp.find(tvRegExp) > -1) { + TQString tmp = output.mid(pos+len, aPos-pos-len); + if(tmp.tqfind(tvRegExp) > -1) { isEpisode = true; } - pPos = tmp.find('('); + pPos = tmp.tqfind('('); if(pPos > -1) { - int pNewLine = tmp.find(QString::fromLatin1("<br")); + int pNewLine = tmp.tqfind(TQString::tqfromLatin1("<br")); if(pNewLine == -1 || pPos < pNewLine) { - int pEnd = tmp.find(')', pPos+1); + int pEnd = tmp.tqfind(')', pPos+1); desc = tmp.mid(pPos+1, pEnd-pPos-1).remove(*s_tagRx); } // but need to indicate it wasn't found initially @@ -479,10 +479,10 @@ void IMDBFetcher::parseSingleNameResult() { break; } - // FIXME: maybe remove parentheses here? - SearchResult* r = new SearchResult(this, pPos == -1 ? cap2 : cap2.left(pPos), desc, QString()); + // FIXME: maybe remove tqparentheses here? + SearchResult* r = new SearchResult(this, pPos == -1 ? cap2 : cap2.left(pPos), desc, TQString()); KURL u(m_url, s_anchorTitleRx->cap(1)); // relative URL constructor - u.setQuery(QString::null); + u.setQuery(TQString()); m_matches.insert(r->uid, u); // myDebug() << u.prettyURL() << endl; // myDebug() << cap2 << endl; @@ -500,36 +500,36 @@ void IMDBFetcher::parseMultipleNameResults() { // myDebug() << "IMDBFetcher::parseMultipleNameResults()" << endl; // the exact results are in the first table after the "exact results" text - QString output = Tellico::decodeHTML(QString(m_data)); - int pos = output.find(QString::fromLatin1("Popular Results"), 0, false); + TQString output = Tellico::decodeHTML(TQString(m_data)); + int pos = output.tqfind(TQString::tqfromLatin1("Popular Results"), 0, false); if(pos == -1) { - pos = output.find(QString::fromLatin1("Exact Matches"), 0, false); + pos = output.tqfind(TQString::tqfromLatin1("Exact Matches"), 0, false); } // find beginning of partial matches - int end = output.find(QString::fromLatin1("Other Results"), QMAX(pos, 0), false); + int end = output.tqfind(TQString::tqfromLatin1("Other Results"), TQMAX(pos, 0), false); if(end == -1) { - end = output.find(QString::fromLatin1("Partial Matches"), QMAX(pos, 0), false); + end = output.tqfind(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos, 0), false); if(end == -1) { - end = output.find(QString::fromLatin1("Approx Matches"), QMAX(pos, 0), false); + end = output.tqfind(TQString::tqfromLatin1("Approx Matches"), TQMAX(pos, 0), false); if(end == -1) { end = output.length(); } } } - QMap<QString, KURL> map; - QMap<QString, int> nameMap; + TQMap<TQString, KURL> map; + TQMap<TQString, int> nameMap; - QString s; + TQString s; // if found exact matches if(pos > -1) { pos = s_anchorNameRx->search(output, pos+13); while(pos > -1 && pos < end && m_matches.size() < m_limit) { KURL u(m_url, s_anchorNameRx->cap(1)); s = s_anchorNameRx->cap(2).stripWhiteSpace() + ' '; - // if more than one exact, add parentheses - if(nameMap.contains(s) && nameMap[s] > 0) { + // if more than one exact, add tqparentheses + if(nameMap.tqcontains(s) && nameMap[s] > 0) { // fix the first one that didn't have a number if(nameMap[s] == 1) { KURL u2 = map[s]; @@ -538,7 +538,7 @@ void IMDBFetcher::parseMultipleNameResults() { } nameMap.insert(s, nameMap[s] + 1); // check for duplicate names - s += QString::fromLatin1("(%1) ").arg(nameMap[s]); + s += TQString::tqfromLatin1("(%1) ").tqarg(nameMap[s]); } else { nameMap.insert(s, 1); } @@ -552,7 +552,7 @@ void IMDBFetcher::parseMultipleNameResults() { while(pos > -1 && m_matches.size() < m_limit) { KURL u(m_url, s_anchorNameRx->cap(1)); // relative URL s = s_anchorNameRx->cap(2).stripWhiteSpace(); - if(nameMap.contains(s) && nameMap[s] > 0) { + if(nameMap.tqcontains(s) && nameMap[s] > 0) { // fix the first one that didn't have a number if(nameMap[s] == 1) { KURL u2 = map[s]; @@ -561,7 +561,7 @@ void IMDBFetcher::parseMultipleNameResults() { } nameMap.insert(s, nameMap[s] + 1); // check for duplicate names - s += QString::fromLatin1(" (%1)").arg(nameMap[s]); + s += TQString::tqfromLatin1(" (%1)").tqarg(nameMap[s]); } else { nameMap.insert(s, 1); } @@ -576,16 +576,16 @@ void IMDBFetcher::parseMultipleNameResults() { KDialogBase* dlg = new KDialogBase(Kernel::self()->widget(), "imdb dialog", true, i18n("Select IMDB Result"), KDialogBase::Ok|KDialogBase::Cancel); - QVBox* box = new QVBox(dlg); + TQVBox* box = new TQVBox(dlg); box->setSpacing(10); - (void) new QLabel(i18n("<qt>Your search returned multiple matches. Please select one below.</qt>"), box); + (void) new TQLabel(i18n("<qt>Your search returned multiple matches. Please select one below.</qt>"), box); - QListBox* listBox = new QListBox(box); + TQListBox* listBox = new TQListBox(box); listBox->setMinimumWidth(400); - listBox->setColumnMode(QListBox::FitToWidth); - const QStringList values = map.keys(); - for(QStringList::ConstIterator it = values.begin(); it != values.end(); ++it) { - if((*it).endsWith(QChar(' '))) { + listBox->setColumnMode(TQListBox::FitToWidth); + const TQStringList values = map.keys(); + for(TQStringList::ConstIterator it = values.begin(); it != values.end(); ++it) { + if((*it).endsWith(TQChar(' '))) { GUI::ListBoxText* box = new GUI::ListBoxText(listBox, *it, 0); box->setColored(true); } else { @@ -593,10 +593,10 @@ void IMDBFetcher::parseMultipleNameResults() { } } listBox->setSelected(0, true); - QWhatsThis::add(listBox, i18n("<qt>Select a search result.</qt>")); + TQWhatsThis::add(listBox, i18n("<qt>Select a search result.</qt>")); dlg->setMainWidget(box); - if(dlg->exec() != QDialog::Accepted || listBox->currentText().isEmpty()) { + if(dlg->exec() != TQDialog::Accepted || listBox->currentText().isEmpty()) { dlg->delayedDestruct(); stop(); return; @@ -609,12 +609,12 @@ void IMDBFetcher::parseMultipleNameResults() { m_redirected = true; m_data.truncate(0); m_job = KIO::get(m_url, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); - connect(m_job, SIGNAL(redirection(KIO::Job *, const KURL&)), - SLOT(slotRedirection(KIO::Job*, const KURL&))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(redirection(KIO::Job *, const KURL&)), + TQT_SLOT(slotRedirection(KIO::Job*, const KURL&))); // do not stop() here } @@ -633,15 +633,15 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntry(uint uid_) { } KURL origURL = m_url; // keep to switch back - QString results; + TQString results; // if the url matches the current one, no need to redownload it if(url == m_url) { // myDebug() << "IMDBFetcher::fetchEntry() - matches previous URL, no downloading needed." << endl; - results = Tellico::decodeHTML(QString(m_data)); + results = Tellico::decodeHTML(TQString(m_data)); } else { // now it's sychronous #ifdef IMDB_TEST - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/imdb-title-result.html")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-title-result.html")); results = Tellico::decodeHTML(FileHandler::readTextFile(u)); #else // be quiet about failure @@ -665,7 +665,7 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntry(uint uid_) { return entry; } -Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const QString& str_) { +Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) { Data::CollPtr coll = new Data::VideoCollection(true); Data::EntryPtr entry = new Data::Entry(coll); @@ -675,8 +675,8 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const QString& str_) { doAlsoKnownAs(str_, entry); doPlot(str_, entry, m_url); doLists(str_, entry); - doPerson(str_, entry, QString::fromLatin1("Director"), QString::fromLatin1("director")); - doPerson(str_, entry, QString::fromLatin1("Writer"), QString::fromLatin1("writer")); + doPerson(str_, entry, TQString::tqfromLatin1("Director"), TQString::tqfromLatin1("director")); + doPerson(str_, entry, TQString::tqfromLatin1("Writer"), TQString::tqfromLatin1("writer")); doRating(str_, entry); doCast(str_, entry, m_url); if(m_fetchImages) { @@ -684,93 +684,93 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const QString& str_) { doCover(str_, entry, m_url); } - const QString imdb = QString::fromLatin1("imdb"); - if(!coll->hasField(imdb) && m_fields.findIndex(imdb) > -1) { + const TQString imdb = TQString::tqfromLatin1("imdb"); + if(!coll->hasField(imdb) && m_fields.tqfindIndex(imdb) > -1) { Data::FieldPtr field = new Data::Field(imdb, i18n("IMDB Link"), Data::Field::URL); field->setCategory(i18n("General")); coll->addField(field); } if(coll->hasField(imdb) && coll->fieldByName(imdb)->type() == Data::Field::URL) { - m_url.setQuery(QString::null); + m_url.setQuery(TQString()); entry->setField(imdb, m_url.url()); } return entry; } -void IMDBFetcher::doTitle(const QString& str_, Data::EntryPtr entry_) { +void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) { if(s_titleRx->search(str_) > -1) { - const QString cap1 = s_titleRx->cap(1); - // titles always have parentheses - int pPos = cap1.find('('); - QString title = cap1.left(pPos).stripWhiteSpace(); + const TQString cap1 = s_titleRx->cap(1); + // titles always have tqparentheses + int pPos = cap1.tqfind('('); + TQString title = cap1.left(pPos).stripWhiteSpace(); // remove first and last quotes is there - if(title.startsWith(QChar('"')) && title.endsWith(QChar('"'))) { + if(title.startsWith(TQChar('"')) && title.endsWith(TQChar('"'))) { title = title.mid(1, title.length()-2); } - entry_->setField(QString::fromLatin1("title"), title); - // remove parenthesis + entry_->setField(TQString::tqfromLatin1("title"), title); + // remove tqparenthesis uint pPos2 = pPos+1; while(pPos2 < cap1.length() && cap1[pPos2].isDigit()) { ++pPos2; } - QString year = cap1.mid(pPos+1, pPos2-pPos-1); + TQString year = cap1.mid(pPos+1, pPos2-pPos-1); if(!year.isEmpty()) { - entry_->setField(QString::fromLatin1("year"), year); + entry_->setField(TQString::tqfromLatin1("year"), year); } } } -void IMDBFetcher::doRunningTime(const QString& str_, Data::EntryPtr entry_) { +void IMDBFetcher::doRunningTime(const TQString& str_, Data::EntryPtr entry_) { // running time - QRegExp runtimeRx(QString::fromLatin1("runtime:.*(\\d+)\\s+min"), false); + TQRegExp runtimeRx(TQString::tqfromLatin1("runtime:.*(\\d+)\\s+min"), false); runtimeRx.setMinimal(true); if(runtimeRx.search(str_) > -1) { // myDebug() << "running-time = " << runtimeRx.cap(1) << endl; - entry_->setField(QString::fromLatin1("running-time"), runtimeRx.cap(1)); + entry_->setField(TQString::tqfromLatin1("running-time"), runtimeRx.cap(1)); } } -void IMDBFetcher::doAspectRatio(const QString& str_, Data::EntryPtr entry_) { - QRegExp rx(QString::fromLatin1("aspect ratio:.*([\\d\\.]+\\s*:\\s*[\\d\\.]+)"), false); +void IMDBFetcher::doAspectRatio(const TQString& str_, Data::EntryPtr entry_) { + TQRegExp rx(TQString::tqfromLatin1("aspect ratio:.*([\\d\\.]+\\s*:\\s*[\\d\\.]+)"), false); rx.setMinimal(true); if(rx.search(str_) > -1) { // myDebug() << "aspect ratio = " << rx.cap(1) << endl; - entry_->setField(QString::fromLatin1("aspect-ratio"), rx.cap(1).stripWhiteSpace()); + entry_->setField(TQString::tqfromLatin1("aspect-ratio"), rx.cap(1).stripWhiteSpace()); } } -void IMDBFetcher::doAlsoKnownAs(const QString& str_, Data::EntryPtr entry_) { - if(m_fields.findIndex(QString::fromLatin1("alttitle")) == -1) { +void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) { + if(m_fields.tqfindIndex(TQString::tqfromLatin1("alttitle")) == -1) { return; } // match until next b tag -// QRegExp akaRx(QString::fromLatin1("also known as(.*)<b(?:\\s.*)?>")); - QRegExp akaRx(QString::fromLatin1("also known as(.*)<(b[>\\s/]|div)"), false); +// TQRegExp akaRx(TQString::tqfromLatin1("also known as(.*)<b(?:\\s.*)?>")); + TQRegExp akaRx(TQString::tqfromLatin1("also known as(.*)<(b[>\\s/]|div)"), false); akaRx.setMinimal(true); if(akaRx.search(str_) > -1 && !akaRx.cap(1).isEmpty()) { - Data::FieldPtr f = entry_->collection()->fieldByName(QString::fromLatin1("alttitle")); + Data::FieldPtr f = entry_->collection()->fieldByName(TQString::tqfromLatin1("alttitle")); if(!f) { - f = new Data::Field(QString::fromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table); + f = new Data::Field(TQString::tqfromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table); f->setFormatFlag(Data::Field::FormatTitle); entry_->collection()->addField(f); } // split by <br>, remembering it could become valid xhtml! - QRegExp brRx(QString::fromLatin1("<br[\\s/]*>"), false); + TQRegExp brRx(TQString::tqfromLatin1("<br[\\s/]*>"), false); brRx.setMinimal(true); - QStringList list = QStringList::split(brRx, akaRx.cap(1)); + TQStringList list = TQStringList::split(brRx, akaRx.cap(1)); // lang could be included with [fr] -// const QRegExp parRx(QString::fromLatin1("\\(.+\\)")); - const QRegExp brackRx(QString::fromLatin1("\\[\\w+\\]")); - QStringList values; - for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { - QString s = *it; +// const TQRegExp parRx(TQString::tqfromLatin1("\\(.+\\)")); + const TQRegExp brackRx(TQString::tqfromLatin1("\\[\\w+\\]")); + TQStringList values; + for(TQStringList::Iterator it = list.begin(); it != list.end(); ++it) { + TQString s = *it; // sometimes, the word "more" gets linked to the releaseinfo page, check that - if(s.find(QString::fromLatin1("releaseinfo")) > -1) { + if(s.tqfind(TQString::tqfromLatin1("releaseinfo")) > -1) { continue; } s.remove(*s_tagRx); @@ -778,7 +778,7 @@ void IMDBFetcher::doAlsoKnownAs(const QString& str_, Data::EntryPtr entry_) { s = s.stripWhiteSpace(); // the first value ends up being or starting with the colon after "Also know as" // I'm too lazy to figure out a better regexp - if(s.startsWith(QChar(':'))) { + if(s.startsWith(TQChar(':'))) { s = s.mid(1); } if(!s.isEmpty()) { @@ -786,71 +786,71 @@ void IMDBFetcher::doAlsoKnownAs(const QString& str_, Data::EntryPtr entry_) { } } if(!values.isEmpty()) { - entry_->setField(QString::fromLatin1("alttitle"), values.join(sep)); + entry_->setField(TQString::tqfromLatin1("alttitle"), values.join(sep)); } } } -void IMDBFetcher::doPlot(const QString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { +void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { // plot summaries provided by users are on a separate page // should those be preferred? bool useUserSummary = false; - QString thisPlot; + TQString thisPlot; // match until next opening tag - QRegExp plotRx(QString::fromLatin1("plot (?:outline|summary):(.*)<[^/].*</"), false); + TQRegExp plotRx(TQString::tqfromLatin1("plot (?:outline|summary):(.*)<[^/].*</"), false); plotRx.setMinimal(true); - QRegExp plotURLRx(QString::fromLatin1("<a\\s+.*href\\s*=\\s*\".*/title/.*/plotsummary\""), false); + TQRegExp plotURLRx(TQString::tqfromLatin1("<a\\s+.*href\\s*=\\s*\".*/title/.*/plotsummary\""), false); plotURLRx.setMinimal(true); if(plotRx.search(str_) > -1) { thisPlot = plotRx.cap(1); thisPlot.remove(*s_tagRx); // remove HTML tags - entry_->setField(QString::fromLatin1("plot"), thisPlot); - // if thisPlot ends with (more) or contains + entry_->setField(TQString::tqfromLatin1("plot"), thisPlot); + // if thisPlot ends with (more) or tqcontains // a url that ends with plotsummary, then we'll grab it, otherwise not - if(plotRx.cap(0).endsWith(QString::fromLatin1("(more)</")) || plotURLRx.search(plotRx.cap(0)) > -1) { + if(plotRx.cap(0).endsWith(TQString::tqfromLatin1("(more)</")) || plotURLRx.search(plotRx.cap(0)) > -1) { useUserSummary = true; } } if(useUserSummary) { - QRegExp idRx(QString::fromLatin1("title/(tt\\d+)")); + TQRegExp idRx(TQString::tqfromLatin1("title/(tt\\d+)")); idRx.search(baseURL_.path()); KURL plotURL = baseURL_; - plotURL.setPath(QString::fromLatin1("/title/") + idRx.cap(1) + QString::fromLatin1("/plotsummary")); + plotURL.setPath(TQString::tqfromLatin1("/title/") + idRx.cap(1) + TQString::tqfromLatin1("/plotsummary")); // be quiet about failure - QString plotPage = FileHandler::readTextFile(plotURL, true); + TQString plotPage = FileHandler::readTextFile(plotURL, true); if(!plotPage.isEmpty()) { - QRegExp plotRx(QString::fromLatin1("<p\\s+class\\s*=\\s*\"plotpar\">(.*)</p")); + TQRegExp plotRx(TQString::tqfromLatin1("<p\\s+class\\s*=\\s*\"plotpar\">(.*)</p")); plotRx.setMinimal(true); if(plotRx.search(plotPage) > -1) { - QString userPlot = plotRx.cap(1); + TQString userPlot = plotRx.cap(1); userPlot.remove(*s_tagRx); // remove HTML tags - entry_->setField(QString::fromLatin1("plot"), Tellico::decodeHTML(userPlot)); + entry_->setField(TQString::tqfromLatin1("plot"), Tellico::decodeHTML(userPlot)); } } } } -void IMDBFetcher::doPerson(const QString& str_, Data::EntryPtr entry_, - const QString& imdbHeader_, const QString& fieldName_) { - QRegExp br2Rx(QString::fromLatin1("<br[\\s/]*>\\s*<br[\\s/]*>"), false); +void IMDBFetcher::doPerson(const TQString& str_, Data::EntryPtr entry_, + const TQString& imdbHeader_, const TQString& fieldName_) { + TQRegExp br2Rx(TQString::tqfromLatin1("<br[\\s/]*>\\s*<br[\\s/]*>"), false); br2Rx.setMinimal(true); - QRegExp divRx(QString::fromLatin1("<[/]*div"), false); + TQRegExp divRx(TQString::tqfromLatin1("<[/]*div"), false); divRx.setMinimal(true); - QString name = QString::fromLatin1("/name/"); + TQString name = TQString::tqfromLatin1("/name/"); StringSet people; - for(int pos = str_.find(imdbHeader_); pos > 0; pos = str_.find(imdbHeader_, pos)) { + for(int pos = str_.tqfind(imdbHeader_); pos > 0; pos = str_.tqfind(imdbHeader_, pos)) { // loop until repeated <br> tags or </div> tag - const int endPos1 = str_.find(br2Rx, pos); - const int endPos2 = str_.find(divRx, pos); - const int endPos = QMIN(endPos1, endPos2); // ok to be -1 + const int endPos1 = str_.tqfind(br2Rx, pos); + const int endPos2 = str_.tqfind(divRx, pos); + const int endPos = TQMIN(endPos1, endPos2); // ok to be -1 pos = s_anchorRx->search(str_, pos+1); while(pos > -1 && pos < endPos) { - if(s_anchorRx->cap(1).find(name) > -1) { + if(s_anchorRx->cap(1).tqfind(name) > -1) { people.add(s_anchorRx->cap(2).stripWhiteSpace()); } pos = s_anchorRx->search(str_, pos+1); @@ -861,50 +861,50 @@ void IMDBFetcher::doPerson(const QString& str_, Data::EntryPtr entry_, } } -void IMDBFetcher::doCast(const QString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { +void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { // the extended cast list is on a separate page // that's usually a lot of people // but since it can be in billing order, the main actors might not // be in the short list - QRegExp idRx(QString::fromLatin1("title/(tt\\d+)")); + TQRegExp idRx(TQString::tqfromLatin1("title/(tt\\d+)")); idRx.search(baseURL_.path()); #ifdef IMDB_TEST - KURL castURL = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/imdb-title-fullcredits.html")); + KURL castURL = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-title-fullcredits.html")); #else KURL castURL = baseURL_; - castURL.setPath(QString::fromLatin1("/title/") + idRx.cap(1) + QString::fromLatin1("/fullcredits")); + castURL.setPath(TQString::tqfromLatin1("/title/") + idRx.cap(1) + TQString::tqfromLatin1("/fullcredits")); #endif // be quiet about failure and be sure to translate entities - QString castPage = Tellico::decodeHTML(FileHandler::readTextFile(castURL, true)); + TQString castPage = Tellico::decodeHTML(FileHandler::readTextFile(castURL, true)); int pos = -1; // the text to search, depends on which page is being read - QString castText = castPage; + TQString castText = castPage; if(castText.isEmpty()) { // fall back to short list castText = str_; - pos = castText.find(QString::fromLatin1("cast overview"), 0, false); + pos = castText.tqfind(TQString::tqfromLatin1("cast overview"), 0, false); if(pos == -1) { - pos = castText.find(QString::fromLatin1("credited cast"), 0, false); + pos = castText.tqfind(TQString::tqfromLatin1("credited cast"), 0, false); } } else { // first look for anchor - QRegExp castAnchorRx(QString::fromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false); - pos = castText.find(castAnchorRx); + TQRegExp castAnchorRx(TQString::tqfromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false); + pos = castText.tqfind(castAnchorRx); if(pos < 0) { - QRegExp tableClassRx(QString::fromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false); - pos = castText.find(tableClassRx); + TQRegExp tableClassRx(TQString::tqfromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false); + pos = castText.tqfind(tableClassRx); if(pos < 0) { - // fragile, the word "cast" appears in the title, but need to find + // fragile, the word "cast" appears in the title, but need to tqfind // the one right above the actual cast table // for TV shows, there's a link on the sidebar for "episodes case" // so need to not match that one - pos = castText.find(QString::fromLatin1("cast</"), 0, false); + pos = castText.tqfind(TQString::tqfromLatin1("cast</"), 0, false); if(pos > 9) { // back up 9 places - if(castText.mid(pos-9, 9).startsWith(QString::fromLatin1("episodes"))) { + if(castText.mid(pos-9, 9).startsWith(TQString::tqfromLatin1("episodes"))) { // find next cast list - pos = castText.find(QString::fromLatin1("cast</"), pos+6, false); + pos = castText.tqfind(TQString::tqfromLatin1("cast</"), pos+6, false); } } } @@ -915,22 +915,22 @@ void IMDBFetcher::doCast(const QString& str_, Data::EntryPtr entry_, const KURL& return; } - const QString name = QString::fromLatin1("/name/"); - QRegExp tdRx(QString::fromLatin1("<td[^>]*>(.*)</td>"), false); + const TQString name = TQString::tqfromLatin1("/name/"); + TQRegExp tdRx(TQString::tqfromLatin1("<td[^>]*>(.*)</td>"), false); tdRx.setMinimal(true); - QStringList cast; + TQStringList cast; // loop until closing table tag - const int endPos = castText.find(QString::fromLatin1("</table"), pos, false); + const int endPos = castText.tqfind(TQString::tqfromLatin1("</table"), pos, false); pos = s_anchorRx->search(castText, pos+1); while(pos > -1 && pos < endPos && static_cast<int>(cast.count()) < m_numCast) { - if(s_anchorRx->cap(1).find(name) > -1) { + if(s_anchorRx->cap(1).tqfind(name) > -1) { // now search for <td> item with character name // there's a column with ellipses then the character const int pos2 = tdRx.search(castText, pos); if(pos2 > -1 && tdRx.search(castText, pos2+1) > -1) { cast += s_anchorRx->cap(2).stripWhiteSpace() - + QString::fromLatin1("::") + tdRx.cap(1).simplifyWhiteSpace().remove(*s_tagRx); + + TQString::tqfromLatin1("::") + tdRx.cap(1).simplifyWhiteSpace().remove(*s_tagRx); } else { cast += s_anchorRx->cap(2).stripWhiteSpace(); } @@ -939,52 +939,52 @@ void IMDBFetcher::doCast(const QString& str_, Data::EntryPtr entry_, const KURL& } if(!cast.isEmpty()) { - entry_->setField(QString::fromLatin1("cast"), cast.join(sep)); + entry_->setField(TQString::tqfromLatin1("cast"), cast.join(sep)); } } -void IMDBFetcher::doRating(const QString& str_, Data::EntryPtr entry_) { - if(m_fields.findIndex(QString::fromLatin1("imdb-rating")) == -1) { +void IMDBFetcher::doRating(const TQString& str_, Data::EntryPtr entry_) { + if(m_fields.tqfindIndex(TQString::tqfromLatin1("imdb-rating")) == -1) { return; } // don't add a colon, since there's a <br> at the end // some of the imdb images use /10.gif in their path, so check for space or bracket - QRegExp rx(QString::fromLatin1("[>\\s](\\d+.?\\d*)/10[<//s]"), false); + TQRegExp rx(TQString::tqfromLatin1("[>\\s](\\d+.?\\d*)/10[<//s]"), false); rx.setMinimal(true); if(rx.search(str_) > -1 && !rx.cap(1).isEmpty()) { - Data::FieldPtr f = entry_->collection()->fieldByName(QString::fromLatin1("imdb-rating")); + Data::FieldPtr f = entry_->collection()->fieldByName(TQString::tqfromLatin1("imdb-rating")); if(!f) { - f = new Data::Field(QString::fromLatin1("imdb-rating"), i18n("IMDB Rating"), Data::Field::Rating); + f = new Data::Field(TQString::tqfromLatin1("imdb-rating"), i18n("IMDB Rating"), Data::Field::Rating); f->setCategory(i18n("General")); - f->setProperty(QString::fromLatin1("maximum"), QString::fromLatin1("10")); + f->setProperty(TQString::tqfromLatin1("maximum"), TQString::tqfromLatin1("10")); entry_->collection()->addField(f); } bool ok; float value = rx.cap(1).toFloat(&ok); if(ok) { - entry_->setField(QString::fromLatin1("imdb-rating"), QString::number(value)); + entry_->setField(TQString::tqfromLatin1("imdb-rating"), TQString::number(value)); } } } -void IMDBFetcher::doCover(const QString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { +void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { // cover is the img with the "cover" alt text - QRegExp imgRx(QString::fromLatin1("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), false); + TQRegExp imgRx(TQString::tqfromLatin1("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), false); imgRx.setMinimal(true); - QRegExp posterRx(QString::fromLatin1("<a\\s+[^>]*name\\s*=\\s*\"poster\"[^>]*>(.*)</a>"), false); + TQRegExp posterRx(TQString::tqfromLatin1("<a\\s+[^>]*name\\s*=\\s*\"poster\"[^>]*>(.*)</a>"), false); posterRx.setMinimal(true); - const QString cover = QString::fromLatin1("cover"); + const TQString cover = TQString::tqfromLatin1("cover"); int pos = posterRx.search(str_); while(pos > -1) { if(imgRx.search(posterRx.cap(1)) > -1) { KURL u(baseURL_, imgRx.cap(1)); - QString id = ImageFactory::addImage(u, true); + TQString id = ImageFactory::addImage(u, true); if(!id.isEmpty()) { entry_->setField(cover, id); } @@ -996,9 +996,9 @@ void IMDBFetcher::doCover(const QString& str_, Data::EntryPtr entry_, const KURL // didn't find the cover, IMDb also used to put "cover" inside the url pos = imgRx.search(str_); while(pos > -1) { - if(imgRx.cap(0).find(cover, 0, false) > -1) { + if(imgRx.cap(0).tqfind(cover, 0, false) > -1) { KURL u(baseURL_, imgRx.cap(1)); - QString id = ImageFactory::addImage(u, true); + TQString id = ImageFactory::addImage(u, true); if(!id.isEmpty()) { entry_->setField(cover, id); } @@ -1010,79 +1010,79 @@ void IMDBFetcher::doCover(const QString& str_, Data::EntryPtr entry_, const KURL // end up reparsing whole string, but it's not really that slow // loook at every anchor tag in the string -void IMDBFetcher::doLists(const QString& str_, Data::EntryPtr entry_) { - const QString genre = QString::fromLatin1("/Genres/"); - const QString country = QString::fromLatin1("/Countries/"); - const QString lang = QString::fromLatin1("/Languages/"); - const QString colorInfo = QString::fromLatin1("color-info"); - const QString cert = QString::fromLatin1("certificates="); - const QString soundMix = QString::fromLatin1("sound-mix="); - const QString year = QString::fromLatin1("/Years/"); - const QString company = QString::fromLatin1("/company/"); +void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { + const TQString genre = TQString::tqfromLatin1("/Genres/"); + const TQString country = TQString::tqfromLatin1("/Countries/"); + const TQString lang = TQString::tqfromLatin1("/Languages/"); + const TQString colorInfo = TQString::tqfromLatin1("color-info"); + const TQString cert = TQString::tqfromLatin1("certificates="); + const TQString soundMix = TQString::tqfromLatin1("sound-mix="); + const TQString year = TQString::tqfromLatin1("/Years/"); + const TQString company = TQString::tqfromLatin1("/company/"); // IIMdb also has links with the word "sections" in them, remove that // for genres and nationalities - QStringList genres, countries, langs, certs, tracks, studios; + TQStringList genres, countries, langs, certs, tracks, studios; for(int pos = s_anchorRx->search(str_); pos > -1; pos = s_anchorRx->search(str_, pos+1)) { - const QString cap1 = s_anchorRx->cap(1); - if(cap1.find(genre) > -1) { - if(s_anchorRx->cap(2).find(QString::fromLatin1(" section"), 0, false) == -1) { + const TQString cap1 = s_anchorRx->cap(1); + if(cap1.tqfind(genre) > -1) { + if(s_anchorRx->cap(2).tqfind(TQString::tqfromLatin1(" section"), 0, false) == -1) { genres += s_anchorRx->cap(2).stripWhiteSpace(); } - } else if(cap1.find(country) > -1) { - if(s_anchorRx->cap(2).find(QString::fromLatin1(" section"), 0, false) == -1) { + } else if(cap1.tqfind(country) > -1) { + if(s_anchorRx->cap(2).tqfind(TQString::tqfromLatin1(" section"), 0, false) == -1) { countries += s_anchorRx->cap(2).stripWhiteSpace(); } - } else if(cap1.find(lang) > -1) { + } else if(cap1.tqfind(lang) > -1) { langs += s_anchorRx->cap(2).stripWhiteSpace(); - } else if(cap1.find(colorInfo) > -1) { + } else if(cap1.tqfind(colorInfo) > -1) { // change "black and white" to "black & white" - entry_->setField(QString::fromLatin1("color"), - s_anchorRx->cap(2).replace(QString::fromLatin1("and"), QChar('&')).stripWhiteSpace()); - } else if(cap1.find(cert) > -1) { + entry_->setField(TQString::tqfromLatin1("color"), + s_anchorRx->cap(2).tqreplace(TQString::tqfromLatin1("and"), TQChar('&')).stripWhiteSpace()); + } else if(cap1.tqfind(cert) > -1) { certs += s_anchorRx->cap(2).stripWhiteSpace(); - } else if(cap1.find(soundMix) > -1) { + } else if(cap1.tqfind(soundMix) > -1) { tracks += s_anchorRx->cap(2).stripWhiteSpace(); - } else if(cap1.find(company) > -1) { + } else if(cap1.tqfind(company) > -1) { studios += s_anchorRx->cap(2).stripWhiteSpace(); // if year field wasn't set before, do it now - } else if(entry_->field(QString::fromLatin1("year")).isEmpty() && cap1.find(year) > -1) { - entry_->setField(QString::fromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace()); + } else if(entry_->field(TQString::tqfromLatin1("year")).isEmpty() && cap1.tqfind(year) > -1) { + entry_->setField(TQString::tqfromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace()); } } - entry_->setField(QString::fromLatin1("genre"), genres.join(sep)); - entry_->setField(QString::fromLatin1("nationality"), countries.join(sep)); - entry_->setField(QString::fromLatin1("language"), langs.join(sep)); - entry_->setField(QString::fromLatin1("audio-track"), tracks.join(sep)); - entry_->setField(QString::fromLatin1("studio"), studios.join(sep)); + entry_->setField(TQString::tqfromLatin1("genre"), genres.join(sep)); + entry_->setField(TQString::tqfromLatin1("nationality"), countries.join(sep)); + entry_->setField(TQString::tqfromLatin1("language"), langs.join(sep)); + entry_->setField(TQString::tqfromLatin1("audio-track"), tracks.join(sep)); + entry_->setField(TQString::tqfromLatin1("studio"), studios.join(sep)); if(!certs.isEmpty()) { // first try to set default certification - const QStringList& certsAllowed = entry_->collection()->fieldByName(QString::fromLatin1("certification"))->allowed(); - for(QStringList::ConstIterator it = certs.begin(); it != certs.end(); ++it) { - QString country = (*it).section(':', 0, 0); - QString cert = (*it).section(':', 1, 1); + const TQStringList& certsAllowed = entry_->collection()->fieldByName(TQString::tqfromLatin1("certification"))->allowed(); + for(TQStringList::ConstIterator it = certs.begin(); it != certs.end(); ++it) { + TQString country = (*it).section(':', 0, 0); + TQString cert = (*it).section(':', 1, 1); if(cert == Latin1Literal("Unrated")) { - cert = QChar('U'); + cert = TQChar('U'); } - cert += QString::fromLatin1(" (") + country + ')'; - if(certsAllowed.findIndex(cert) > -1) { - entry_->setField(QString::fromLatin1("certification"), cert); + cert += TQString::tqfromLatin1(" (") + country + ')'; + if(certsAllowed.tqfindIndex(cert) > -1) { + entry_->setField(TQString::tqfromLatin1("certification"), cert); break; } } // now add new field for all certifications - const QString allc = QString::fromLatin1("allcertification"); - if(m_fields.findIndex(allc) > -1) { + const TQString allc = TQString::tqfromLatin1("allcertification"); + if(m_fields.tqfindIndex(allc) > -1) { Data::FieldPtr f = entry_->collection()->fieldByName(allc); if(!f) { f = new Data::Field(allc, i18n("Certifications"), Data::Field::Table); f->setFlags(Data::Field::AllowGrouped); entry_->collection()->addField(f); } - entry_->setField(QString::fromLatin1("allcertification"), certs.join(sep)); + entry_->setField(TQString::tqfromLatin1("allcertification"), certs.join(sep)); } } } @@ -1091,8 +1091,8 @@ void IMDBFetcher::updateEntry(Data::EntryPtr entry_) { // myLog() << "IMDBFetcher::updateEntry() - " << entry_->title() << endl; // only take first 5 m_limit = 5; - QString t = entry_->field(QString::fromLatin1("title")); - KURL link = entry_->field(QString::fromLatin1("imdb")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); + KURL link = entry_->field(TQString::tqfromLatin1("imdb")); if(!link.isEmpty() && link.isValid()) { // check if we want a different host if(link.host() != m_host) { @@ -1107,12 +1107,12 @@ void IMDBFetcher::updateEntry(Data::EntryPtr entry_) { m_url = link; m_redirected = true; // m_redirected is used as a flag later to tell if we get a single result m_job = KIO::get(m_url, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); - connect(m_job, SIGNAL(redirection(KIO::Job *, const KURL&)), - SLOT(slotRedirection(KIO::Job*, const KURL&))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(redirection(KIO::Job *, const KURL&)), + TQT_SLOT(slotRedirection(KIO::Job*, const KURL&))); return; } // optimistically try searching for title and rely on Collection::sameEntry() to figure things out @@ -1123,64 +1123,64 @@ void IMDBFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* IMDBFetcher::configWidget(QWidget* parent_) const { - return new IMDBFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* IMDBFetcher::configWidget(TQWidget* tqparent_) const { + return new IMDBFetcher::ConfigWidget(tqparent_, this); } -IMDBFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const IMDBFetcher* fetcher_/*=0*/) - : Fetch::ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget(), 4, 2); +IMDBFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const IMDBFetcher* fetcher_/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 4, 2); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - QLabel* label = new QLabel(i18n("Hos&t: "), optionsWidget()); + TQLabel* label = new TQLabel(i18n("Hos&t: "), optionsWidget()); l->addWidget(label, ++row, 0); m_hostEdit = new KLineEdit(optionsWidget()); - connect(m_hostEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_hostEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_hostEdit, row, 1); - QString w = i18n("The Internet Movie Database uses several different servers. Choose the one " + TQString w = i18n("The Internet Movie Database uses several different servers. Choose the one " "you wish to use."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_hostEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_hostEdit, w); label->setBuddy(m_hostEdit); - label = new QLabel(i18n("&Maximum cast: "), optionsWidget()); + label = new TQLabel(i18n("&Maximum cast: "), optionsWidget()); l->addWidget(label, ++row, 0); m_numCast = new KIntSpinBox(0, 99, 1, 10, 10, optionsWidget()); - connect(m_numCast, SIGNAL(valueChanged(const QString&)), SLOT(slotSetModified())); + connect(m_numCast, TQT_SIGNAL(valueChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_numCast, row, 1); w = i18n("The list of cast members may include many people. Set the maximum number returned from the search."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_numCast, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_numCast, w); label->setBuddy(m_numCast); - m_fetchImageCheck = new QCheckBox(i18n("Download cover &image"), optionsWidget()); - connect(m_fetchImageCheck, SIGNAL(clicked()), SLOT(slotSetModified())); + m_fetchImageCheck = new TQCheckBox(i18n("Download cover &image"), optionsWidget()); + connect(m_fetchImageCheck, TQT_SIGNAL(clicked()), TQT_SLOT(slotSetModified())); ++row; l->addMultiCellWidget(m_fetchImageCheck, row, row, 0, 1); w = i18n("The cover image may be downloaded as well. However, too many large images in the " "collection may degrade performance."); - QWhatsThis::add(m_fetchImageCheck, w); + TQWhatsThis::add(m_fetchImageCheck, w); l->setRowStretch(++row, 10); // now add additional fields widget - addFieldsWidget(IMDBFetcher::customFields(), fetcher_ ? fetcher_->m_fields : QStringList()); + addFieldsWidget(IMDBFetcher::customFields(), fetcher_ ? fetcher_->m_fields : TQStringList()); if(fetcher_) { m_hostEdit->setText(fetcher_->m_host); m_numCast->setValue(fetcher_->m_numCast); m_fetchImageCheck->setChecked(fetcher_->m_fetchImages); } else { //defaults - m_hostEdit->setText(QString::fromLatin1(IMDB_SERVER)); + m_hostEdit->setText(TQString::tqfromLatin1(IMDB_SERVER)); m_numCast->setValue(10); m_fetchImageCheck->setChecked(true); } } void IMDBFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { - QString host = m_hostEdit->text().stripWhiteSpace(); + TQString host = m_hostEdit->text().stripWhiteSpace(); if(!host.isEmpty()) { config_.writeEntry("Host", host); } @@ -1191,17 +1191,17 @@ void IMDBFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { slotSetModified(false); } -QString IMDBFetcher::ConfigWidget::preferredName() const { +TQString IMDBFetcher::ConfigWidget::preferredName() const { return IMDBFetcher::defaultName(); } //static Tellico::StringMap IMDBFetcher::customFields() { StringMap map; - map[QString::fromLatin1("imdb")] = i18n("IMDB Link"); - map[QString::fromLatin1("imdb-rating")] = i18n("IMDB Rating"); - map[QString::fromLatin1("alttitle")] = i18n("Alternative Titles"); - map[QString::fromLatin1("allcertification")] = i18n("Certifications"); + map[TQString::tqfromLatin1("imdb")] = i18n("IMDB Link"); + map[TQString::tqfromLatin1("imdb-rating")] = i18n("IMDB Rating"); + map[TQString::tqfromLatin1("alttitle")] = i18n("Alternative Titles"); + map[TQString::tqfromLatin1("allcertification")] = i18n("Certifications"); return map; } diff --git a/src/fetch/imdbfetcher.h b/src/fetch/imdbfetcher.h index 3dc19f2..fd68b62 100644 --- a/src/fetch/imdbfetcher.h +++ b/src/fetch/imdbfetcher.h @@ -21,14 +21,14 @@ #include <kurl.h> #include <kio/job.h> -#include <qcstring.h> // for QByteArray -#include <qmap.h> -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqmap.h> +#include <tqguardedptr.h> class KLineEdit; class KIntSpinBox; -class QCheckBox; -class QRegExpr; +class TQCheckBox; +class TQRegExpr; namespace Tellico { namespace Fetch { @@ -38,16 +38,17 @@ namespace Tellico { */ class IMDBFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - IMDBFetcher(QObject* parent, const char* name=0); + IMDBFetcher(TQObject* tqparent, const char* name=0); /** */ virtual ~IMDBFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); // imdb can search title, person virtual bool canSearch(FetchKey k) const { return k == Title || k == Person; } @@ -59,77 +60,77 @@ public: virtual void updateEntry(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; static StringMap customFields(); class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const IMDBFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const IMDBFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; private: KLineEdit* m_hostEdit; - QCheckBox* m_fetchImageCheck; + TQCheckBox* m_fetchImageCheck; KIntSpinBox* m_numCast; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); void slotRedirection(KIO::Job* job, const KURL& toURL); private: static void initRegExps(); - static QRegExp* s_tagRx; - static QRegExp* s_anchorRx; - static QRegExp* s_anchorTitleRx; - static QRegExp* s_anchorNameRx; - static QRegExp* s_titleRx; - - void doTitle(const QString& s, Data::EntryPtr e); - void doRunningTime(const QString& s, Data::EntryPtr e); - void doAspectRatio(const QString& s, Data::EntryPtr e); - void doAlsoKnownAs(const QString& s, Data::EntryPtr e); - void doPlot(const QString& s, Data::EntryPtr e, const KURL& baseURL_); - void doPerson(const QString& s, Data::EntryPtr e, - const QString& imdbHeader, const QString& fieldName); - void doCast(const QString& s, Data::EntryPtr e, const KURL& baseURL_); - void doLists(const QString& s, Data::EntryPtr e); - void doRating(const QString& s, Data::EntryPtr e); - void doCover(const QString& s, Data::EntryPtr e, const KURL& baseURL); + static TQRegExp* s_tagRx; + static TQRegExp* s_anchorRx; + static TQRegExp* s_anchorTitleRx; + static TQRegExp* s_anchorNameRx; + static TQRegExp* s_titleRx; + + void doTitle(const TQString& s, Data::EntryPtr e); + void doRunningTime(const TQString& s, Data::EntryPtr e); + void doAspectRatio(const TQString& s, Data::EntryPtr e); + void doAlsoKnownAs(const TQString& s, Data::EntryPtr e); + void doPlot(const TQString& s, Data::EntryPtr e, const KURL& baseURL_); + void doPerson(const TQString& s, Data::EntryPtr e, + const TQString& imdbHeader, const TQString& fieldName); + void doCast(const TQString& s, Data::EntryPtr e, const KURL& baseURL_); + void doLists(const TQString& s, Data::EntryPtr e); + void doRating(const TQString& s, Data::EntryPtr e); + void doCover(const TQString& s, Data::EntryPtr e, const KURL& baseURL); void parseSingleTitleResult(); void parseSingleNameResult(); void parseMultipleTitleResults(); - void parseTitleBlock(const QString& str); + void parseTitleBlock(const TQString& str); void parseMultipleNameResults(); - Data::EntryPtr parseEntry(const QString& str); + Data::EntryPtr parseEntry(const TQString& str); - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QMap<int, KURL> m_matches; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQMap<int, KURL> m_matches; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; bool m_fetchImages; - QString m_host; + TQString m_host; int m_numCast; KURL m_url; bool m_redirected; uint m_limit; - QStringList m_fields; + TQStringList m_fields; - QString m_popularTitles; - QString m_exactTitles; - QString m_partialTitles; + TQString m_popularTitles; + TQString m_exactTitles; + TQString m_partialTitles; enum TitleBlock { Unknown = 0, Popular = 1, Exact = 2, Partial = 3, SinglePerson = 4}; TitleBlock m_currentTitleBlock; int m_countOffset; diff --git a/src/fetch/isbndbfetcher.cpp b/src/fetch/isbndbfetcher.cpp index 5ffc379..92fb084 100644 --- a/src/fetch/isbndbfetcher.cpp +++ b/src/fetch/isbndbfetcher.cpp @@ -25,10 +25,10 @@ #include <kstandarddirs.h> #include <kconfig.h> -#include <qdom.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qfile.h> +#include <tqdom.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqfile.h> namespace { static const int ISBNDB_RETURNS_PER_REQUEST = 10; @@ -39,8 +39,8 @@ namespace { using Tellico::Fetch::ISBNdbFetcher; -ISBNdbFetcher::ISBNdbFetcher(QObject* parent_, const char* name_) - : Fetcher(parent_, name_), m_xsltHandler(0), +ISBNdbFetcher::ISBNdbFetcher(TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_xsltHandler(0), m_limit(ISBNDB_MAX_RETURNS_TOTAL), m_page(1), m_total(-1), m_countOffset(0), m_job(0), m_started(false) { } @@ -50,11 +50,11 @@ ISBNdbFetcher::~ISBNdbFetcher() { m_xsltHandler = 0; } -QString ISBNdbFetcher::defaultName() { +TQString ISBNdbFetcher::defaultName() { return i18n("ISBNdb.com"); } -QString ISBNdbFetcher::source() const { +TQString ISBNdbFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -66,7 +66,7 @@ void ISBNdbFetcher::readConfigHook(const KConfigGroup& config_) { Q_UNUSED(config_); } -void ISBNdbFetcher::search(FetchKey key_, const QString& value_) { +void ISBNdbFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_.stripWhiteSpace(); m_started = true; @@ -76,7 +76,7 @@ void ISBNdbFetcher::search(FetchKey key_, const QString& value_) { m_countOffset = 0; if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } @@ -94,35 +94,35 @@ void ISBNdbFetcher::doSearch() { // myDebug() << "ISBNdbFetcher::search() - value = " << value_ << endl; - KURL u(QString::fromLatin1(ISBNDB_BASE_URL)); - u.addQueryItem(QString::fromLatin1("access_key"), QString::fromLatin1(ISBNDB_APP_ID)); - u.addQueryItem(QString::fromLatin1("results"), QString::fromLatin1("details,authors,subjects,texts")); - u.addQueryItem(QString::fromLatin1("page_number"), QString::number(m_page)); + KURL u(TQString::tqfromLatin1(ISBNDB_BASE_URL)); + u.addQueryItem(TQString::tqfromLatin1("access_key"), TQString::tqfromLatin1(ISBNDB_APP_ID)); + u.addQueryItem(TQString::tqfromLatin1("results"), TQString::tqfromLatin1("details,authors,subjects,texts")); + u.addQueryItem(TQString::tqfromLatin1("page_number"), TQString::number(m_page)); switch(m_key) { case Title: - u.addQueryItem(QString::fromLatin1("index1"), QString::fromLatin1("title")); - u.addQueryItem(QString::fromLatin1("value1"), m_value); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("title")); + u.addQueryItem(TQString::tqfromLatin1("value1"), m_value); break; case Person: // yes, this also queries titles, too, it's a limitation of the isbndb api service - u.addQueryItem(QString::fromLatin1("index1"), QString::fromLatin1("combined")); - u.addQueryItem(QString::fromLatin1("value1"), m_value); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("combined")); + u.addQueryItem(TQString::tqfromLatin1("value1"), m_value); break; case Keyword: - u.addQueryItem(QString::fromLatin1("index1"), QString::fromLatin1("full")); - u.addQueryItem(QString::fromLatin1("value1"), m_value); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("full")); + u.addQueryItem(TQString::tqfromLatin1("value1"), m_value); break; case ISBN: - u.addQueryItem(QString::fromLatin1("index1"), QString::fromLatin1("isbn")); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("isbn")); { // only grab first value - QString v = m_value.section(QChar(';'), 0); + TQString v = m_value.section(TQChar(';'), 0); v.remove('-'); - u.addQueryItem(QString::fromLatin1("value1"), v); + u.addQueryItem(TQString::tqfromLatin1("value1"), v); } break; @@ -134,10 +134,10 @@ void ISBNdbFetcher::doSearch() { // myDebug() << "ISBNdbFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void ISBNdbFetcher::stop() { @@ -154,8 +154,8 @@ void ISBNdbFetcher::stop() { emit signalDone(this); } -void ISBNdbFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void ISBNdbFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -178,26 +178,26 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from isbndbfetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, false)) { kdWarning() << "ISBNdbFetcher::slotComplete() - server did not return valid XML." << endl; return; } if(m_total == -1) { - QDomNode n = dom.documentElement().namedItem(QString::fromLatin1("BookList")); - QDomElement e = n.toElement(); + TQDomNode n = dom.documentElement().namedItem(TQString::tqfromLatin1("BookList")); + TQDomElement e = n.toElement(); if(!e.isNull()) { - m_total = e.attribute(QString::fromLatin1("total_results"), QString::number(-1)).toInt(); + m_total = e.attribute(TQString::tqfromLatin1("total_results"), TQString::number(-1)).toInt(); } } @@ -210,7 +210,7 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { } // assume result is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size())); + TQString str = m_xsltHandler->applyStylesheet(TQString::fromUtf8(m_data, m_data.size())); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); @@ -224,15 +224,15 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("author")) - + QChar('/') + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("cr_year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("cr_year")); - } else if(!entry->field(QString::fromLatin1("pub_year")).isEmpty()){ - desc += QChar('/') + entry->field(QString::fromLatin1("pub_year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("cr_year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("cr_year")); + } else if(!entry->field(TQString::tqfromLatin1("pub_year")).isEmpty()){ + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("pub_year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); ++m_numResults; @@ -241,10 +241,10 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { // are there any additional results to get? m_hasMoreResults = m_page * ISBNDB_RETURNS_PER_REQUEST < m_total; - const int currentTotal = QMIN(m_total, m_limit); + const int currentTotal = TQMIN(m_total, m_limit); if(m_page * ISBNDB_RETURNS_PER_REQUEST < currentTotal) { int foundCount = (m_page-1) * ISBNDB_RETURNS_PER_REQUEST + coll->entryCount(); - message(i18n("Results from %1: %2/%3").arg(source()).arg(foundCount).arg(m_total), MessageHandler::Status); + message(i18n("Results from %1: %2/%3").tqarg(source()).tqarg(foundCount).tqarg(m_total), MessageHandler::tqStatus); ++m_page; m_countOffset = 0; doSearch(); @@ -265,32 +265,32 @@ Tellico::Data::EntryPtr ISBNdbFetcher::fetchEntry(uint uid_) { } // if the publisher id is set, then we need to grab the real publisher name - const QString id = entry->field(QString::fromLatin1("pub_id")); + const TQString id = entry->field(TQString::tqfromLatin1("pub_id")); if(!id.isEmpty()) { - KURL u(QString::fromLatin1(ISBNDB_BASE_URL)); - u.setFileName(QString::fromLatin1("publishers.xml")); - u.addQueryItem(QString::fromLatin1("access_key"), QString::fromLatin1(ISBNDB_APP_ID)); - u.addQueryItem(QString::fromLatin1("index1"), QString::fromLatin1("publisher_id")); - u.addQueryItem(QString::fromLatin1("value1"), id); + KURL u(TQString::tqfromLatin1(ISBNDB_BASE_URL)); + u.setFileName(TQString::tqfromLatin1("publishers.xml")); + u.addQueryItem(TQString::tqfromLatin1("access_key"), TQString::tqfromLatin1(ISBNDB_APP_ID)); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("publisher_id")); + u.addQueryItem(TQString::tqfromLatin1("value1"), id); - QDomDocument dom = FileHandler::readXMLFile(u, true); + TQDomDocument dom = FileHandler::readXMLFile(u, true); if(!dom.isNull()) { - QString pub = dom.documentElement().namedItem(QString::fromLatin1("PublisherList")) - .namedItem(QString::fromLatin1("PublisherData")) - .namedItem(QString::fromLatin1("Name")) + TQString pub = dom.documentElement().namedItem(TQString::tqfromLatin1("PublisherList")) + .namedItem(TQString::tqfromLatin1("PublisherData")) + .namedItem(TQString::tqfromLatin1("Name")) .toElement().text(); if(!pub.isEmpty()) { - entry->setField(QString::fromLatin1("publisher"), pub); + entry->setField(TQString::tqfromLatin1("publisher"), pub); } } - entry->setField(QString::fromLatin1("pub_id"), QString()); + entry->setField(TQString::tqfromLatin1("pub_id"), TQString()); } return entry; } void ISBNdbFetcher::initXSLTHandler() { - QString xsltfile = locate("appdata", QString::fromLatin1("isbndb2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("isbndb2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "ISBNdbFetcher::initXSLTHandler() - can not locate isbndb2tellico.xsl." << endl; return; @@ -314,14 +314,14 @@ void ISBNdbFetcher::updateEntry(Data::EntryPtr entry_) { // limit to top 5 results m_limit = 5; - QString isbn = entry_->field(QString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { m_limit = 10; // raise limit so more possibility of match search(Fetch::Title, t); @@ -332,18 +332,18 @@ void ISBNdbFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* ISBNdbFetcher::configWidget(QWidget* parent_) const { - return new ISBNdbFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* ISBNdbFetcher::configWidget(TQWidget* tqparent_) const { + return new ISBNdbFetcher::ConfigWidget(tqparent_, this); } -ISBNdbFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const ISBNdbFetcher*/*=0*/) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +ISBNdbFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const ISBNdbFetcher*/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } -QString ISBNdbFetcher::ConfigWidget::preferredName() const { +TQString ISBNdbFetcher::ConfigWidget::preferredName() const { return ISBNdbFetcher::defaultName(); } diff --git a/src/fetch/isbndbfetcher.h b/src/fetch/isbndbfetcher.h index e49246a..f5983b2 100644 --- a/src/fetch/isbndbfetcher.h +++ b/src/fetch/isbndbfetcher.h @@ -24,8 +24,8 @@ namespace Tellico { #include <kio/job.h> -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace Tellico { namespace Fetch { @@ -35,14 +35,15 @@ namespace Tellico { */ class ISBNdbFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - ISBNdbFetcher(QObject* parent = 0, const char* name = 0); + ISBNdbFetcher(TQObject* tqparent = 0, const char* name = 0); ~ISBNdbFetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == Keyword || k == ISBN; } virtual void stop(); @@ -53,20 +54,20 @@ public: virtual void updateEntry(Data::EntryPtr entry); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const ISBNdbFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const ISBNdbFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup&) {} - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: @@ -80,12 +81,12 @@ private: int m_numResults; int m_countOffset; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; }; diff --git a/src/fetch/messagehandler.cpp b/src/fetch/messagehandler.cpp index f3c36a1..5510480 100644 --- a/src/fetch/messagehandler.cpp +++ b/src/fetch/messagehandler.cpp @@ -20,8 +20,8 @@ using Tellico::Fetch::ManagerMessage; // all messages go to manager -void ManagerMessage::send(const QString& message_, Type type_) { - Fetch::Manager::self()->updateStatus(message_); +void ManagerMessage::send(const TQString& message_, Type type_) { + Fetch::Manager::self()->updatetqStatus(message_); // plus errors get a message box if(type_ == Error) { KMessageBox::sorry(Kernel::self()->widget(), message_); @@ -30,6 +30,6 @@ void ManagerMessage::send(const QString& message_, Type type_) { } } -void ManagerMessage::infoList(const QString& message_, const QStringList& list_) { +void ManagerMessage::infoList(const TQString& message_, const TQStringList& list_) { KMessageBox::informationList(Kernel::self()->widget(), message_, list_); } diff --git a/src/fetch/messagehandler.h b/src/fetch/messagehandler.h index 0ec9269..804d574 100644 --- a/src/fetch/messagehandler.h +++ b/src/fetch/messagehandler.h @@ -14,8 +14,8 @@ #ifndef TELLICO_FETCH_MESSAGEHANDLER_H #define TELLICO_FETCH_MESSAGEHANDLER_H -class QString; -class QStringList; +class TQString; +class TQStringList; namespace Tellico { namespace Fetch { @@ -25,13 +25,13 @@ namespace Tellico { */ class MessageHandler { public: - enum Type { Status, Warning, Error, ListError }; + enum Type { tqStatus, Warning, Error, ListError }; MessageHandler() {} virtual ~MessageHandler() {} - virtual void send(const QString& message, Type type) = 0; - virtual void infoList(const QString& message, const QStringList& list) = 0; + virtual void send(const TQString& message, Type type) = 0; + virtual void infoList(const TQString& message, const TQStringList& list) = 0; }; class ManagerMessage : public MessageHandler { @@ -39,8 +39,8 @@ public: ManagerMessage() : MessageHandler() {} virtual ~ManagerMessage() {} - virtual void send(const QString& message, Type type); - virtual void infoList(const QString& message, const QStringList& list); + virtual void send(const TQString& message, Type type); + virtual void infoList(const TQString& message, const TQStringList& list); }; } // end namespace diff --git a/src/fetch/scripts/dark_horse_comics.py b/src/fetch/scripts/dark_horse_comics.py index 4f3b651..0db83ec 100644 --- a/src/fetch/scripts/dark_horse_comics.py +++ b/src/fetch/scripts/dark_horse_comics.py @@ -86,7 +86,7 @@ class BasicTellicoDOM: entryNode.setAttribute('id', str(self.__currentId)) titleNode = self.__doc.createElement('title') - titleNode.appendChild(self.__doc.createTextNode(unicode(d['title'], 'latin-1').encode('utf-8'))) + titleNode.appendChild(self.__doc.createTextNode(tqunicode(d['title'], 'latin-1').encode('utf-8'))) yearNode = self.__doc.createElement('pub_year') yearNode.appendChild(self.__doc.createTextNode(d['pub_year'])) @@ -101,25 +101,25 @@ class BasicTellicoDOM: writersNode = self.__doc.createElement('writers') for g in d['writer']: writerNode = self.__doc.createElement('writer') - writerNode.appendChild(self.__doc.createTextNode(unicode(g, 'latin-1').encode('utf-8'))) + writerNode.appendChild(self.__doc.createTextNode(tqunicode(g, 'latin-1').encode('utf-8'))) writersNode.appendChild(writerNode) genresNode = self.__doc.createElement('genres') for g in d['genre']: genreNode = self.__doc.createElement('genre') - genreNode.appendChild(self.__doc.createTextNode(unicode(g, 'latin-1').encode('utf-8'))) + genreNode.appendChild(self.__doc.createTextNode(tqunicode(g, 'latin-1').encode('utf-8'))) genresNode.appendChild(genreNode) commentsNode = self.__doc.createElement('comments') #for g in d['comments']: - # commentsNode.appendChild(self.__doc.createTextNode(unicode("%s\n\n" % g, 'latin-1').encode('utf-8'))) + # commentsNode.appendChild(self.__doc.createTextNode(tqunicode("%s\n\n" % g, 'latin-1').encode('utf-8'))) commentsData = string.join(d['comments'], '\n\n') - commentsNode.appendChild(self.__doc.createTextNode(unicode(commentsData, 'latin-1').encode('utf-8'))) + commentsNode.appendChild(self.__doc.createTextNode(tqunicode(commentsData, 'latin-1').encode('utf-8'))) artistsNode = self.__doc.createElement('artists') for k, v in d['artist'].iteritems(): artistNode = self.__doc.createElement('artist') - artistNode.appendChild(self.__doc.createTextNode(unicode(v, 'latin-1').encode('utf-8'))) + artistNode.appendChild(self.__doc.createTextNode(tqunicode(v, 'latin-1').encode('utf-8'))) artistsNode.appendChild(artistNode) pagesNode = self.__doc.createElement('pages') @@ -132,7 +132,7 @@ class BasicTellicoDOM: imageNode = self.__doc.createElement('image') imageNode.setAttribute('format', 'JPEG') imageNode.setAttribute('id', d['image'][0]) - imageNode.appendChild(self.__doc.createTextNode(unicode(d['image'][1], 'latin-1').encode('utf-8'))) + imageNode.appendChild(self.__doc.createTextNode(tqunicode(d['image'][1], 'latin-1').encode('utf-8'))) coverNode = self.__doc.createElement('cover') coverNode.appendChild(self.__doc.createTextNode(d['image'][0])) @@ -220,7 +220,7 @@ class DarkHorseParser: Retrieve all links related to the search. self.__data contains HTML content fetched by self.__getHTMLContent() that need to be parsed. """ - matchList = re.findall("""<a *href="%s(?P<page>.*?)">(?P<title>.*?)</a>""" % self.__basePath.replace('?', '\?'), self.__data) + matchList = re.findall("""<a *href="%s(?P<page>.*?)">(?P<title>.*?)</a>""" % self.__basePath.tqreplace('?', '\?'), self.__data) if not matchList: return None return matchList diff --git a/src/fetch/scripts/fr.allocine.py b/src/fetch/scripts/fr.allocine.py index 97a2247..6412ecf 100755 --- a/src/fetch/scripts/fr.allocine.py +++ b/src/fetch/scripts/fr.allocine.py @@ -90,23 +90,23 @@ class BasicTellicoDOM: entryNode.setAttribute('id', str(self.__currentId)) titleNode = self.__doc.createElement('title') - titleNode.appendChild(self.__doc.createTextNode(unicode(d['title'], 'latin-1').encode('utf-8'))) + titleNode.appendChild(self.__doc.createTextNode(tqunicode(d['title'], 'latin-1').encode('utf-8'))) otitleNode = self.__doc.createElement('titre-original') - otitleNode.appendChild(self.__doc.createTextNode(unicode(d['otitle'], 'latin-1').encode('utf-8'))) + otitleNode.appendChild(self.__doc.createTextNode(tqunicode(d['otitle'], 'latin-1').encode('utf-8'))) yearNode = self.__doc.createElement('year') - yearNode.appendChild(self.__doc.createTextNode(unicode(d['year'], 'latin-1').encode('utf-8'))) + yearNode.appendChild(self.__doc.createTextNode(tqunicode(d['year'], 'latin-1').encode('utf-8'))) genresNode = self.__doc.createElement('genres') for g in d['genres']: genreNode = self.__doc.createElement('genre') - genreNode.appendChild(self.__doc.createTextNode(unicode(g, 'latin-1').encode('utf-8'))) + genreNode.appendChild(self.__doc.createTextNode(tqunicode(g, 'latin-1').encode('utf-8'))) genresNode.appendChild(genreNode) natsNode = self.__doc.createElement('nationalitys') natNode = self.__doc.createElement('nat') - natNode.appendChild(self.__doc.createTextNode(unicode(d['nat'], 'latin-1').encode('utf-8'))) + natNode.appendChild(self.__doc.createTextNode(tqunicode(d['nat'], 'latin-1').encode('utf-8'))) natsNode.appendChild(natNode) castsNode = self.__doc.createElement('casts') @@ -114,7 +114,7 @@ class BasicTellicoDOM: castNode = self.__doc.createElement('cast') col1Node = self.__doc.createElement('column') col2Node = self.__doc.createElement('column') - col1Node.appendChild(self.__doc.createTextNode(unicode(g, 'latin-1').encode('utf-8'))) + col1Node.appendChild(self.__doc.createTextNode(tqunicode(g, 'latin-1').encode('utf-8'))) castNode.appendChild(col1Node) castNode.appendChild(col2Node) castsNode.appendChild(castNode) @@ -122,17 +122,17 @@ class BasicTellicoDOM: dirsNode = self.__doc.createElement('directors') for g in d['dirs']: dirNode = self.__doc.createElement('director') - dirNode.appendChild(self.__doc.createTextNode(unicode(g, 'latin-1').encode('utf-8'))) + dirNode.appendChild(self.__doc.createTextNode(tqunicode(g, 'latin-1').encode('utf-8'))) dirsNode.appendChild(dirNode) timeNode = self.__doc.createElement('running-time') - timeNode.appendChild(self.__doc.createTextNode(unicode(d['time'], 'latin-1').encode('utf-8'))) + timeNode.appendChild(self.__doc.createTextNode(tqunicode(d['time'], 'latin-1').encode('utf-8'))) - allocineNode = self.__doc.createElement(unicode('allocin�-link', 'latin-1').encode('utf-8')) - allocineNode.appendChild(self.__doc.createTextNode(unicode(d['allocine'], 'latin-1').encode('utf-8'))) + allocineNode = self.__doc.createElement(tqunicode('allocin�-link', 'latin-1').encode('utf-8')) + allocineNode.appendChild(self.__doc.createTextNode(tqunicode(d['allocine'], 'latin-1').encode('utf-8'))) plotNode = self.__doc.createElement('plot') - plotNode.appendChild(self.__doc.createTextNode(unicode(d['plot'], 'latin-1').encode('utf-8'))) + plotNode.appendChild(self.__doc.createTextNode(tqunicode(d['plot'], 'latin-1').encode('utf-8'))) if d['image']: imageNode = self.__doc.createElement('image') @@ -140,7 +140,7 @@ class BasicTellicoDOM: imageNode.setAttribute('id', d['image'][0]) imageNode.setAttribute('width', '120') imageNode.setAttribute('height', '160') - imageNode.appendChild(self.__doc.createTextNode(unicode(d['image'][1], 'latin-1').encode('utf-8'))) + imageNode.appendChild(self.__doc.createTextNode(tqunicode(d['image'][1], 'latin-1').encode('utf-8'))) coverNode = self.__doc.createElement('cover') coverNode.appendChild(self.__doc.createTextNode(d['image'][0])) diff --git a/src/fetch/scripts/ministerio_de_cultura.py b/src/fetch/scripts/ministerio_de_cultura.py index 8a768f9..cdbb580 100644 --- a/src/fetch/scripts/ministerio_de_cultura.py +++ b/src/fetch/scripts/ministerio_de_cultura.py @@ -53,7 +53,7 @@ SVN Version: * Removed "Collection" field as I moved to Series/Series Number Version 0.3.2: - * Now find 'notas' field related information + * Now tqfind 'notas' field related information * search URL modified to fetch information of exhausted books too Version 0.3.1: @@ -155,9 +155,9 @@ class BasicTellicoDOM: # Convert all strings to UTF-8 for i in d.keys(): if type(d[i]) == types.ListType: - d[i] = [unicode(d[i][j], 'latin-1').encode('utf-8') for j in range(len(d[i]))] + d[i] = [tqunicode(d[i][j], 'latin-1').encode('utf-8') for j in range(len(d[i]))] elif type(d[i]) == types.StringType: - d[i] = unicode(d[i], 'latin-1').encode('utf-8') + d[i] = tqunicode(d[i], 'latin-1').encode('utf-8') entryNode = self.__doc.createElement('entry') entryNode.setAttribute('id', str(self.__currentId)) @@ -281,7 +281,7 @@ class MinisterioCulturaParser: # Strip out hyphens if kind is ISBN if kind == ISBN: - criteria = criteria.replace('-', NULLSTRING) + criteria = criteria.tqreplace('-', NULLSTRING) # Support for multiple search isbnList = criteria.split(';') for n in isbnList: @@ -502,7 +502,7 @@ Tellico cannot connect to: http://www.mcu.es/comun/bases/isbn/ISBN.htm webpage: # Now retrieve infos if links: for entry in links: - data = self.__fetchBookInfo( url = self.__baseURL + entry.replace(' ', '%20') ) + data = self.__fetchBookInfo( url = self.__baseURL + entry.tqreplace(' ', '%20') ) node = self.__domTree.addEntry(data) else: return None diff --git a/src/fetch/srufetcher.cpp b/src/fetch/srufetcher.cpp index 1d7289b..96ca7d4 100644 --- a/src/fetch/srufetcher.cpp +++ b/src/fetch/srufetcher.cpp @@ -35,9 +35,9 @@ #include <kaccelmanager.h> #include <knuminput.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qwhatsthis.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> //#define SRU_DEBUG @@ -51,12 +51,12 @@ namespace { using Tellico::Fetch::SRUFetcher; using Tellico::Fetch::SRUConfigWidget; -SRUFetcher::SRUFetcher(QObject* parent_, const char* name_) - : Fetcher(parent_, name_), m_job(0), m_MARCXMLHandler(0), m_MODSHandler(0), m_started(false) { +SRUFetcher::SRUFetcher(TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_job(0), m_MARCXMLHandler(0), m_MODSHandler(0), m_started(false) { } -SRUFetcher::SRUFetcher(const QString& name_, const QString& host_, uint port_, const QString& path_, - QObject* parent_) : Fetcher(parent_), +SRUFetcher::SRUFetcher(const TQString& name_, const TQString& host_, uint port_, const TQString& path_, + TQObject* tqparent_) : Fetcher(tqparent_), m_host(host_), m_port(port_), m_path(path_), m_job(0), m_MARCXMLHandler(0), m_MODSHandler(0), m_started(false) { m_name = name_; // m_name is protected in super class @@ -69,11 +69,11 @@ SRUFetcher::~SRUFetcher() { m_MODSHandler = 0; } -QString SRUFetcher::defaultName() { +TQString SRUFetcher::defaultName() { return i18n("SRU Server"); } -QString SRUFetcher::source() const { +TQString SRUFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -92,14 +92,14 @@ void SRUFetcher::readConfigHook(const KConfigGroup& config_) { if(m_path.isEmpty()) { m_path = config_.readEntry("Database"); } - if(!m_path.startsWith(QChar('/'))) { + if(!m_path.startsWith(TQChar('/'))) { m_path.prepend('/'); } - m_format = config_.readEntry("Format", QString::fromLatin1("mods")); + m_format = config_.readEntry("Format", TQString::tqfromLatin1("mods")); m_fields = config_.readListEntry("Custom Fields"); } -void SRUFetcher::search(FetchKey key_, const QString& value_) { +void SRUFetcher::search(FetchKey key_, const TQString& value_) { if(m_host.isEmpty() || m_path.isEmpty()) { myDebug() << "SRUFetcher::search() - settings are not set!" << endl; stop(); @@ -109,35 +109,35 @@ void SRUFetcher::search(FetchKey key_, const QString& value_) { m_started = true; #ifdef SRU_DEBUG - KURL u = KURL::fromPathOrURL(QString::fromLatin1("/home/robby/sru.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/sru.xml")); #else KURL u; - u.setProtocol(QString::fromLatin1("http")); + u.setProtocol(TQString::tqfromLatin1("http")); u.setHost(m_host); u.setPort(m_port); u.setPath(m_path); - u.addQueryItem(QString::fromLatin1("operation"), QString::fromLatin1("searchRetrieve")); - u.addQueryItem(QString::fromLatin1("version"), QString::fromLatin1("1.1")); - u.addQueryItem(QString::fromLatin1("maximumRecords"), QString::number(SRU_MAX_RECORDS)); - u.addQueryItem(QString::fromLatin1("recordSchema"), m_format); + u.addQueryItem(TQString::tqfromLatin1("operation"), TQString::tqfromLatin1("searchRetrieve")); + u.addQueryItem(TQString::tqfromLatin1("version"), TQString::tqfromLatin1("1.1")); + u.addQueryItem(TQString::tqfromLatin1("maximumRecords"), TQString::number(SRU_MAX_RECORDS)); + u.addQueryItem(TQString::tqfromLatin1("recordSchema"), m_format); const int type = Kernel::self()->collectionType(); - QString str = QChar('"') + value_ + QChar('"'); + TQString str = TQChar('"') + value_ + TQChar('"'); switch(key_) { case Title: - u.addQueryItem(QString::fromLatin1("query"), QString::fromLatin1("dc.title=") + str); + u.addQueryItem(TQString::tqfromLatin1("query"), TQString::tqfromLatin1("dc.title=") + str); break; case Person: { - QString s; + TQString s; if(type == Data::Collection::Book || type == Data::Collection::Bibtex) { - s = QString::fromLatin1("author=") + str + QString::fromLatin1(" or dc.author=") + str; + s = TQString::tqfromLatin1("author=") + str + TQString::tqfromLatin1(" or dc.author=") + str; } else { - s = QString::fromLatin1("dc.creator=") + str + QString::fromLatin1(" or dc.editor=") + str; + s = TQString::tqfromLatin1("dc.creator=") + str + TQString::tqfromLatin1(" or dc.editor=") + str; } - u.addQueryItem(QString::fromLatin1("query"), s); + u.addQueryItem(TQString::tqfromLatin1("query"), s); } break; @@ -146,7 +146,7 @@ void SRUFetcher::search(FetchKey key_, const QString& value_) { str.remove('-'); // limit to first isbn str = str.section(';', 0, 0); - u.addQueryItem(QString::fromLatin1("query"), QString::fromLatin1("bath.isbn=") + str); + u.addQueryItem(TQString::tqfromLatin1("query"), TQString::tqfromLatin1("bath.isbn=") + str); break; case LCCN: @@ -155,22 +155,22 @@ void SRUFetcher::search(FetchKey key_, const QString& value_) { str.remove('-'); str = str.section(';', 0, 0); // also try formalized lccn - QString lccn = LCCNValidator::formalize(str); - u.addQueryItem(QString::fromLatin1("query"), - QString::fromLatin1("bath.lccn=") + str + - QString::fromLatin1(" or bath.lccn=") + lccn + TQString lccn = LCCNValidator::formalize(str); + u.addQueryItem(TQString::tqfromLatin1("query"), + TQString::tqfromLatin1("bath.lccn=") + str + + TQString::tqfromLatin1(" or bath.lccn=") + lccn ); } break; case Keyword: - u.addQueryItem(QString::fromLatin1("query"), str); + u.addQueryItem(TQString::tqfromLatin1("query"), str); break; case Raw: { - QString key = value_.section('=', 0, 0).stripWhiteSpace(); - QString str = value_.section('=', 1).stripWhiteSpace(); + TQString key = value_.section('=', 0, 0).stripWhiteSpace(); + TQString str = value_.section('=', 1).stripWhiteSpace(); u.addQueryItem(key, str); } break; @@ -184,10 +184,10 @@ void SRUFetcher::search(FetchKey key_, const QString& value_) { // myDebug() << u.prettyURL() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void SRUFetcher::stop() { @@ -203,8 +203,8 @@ void SRUFetcher::stop() { emit signalDone(this); } -void SRUFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void SRUFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -224,24 +224,24 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { } Data::CollPtr coll; - QString msg; + TQString msg; - const QString result = QString::fromUtf8(m_data, m_data.size()); + const TQString result = TQString::fromUtf8(m_data, m_data.size()); // first check for SRU errors - const QString& diag = XML::nsZingDiag; + const TQString& diag = XML::nsZingDiag; Import::XMLImporter xmlImporter(result); - QDomDocument dom = xmlImporter.domDocument(); + TQDomDocument dom = xmlImporter.domDocument(); - QDomNodeList diagList = dom.elementsByTagNameNS(diag, QString::fromLatin1("diagnostic")); + TQDomNodeList diagList = dom.elementsByTagNameNS(diag, TQString::tqfromLatin1("diagnostic")); for(uint i = 0; i < diagList.count(); ++i) { - QDomElement elem = diagList.item(i).toElement(); - QDomNodeList nodeList1 = elem.elementsByTagNameNS(diag, QString::fromLatin1("message")); - QDomNodeList nodeList2 = elem.elementsByTagNameNS(diag, QString::fromLatin1("details")); + TQDomElement elem = diagList.item(i).toElement(); + TQDomNodeList nodeList1 = elem.elementsByTagNameNS(diag, TQString::tqfromLatin1("message")); + TQDomNodeList nodeList2 = elem.elementsByTagNameNS(diag, TQString::tqfromLatin1("details")); for(uint j = 0; j < nodeList1.count(); ++j) { - QString d = nodeList1.item(j).toElement().text(); + TQString d = nodeList1.item(j).toElement().text(); if(!d.isEmpty()) { - QString d2 = nodeList2.item(j).toElement().text(); + TQString d2 = nodeList2.item(j).toElement().text(); if(!d2.isEmpty()) { d += " (" + d2 + ')'; } @@ -252,7 +252,7 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { } } - QString modsResult; + TQString modsResult; if(m_format == Latin1Literal("mods")) { modsResult = result; } else if(m_format == Latin1Literal("marcxml") && initMARCXMLHandler()) { @@ -275,7 +275,7 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { } if(coll && !msg.isEmpty()) { - message(msg, coll->entryCount() == 0 ? MessageHandler::Warning : MessageHandler::Status); + message(msg, coll->entryCount() == 0 ? MessageHandler::Warning : MessageHandler::tqStatus); } if(!coll) { @@ -289,46 +289,46 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { const StringMap customFields = SRUFetcher::customFields(); for(StringMap::ConstIterator it = customFields.begin(); it != customFields.end(); ++it) { - if(!m_fields.contains(it.key())) { + if(!m_fields.tqcontains(it.key())) { coll->removeField(it.key()); } } Data::EntryVec entries = coll->entries(); for(Data::EntryVec::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - QString desc; + TQString desc; switch(coll->type()) { case Data::Collection::Book: - desc = entry->field(QString::fromLatin1("author")) - + QChar('/') - + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("cr_year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("cr_year")); - } else if(!entry->field(QString::fromLatin1("pub_year")).isEmpty()){ - desc += QChar('/') + entry->field(QString::fromLatin1("pub_year")); + desc = entry->field(TQString::tqfromLatin1("author")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("cr_year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("cr_year")); + } else if(!entry->field(TQString::tqfromLatin1("pub_year")).isEmpty()){ + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("pub_year")); } break; case Data::Collection::Video: - desc = entry->field(QString::fromLatin1("studio")) - + QChar('/') - + entry->field(QString::fromLatin1("director")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("studio")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("director")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Album: - desc = entry->field(QString::fromLatin1("artist")) - + QChar('/') - + entry->field(QString::fromLatin1("label")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + desc = entry->field(TQString::tqfromLatin1("artist")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("label")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); break; default: break; } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, entry); emit signalResultFound(r); } @@ -341,20 +341,20 @@ Tellico::Data::EntryPtr SRUFetcher::fetchEntry(uint uid_) { void SRUFetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "SRUFetcher::updateEntry() - " << source() << ": " << entry_->title() << endl; - QString isbn = entry_->field(QString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - QString lccn = entry_->field(QString::fromLatin1("lccn")); + TQString lccn = entry_->field(TQString::tqfromLatin1("lccn")); if(!lccn.isEmpty()) { search(Fetch::LCCN, lccn); return; } // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -369,7 +369,7 @@ bool SRUFetcher::initMARCXMLHandler() { return true; } - QString xsltfile = locate("appdata", QString::fromLatin1("MARC21slim2MODS3.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("MARC21slim2MODS3.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "SRUFetcher::initHandlers() - can not locate MARC21slim2MODS3.xsl." << endl; return false; @@ -393,7 +393,7 @@ bool SRUFetcher::initMODSHandler() { return true; } - QString xsltfile = locate("appdata", QString::fromLatin1("mods2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("mods2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "SRUFetcher::initHandlers() - can not locate mods2tellico.xsl." << endl; return false; @@ -412,79 +412,79 @@ bool SRUFetcher::initMODSHandler() { return true; } -Tellico::Fetch::Fetcher::Ptr SRUFetcher::libraryOfCongress(QObject* parent_) { - return new SRUFetcher(i18n("Library of Congress (US)"), QString::fromLatin1("z3950.loc.gov"), 7090, - QString::fromLatin1("voyager"), parent_); +Tellico::Fetch::Fetcher::Ptr SRUFetcher::libraryOfCongress(TQObject* tqparent_) { + return new SRUFetcher(i18n("Library of Congress (US)"), TQString::tqfromLatin1("z3950.loc.gov"), 7090, + TQString::tqfromLatin1("voyager"), tqparent_); } // static Tellico::StringMap SRUFetcher::customFields() { StringMap map; - map[QString::fromLatin1("address")] = i18n("Address"); - map[QString::fromLatin1("abstract")] = i18n("Abstract"); + map[TQString::tqfromLatin1("address")] = i18n("Address"); + map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); return map; } -Tellico::Fetch::ConfigWidget* SRUFetcher::configWidget(QWidget* parent_) const { - return new SRUConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* SRUFetcher::configWidget(TQWidget* tqparent_) const { + return new SRUConfigWidget(tqparent_, this); } -SRUConfigWidget::SRUConfigWidget(QWidget* parent_, const SRUFetcher* fetcher_ /*=0*/) - : ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget(), 4, 2); +SRUConfigWidget::SRUConfigWidget(TQWidget* tqparent_, const SRUFetcher* fetcher_ /*=0*/) + : ConfigWidget(tqparent_) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 4, 2); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - QLabel* label = new QLabel(i18n("Hos&t: "), optionsWidget()); + TQLabel* label = new TQLabel(i18n("Hos&t: "), optionsWidget()); l->addWidget(label, ++row, 0); m_hostEdit = new GUI::LineEdit(optionsWidget()); - connect(m_hostEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); - connect(m_hostEdit, SIGNAL(textChanged(const QString&)), SIGNAL(signalName(const QString&))); - connect(m_hostEdit, SIGNAL(textChanged(const QString&)), SLOT(slotCheckHost())); + connect(m_hostEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); + connect(m_hostEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SIGNAL(signalName(const TQString&))); + connect(m_hostEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotCheckHost())); l->addWidget(m_hostEdit, row, 1); - QString w = i18n("Enter the host name of the server."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_hostEdit, w); + TQString w = i18n("Enter the host name of the server."); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_hostEdit, w); label->setBuddy(m_hostEdit); - label = new QLabel(i18n("&Port: "), optionsWidget()); + label = new TQLabel(i18n("&Port: "), optionsWidget()); l->addWidget(label, ++row, 0); m_portSpinBox = new KIntSpinBox(0, 999999, 1, SRU_DEFAULT_PORT, 10, optionsWidget()); - connect(m_portSpinBox, SIGNAL(valueChanged(int)), SLOT(slotSetModified())); + connect(m_portSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_portSpinBox, row, 1); - w = i18n("Enter the port number of the server. The default is %1.").arg(SRU_DEFAULT_PORT); - QWhatsThis::add(label, w); - QWhatsThis::add(m_portSpinBox, w); + w = i18n("Enter the port number of the server. The default is %1.").tqarg(SRU_DEFAULT_PORT); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_portSpinBox, w); label->setBuddy(m_portSpinBox); - label = new QLabel(i18n("Path: "), optionsWidget()); + label = new TQLabel(i18n("Path: "), optionsWidget()); l->addWidget(label, ++row, 0); m_pathEdit = new GUI::LineEdit(optionsWidget()); - connect(m_pathEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_pathEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_pathEdit, row, 1); w = i18n("Enter the path to the database used by the server."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_pathEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_pathEdit, w); label->setBuddy(m_pathEdit); - label = new QLabel(i18n("Format: "), optionsWidget()); + label = new TQLabel(i18n("Format: "), optionsWidget()); l->addWidget(label, ++row, 0); m_formatCombo = new GUI::ComboBox(optionsWidget()); - m_formatCombo->insertItem(QString::fromLatin1("MODS"), QString::fromLatin1("mods")); - m_formatCombo->insertItem(QString::fromLatin1("MARCXML"), QString::fromLatin1("marcxml")); - m_formatCombo->insertItem(QString::fromLatin1("Dublin Core"), QString::fromLatin1("dc")); - connect(m_formatCombo, SIGNAL(activated(int)), SLOT(slotSetModified())); + m_formatCombo->insertItem(TQString::tqfromLatin1("MODS"), TQString::tqfromLatin1("mods")); + m_formatCombo->insertItem(TQString::tqfromLatin1("MARCXML"), TQString::tqfromLatin1("marcxml")); + m_formatCombo->insertItem(TQString::tqfromLatin1("Dublin Core"), TQString::tqfromLatin1("dc")); + connect(m_formatCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_formatCombo, row, 1); w = i18n("Enter the result format used by the server."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_formatCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_formatCombo, w); label->setBuddy(m_formatCombo); l->setRowStretch(++row, 1); // now add additional fields widget - addFieldsWidget(SRUFetcher::customFields(), fetcher_ ? fetcher_->m_fields : QStringList()); + addFieldsWidget(SRUFetcher::customFields(), fetcher_ ? fetcher_->m_fields : TQStringList()); if(fetcher_) { m_hostEdit->setText(fetcher_->m_host); @@ -496,7 +496,7 @@ SRUConfigWidget::SRUConfigWidget(QWidget* parent_, const SRUFetcher* fetcher_ /* } void SRUConfigWidget::saveConfig(KConfigGroup& config_) { - QString s = m_hostEdit->text().stripWhiteSpace(); + TQString s = m_hostEdit->text().stripWhiteSpace(); if(!s.isEmpty()) { config_.writeEntry("Host", s); } @@ -516,15 +516,15 @@ void SRUConfigWidget::saveConfig(KConfigGroup& config_) { slotSetModified(false); } -QString SRUConfigWidget::preferredName() const { - QString s = m_hostEdit->text(); +TQString SRUConfigWidget::preferredName() const { + TQString s = m_hostEdit->text(); return s.isEmpty() ? SRUFetcher::defaultName() : s; } void SRUConfigWidget::slotCheckHost() { - QString s = m_hostEdit->text(); + TQString s = m_hostEdit->text(); // someone might be pasting a full URL, check that - if(s.find(':') > -1 || s.find('/') > -1) { + if(s.tqfind(':') > -1 || s.tqfind('/') > -1) { KURL u(s); if(u.isValid()) { m_hostEdit->setText(u.host()); diff --git a/src/fetch/srufetcher.h b/src/fetch/srufetcher.h index fd07323..d62b866 100644 --- a/src/fetch/srufetcher.h +++ b/src/fetch/srufetcher.h @@ -32,8 +32,8 @@ namespace KIO { #include "configwidget.h" #include "../datavectors.h" -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace Tellico { namespace Fetch { @@ -48,24 +48,25 @@ class SRUConfigWidget; */ class SRUFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT friend class SRUConfigWidget; public: /** */ - SRUFetcher(QObject* parent, const char* name = 0); - SRUFetcher(const QString& name, const QString& host, uint port, const QString& dbname, - QObject* parent); + SRUFetcher(TQObject* tqparent, const char* name = 0); + SRUFetcher(const TQString& name, const TQString& host, uint port, const TQString& dbname, + TQObject* tqparent); /** */ virtual ~SRUFetcher(); /** */ - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); // only search title, person, isbn, or keyword. No Raw for now. virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == ISBN || k == Keyword || k == LCCN; } virtual void stop(); @@ -78,43 +79,44 @@ public: static StringMap customFields(); - virtual ConfigWidget* configWidget(QWidget* parent) const; + virtual ConfigWidget* configWidget(TQWidget* tqparent) const; - static QString defaultName(); + static TQString defaultName(); - static Fetcher::Ptr libraryOfCongress(QObject* parent); + static Fetcher::Ptr libraryOfCongress(TQObject* tqparent); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: bool initMARCXMLHandler(); bool initMODSHandler(); - QString m_host; + TQString m_host; uint m_port; - QString m_path; - QString m_format; + TQString m_path; + TQString m_format; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; + TQGuardedPtr<KIO::Job> m_job; XSLTHandler* m_MARCXMLHandler; XSLTHandler* m_MODSHandler; bool m_started; - QStringList m_fields; + TQStringList m_fields; }; class SRUConfigWidget : public ConfigWidget { Q_OBJECT + TQ_OBJECT friend class SRUFetcher; public: - SRUConfigWidget(QWidget* parent_, const SRUFetcher* fetcher = 0); + SRUConfigWidget(TQWidget* tqparent_, const SRUFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup& config); - virtual QString preferredName() const; + virtual TQString preferredName() const; private slots: void slotCheckHost(); diff --git a/src/fetch/yahoofetcher.cpp b/src/fetch/yahoofetcher.cpp index 002b63b..d625cad 100644 --- a/src/fetch/yahoofetcher.cpp +++ b/src/fetch/yahoofetcher.cpp @@ -27,10 +27,10 @@ #include <kconfig.h> #include <kio/job.h> -#include <qdom.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qfile.h> +#include <tqdom.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqfile.h> namespace { static const int YAHOO_MAX_RETURNS_TOTAL = 20; @@ -40,8 +40,8 @@ namespace { using Tellico::Fetch::YahooFetcher; -YahooFetcher::YahooFetcher(QObject* parent_, const char* name_) - : Fetcher(parent_, name_), m_xsltHandler(0), +YahooFetcher::YahooFetcher(TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_xsltHandler(0), m_limit(YAHOO_MAX_RETURNS_TOTAL), m_job(0), m_started(false) { } @@ -50,11 +50,11 @@ YahooFetcher::~YahooFetcher() { m_xsltHandler = 0; } -QString YahooFetcher::defaultName() { +TQString YahooFetcher::defaultName() { return i18n("Yahoo! Audio Search"); } -QString YahooFetcher::source() const { +TQString YahooFetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -66,7 +66,7 @@ void YahooFetcher::readConfigHook(const KConfigGroup& config_) { Q_UNUSED(config_); } -void YahooFetcher::search(FetchKey key_, const QString& value_) { +void YahooFetcher::search(FetchKey key_, const TQString& value_) { m_key = key_; m_value = value_; m_started = true; @@ -83,32 +83,32 @@ void YahooFetcher::continueSearch() { void YahooFetcher::doSearch() { // myDebug() << "YahooFetcher::search() - value = " << value_ << endl; - KURL u(QString::fromLatin1(YAHOO_BASE_URL)); - u.addQueryItem(QString::fromLatin1("appid"), QString::fromLatin1(YAHOO_APP_ID)); - u.addQueryItem(QString::fromLatin1("type"), QString::fromLatin1("all")); - u.addQueryItem(QString::fromLatin1("output"), QString::fromLatin1("xml")); - u.addQueryItem(QString::fromLatin1("start"), QString::number(m_start)); - u.addQueryItem(QString::fromLatin1("results"), QString::number(YAHOO_MAX_RETURNS_TOTAL)); + KURL u(TQString::tqfromLatin1(YAHOO_BASE_URL)); + u.addQueryItem(TQString::tqfromLatin1("appid"), TQString::tqfromLatin1(YAHOO_APP_ID)); + u.addQueryItem(TQString::tqfromLatin1("type"), TQString::tqfromLatin1("all")); + u.addQueryItem(TQString::tqfromLatin1("output"), TQString::tqfromLatin1("xml")); + u.addQueryItem(TQString::tqfromLatin1("start"), TQString::number(m_start)); + u.addQueryItem(TQString::tqfromLatin1("results"), TQString::number(YAHOO_MAX_RETURNS_TOTAL)); if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } switch(m_key) { case Title: - u.addQueryItem(QString::fromLatin1("album"), m_value); + u.addQueryItem(TQString::tqfromLatin1("album"), m_value); break; case Person: - u.addQueryItem(QString::fromLatin1("artist"), m_value); + u.addQueryItem(TQString::tqfromLatin1("artist"), m_value); break; // raw is used for the entry updates case Raw: -// u.removeQueryItem(QString::fromLatin1("type")); -// u.addQueryItem(QString::fromLatin1("type"), QString::fromLatin1("phrase")); +// u.removeQueryItem(TQString::tqfromLatin1("type")); +// u.addQueryItem(TQString::tqfromLatin1("type"), TQString::tqfromLatin1("phrase")); u.setQuery(u.query() + '&' + m_value); break; @@ -120,10 +120,10 @@ void YahooFetcher::doSearch() { // myDebug() << "YahooFetcher::search() - url: " << u.url() << endl; m_job = KIO::get(u, false, false); - connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), - SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(m_job, SIGNAL(result(KIO::Job*)), - SLOT(slotComplete(KIO::Job*))); + connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)), + TQT_SLOT(slotData(KIO::Job*, const TQByteArray&))); + connect(m_job, TQT_SIGNAL(result(KIO::Job*)), + TQT_SLOT(slotComplete(KIO::Job*))); } void YahooFetcher::stop() { @@ -139,8 +139,8 @@ void YahooFetcher::stop() { emit signalDone(this); } -void YahooFetcher::slotData(KIO::Job*, const QByteArray& data_) { - QDataStream stream(m_data, IO_WriteOnly | IO_Append); +void YahooFetcher::slotData(KIO::Job*, const TQByteArray& data_) { + TQDataStream stream(m_data, IO_WriteOnly | IO_Append); stream.writeRawBytes(data_.data(), data_.size()); } @@ -163,11 +163,11 @@ void YahooFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from yahoofetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); - t << QCString(m_data, m_data.size()+1); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); + t << TQCString(m_data, m_data.size()+1); } f.close(); #endif @@ -181,20 +181,20 @@ void YahooFetcher::slotComplete(KIO::Job* job_) { } if(m_total == -1) { - QDomDocument dom; + TQDomDocument dom; if(!dom.setContent(m_data, false)) { kdWarning() << "YahooFetcher::slotComplete() - server did not return valid XML." << endl; return; } // total is top level element, with attribute totalResultsAvailable - QDomElement e = dom.documentElement(); + TQDomElement e = dom.documentElement(); if(!e.isNull()) { - m_total = e.attribute(QString::fromLatin1("totalResultsAvailable")).toInt(); + m_total = e.attribute(TQString::tqfromLatin1("totalResultsAvailable")).toInt(); } } // assume yahoo is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size())); + TQString str = m_xsltHandler->applyStylesheet(TQString::fromUtf8(m_data, m_data.size())); Import::TellicoImporter imp(str); Data::CollPtr coll = imp.collection(); if(!coll) { @@ -210,13 +210,13 @@ void YahooFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - QString desc = entry->field(QString::fromLatin1("artist")) - + QChar('/') - + entry->field(QString::fromLatin1("label")) - + QChar('/') - + entry->field(QString::fromLatin1("year")); + TQString desc = entry->field(TQString::tqfromLatin1("artist")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("label")) + + TQChar('/') + + entry->field(TQString::tqfromLatin1("year")); - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, Data::EntryPtr(entry)); emit signalResultFound(r); } @@ -232,30 +232,30 @@ Tellico::Data::EntryPtr YahooFetcher::fetchEntry(uint uid_) { return 0; } - KURL imageURL = entry->field(QString::fromLatin1("image")); + KURL imageURL = entry->field(TQString::tqfromLatin1("image")); if(!imageURL.isEmpty()) { - QString id = ImageFactory::addImage(imageURL, true); + TQString id = ImageFactory::addImage(imageURL, true); if(id.isEmpty()) { - // rich text causes layout issues -// emit signalStatus(i18n("<qt>The cover image for <i>%1</i> could not be loaded.</qt>").arg( -// entry->field(QString::fromLatin1("title")))); + // rich text causes tqlayout issues +// emit signaltqStatus(i18n("<qt>The cover image for <i>%1</i> could not be loaded.</qt>").tqarg( +// entry->field(TQString::tqfromLatin1("title")))); message(i18n("The cover image could not be loaded."), MessageHandler::Warning); } else { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } getTracks(entry); // don't want to show image urls in the fetch dialog - entry->setField(QString::fromLatin1("image"), QString::null); + entry->setField(TQString::tqfromLatin1("image"), TQString()); // no need for album id now ? - entry->setField(QString::fromLatin1("yahoo"), QString::null); + entry->setField(TQString::tqfromLatin1("yahoo"), TQString()); return entry; } void YahooFetcher::initXSLTHandler() { - QString xsltfile = locate("appdata", QString::fromLatin1("yahoo2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("yahoo2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "YahooFetcher::initXSLTHandler() - can not locate yahoo2tellico.xsl." << endl; return; @@ -276,23 +276,23 @@ void YahooFetcher::initXSLTHandler() { void YahooFetcher::getTracks(Data::EntryPtr entry_) { // get album id - if(!entry_ || entry_->field(QString::fromLatin1("yahoo")).isEmpty()) { + if(!entry_ || entry_->field(TQString::tqfromLatin1("yahoo")).isEmpty()) { return; } - const QString albumid = entry_->field(QString::fromLatin1("yahoo")); + const TQString albumid = entry_->field(TQString::tqfromLatin1("yahoo")); - KURL u(QString::fromLatin1(YAHOO_BASE_URL)); - u.setFileName(QString::fromLatin1("songSearch")); - u.addQueryItem(QString::fromLatin1("appid"), QString::fromLatin1(YAHOO_APP_ID)); - u.addQueryItem(QString::fromLatin1("type"), QString::fromLatin1("all")); - u.addQueryItem(QString::fromLatin1("output"), QString::fromLatin1("xml")); + KURL u(TQString::tqfromLatin1(YAHOO_BASE_URL)); + u.setFileName(TQString::tqfromLatin1("songSearch")); + u.addQueryItem(TQString::tqfromLatin1("appid"), TQString::tqfromLatin1(YAHOO_APP_ID)); + u.addQueryItem(TQString::tqfromLatin1("type"), TQString::tqfromLatin1("all")); + u.addQueryItem(TQString::tqfromLatin1("output"), TQString::tqfromLatin1("xml")); // go ahesad and ask for all results, since there might well be more than 10 songs on the CD - u.addQueryItem(QString::fromLatin1("results"), QString::number(50)); - u.addQueryItem(QString::fromLatin1("albumid"), albumid); + u.addQueryItem(TQString::tqfromLatin1("results"), TQString::number(50)); + u.addQueryItem(TQString::tqfromLatin1("albumid"), albumid); // myDebug() << "YahooFetcher::getTracks() - url: " << u.url() << endl; - QDomDocument dom = FileHandler::readXMLFile(u, false /*no namespace*/, true /*quiet*/); + TQDomDocument dom = FileHandler::readXMLFile(u, false /*no namespace*/, true /*quiet*/); if(dom.isNull()) { myDebug() << "YahooFetcher::getTracks() - null dom returned" << endl; return; @@ -300,36 +300,36 @@ void YahooFetcher::getTracks(Data::EntryPtr entry_) { #if 0 kdWarning() << "Remove debug from yahoofetcher.cpp" << endl; - QFile f(QString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f); + t.setEncoding(TQTextStream::UnicodeUTF8); t << dom.toString(); } f.close(); #endif - const QString track = QString::fromLatin1("track"); + const TQString track = TQString::tqfromLatin1("track"); - QDomNodeList nodes = dom.documentElement().childNodes(); + TQDomNodeList nodes = dom.documentElement().childNodes(); for(uint i = 0; i < nodes.count(); ++i) { - QDomElement e = nodes.item(i).toElement(); + TQDomElement e = nodes.item(i).toElement(); if(e.isNull()) { continue; } - QString t = e.namedItem(QString::fromLatin1("Title")).toElement().text(); - QString n = e.namedItem(QString::fromLatin1("Track")).toElement().text(); + TQString t = e.namedItem(TQString::tqfromLatin1("Title")).toElement().text(); + TQString n = e.namedItem(TQString::tqfromLatin1("Track")).toElement().text(); bool ok; int trackNum = Tellico::toUInt(n, &ok); // trackNum might be 0 if(t.isEmpty() || !ok || trackNum < 1) { continue; } - QString a = e.namedItem(QString::fromLatin1("Artist")).toElement().text(); - QString l = e.namedItem(QString::fromLatin1("Length")).toElement().text(); + TQString a = e.namedItem(TQString::tqfromLatin1("Artist")).toElement().text(); + TQString l = e.namedItem(TQString::tqfromLatin1("Length")).toElement().text(); int len = Tellico::toUInt(l, &ok); - QString value = t + "::" + a; + TQString value = t + "::" + a; if(ok && len > 0) { value += + "::" + Tellico::minutes(len); } @@ -338,22 +338,22 @@ void YahooFetcher::getTracks(Data::EntryPtr entry_) { } // not zero-based -QString YahooFetcher::insertValue(const QString& str_, const QString& value_, uint pos_) { - QStringList list = Data::Field::split(str_, true); +TQString YahooFetcher::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(); } bool write = true; if(!list[pos_-1].isNull()) { // for some reason, some songs are repeated from yahoo, with 0 length, don't overwrite that - if(value_.contains(QString::fromLatin1("::")) < 2) { // means no length value + if(value_.tqcontains(TQString::tqfromLatin1("::")) < 2) { // means no length value write = false; } } if(!value_.isEmpty() && write) { list[pos_-1] = value_; } - return list.join(QString::fromLatin1("; ")); + return list.join(TQString::tqfromLatin1("; ")); } void YahooFetcher::updateEntry(Data::EntryPtr entry_) { @@ -361,17 +361,17 @@ void YahooFetcher::updateEntry(Data::EntryPtr entry_) { // limit to top 5 results m_limit = 5; - QString value; - QString title = entry_->field(QString::fromLatin1("title")); + TQString value; + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { - value += QString::fromLatin1("album=") + title; + value += TQString::tqfromLatin1("album=") + title; } - QString artist = entry_->field(QString::fromLatin1("artist")); + TQString artist = entry_->field(TQString::tqfromLatin1("artist")); if(!artist.isEmpty()) { if(!value.isEmpty()) { value += '&'; } - value += QString::fromLatin1("artist=") + artist; + value += TQString::tqfromLatin1("artist=") + artist; } if(!value.isEmpty()) { search(Fetch::Raw, value); @@ -382,18 +382,18 @@ void YahooFetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* YahooFetcher::configWidget(QWidget* parent_) const { - return new YahooFetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* YahooFetcher::configWidget(TQWidget* tqparent_) const { + return new YahooFetcher::ConfigWidget(tqparent_, this); } -YahooFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const YahooFetcher*/*=0*/) - : Fetch::ConfigWidget(parent_) { - QVBoxLayout* l = new QVBoxLayout(optionsWidget()); - l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget())); +YahooFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const YahooFetcher*/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQVBoxLayout* l = new TQVBoxLayout(optionsWidget()); + l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget())); l->addStretch(); } -QString YahooFetcher::ConfigWidget::preferredName() const { +TQString YahooFetcher::ConfigWidget::preferredName() const { return YahooFetcher::defaultName(); } diff --git a/src/fetch/yahoofetcher.h b/src/fetch/yahoofetcher.h index 7ff5733..d7b2082 100644 --- a/src/fetch/yahoofetcher.h +++ b/src/fetch/yahoofetcher.h @@ -22,8 +22,8 @@ namespace Tellico { #include "configwidget.h" #include "../datavectors.h" -#include <qcstring.h> // for QByteArray -#include <qguardedptr.h> +#include <tqcstring.h> // for TQByteArray +#include <tqguardedptr.h> namespace KIO { class Job; @@ -37,20 +37,21 @@ namespace Tellico { */ class YahooFetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: /** */ - YahooFetcher(QObject* parent, const char* name = 0); + YahooFetcher(TQObject* tqparent, const char* name = 0); /** */ virtual ~YahooFetcher(); /** */ - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); virtual bool canSearch(FetchKey k) const { return k == Title || k == Person; } virtual void stop(); @@ -64,39 +65,39 @@ public: /** * Returns a widget for modifying the fetcher's config. */ - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget : public Fetch::ConfigWidget { public: - ConfigWidget(QWidget* parent_, const YahooFetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent_, const YahooFetcher* fetcher = 0); virtual void saveConfig(KConfigGroup&) {} - virtual QString preferredName() const; + virtual TQString preferredName() const; }; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); private slots: - void slotData(KIO::Job* job, const QByteArray& data); + void slotData(KIO::Job* job, const TQByteArray& data); void slotComplete(KIO::Job* job); private: void initXSLTHandler(); void doSearch(); void getTracks(Data::EntryPtr entry); - QString insertValue(const QString& str, const QString& value, uint pos); + TQString insertValue(const TQString& str, const TQString& value, uint pos); XSLTHandler* m_xsltHandler; int m_limit; int m_start; int m_total; - QByteArray m_data; - QMap<int, Data::EntryPtr> m_entries; // they get modified after collection is created, so can't be const - QGuardedPtr<KIO::Job> m_job; + TQByteArray m_data; + TQMap<int, Data::EntryPtr> m_entries; // they get modified after collection is created, so can't be const + TQGuardedPtr<KIO::Job> m_job; FetchKey m_key; - QString m_value; + TQString m_value; bool m_started; }; diff --git a/src/fetch/z3950connection.cpp b/src/fetch/z3950connection.cpp index 27efe51..5bf77ac 100644 --- a/src/fetch/z3950connection.cpp +++ b/src/fetch/z3950connection.cpp @@ -31,7 +31,7 @@ extern "C" { #include <klocale.h> -#include <qfile.h> +#include <tqfile.h> namespace { static const size_t Z3950_DEFAULT_MAX_RECORDS = 20; @@ -40,8 +40,8 @@ namespace { using Tellico::Fetch::Z3950ResultFound; using Tellico::Fetch::Z3950Connection; -Z3950ResultFound::Z3950ResultFound(const QString& s) : QCustomEvent(uid()) - , m_result(QDeepCopy<QString>(s)) { +Z3950ResultFound::Z3950ResultFound(const TQString& s) : TQCustomEvent(uid()) + , m_result(TQDeepCopy<TQString>(s)) { ++Z3950Connection::resultsLeft; } @@ -69,23 +69,23 @@ int Z3950Connection::resultsLeft = 0; // I'm paranoid about user insertions, so just grab 64 // characters at most Z3950Connection::Z3950Connection(Z3950Fetcher* fetcher, - const QString& host, + const TQString& host, uint port, - const QString& dbname, - const QString& sourceCharSet, - const QString& syntax, - const QString& esn) - : QThread() + const TQString& dbname, + const TQString& sourceCharSet, + const TQString& syntax, + const TQString& esn) + : TQThread() , d(new Private()) , m_connected(false) , m_aborted(false) , m_fetcher(fetcher) - , m_host(QDeepCopy<QString>(host)) + , m_host(TQDeepCopy<TQString>(host)) , m_port(port) - , m_dbname(QDeepCopy<QString>(dbname)) - , m_sourceCharSet(QDeepCopy<QString>(sourceCharSet.left(64))) - , m_syntax(QDeepCopy<QString>(syntax)) - , m_esn(QDeepCopy<QString>(esn)) + , m_dbname(TQDeepCopy<TQString>(dbname)) + , m_sourceCharSet(TQDeepCopy<TQString>(sourceCharSet.left(64))) + , m_syntax(TQDeepCopy<TQString>(syntax)) + , m_esn(TQDeepCopy<TQString>(esn)) , m_start(0) , m_limit(Z3950_DEFAULT_MAX_RECORDS) , m_hasMore(false) { @@ -102,13 +102,13 @@ void Z3950Connection::reset() { m_limit = Z3950_DEFAULT_MAX_RECORDS; } -void Z3950Connection::setQuery(const QString& query_) { - m_pqn = QDeepCopy<QString>(query_); +void Z3950Connection::setQuery(const TQString& query_) { + m_pqn = TQDeepCopy<TQString>(query_); } -void Z3950Connection::setUserPassword(const QString& user_, const QString& pword_) { - m_user = QDeepCopy<QString>(user_); - m_password = QDeepCopy<QString>(pword_); +void Z3950Connection::setUserPassword(const TQString& user_, const TQString& pword_) { + m_user = TQDeepCopy<TQString>(user_); + m_password = TQDeepCopy<TQString>(pword_); } void Z3950Connection::run() { @@ -129,7 +129,7 @@ void Z3950Connection::run() { if(errcode != 0) { myDebug() << "Z3950Connection::run() - query error: " << m_pqn << endl; ZOOM_query_destroy(query); - QString s = i18n("Query error!"); + TQString s = i18n("Query error!"); s += ' ' + m_pqn; done(s, MessageHandler::Error); return; @@ -147,16 +147,16 @@ void Z3950Connection::run() { // to get MODS data, that seems a bit odd... // esn only makes sense for marc and grs-1 // if syntax is mods, set esn to mods too - QCString type = "raw"; + TQCString type = "raw"; if(m_syntax == Latin1Literal("mods")) { - m_syntax = QString::fromLatin1("xml"); + m_syntax = TQString::tqfromLatin1("xml"); ZOOM_resultset_option_set(resultSet, "elementSetName", "mods"); type = "xml"; } else { ZOOM_resultset_option_set(resultSet, "elementSetName", m_esn.latin1()); } - ZOOM_resultset_option_set(resultSet, "start", QCString().setNum(m_start)); - ZOOM_resultset_option_set(resultSet, "count", QCString().setNum(m_limit-m_start)); + ZOOM_resultset_option_set(resultSet, "start", TQCString().setNum(m_start)); + ZOOM_resultset_option_set(resultSet, "count", TQCString().setNum(m_limit-m_start)); // search in default syntax, unless syntax is already set if(!m_syntax.isEmpty()) { ZOOM_resultset_option_set(resultSet, "preferredRecordSyntax", m_syntax.latin1()); @@ -170,8 +170,8 @@ void Z3950Connection::run() { ZOOM_query_destroy(query); m_connected = false; - QString s = i18n("Connection search error %1: %2").arg(errcode).arg(toString(errmsg)); - if(!QCString(addinfo).isEmpty()) { + TQString s = i18n("Connection search error %1: %2").tqarg(errcode).tqarg(toString(errmsg)); + if(!TQCString(addinfo).isEmpty()) { s += " (" + toString(addinfo) + ")"; } myDebug() << "Z3950Connection::run() - " << s << endl; @@ -181,7 +181,7 @@ void Z3950Connection::run() { const size_t numResults = ZOOM_resultset_size(resultSet); - QString newSyntax = m_syntax; + TQString newSyntax = m_syntax; if(numResults > 0) { myLog() << "Z3950Connection::run() - current syntax is " << m_syntax << " (" << numResults << " results)" << endl; // so now we know that results exist, might have to check syntax @@ -190,10 +190,10 @@ void Z3950Connection::run() { // want raw unless it's mods ZOOM_record_get(rec, type, &len); if(len > 0 && m_syntax.isEmpty()) { - newSyntax = QString::fromLatin1(ZOOM_record_get(rec, "syntax", &len)).lower(); + newSyntax = TQString::tqfromLatin1(ZOOM_record_get(rec, "syntax", &len)).lower(); myLog() << "Z3950Connection::run() - syntax guess is " << newSyntax << endl; if(newSyntax == Latin1Literal("mods") || newSyntax == Latin1Literal("xml")) { - m_syntax = QString::fromLatin1("xml"); + m_syntax = TQString::tqfromLatin1("xml"); ZOOM_resultset_option_set(resultSet, "elementSetName", "mods"); } else if(newSyntax == Latin1Literal("grs-1")) { // if it's defaulting to grs-1, go ahead and change it to try to get a marc @@ -208,7 +208,7 @@ void Z3950Connection::run() { newSyntax != Latin1Literal("unimarc") && newSyntax != Latin1Literal("grs-1")) { myLog() << "Z3950Connection::run() - changing z39.50 syntax to MODS" << endl; - newSyntax = QString::fromLatin1("xml"); + newSyntax = TQString::tqfromLatin1("xml"); ZOOM_resultset_option_set(resultSet, "elementSetName", "mods"); ZOOM_resultset_option_set(resultSet, "preferredRecordSyntax", newSyntax.latin1()); rec = ZOOM_resultset_record(resultSet, 0); @@ -216,28 +216,28 @@ void Z3950Connection::run() { if(len == 0) { // change set name back ZOOM_resultset_option_set(resultSet, "elementSetName", m_esn.latin1()); - newSyntax = QString::fromLatin1("usmarc"); // try usmarc + newSyntax = TQString::tqfromLatin1("usmarc"); // try usmarc myLog() << "Z3950Connection::run() - changing z39.50 syntax to USMARC" << endl; ZOOM_resultset_option_set(resultSet, "preferredRecordSyntax", newSyntax.latin1()); rec = ZOOM_resultset_record(resultSet, 0); ZOOM_record_get(rec, "raw", &len); } if(len == 0) { - newSyntax = QString::fromLatin1("marc21"); // try marc21 + newSyntax = TQString::tqfromLatin1("marc21"); // try marc21 myLog() << "Z3950Connection::run() - changing z39.50 syntax to MARC21" << endl; ZOOM_resultset_option_set(resultSet, "preferredRecordSyntax", newSyntax.latin1()); rec = ZOOM_resultset_record(resultSet, 0); ZOOM_record_get(rec, "raw", &len); } if(len == 0) { - newSyntax = QString::fromLatin1("unimarc"); // try unimarc + newSyntax = TQString::tqfromLatin1("unimarc"); // try unimarc myLog() << "Z3950Connection::run() - changing z39.50 syntax to UNIMARC" << endl; ZOOM_resultset_option_set(resultSet, "preferredRecordSyntax", newSyntax.latin1()); rec = ZOOM_resultset_record(resultSet, 0); ZOOM_record_get(rec, "raw", &len); } if(len == 0) { - newSyntax = QString::fromLatin1("grs-1"); // try grs-1 + newSyntax = TQString::tqfromLatin1("grs-1"); // try grs-1 myLog() << "Z3950Connection::run() - changing z39.50 syntax to GRS-1" << endl; ZOOM_resultset_option_set(resultSet, "preferredRecordSyntax", newSyntax.latin1()); rec = ZOOM_resultset_record(resultSet, 0); @@ -256,10 +256,10 @@ void Z3950Connection::run() { // go back to fooling ourselves and calling it mods if(m_syntax == Latin1Literal("xml")) { - m_syntax = QString::fromLatin1("mods"); + m_syntax = TQString::tqfromLatin1("mods"); } if(newSyntax == Latin1Literal("xml")) { - newSyntax = QString::fromLatin1("mods"); + newSyntax = TQString::tqfromLatin1("mods"); } // save syntax change for next time if(m_syntax != newSyntax) { @@ -268,10 +268,10 @@ void Z3950Connection::run() { } if(m_sourceCharSet.isEmpty()) { - m_sourceCharSet = QString::fromLatin1("marc-8"); + m_sourceCharSet = TQString::tqfromLatin1("marc-8"); } - const size_t realLimit = QMIN(numResults, m_limit); + const size_t realLimit = TQMIN(numResults, m_limit); for(size_t i = m_start; i < realLimit && !m_aborted; ++i) { myLog() << "Z3950Connection::run() - grabbing index " << i << endl; @@ -281,7 +281,7 @@ void Z3950Connection::run() { continue; } int len; - QString data; + TQString data; if(m_syntax == Latin1Literal("mods")) { data = toString(ZOOM_record_get(rec, "xml", &len)); } else if(m_syntax == Latin1Literal("grs-1")) { // grs-1 @@ -291,9 +291,9 @@ void Z3950Connection::run() { #if 0 kdWarning() << "Remove debug from z3950connection.cpp" << endl; { - QFile f1(QString::fromLatin1("/tmp/z3950.raw")); + TQFile f1(TQString::tqfromLatin1("/tmp/z3950.raw")); if(f1.open(IO_WriteOnly)) { - QDataStream t(&f1); + TQDataStream t(&f1); t << ZOOM_record_get(rec, "raw", &len); } f1.close(); @@ -302,7 +302,7 @@ void Z3950Connection::run() { data = toXML(ZOOM_record_get(rec, "raw", &len), m_sourceCharSet); } Z3950ResultFound* ev = new Z3950ResultFound(data); - QApplication::postEvent(m_fetcher, ev); + TQApplication::postEvent(m_fetcher, ev); } ZOOM_resultset_destroy(resultSet); @@ -342,8 +342,8 @@ bool Z3950Connection::makeConnection() { ZOOM_connection_destroy(d->conn); m_connected = false; - QString s = i18n("Connection error %1: %2").arg(errcode).arg(toString(errmsg)); - if(!QCString(addinfo).isEmpty()) { + TQString s = i18n("Connection error %1: %2").tqarg(errcode).tqarg(toString(errmsg)); + if(!TQCString(addinfo).isEmpty()) { s += " (" + toString(addinfo) + ")"; } myDebug() << "Z3950Connection::makeConnection() - " << s << endl; @@ -360,7 +360,7 @@ void Z3950Connection::done() { kapp->postEvent(m_fetcher, new Z3950ConnectionDone(m_hasMore)); } -void Z3950Connection::done(const QString& msg_, int type_) { +void Z3950Connection::done(const TQString& msg_, int type_) { checkPendingEvents(); if(m_aborted) { kapp->postEvent(m_fetcher, new Z3950ConnectionDone(m_hasMore)); @@ -377,17 +377,17 @@ void Z3950Connection::checkPendingEvents() { } inline -QCString Z3950Connection::toCString(const QString& text_) { - return iconvRun(text_.utf8(), QString::fromLatin1("utf-8"), m_sourceCharSet); +TQCString Z3950Connection::toCString(const TQString& text_) { + return iconvRun(text_.utf8(), TQString::tqfromLatin1("utf-8"), m_sourceCharSet); } inline -QString Z3950Connection::toString(const QCString& text_) { - return QString::fromUtf8(iconvRun(text_, m_sourceCharSet, QString::fromLatin1("utf-8"))); +TQString Z3950Connection::toString(const TQCString& text_) { + return TQString::fromUtf8(iconvRun(text_, m_sourceCharSet, TQString::tqfromLatin1("utf-8"))); } // static -QCString Z3950Connection::iconvRun(const QCString& text_, const QString& fromCharSet_, const QString& toCharSet_) { +TQCString Z3950Connection::iconvRun(const TQCString& text_, const TQString& fromCharSet_, const TQString& toCharSet_) { #ifdef HAVE_YAZ if(text_.isEmpty()) { return text_; @@ -400,12 +400,12 @@ QCString Z3950Connection::iconvRun(const QCString& text_, const QString& fromCha yaz_iconv_t cd = yaz_iconv_open(toCharSet_.latin1(), fromCharSet_.latin1()); if(!cd) { // maybe it's iso 5426, which we sorta support - QString charSetLower = fromCharSet_.lower(); + TQString charSetLower = fromCharSet_.lower(); charSetLower.remove('-').remove(' '); if(charSetLower == Latin1Literal("iso5426")) { - return iconvRun(Iso5426Converter::toUtf8(text_).utf8(), QString::fromLatin1("utf-8"), toCharSet_); + return iconvRun(Iso5426Converter::toUtf8(text_).utf8(), TQString::tqfromLatin1("utf-8"), toCharSet_); } else if(charSetLower == Latin1Literal("iso6937")) { - return iconvRun(Iso6937Converter::toUtf8(text_).utf8(), QString::fromLatin1("utf-8"), toCharSet_); + return iconvRun(Iso6937Converter::toUtf8(text_).utf8(), TQString::tqfromLatin1("utf-8"), toCharSet_); } kdWarning() << "Z3950Connection::iconvRun() - conversion from " << fromCharSet_ << " to " << toCharSet_ << " is unsupported" << endl; @@ -416,7 +416,7 @@ QCString Z3950Connection::iconvRun(const QCString& text_, const QString& fromCha size_t inlen = text_.length(); size_t outlen = 2 * inlen; // this is enough, right? - QMemArray<char> result0(outlen); + TQMemArray<char> result0(outlen); char* result = result0.data(); int r = yaz_iconv(cd, const_cast<char**>(&input), &inlen, &result, &outlen); @@ -430,7 +430,7 @@ QCString Z3950Connection::iconvRun(const QCString& text_, const QString& fromCha // length is pointer difference size_t len = result - result0; - QCString output = QCString(result0, len+1); + TQCString output = TQCString(result0, len+1); // myDebug() << "-------------------------------------------" << endl; // myDebug() << output << endl; // myDebug() << "-------------------------------------------" << endl; @@ -440,25 +440,25 @@ QCString Z3950Connection::iconvRun(const QCString& text_, const QString& fromCha return text_; } -QString Z3950Connection::toXML(const QCString& marc_, const QString& charSet_) { +TQString Z3950Connection::toXML(const TQCString& marc_, const TQString& charSet_) { #ifdef HAVE_YAZ if(marc_.isEmpty()) { myDebug() << "Z3950Connection::toXML() - empty string" << endl; - return QString::null; + return TQString(); } yaz_iconv_t cd = yaz_iconv_open("utf-8", charSet_.latin1()); if(!cd) { // maybe it's iso 5426, which we sorta support - QString charSetLower = charSet_.lower(); + TQString charSetLower = charSet_.lower(); charSetLower.remove('-').remove(' '); if(charSetLower == Latin1Literal("iso5426")) { - return toXML(Iso5426Converter::toUtf8(marc_).utf8(), QString::fromLatin1("utf-8")); + return toXML(Iso5426Converter::toUtf8(marc_).utf8(), TQString::tqfromLatin1("utf-8")); } else if(charSetLower == Latin1Literal("iso6937")) { - return toXML(Iso6937Converter::toUtf8(marc_).utf8(), QString::fromLatin1("utf-8")); + return toXML(Iso6937Converter::toUtf8(marc_).utf8(), TQString::tqfromLatin1("utf-8")); } kdWarning() << "Z3950Connection::toXML() - conversion from " << charSet_ << " is unsupported" << endl; - return QString::null; + return TQString(); } yaz_marc_t mt = yaz_marc_create(); @@ -474,7 +474,7 @@ QString Z3950Connection::toXML(const QCString& marc_, const QString& charSet_) { #endif if(ok && (len < 25 || len > 100000)) { myDebug() << "Z3950Connection::toXML() - bad length: " << (ok ? len : -1) << endl; - return QString::null; + return TQString(); } #if YAZ_VERSIONL < 0x030000 @@ -485,12 +485,12 @@ QString Z3950Connection::toXML(const QCString& marc_, const QString& charSet_) { int r = yaz_marc_decode_buf(mt, marc_, -1, &result, &len); if(r <= 0) { myDebug() << "Z3950Connection::toXML() - can't decode buffer" << endl; - return QString::null; + return TQString(); } - QString output = QString::fromLatin1("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); - output += QString::fromUtf8(QCString(result, len+1), len+1); -// myDebug() << QCString(result) << endl; + TQString output = TQString::tqfromLatin1("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + output += TQString::fromUtf8(TQCString(result, len+1), len+1); +// myDebug() << TQCString(result) << endl; // myDebug() << "-------------------------------------------" << endl; // myDebug() << output << endl; yaz_iconv_close(cd); @@ -498,6 +498,6 @@ QString Z3950Connection::toXML(const QCString& marc_, const QString& charSet_) { return output; #else // no yaz - return QString::null; + return TQString(); #endif } diff --git a/src/fetch/z3950connection.h b/src/fetch/z3950connection.h index 0929cb7..2c49c37 100644 --- a/src/fetch/z3950connection.h +++ b/src/fetch/z3950connection.h @@ -14,9 +14,9 @@ #ifndef TELLICO_FETCH_Z3950CONNECTION_H #define TELLICO_FETCH_Z3950CONNECTION_H -#include <qthread.h> -#include <qevent.h> -#include <qdeepcopy.h> +#include <tqthread.h> +#include <tqevent.h> +#include <tqdeepcopy.h> #include <ksharedptr.h> @@ -24,76 +24,76 @@ namespace Tellico { namespace Fetch { class Z3950Fetcher; -class Z3950ResultFound : public QCustomEvent { +class Z3950ResultFound : public TQCustomEvent { public: - Z3950ResultFound(const QString& s); + Z3950ResultFound(const TQString& s); ~Z3950ResultFound(); - const QString& result() const { return m_result; } + const TQString& result() const { return m_result; } static int uid() { return User + 11111; } private: - QString m_result; + TQString m_result; }; -class Z3950ConnectionDone : public QCustomEvent { +class Z3950ConnectionDone : public TQCustomEvent { public: - Z3950ConnectionDone(bool more) : QCustomEvent(uid()), m_type(-1), m_hasMore(more) {} - Z3950ConnectionDone(bool more, const QString& s, int t) : QCustomEvent(uid()), m_msg(QDeepCopy<QString>(s)), m_type(t), m_hasMore(more) {} + Z3950ConnectionDone(bool more) : TQCustomEvent(uid()), m_type(-1), m_hasMore(more) {} + Z3950ConnectionDone(bool more, const TQString& s, int t) : TQCustomEvent(uid()), m_msg(TQDeepCopy<TQString>(s)), m_type(t), m_hasMore(more) {} - const QString& message() const { return m_msg; } + const TQString& message() const { return m_msg; } int messageType() const { return m_type; } bool hasMoreResults() const { return m_hasMore; } static int uid() { return User + 22222; } private: - QString m_msg; + TQString m_msg; int m_type; bool m_hasMore; }; -class Z3950SyntaxChange : public QCustomEvent { +class Z3950SyntaxChange : public TQCustomEvent { public: - Z3950SyntaxChange(const QString& s) : QCustomEvent(uid()), m_syntax(QDeepCopy<QString>(s)) {} - const QString& syntax() const { return m_syntax; } + Z3950SyntaxChange(const TQString& s) : TQCustomEvent(uid()), m_syntax(TQDeepCopy<TQString>(s)) {} + const TQString& syntax() const { return m_syntax; } static int uid() { return User + 33333; } private: - QString m_syntax; + TQString m_syntax; }; /** * @author Robby Stephenson */ -class Z3950Connection : public QThread { +class Z3950Connection : public TQThread { public: Z3950Connection(Z3950Fetcher* fetcher, - const QString& host, + const TQString& host, uint port, - const QString& dbname, - const QString& sourceCharSet, - const QString& syntax, - const QString& esn); + const TQString& dbname, + const TQString& sourceCharSet, + const TQString& syntax, + const TQString& esn); ~Z3950Connection(); void reset(); - void setQuery(const QString& query); - void setUserPassword(const QString& user, const QString& pword); + void setQuery(const TQString& query); + void setUserPassword(const TQString& user, const TQString& pword); void run(); void abort() { m_aborted = true; } private: - static QCString iconvRun(const QCString& text, const QString& fromCharSet, const QString& toCharSet); - static QString toXML(const QCString& marc, const QString& fromCharSet); + static TQCString iconvRun(const TQCString& text, const TQString& fromCharSet, const TQString& toCharSet); + static TQString toXML(const TQCString& marc, const TQString& fromCharSet); bool makeConnection(); void done(); - void done(const QString& message, int type); - QCString toCString(const QString& text); - QString toString(const QCString& text); + void done(const TQString& message, int type); + TQCString toCString(const TQString& text); + TQString toString(const TQCString& text); void checkPendingEvents(); class Private; @@ -103,15 +103,15 @@ private: bool m_aborted; KSharedPtr<Z3950Fetcher> m_fetcher; - QString m_host; + TQString m_host; uint m_port; - QString m_dbname; - QString m_user; - QString m_password; - QString m_sourceCharSet; - QString m_syntax; - QString m_pqn; - QString m_esn; + TQString m_dbname; + TQString m_user; + TQString m_password; + TQString m_sourceCharSet; + TQString m_syntax; + TQString m_pqn; + TQString m_esn; size_t m_start; size_t m_limit; bool m_hasMore; diff --git a/src/fetch/z3950fetcher.cpp b/src/fetch/z3950fetcher.cpp index 5e045cf..465df5c 100644 --- a/src/fetch/z3950fetcher.cpp +++ b/src/fetch/z3950fetcher.cpp @@ -46,21 +46,21 @@ #include <kaccelmanager.h> #include <kseparator.h> -#include <qfile.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> -#include <qdom.h> +#include <tqfile.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqdom.h> namespace { static const int Z3950_DEFAULT_PORT = 210; - static const QString Z3950_DEFAULT_ESN = QString::fromLatin1("F"); + static const TQString Z3950_DEFAULT_ESN = TQString::tqfromLatin1("F"); } using Tellico::Fetch::Z3950Fetcher; -Z3950Fetcher::Z3950Fetcher(QObject* parent_, const char* name_) - : Fetcher(parent_, name_), m_conn(0), m_port(Z3950_DEFAULT_PORT), m_esn(Z3950_DEFAULT_ESN), +Z3950Fetcher::Z3950Fetcher(TQObject* tqparent_, const char* name_) + : Fetcher(tqparent_, name_), m_conn(0), m_port(Z3950_DEFAULT_PORT), m_esn(Z3950_DEFAULT_ESN), m_started(false), m_done(true), m_MARC21XMLHandler(0), m_UNIMARCXMLHandler(0), m_MODSHandler(0) { } @@ -76,11 +76,11 @@ Z3950Fetcher::~Z3950Fetcher() { m_conn = 0; } -QString Z3950Fetcher::defaultName() { +TQString Z3950Fetcher::defaultName() { return i18n("z39.50 Server"); } -QString Z3950Fetcher::source() const { +TQString Z3950Fetcher::source() const { return m_name.isEmpty() ? defaultName() : m_name; } @@ -89,7 +89,7 @@ bool Z3950Fetcher::canFetch(int type) const { } void Z3950Fetcher::readConfigHook(const KConfigGroup& config_) { - QString preset = config_.readEntry("Preset"); + TQString preset = config_.readEntry("Preset"); if(preset.isEmpty()) { m_host = config_.readEntry("Host"); int p = config_.readNumEntry("Port", Z3950_DEFAULT_PORT); @@ -103,16 +103,16 @@ void Z3950Fetcher::readConfigHook(const KConfigGroup& config_) { m_password = config_.readEntry("Password"); } else { m_preset = preset; - QString serverFile = locate("appdata", QString::fromLatin1("z3950-servers.cfg")); + TQString serverFile = locate("appdata", TQString::tqfromLatin1("z3950-servers.cfg")); if(!serverFile.isEmpty()) { KConfig cfg(serverFile, true /* read-only */, false /* read KDE */); - const QStringList servers = cfg.groupList(); - for(QStringList::ConstIterator server = servers.begin(); server != servers.end(); ++server) { + const TQStringList servers = cfg.groupList(); + for(TQStringList::ConstIterator server = servers.begin(); server != servers.end(); ++server) { cfg.setGroup(*server); - const QString id = *server; + const TQString id = *server; if(id == preset) { - const QString name = cfg.readEntry("Name"); + const TQString name = cfg.readEntry("Name"); m_host = cfg.readEntry("Host"); m_port = cfg.readNumEntry("Port", Z3950_DEFAULT_PORT); m_dbname = cfg.readEntry("Database"); @@ -133,7 +133,7 @@ void Z3950Fetcher::saveConfigHook(KConfigGroup& config_) { config_.sync(); } -void Z3950Fetcher::search(FetchKey key_, const QString& value_) { +void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { #ifdef HAVE_YAZ m_started = true; m_done = false; @@ -146,43 +146,43 @@ void Z3950Fetcher::search(FetchKey key_, const QString& value_) { m_value = value_; m_started = true; - QString svalue = m_value; - QRegExp rx1(QString::fromLatin1("['\"].*\\1")); + TQString svalue = m_value; + TQRegExp rx1(TQString::tqfromLatin1("['\"].*\\1")); if(!rx1.exactMatch(svalue)) { svalue.prepend('"').append('"'); } switch(key_) { case Title: - m_pqn = QString::fromLatin1("@attr 1=4 ") + svalue; + m_pqn = TQString::tqfromLatin1("@attr 1=4 ") + svalue; break; case Person: -// m_pqn = QString::fromLatin1("@or "); -// m_pqn += QString::fromLatin1("@attr 1=1 \"") + m_value + '"'; - m_pqn = QString::fromLatin1(" @attr 1=1003 ") + svalue; +// m_pqn = TQString::tqfromLatin1("@or "); +// m_pqn += TQString::tqfromLatin1("@attr 1=1 \"") + m_value + '"'; + m_pqn = TQString::tqfromLatin1(" @attr 1=1003 ") + svalue; break; case ISBN: { m_pqn.truncate(0); - QString s = m_value; + TQString s = m_value; s.remove('-'); - QStringList isbnList = QStringList::split(QString::fromLatin1("; "), s); + TQStringList isbnList = TQStringList::split(TQString::tqfromLatin1("; "), s); // also going to search for isbn10 values - for(QStringList::Iterator it = isbnList.begin(); it != isbnList.end(); ++it) { - if((*it).startsWith(QString::fromLatin1("978"))) { - QString isbn10 = ISBNValidator::isbn10(*it); + for(TQStringList::Iterator it = isbnList.begin(); it != isbnList.end(); ++it) { + if((*it).startsWith(TQString::tqfromLatin1("978"))) { + TQString isbn10 = ISBNValidator::isbn10(*it); isbn10.remove('-'); isbnList.insert(it, isbn10); } } const int count = isbnList.count(); if(count > 1) { - m_pqn = QString::fromLatin1("@or "); + m_pqn = TQString::tqfromLatin1("@or "); } for(int i = 0; i < count; ++i) { - m_pqn += QString::fromLatin1(" @attr 1=7 ") + isbnList[i]; + m_pqn += TQString::tqfromLatin1(" @attr 1=7 ") + isbnList[i]; if(i < count-2) { - m_pqn += QString::fromLatin1(" @or"); + m_pqn += TQString::tqfromLatin1(" @or"); } } } @@ -190,21 +190,21 @@ void Z3950Fetcher::search(FetchKey key_, const QString& value_) { case LCCN: { m_pqn.truncate(0); - QString s = m_value; + TQString s = m_value; s.remove('-'); - QStringList lccnList = QStringList::split(QString::fromLatin1("; "), s); + TQStringList lccnList = TQStringList::split(TQString::tqfromLatin1("; "), s); while(!lccnList.isEmpty()) { - m_pqn += QString::fromLatin1(" @or @attr 1=9 ") + lccnList.front(); + m_pqn += TQString::tqfromLatin1(" @or @attr 1=9 ") + lccnList.front(); if(lccnList.count() > 1) { - m_pqn += QString::fromLatin1(" @or"); + m_pqn += TQString::tqfromLatin1(" @or"); } - m_pqn += QString::fromLatin1(" @attr 1=9 ") + LCCNValidator::formalize(lccnList.front()); + m_pqn += TQString::tqfromLatin1(" @attr 1=9 ") + LCCNValidator::formalize(lccnList.front()); lccnList.pop_front(); } } break; case Keyword: - m_pqn = QString::fromLatin1("@attr 1=1016 ") + svalue; + m_pqn = TQString::tqfromLatin1("@attr 1=1016 ") + svalue; break; case Raw: m_pqn = m_value; @@ -214,7 +214,7 @@ void Z3950Fetcher::search(FetchKey key_, const QString& value_) { stop(); return; } -// m_pqn = QString::fromLatin1("@attr 1=7 0253333490"); +// m_pqn = TQString::tqfromLatin1("@attr 1=7 0253333490"); myLog() << "Z3950Fetcher::search() - PQN query = " << m_pqn << endl; if(m_conn) { @@ -256,7 +256,7 @@ bool Z3950Fetcher::initMARC21Handler() { return true; } - QString xsltfile = locate("appdata", QString::fromLatin1("MARC21slim2MODS3.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("MARC21slim2MODS3.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "Z3950Fetcher::initHandlers() - can not locate MARC21slim2MODS3.xsl." << endl; return false; @@ -280,7 +280,7 @@ bool Z3950Fetcher::initUNIMARCHandler() { return true; } - QString xsltfile = locate("appdata", QString::fromLatin1("UNIMARC2MODS3.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("UNIMARC2MODS3.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "Z3950Fetcher::initHandlers() - can not locate UNIMARC2MODS3.xsl." << endl; return false; @@ -304,7 +304,7 @@ bool Z3950Fetcher::initMODSHandler() { return true; } - QString xsltfile = locate("appdata", QString::fromLatin1("mods2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("mods2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "Z3950Fetcher::initHandlers() - can not locate mods2tellico.xsl." << endl; return false; @@ -342,7 +342,7 @@ void Z3950Fetcher::process() { m_conn->start(); } -void Z3950Fetcher::handleResult(const QString& result_) { +void Z3950Fetcher::handleResult(const TQString& result_) { if(result_.isEmpty()) { myDebug() << "Z3950Fetcher::handleResult() - empty record found, maybe the character encoding or record format is wrong?" << endl; return; @@ -351,18 +351,18 @@ void Z3950Fetcher::handleResult(const QString& result_) { #if 0 kdWarning() << "Remove debug from z3950fetcher.cpp" << endl; { - QFile f1(QString::fromLatin1("/tmp/marc.xml")); + TQFile f1(TQString::tqfromLatin1("/tmp/marc.xml")); if(f1.open(IO_WriteOnly)) { // if(f1.open(IO_WriteOnly | IO_Append)) { - QTextStream t(&f1); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f1); + t.setEncoding(TQTextStream::UnicodeUTF8); t << result_; } f1.close(); } #endif // assume always utf-8 - QString str, msg; + TQString str, msg; Data::CollPtr coll = 0; // not marc, has to be grs-1 if(m_syntax == Latin1Literal("grs-1")) { @@ -385,11 +385,11 @@ void Z3950Fetcher::handleResult(const QString& result_) { #if 0 kdWarning() << "Remove debug from z3950fetcher.cpp" << endl; { - QFile f2(QString::fromLatin1("/tmp/mods.xml")); + TQFile f2(TQString::tqfromLatin1("/tmp/mods.xml")); // if(f2.open(IO_WriteOnly)) { if(f2.open(IO_WriteOnly | IO_Append)) { - QTextStream t(&f2); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&f2); + t.setEncoding(TQTextStream::UnicodeUTF8); t << str; } f2.close(); @@ -416,21 +416,21 @@ void Z3950Fetcher::handleResult(const QString& result_) { const StringMap customFields = Z3950Fetcher::customFields(); for(StringMap::ConstIterator it = customFields.begin(); it != customFields.end(); ++it) { - if(!m_fields.contains(it.key())) { + if(!m_fields.tqcontains(it.key())) { coll->removeField(it.key()); } } Data::EntryVec entries = coll->entries(); for(Data::EntryVec::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - QString desc = entry->field(QString::fromLatin1("author")) + '/' - + entry->field(QString::fromLatin1("publisher")); - if(!entry->field(QString::fromLatin1("cr_year")).isEmpty()) { - desc += QChar('/') + entry->field(QString::fromLatin1("cr_year")); - } else if(!entry->field(QString::fromLatin1("pub_year")).isEmpty()){ - desc += QChar('/') + entry->field(QString::fromLatin1("pub_year")); + TQString desc = entry->field(TQString::tqfromLatin1("author")) + '/' + + entry->field(TQString::tqfromLatin1("publisher")); + if(!entry->field(TQString::tqfromLatin1("cr_year")).isEmpty()) { + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("cr_year")); + } else if(!entry->field(TQString::tqfromLatin1("pub_year")).isEmpty()){ + desc += TQChar('/') + entry->field(TQString::tqfromLatin1("pub_year")); } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, entry); emit signalResultFound(r); } @@ -445,7 +445,7 @@ Tellico::Data::EntryPtr Z3950Fetcher::fetchEntry(uint uid_) { return m_entries[uid_]; } -void Z3950Fetcher::customEvent(QCustomEvent* event_) { +void Z3950Fetcher::customEvent(TQCustomEvent* event_) { if(!m_conn) { return; } @@ -480,20 +480,20 @@ void Z3950Fetcher::customEvent(QCustomEvent* event_) { void Z3950Fetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "Z3950Fetcher::updateEntry() - " << source() << ": " << entry_->title() << endl; - QString isbn = entry_->field(QString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - QString lccn = entry_->field(QString::fromLatin1("lccn")); + TQString lccn = entry_->field(TQString::tqfromLatin1("lccn")); if(!lccn.isEmpty()) { search(Fetch::LCCN, lccn); return; } // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -503,123 +503,123 @@ void Z3950Fetcher::updateEntry(Data::EntryPtr entry_) { emit signalDone(this); // always need to emit this if not continuing with the search } -Tellico::Fetch::ConfigWidget* Z3950Fetcher::configWidget(QWidget* parent_) const { - return new Z3950Fetcher::ConfigWidget(parent_, this); +Tellico::Fetch::ConfigWidget* Z3950Fetcher::configWidget(TQWidget* tqparent_) const { + return new Z3950Fetcher::ConfigWidget(tqparent_, this); } -Z3950Fetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const Z3950Fetcher* fetcher_/*=0*/) - : Fetch::ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget(), 7, 2); +Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const Z3950Fetcher* fetcher_/*=0*/) + : Fetch::ConfigWidget(tqparent_) { + TQGridLayout* l = new TQGridLayout(optionsWidget(), 7, 2); l->setSpacing(4); l->setColStretch(1, 10); int row = -1; - m_usePreset = new QCheckBox(i18n("Use preset &server:"), optionsWidget()); + m_usePreset = new TQCheckBox(i18n("Use preset &server:"), optionsWidget()); l->addWidget(m_usePreset, ++row, 0); - connect(m_usePreset, SIGNAL(toggled(bool)), SLOT(slotTogglePreset(bool))); + connect(m_usePreset, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotTogglePreset(bool))); m_serverCombo = new GUI::ComboBox(optionsWidget()); - connect(m_serverCombo, SIGNAL(activated(int)), SLOT(slotPresetChanged())); + connect(m_serverCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotPresetChanged())); l->addWidget(m_serverCombo, row, 1); ++row; l->addMultiCellWidget(new KSeparator(optionsWidget()), row, row, 0, 1); l->setRowSpacing(row, 10); - QLabel* label = new QLabel(i18n("Hos&t: "), optionsWidget()); + TQLabel* label = new TQLabel(i18n("Hos&t: "), optionsWidget()); l->addWidget(label, ++row, 0); m_hostEdit = new GUI::LineEdit(optionsWidget()); - connect(m_hostEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); - connect(m_hostEdit, SIGNAL(textChanged(const QString&)), SIGNAL(signalName(const QString&))); + connect(m_hostEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); + connect(m_hostEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SIGNAL(signalName(const TQString&))); l->addWidget(m_hostEdit, row, 1); - QString w = i18n("Enter the host name of the server."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_hostEdit, w); + TQString w = i18n("Enter the host name of the server."); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_hostEdit, w); label->setBuddy(m_hostEdit); - label = new QLabel(i18n("&Port: "), optionsWidget()); + label = new TQLabel(i18n("&Port: "), optionsWidget()); l->addWidget(label, ++row, 0); m_portSpinBox = new KIntSpinBox(0, 999999, 1, Z3950_DEFAULT_PORT, 10, optionsWidget()); - connect(m_portSpinBox, SIGNAL(valueChanged(int)), SLOT(slotSetModified())); + connect(m_portSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_portSpinBox, row, 1); - w = i18n("Enter the port number of the server. The default is %1.").arg(Z3950_DEFAULT_PORT); - QWhatsThis::add(label, w); - QWhatsThis::add(m_portSpinBox, w); + w = i18n("Enter the port number of the server. The default is %1.").tqarg(Z3950_DEFAULT_PORT); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_portSpinBox, w); label->setBuddy(m_portSpinBox); - label = new QLabel(i18n("&Database: "), optionsWidget()); + label = new TQLabel(i18n("&Database: "), optionsWidget()); l->addWidget(label, ++row, 0); m_databaseEdit = new GUI::LineEdit(optionsWidget()); - connect(m_databaseEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_databaseEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_databaseEdit, row, 1); w = i18n("Enter the database name used by the server."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_databaseEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_databaseEdit, w); label->setBuddy(m_databaseEdit); - label = new QLabel(i18n("Ch&aracter set: "), optionsWidget()); + label = new TQLabel(i18n("Ch&aracter set: "), optionsWidget()); l->addWidget(label, ++row, 0); m_charSetCombo = new KComboBox(true, optionsWidget()); - m_charSetCombo->insertItem(QString::null); - m_charSetCombo->insertItem(QString::fromLatin1("marc8")); - m_charSetCombo->insertItem(QString::fromLatin1("iso-8859-1")); - m_charSetCombo->insertItem(QString::fromLatin1("utf-8")); - connect(m_charSetCombo, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + m_charSetCombo->insertItem(TQString()); + m_charSetCombo->insertItem(TQString::tqfromLatin1("marc8")); + m_charSetCombo->insertItem(TQString::tqfromLatin1("iso-8859-1")); + m_charSetCombo->insertItem(TQString::tqfromLatin1("utf-8")); + connect(m_charSetCombo, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_charSetCombo, row, 1); w = i18n("Enter the character set encoding used by the z39.50 server. The most likely choice " "is MARC-8, although ISO-8859-1 is common as well."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_charSetCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_charSetCombo, w); label->setBuddy(m_charSetCombo); - label = new QLabel(i18n("&Format: "), optionsWidget()); + label = new TQLabel(i18n("&Format: "), optionsWidget()); l->addWidget(label, ++row, 0); m_syntaxCombo = new GUI::ComboBox(optionsWidget()); - m_syntaxCombo->insertItem(i18n("Auto-detect"), QString()); - m_syntaxCombo->insertItem(QString::fromLatin1("MODS"), QString::fromLatin1("mods")); - m_syntaxCombo->insertItem(QString::fromLatin1("MARC21"), QString::fromLatin1("marc21")); - m_syntaxCombo->insertItem(QString::fromLatin1("UNIMARC"), QString::fromLatin1("unimarc")); - m_syntaxCombo->insertItem(QString::fromLatin1("USMARC"), QString::fromLatin1("usmarc")); - m_syntaxCombo->insertItem(QString::fromLatin1("GRS-1"), QString::fromLatin1("grs-1")); - connect(m_syntaxCombo, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + m_syntaxCombo->insertItem(i18n("Auto-detect"), TQString()); + m_syntaxCombo->insertItem(TQString::tqfromLatin1("MODS"), TQString::tqfromLatin1("mods")); + m_syntaxCombo->insertItem(TQString::tqfromLatin1("MARC21"), TQString::tqfromLatin1("marc21")); + m_syntaxCombo->insertItem(TQString::tqfromLatin1("UNIMARC"), TQString::tqfromLatin1("unimarc")); + m_syntaxCombo->insertItem(TQString::tqfromLatin1("USMARC"), TQString::tqfromLatin1("usmarc")); + m_syntaxCombo->insertItem(TQString::tqfromLatin1("GRS-1"), TQString::tqfromLatin1("grs-1")); + connect(m_syntaxCombo, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_syntaxCombo, row, 1); w = i18n("Enter the data format used by the z39.50 server. Tellico will attempt to " "automatically detect the best setting if <i>auto-detect</i> is selected."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_syntaxCombo, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_syntaxCombo, w); label->setBuddy(m_syntaxCombo); - label = new QLabel(i18n("&User: "), optionsWidget()); + label = new TQLabel(i18n("&User: "), optionsWidget()); l->addWidget(label, ++row, 0); m_userEdit = new GUI::LineEdit(optionsWidget()); m_userEdit->setHint(i18n("Optional")); - connect(m_userEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + connect(m_userEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_userEdit, row, 1); w = i18n("Enter the authentication user name used by the z39.50 database. Most servers " "do not need one."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_userEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_userEdit, w); label->setBuddy(m_userEdit); - label = new QLabel(i18n("Pass&word: "), optionsWidget()); + label = new TQLabel(i18n("Pass&word: "), optionsWidget()); l->addWidget(label, ++row, 0); m_passwordEdit = new GUI::LineEdit(optionsWidget()); m_passwordEdit->setHint(i18n("Optional")); - m_passwordEdit->setEchoMode(QLineEdit::Password); - connect(m_passwordEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); + m_passwordEdit->setEchoMode(TQLineEdit::Password); + connect(m_passwordEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_passwordEdit, row, 1); w = i18n("Enter the authentication password used by the z39.50 database. Most servers " "do not need one. The password will be saved in plain text in the Tellico " "configuration file."); - QWhatsThis::add(label, w); - QWhatsThis::add(m_passwordEdit, w); + TQWhatsThis::add(label, w); + TQWhatsThis::add(m_passwordEdit, w); label->setBuddy(m_passwordEdit); l->setRowStretch(++row, 1); // now add additional fields widget - addFieldsWidget(Z3950Fetcher::customFields(), fetcher_ ? fetcher_->m_fields : QStringList()); + addFieldsWidget(Z3950Fetcher::customFields(), fetcher_ ? fetcher_->m_fields : TQStringList()); - loadPresets(fetcher_ ? fetcher_->m_preset : QString::null); + loadPresets(fetcher_ ? fetcher_->m_preset : TQString()); if(fetcher_) { m_hostEdit->setText(fetcher_->m_host); m_portSpinBox->setValue(fetcher_->m_port); @@ -646,13 +646,13 @@ Z3950Fetcher::ConfigWidget::~ConfigWidget() { void Z3950Fetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { if(m_usePreset->isChecked()) { - QString presetID = m_serverCombo->currentData().toString(); + TQString presetID = m_serverCombo->currentData().toString(); config_.writeEntry("Preset", presetID); return; } config_.deleteEntry("Preset"); - QString s = m_hostEdit->text().stripWhiteSpace(); + TQString s = m_hostEdit->text().stripWhiteSpace(); if(!s.isEmpty()) { config_.writeEntry("Host", s); } @@ -689,9 +689,9 @@ void Z3950Fetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { // static Tellico::StringMap Z3950Fetcher::customFields() { StringMap map; - map[QString::fromLatin1("address")] = i18n("Address"); - map[QString::fromLatin1("abstract")] = i18n("Abstract"); - map[QString::fromLatin1("illustrator")] = i18n("Illustrator"); + map[TQString::tqfromLatin1("address")] = i18n("Address"); + map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); + map[TQString::tqfromLatin1("illustrator")] = i18n("Illustrator"); return map; } @@ -719,15 +719,15 @@ void Z3950Fetcher::ConfigWidget::slotPresetChanged() { emit signalName(m_serverCombo->currentText()); } -void Z3950Fetcher::ConfigWidget::loadPresets(const QString& current_) { - QString lang = KGlobal::locale()->languageList().first(); - QString lang2A; +void Z3950Fetcher::ConfigWidget::loadPresets(const TQString& current_) { + TQString lang = KGlobal::locale()->languageList().first(); + TQString lang2A; { - QString dummy; + TQString dummy; KGlobal::locale()->splitLocale(lang, lang2A, dummy, dummy); } - QString serverFile = locate("appdata", QString::fromLatin1("z3950-servers.cfg")); + TQString serverFile = locate("appdata", TQString::tqfromLatin1("z3950-servers.cfg")); if(serverFile.isEmpty()) { kdWarning() << "Z3950Fetcher::loadPresets() - no z3950 servers file found" << endl; return; @@ -736,30 +736,30 @@ void Z3950Fetcher::ConfigWidget::loadPresets(const QString& current_) { int idx = -1; KConfig cfg(serverFile, true /* read-only */, false /* read KDE */); - const QStringList servers = cfg.groupList(); + const TQStringList servers = cfg.groupList(); // I want the list of servers sorted by name - QMap<QString, QString> serverNameMap; - for(QStringList::ConstIterator server = servers.constBegin(); server != servers.constEnd(); ++server) { + TQMap<TQString, TQString> serverNameMap; + for(TQStringList::ConstIterator server = servers.constBegin(); server != servers.constEnd(); ++server) { if((*server).isEmpty()) { myDebug() << "Z3950Fetcher::ConfigWidget::loadPresets() - empty id" << endl; continue; } cfg.setGroup(*server); - const QString name = cfg.readEntry("Name"); + const TQString name = cfg.readEntry("Name"); if(!name.isEmpty()) { serverNameMap.insert(name, *server); } } - for(QMap<QString, QString>::ConstIterator it = serverNameMap.constBegin(); it != serverNameMap.constEnd(); ++it) { - const QString name = it.key(); - const QString id = it.data(); + for(TQMap<TQString, TQString>::ConstIterator it = serverNameMap.constBegin(); it != serverNameMap.constEnd(); ++it) { + const TQString name = it.key(); + const TQString id = it.data(); cfg.setGroup(id); m_serverCombo->insertItem(i18n(name.utf8()), id); if(current_.isEmpty() && idx == -1) { // set the initial selection to something depending on the language - const QStringList locales = cfg.readListEntry("Locale"); - if(locales.findIndex(lang) > -1 || locales.findIndex(lang2A) > -1) { + const TQStringList locales = cfg.readListEntry("Locale"); + if(locales.tqfindIndex(lang) > -1 || locales.tqfindIndex(lang2A) > -1) { idx = m_serverCombo->count() - 1; } } else if(id == current_) { @@ -771,11 +771,11 @@ void Z3950Fetcher::ConfigWidget::loadPresets(const QString& current_) { } } -QString Z3950Fetcher::ConfigWidget::preferredName() const { +TQString Z3950Fetcher::ConfigWidget::preferredName() const { if(m_usePreset->isChecked()) { return m_serverCombo->currentText(); } - QString s = m_hostEdit->text(); + TQString s = m_hostEdit->text(); return s.isEmpty() ? i18n("z39.50 Server") : s; } diff --git a/src/fetch/z3950fetcher.h b/src/fetch/z3950fetcher.h index ec6dca0..a183871 100644 --- a/src/fetch/z3950fetcher.h +++ b/src/fetch/z3950fetcher.h @@ -39,7 +39,7 @@ class KComboBox; #include "configwidget.h" #include "../datavectors.h" -#include <qguardedptr.h> +#include <tqguardedptr.h> namespace Tellico { namespace Fetch { @@ -50,15 +50,16 @@ namespace Tellico { */ class Z3950Fetcher : public Fetcher { Q_OBJECT + TQ_OBJECT public: - Z3950Fetcher(QObject* parent, const char* name = 0); + Z3950Fetcher(TQObject* tqparent, const char* name = 0); virtual ~Z3950Fetcher(); - virtual QString source() const; + virtual TQString source() const; virtual bool isSearching() const { return m_started; } - virtual void search(FetchKey key, const QString& value); + virtual void search(FetchKey key, const TQString& value); virtual void continueSearch(); // can search title, person, isbn, or keyword. No UPC or Raw for now. virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == ISBN || k == Keyword || k == LCCN; } @@ -70,72 +71,73 @@ public: virtual void saveConfigHook(KConfigGroup& config); virtual void updateEntry(Data::EntryPtr entry); - const QString& host() const { return m_host; } + const TQString& host() const { return m_host; } static StringMap customFields(); - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const; + virtual Fetch::ConfigWidget* configWidget(TQWidget* tqparent) const; class ConfigWidget; friend class ConfigWidget; - static QString defaultName(); + static TQString defaultName(); protected: - virtual void customEvent(QCustomEvent* event); + virtual void customEvent(TQCustomEvent* event); private: bool initMARC21Handler(); bool initUNIMARCHandler(); bool initMODSHandler(); void process(); - void handleResult(const QString& result); + void handleResult(const TQString& result); void done(); Z3950Connection* m_conn; - QString m_host; + TQString m_host; uint m_port; - QString m_dbname; - QString m_user; - QString m_password; - QString m_sourceCharSet; - QString m_syntax; - QString m_pqn; // prefix query notation - QString m_esn; // element set name + TQString m_dbname; + TQString m_user; + TQString m_password; + TQString m_sourceCharSet; + TQString m_syntax; + TQString m_pqn; // prefix query notation + TQString m_esn; // element set name FetchKey m_key; - QString m_value; - QMap<int, Data::EntryPtr> m_entries; + TQString m_value; + TQMap<int, Data::EntryPtr> m_entries; bool m_started; bool m_done; - QString m_preset; + TQString m_preset; XSLTHandler* m_MARC21XMLHandler; XSLTHandler* m_UNIMARCXMLHandler; XSLTHandler* m_MODSHandler; - QStringList m_fields; + TQStringList m_fields; friend class Z3950Connection; }; class Z3950Fetcher::ConfigWidget : public Fetch::ConfigWidget { Q_OBJECT + TQ_OBJECT public: - ConfigWidget(QWidget* parent, const Z3950Fetcher* fetcher = 0); + ConfigWidget(TQWidget* tqparent, const Z3950Fetcher* fetcher = 0); virtual ~ConfigWidget(); virtual void saveConfig(KConfigGroup& config_); - virtual QString preferredName() const; + virtual TQString preferredName() const; private slots: void slotTogglePreset(bool on); void slotPresetChanged(); private: - void loadPresets(const QString& current); + void loadPresets(const TQString& current); - QCheckBox* m_usePreset; + TQCheckBox* m_usePreset; GUI::ComboBox* m_serverCombo; GUI::LineEdit* m_hostEdit; KIntSpinBox* m_portSpinBox; @@ -145,7 +147,7 @@ private: KComboBox* m_charSetCombo; GUI::ComboBox* m_syntaxCombo; // have to remember syntax - QString m_syntax; + TQString m_syntax; }; } // end namespace |