diff options
Diffstat (limited to 'src/fetch')
27 files changed, 891 insertions, 891 deletions
diff --git a/src/fetch/amazonfetcher.cpp b/src/fetch/amazonfetcher.cpp index 9484581..e5f50b8 100644 --- a/src/fetch/amazonfetcher.cpp +++ b/src/fetch/amazonfetcher.cpp @@ -37,12 +37,12 @@ #include <kaccelmanager.h> #include <tqdom.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqwhatsthis.h> #include <tqcheckbox.h> #include <tqfile.h> -#include <textcodec.h> +#include <tqtextcodec.h> namespace { static const int AMAZON_RETURNS_PER_REQUEST = 10; @@ -84,8 +84,8 @@ const AmazonFetcher::SiteData& AmazonFetcher::siteData(int site_) { AmazonFetcher::AmazonFetcher(Site site_, TQObject* parent_, const char* name_) : Fetcher(parent_, name_), m_xsltHandler(0), m_site(site_), m_imageSize(MediumImage), - m_access(TQString::fromLatin1(AMAZON_ACCESS_KEY)), - m_assoc(TQString::fromLatin1(AMAZON_ASSOC_TOKEN)), m_addLinkField(true), m_limit(AMAZON_MAX_RETURNS_TOTAL), + 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; } @@ -125,7 +125,7 @@ void AmazonFetcher::readConfigHook(const KConfigGroup& config_) { if(imageSize > -1) { m_imageSize = static_cast<ImageSize>(imageSize); } - m_fields = config_.readListEntry("Custom Fields", TQString::fromLatin1("keyword")); + m_fields = config_.readListEntry("Custom Fields", TQString::tqfromLatin1("keyword")); } void AmazonFetcher::search(FetchKey key_, const TQString& value_) { @@ -153,34 +153,34 @@ void AmazonFetcher::doSearch() { const SiteData& data = siteData(m_site); KURL u = data.url; - u.addQueryItem(TQString::fromLatin1("Service"), TQString::fromLatin1("AWSECommerceService")); - u.addQueryItem(TQString::fromLatin1("AssociateTag"), m_assoc); - u.addQueryItem(TQString::fromLatin1("AWSAccessKeyId"), m_access); - u.addQueryItem(TQString::fromLatin1("Operation"), TQString::fromLatin1("ItemSearch")); - u.addQueryItem(TQString::fromLatin1("ResponseGroup"), TQString::fromLatin1("Large")); - u.addQueryItem(TQString::fromLatin1("ItemPage"), TQString::number(m_page)); - u.addQueryItem(TQString::fromLatin1("Version"), TQString::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(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("Books")); - u.addQueryItem(TQString::fromLatin1("SortIndex"), TQString::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(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("Music")); + u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Music")); break; case Data::Collection::Video: - u.addQueryItem(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("Video")); - u.addQueryItem(TQString::fromLatin1("SortIndex"), TQString::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(TQString::fromLatin1("SearchIndex"), TQString::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; } @@ -207,40 +207,40 @@ void AmazonFetcher::doSearch() { switch(m_key) { case Title: - u.addQueryItem(TQString::fromLatin1("Title"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Title"), value, mib); break; case Person: if(type == Data::Collection::Video) { - u.addQueryItem(TQString::fromLatin1("Actor"), value, mib); - u.addQueryItem(TQString::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(TQString::fromLatin1("Artist"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Artist"), value, mib); } else if(type == Data::Collection::Game) { - u.addQueryItem(TQString::fromLatin1("Manufacturer"), value, mib); + u.addQueryItem(TQString::tqfromLatin1("Manufacturer"), value, mib); } else { // books and bibtex - TQString s = TQString::fromLatin1("author:%1 or publisher:%2").arg(value, value); -// u.addQueryItem(TQString::fromLatin1("Author"), value, mib); -// u.addQueryItem(TQString::fromLatin1("Publisher"), value, mib); - u.addQueryItem(TQString::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(TQString::fromLatin1("Operation")); - u.addQueryItem(TQString::fromLatin1("Operation"), TQString::fromLatin1("ItemLookup")); + u.removeQueryItem(TQString::tqfromLatin1("Operation")); + u.addQueryItem(TQString::tqfromLatin1("Operation"), TQString::tqfromLatin1("ItemLookup")); TQString s = m_value; // not encValue!!! s.remove('-'); // ISBN only get digits or 'X', and multiple values are connected with "; " - TQStringList isbns = TQStringList::split(TQString::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(TQStringList::Iterator it = isbns.begin(); it != isbns.end(); ) { - if(m_value.startsWith(TQString::fromLatin1("979"))) { + 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 @@ -260,40 +260,40 @@ void AmazonFetcher::doSearch() { } } // the default search is by ASIN, which prohibits SearchIndex - u.removeQueryItem(TQString::fromLatin1("SearchIndex")); + u.removeQueryItem(TQString::tqfromLatin1("SearchIndex")); } // limit to first 10 while(isbns.size() > 10) { isbns.pop_back(); } - u.addQueryItem(TQString::fromLatin1("ItemId"), isbns.join(TQString::fromLatin1(","))); + u.addQueryItem(TQString::tqfromLatin1("ItemId"), isbns.join(TQString::tqfromLatin1(","))); if(isbn13) { - u.addQueryItem(TQString::fromLatin1("IdType"), TQString::fromLatin1("EAN")); + u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("EAN")); } } break; case UPC: { - u.removeQueryItem(TQString::fromLatin1("Operation")); - u.addQueryItem(TQString::fromLatin1("Operation"), TQString::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(TQString::fromLatin1("IdType"), TQString::fromLatin1("UPC")); + u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("UPC")); } else { - u.addQueryItem(TQString::fromLatin1("IdType"), TQString::fromLatin1("EAN")); + u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("EAN")); } TQString s = m_value; // not encValue!!! s.remove('-'); // limit to first 10 - s.replace(TQString::fromLatin1("; "), TQString::fromLatin1(",")); + s.replace(TQString::tqfromLatin1("; "), TQString::tqfromLatin1(",")); s = s.section(',', 0, 9); - u.addQueryItem(TQString::fromLatin1("ItemId"), s); + u.addQueryItem(TQString::tqfromLatin1("ItemId"), s); } break; case Keyword: - u.addQueryItem(TQString::fromLatin1("Keywords"), m_value, mib); + u.addQueryItem(TQString::tqfromLatin1("Keywords"), m_value, mib); break; case Raw: @@ -357,7 +357,7 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from amazonfetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test%1.xml").arg(m_page)); + TQFile f(TQString::tqfromLatin1("/tmp/test%1.xml").tqarg(m_page)); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -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 - TQDomNode n = dom.documentElement().namedItem(TQString::fromLatin1("Items")) - .namedItem(TQString::fromLatin1("TotalResults")); + 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(TQString::fromLatin1("Items")) - .namedItem(TQString::fromLatin1("Request")) - .namedItem(TQString::fromLatin1("Errors")); + n = dom.documentElement().namedItem(TQString::tqfromLatin1("Items")) + .namedItem(TQString::tqfromLatin1("Request")) + .namedItem(TQString::tqfromLatin1("Errors")); e = n.toElement(); if(!e.isNull()) { - TQDomNodeList nodes = e.elementsByTagName(TQString::fromLatin1("Error")); + TQDomNodeList nodes = e.elementsByTagName(TQString::tqfromLatin1("Error")); for(uint i = 0; i < nodes.count(); ++i) { - e = nodes.item(i).toElement().namedItem(TQString::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 - TQDomNode isValidNode = n.parentNode().namedItem(TQString::fromLatin1("IsValid")); + TQDomNode isValidNode = n.parentNode().namedItem(TQString::tqfromLatin1("IsValid")); if(m_key == ISBN && isValidNode.toElement().text().lower() == Latin1Literal("true")) { continue; } - e = nodes.item(i).toElement().namedItem(TQString::fromLatin1("Message")).toElement(); + e = nodes.item(i).toElement().namedItem(TQString::tqfromLatin1("Message")).toElement(); if(!e.isNull()) { errors << e.text(); } @@ -417,7 +417,7 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { } } -// TQRegExp stripHTML(TQString::fromLatin1("<.*>"), true); +// TQRegExp stripHTML(TQString::tqfromLatin1("<.*>"), true); // stripHTML.setMinimal(true); // assume amazon is always utf-8 @@ -432,7 +432,7 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { if(!m_addLinkField) { // remove amazon field if it's not to be added - coll->removeField(TQString::fromLatin1("amazon")); + coll->removeField(TQString::tqfromLatin1("amazon")); } Data::EntryVec entries = coll->entries(); @@ -460,24 +460,24 @@ 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) { - TQRegExp rx(TQString::fromLatin1("\\.([^\\s])")); - TQStringList values = entry->fields(TQString::fromLatin1("author"), false); + TQRegExp rx(TQString::tqfromLatin1("\\.([^\\s])")); + TQStringList values = entry->fields(TQString::tqfromLatin1("author"), false); for(TQStringList::Iterator it = values.begin(); it != values.end(); ++it) { - (*it).replace(rx, TQString::fromLatin1(". \\1")); + (*it).replace(rx, TQString::tqfromLatin1(". \\1")); } - entry->setField(TQString::fromLatin1("author"), values.join(TQString::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) { - TQRegExp rx(TQString::fromLatin1("\\[(\\d{4})\\]")); + TQRegExp rx(TQString::tqfromLatin1("\\[(\\d{4})\\]")); TQString t = entry->title(); if(t.find(rx) > -1) { TQString y = rx.cap(1); t.remove(rx).simplifyWhiteSpace(); - entry->setField(TQString::fromLatin1("title"), t); - if(entry->field(TQString::fromLatin1("year")).isEmpty()) { - entry->setField(TQString::fromLatin1("year"), y); + entry->setField(TQString::tqfromLatin1("title"), t); + if(entry->field(TQString::tqfromLatin1("year")).isEmpty()) { + entry->setField(TQString::tqfromLatin1("year"), y); } } } @@ -487,37 +487,37 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { case Data::Collection::Book: case Data::Collection::ComicBook: case Data::Collection::Bibtex: - desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("cr_year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::fromLatin1("cr_year")); - } else if(!entry->field(TQString::fromLatin1("pub_year")).isEmpty()){ - desc += TQChar('/') + entry->field(TQString::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(TQString::fromLatin1("studio")) + desc = entry->field(TQString::tqfromLatin1("studio")) + TQChar('/') - + entry->field(TQString::fromLatin1("director")) + + entry->field(TQString::tqfromLatin1("director")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")) + + entry->field(TQString::tqfromLatin1("year")) + TQChar('/') - + entry->field(TQString::fromLatin1("medium")); + + entry->field(TQString::tqfromLatin1("medium")); break; case Data::Collection::Album: - desc = entry->field(TQString::fromLatin1("artist")) + desc = entry->field(TQString::tqfromLatin1("artist")) + TQChar('/') - + entry->field(TQString::fromLatin1("label")) + + entry->field(TQString::tqfromLatin1("label")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Game: - desc = entry->field(TQString::fromLatin1("platform")) + desc = entry->field(TQString::tqfromLatin1("platform")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + 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) { - TQString plot = entry->field(TQString::fromLatin1("plot")); + TQString plot = entry->field(TQString::tqfromLatin1("plot")); plot.remove(stripHTML); - entry->setField(TQString::fromLatin1("plot"), plot); + entry->setField(TQString::tqfromLatin1("plot"), plot); } else if(coll->type() == Data::Collection::Game) { - TQString desc = entry->field(TQString::fromLatin1("description")); + TQString desc = entry->field(TQString::tqfromLatin1("description")); desc.remove(stripHTML); - entry->setField(TQString::fromLatin1("description"), desc); + entry->setField(TQString::tqfromLatin1("description"), desc); } else { - TQString comments = entry->field(TQString::fromLatin1("comments")); + TQString comments = entry->field(TQString::tqfromLatin1("comments")); comments.remove(stripHTML); - entry->setField(TQString::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(TQString::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; @@ -559,7 +559,7 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) { 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(); @@ -595,7 +595,7 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { case Data::Collection::ComicBook: case Data::Collection::Bibtex: { - const TQString keywords = TQString::fromLatin1("keyword"); + const TQString keywords = TQString::tqfromLatin1("keyword"); TQStringList oldWords = entry->fields(keywords, false); StringSet words; for(TQStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { @@ -607,26 +607,26 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { *it2 == Latin1Literal("Par prix") || // french stuff *it2 == Latin1Literal("Divers") || // french stuff (*it2).startsWith(TQChar('(')) || - (*it2).startsWith(TQString::fromLatin1("Authors"))) { + (*it2).startsWith(TQString::tqfromLatin1("Authors"))) { continue; } words.add(*it2); } } - entry->setField(keywords, words.toList().join(TQString::fromLatin1("; "))); + entry->setField(keywords, words.toList().join(TQString::tqfromLatin1("; "))); } - entry->setField(TQString::fromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("comments")))); + entry->setField(TQString::tqfromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("comments")))); break; case Data::Collection::Video: { - const TQString genres = TQString::fromLatin1("genre"); + 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(TQStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { - if((*it).find(TQString::fromLatin1("Genres")) == -1) { + if((*it).find(TQString::tqfromLatin1("Genres")) == -1) { continue; } @@ -643,27 +643,27 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { break; // we're done } } - entry->setField(genres, words.toList().join(TQString::fromLatin1("; "))); + entry->setField(genres, words.toList().join(TQString::tqfromLatin1("; "))); // language tracks get duplicated, too - TQStringList langs = entry->fields(TQString::fromLatin1("language"), false); + TQStringList langs = entry->fields(TQString::tqfromLatin1("language"), false); words.clear(); for(TQStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it) { words.add(*it); } - entry->setField(TQString::fromLatin1("language"), words.toList().join(TQString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("language"), words.toList().join(TQString::tqfromLatin1("; "))); } - entry->setField(TQString::fromLatin1("plot"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("plot")))); + entry->setField(TQString::tqfromLatin1("plot"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("plot")))); break; case Data::Collection::Album: { - const TQString genres = TQString::fromLatin1("genre"); + 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(TQStringList::Iterator it = oldWords.begin(); it != oldWords.end(); ++it) { - if((*it).find(TQString::fromLatin1("Styles")) == -1) { + if((*it).find(TQString::tqfromLatin1("Styles")) == -1) { continue; } @@ -682,13 +682,13 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { } } } - entry->setField(genres, words.toList().join(TQString::fromLatin1("; "))); + entry->setField(genres, words.toList().join(TQString::tqfromLatin1("; "))); } - entry->setField(TQString::fromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("comments")))); + entry->setField(TQString::tqfromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("comments")))); break; case Data::Collection::Game: - entry->setField(TQString::fromLatin1("description"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("description")))); + entry->setField(TQString::tqfromLatin1("description"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("description")))); break; } @@ -697,7 +697,7 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { // also sometimes table fields have rows but no values Data::FieldVec fields = entry->collection()->fields(); - TQRegExp blank(TQString::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; @@ -710,13 +710,13 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { KURL imageURL; switch(m_imageSize) { case SmallImage: - imageURL = entry->field(TQString::fromLatin1("small-image")); + imageURL = entry->field(TQString::tqfromLatin1("small-image")); break; case MediumImage: - imageURL = entry->field(TQString::fromLatin1("medium-image")); + imageURL = entry->field(TQString::tqfromLatin1("medium-image")); break; case LargeImage: - imageURL = entry->field(TQString::fromLatin1("large-image")); + imageURL = entry->field(TQString::tqfromLatin1("large-image")); break; case NoImage: default: @@ -730,19 +730,19 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) { 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(TQString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } // don't want to show image urls in the fetch dialog - entry->setField(TQString::fromLatin1("small-image"), TQString()); - entry->setField(TQString::fromLatin1("medium-image"), TQString()); - entry->setField(TQString::fromLatin1("large-image"), TQString()); + 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() { - TQString xsltfile = locate("appdata", TQString::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) { - TQString isbn = entry_->field(TQString::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) { - TQString a = entry_->field(TQString::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 - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -794,9 +794,9 @@ 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 - TQRegExp rx(TQString::fromLatin1("[\\(\\[](.*)[\\)\\]]")); + TQRegExp rx(TQString::tqfromLatin1("[\\(\\[](.*)[\\)\\]]")); rx.setMinimal(true); - TQString title = entry->field(TQString::fromLatin1("title")); + TQString title = entry->field(TQString::tqfromLatin1("title")); int pos = rx.search(title); while(pos > -1) { if(parseTitleToken(entry, rx.cap(1))) { @@ -805,30 +805,30 @@ void AmazonFetcher::parseTitle(Data::EntryPtr entry, int collType) { } pos = rx.search(title, pos+1); } - entry->setField(TQString::fromLatin1("title"), title.stripWhiteSpace()); + entry->setField(TQString::tqfromLatin1("title"), title.stripWhiteSpace()); } 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(TQString::fromLatin1("widescreen"), 0, false /* case-insensitive*/) > -1 || + if(token.find(TQString::tqfromLatin1("widescreen"), 0, false /* case-insensitive*/) > -1 || token.find(i18n("Widescreen"), 0, false) > -1) { - entry->setField(TQString::fromLatin1("widescreen"), TQString::fromLatin1("true")); + entry->setField(TQString::tqfromLatin1("widescreen"), TQString::tqfromLatin1("true")); // res = true; leave it in the title - } else if(token.find(TQString::fromLatin1("full screen"), 0, false) > -1) { + } else if(token.find(TQString::tqfromLatin1("full screen"), 0, false) > -1) { // skip, but go ahead and remove from title res = true; } - if(token.find(TQString::fromLatin1("blu-ray"), 0, false) > -1) { - entry->setField(TQString::fromLatin1("medium"), i18n("Blu-ray")); + if(token.find(TQString::tqfromLatin1("blu-ray"), 0, false) > -1) { + entry->setField(TQString::tqfromLatin1("medium"), i18n("Blu-ray")); res = true; - } else if(token.find(TQString::fromLatin1("hd dvd"), 0, false) > -1) { - entry->setField(TQString::fromLatin1("medium"), i18n("HD DVD")); + } else if(token.find(TQString::tqfromLatin1("hd dvd"), 0, false) > -1) { + entry->setField(TQString::tqfromLatin1("medium"), i18n("HD DVD")); res = true; } - if(token.find(TQString::fromLatin1("director's cut"), 0, false) > -1 || + if(token.find(TQString::tqfromLatin1("director's cut"), 0, false) > -1 || token.find(i18n("Director's Cut"), 0, false) > -1) { - entry->setField(TQString::fromLatin1("directors-cut"), TQString::fromLatin1("true")); + entry->setField(TQString::tqfromLatin1("directors-cut"), TQString::tqfromLatin1("true")); // res = true; leave it in the title } return res; @@ -896,7 +896,7 @@ AmazonFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const AmazonFetcher m_assocEdit->setText(fetcher_->m_assoc); m_imageCombo->setCurrentData(fetcher_->m_imageSize); } else { // defaults - m_assocEdit->setText(TQString::fromLatin1(AMAZON_ASSOC_TOKEN)); + m_assocEdit->setText(TQString::tqfromLatin1(AMAZON_ASSOC_TOKEN)); m_imageCombo->setCurrentData(MediumImage); } @@ -930,7 +930,7 @@ void AmazonFetcher::ConfigWidget::slotSiteChanged() { //static Tellico::StringMap AmazonFetcher::customFields() { StringMap map; - map[TQString::fromLatin1("keyword")] = i18n("Keywords"); + map[TQString::tqfromLatin1("keyword")] = i18n("Keywords"); return map; } diff --git a/src/fetch/animenfofetcher.cpp b/src/fetch/animenfofetcher.cpp index bd4460c..8a938a4 100644 --- a/src/fetch/animenfofetcher.cpp +++ b/src/fetch/animenfofetcher.cpp @@ -27,7 +27,7 @@ #include <kio/job.h> #include <tqregexp.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqfile.h> @@ -44,7 +44,7 @@ AnimeNfoFetcher::AnimeNfoFetcher(TQObject* parent_, const char* name_ /*=0*/) } TQString AnimeNfoFetcher::defaultName() { - return TQString::fromLatin1("AnimeNfo.com"); + return TQString::tqfromLatin1("AnimeNfo.com"); } TQString AnimeNfoFetcher::source() const { @@ -64,22 +64,22 @@ void AnimeNfoFetcher::search(FetchKey key_, const TQString& value_) { m_matches.clear(); #ifdef ANIMENFO_TEST - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/animenfo.html")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/animenfo.html")); #else - KURL u(TQString::fromLatin1(ANIMENFO_BASE_URL)); - u.addQueryItem(TQString::fromLatin1("action"), TQString::fromLatin1("Go")); - u.addQueryItem(TQString::fromLatin1("option"), TQString::fromLatin1("keywords")); - u.addQueryItem(TQString::fromLatin1("queryin"), TQString::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(TQString::fromLatin1("query"), value_); + u.addQueryItem(TQString::tqfromLatin1("query"), value_); break; default: @@ -135,11 +135,11 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { TQString s = Tellico::decodeHTML(TQString(m_data)); - TQRegExp infoRx(TQString::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); - TQRegExp anchorRx(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); anchorRx.setMinimal(true); - TQRegExp yearRx(TQString::fromLatin1("\\d{4}"), false); + TQRegExp yearRx(TQString::tqfromLatin1("\\d{4}"), false); // search page comes in groups of threes int n = 0; @@ -151,9 +151,9 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { emit signalResultFound(r); #ifdef ANIMENFO_TEST - KURL url = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/animetitle.html")); + KURL url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/animetitle.html")); #else - KURL url(TQString::fromLatin1(ANIMENFO_BASE_URL), u); + KURL url(TQString::tqfromLatin1(ANIMENFO_BASE_URL), u); url.setQuery(TQString()); #endif m_matches.insert(r->uid, url); @@ -189,7 +189,7 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { if(!u.isEmpty()) { SearchResult* r = new SearchResult(this, t, y, TQString()); emit signalResultFound(r); - KURL url(TQString::fromLatin1(ANIMENFO_BASE_URL), u); + KURL url(TQString::tqfromLatin1(ANIMENFO_BASE_URL), u); url.setQuery(TQString()); m_matches.insert(r->uid, url); } @@ -218,7 +218,7 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { #if 0 kdWarning() << "Remove debug from animenfofetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.html")); + TQFile f(TQString::tqfromLatin1("/tmp/test.html")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -239,13 +239,13 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { // myDebug() << "AnimeNfoFetcher::parseEntry()" << endl; // class might be anime_info_top - TQRegExp infoRx(TQString::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); - TQRegExp tagRx(TQString::fromLatin1("<.*>")); + TQRegExp tagRx(TQString::tqfromLatin1("<.*>")); tagRx.setMinimal(true); - TQRegExp anchorRx(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); anchorRx.setMinimal(true); - TQRegExp jsRx(TQString::fromLatin1("<script.*</script>"), false); + TQRegExp jsRx(TQString::tqfromLatin1("<script.*</script>"), false); jsRx.setMinimal(true); TQString s = str_; @@ -254,32 +254,32 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { Data::CollPtr coll = new Data::VideoCollection(true); // add new fields - Data::FieldPtr f = new Data::Field(TQString::fromLatin1("origtitle"), i18n("Original Title")); + Data::FieldPtr f = new Data::Field(TQString::tqfromLatin1("origtitle"), i18n("Original Title")); coll->addField(f); - f = new Data::Field(TQString::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(TQString::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(TQString::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 TQMap<TQString, TQString> fieldMap; - fieldMap.insert(TQString::fromLatin1("Title"), TQString::fromLatin1("title")); - fieldMap.insert(TQString::fromLatin1("Japanese Title"), TQString::fromLatin1("origtitle")); - fieldMap.insert(TQString::fromLatin1("Total Episodes"), TQString::fromLatin1("episodes")); - fieldMap.insert(TQString::fromLatin1("Genres"), TQString::fromLatin1("genre")); - fieldMap.insert(TQString::fromLatin1("Year Published"), TQString::fromLatin1("year")); - fieldMap.insert(TQString::fromLatin1("Studio"), TQString::fromLatin1("studio")); - fieldMap.insert(TQString::fromLatin1("US Distribution"), TQString::fromLatin1("distributor")); + 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); @@ -292,8 +292,8 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { value = value.simplifyWhiteSpace(); if(value.length() > 2) { // might be "-" if(key == Latin1Literal("Genres")) { - entry->setField(fieldMap[key], TQStringList::split(TQRegExp(TQString::fromLatin1("\\s*,\\s*")), - value).join(TQString::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 TQString& str_) { } // image - TQRegExp imgRx(TQString::fromLatin1("<img\\s+[^>]*src\\s*=\\s*[\"']([^>]*)[\"']\\s+[^>]*alt\\s*=\\s*[\"']%1[\"']") - .arg(entry->field(TQString::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(TQString::fromLatin1(ANIMENFO_BASE_URL), imgRx.cap(1)); + KURL imgURL(TQString::tqfromLatin1(ANIMENFO_BASE_URL), imgRx.cap(1)); TQString id = ImageFactory::addImage(imgURL, true); if(!id.isEmpty()) { - entry->setField(TQString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } // now look for alternative titles and plot - const TQString a = TQString::fromLatin1("Alternative titles"); + const TQString a = TQString::tqfromLatin1("Alternative titles"); pos = s.find(a, oldpos+1, false); if(pos > -1) { pos += a.length(); } int pos2 = -1; if(pos > -1) { - pos2 = s.find(TQString::fromLatin1("Description"), pos+1, true); + pos2 = s.find(TQString::tqfromLatin1("Description"), pos+1, true); if(pos2 > -1) { value = s.mid(pos, pos2-pos).remove(tagRx).simplifyWhiteSpace(); - entry->setField(TQString::fromLatin1("alttitle"), value); + entry->setField(TQString::tqfromLatin1("alttitle"), value); } } - TQRegExp descRx(TQString::fromLatin1("class\\s*=\\s*[\"']description[\"'][^>]*>(.*)<"), false); + TQRegExp descRx(TQString::tqfromLatin1("class\\s*=\\s*[\"']description[\"'][^>]*>(.*)<"), false); descRx.setMinimal(true); pos = descRx.search(s, TQMAX(pos, pos2)); if(pos > -1) { - entry->setField(TQString::fromLatin1("plot"), descRx.cap(1).simplifyWhiteSpace()); + entry->setField(TQString::tqfromLatin1("plot"), descRx.cap(1).simplifyWhiteSpace()); } return entry; } void AnimeNfoFetcher::updateEntry(Data::EntryPtr entry_) { - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Keyword, t); return; diff --git a/src/fetch/arxivfetcher.cpp b/src/fetch/arxivfetcher.cpp index 4d76bd1..6586d94 100644 --- a/src/fetch/arxivfetcher.cpp +++ b/src/fetch/arxivfetcher.cpp @@ -29,7 +29,7 @@ #include <tqdom.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> //#define ARXIV_TEST @@ -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; } @@ -140,7 +140,7 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from arxivfetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -164,8 +164,8 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { return; } // total is top level element, with attribute totalResultsAvailable - TQDomNodeList list = dom.elementsByTagNameNS(TQString::fromLatin1("http://a9.com/-/spec/opensearch/1.1/"), - TQString::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(); } @@ -188,13 +188,13 @@ void ArxivFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::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(TQString::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(TQString::fromLatin1("url")).isEmpty()) { + if(!entry->field(TQString::tqfromLatin1("url")).isEmpty()) { Data::CollPtr coll = entry->collection(); - Data::FieldPtr field = coll->fieldByName(TQString::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(TQString::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()) { - TQPixmap pix = NetAccess::filePreview(entry->field(TQString::fromLatin1("url"))); + TQPixmap pix = NetAccess::filePreview(entry->field(TQString::tqfromLatin1("url"))); if(!pix.isNull()) { - TQString id = ImageFactory::addImage(pix, TQString::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() { - TQString xsltfile = locate("appdata", TQString::fromLatin1("arxiv2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("arxiv2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "ArxivFetcher::initXSLTHandler() - can not locate arxiv2tellico.xsl." << endl; return; @@ -250,33 +250,33 @@ void ArxivFetcher::initXSLTHandler() { } KURL ArxivFetcher::searchURL(FetchKey key_, const TQString& value_) const { - KURL u(TQString::fromLatin1(ARXIV_BASE_URL)); - u.addQueryItem(TQString::fromLatin1("start"), TQString::number(m_start)); - u.addQueryItem(TQString::fromLatin1("max_results"), TQString::number(ARXIV_RETURNS_PER_REQUEST)); + 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 TQString quotedValue = '"' + value_ + '"'; switch(key_) { case Title: - u.addQueryItem(TQString::fromLatin1("search_query"), TQString::fromLatin1("ti:%1").arg(quotedValue)); + u.addQueryItem(TQString::tqfromLatin1("search_query"), TQString::tqfromLatin1("ti:%1").tqarg(quotedValue)); break; case Person: - u.addQueryItem(TQString::fromLatin1("search_query"), TQString::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(TQString::fromLatin1("search_query"), TQString::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 TQString value = value_; - value.remove(TQRegExp(TQString::fromLatin1("^arxiv:"), false)); - value.remove(TQRegExp(TQString::fromLatin1("v\\d+$"))); - u.addQueryItem(TQString::fromLatin1("search_query"), TQString::fromLatin1("id:%1").arg(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 TQString& value_) const { } #ifdef ARXIV_TEST - u = KURL::fromPathOrURL(TQString::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_) { - TQString id = entry_->field(TQString::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 - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -314,7 +314,7 @@ void ArxivFetcher::updateEntrySynchronous(Data::EntryPtr entry) { if(!entry) { return; } - TQString arxiv = entry->field(TQString::fromLatin1("arxiv")); + TQString arxiv = entry->field(TQString::tqfromLatin1("arxiv")); if(arxiv.isEmpty()) { return; } @@ -340,8 +340,8 @@ void ArxivFetcher::updateEntrySynchronous(Data::EntryPtr entry) { 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(TQString::fromLatin1("arxiv"), - coll->entries().front()->field(TQString::fromLatin1("arxiv"))); + entry->setField(TQString::tqfromLatin1("arxiv"), + coll->entries().front()->field(TQString::tqfromLatin1("arxiv"))); } } diff --git a/src/fetch/bibsonomyfetcher.cpp b/src/fetch/bibsonomyfetcher.cpp index 9a4e130..a6fd18a 100644 --- a/src/fetch/bibsonomyfetcher.cpp +++ b/src/fetch/bibsonomyfetcher.cpp @@ -25,7 +25,7 @@ #include <klocale.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> namespace { // always bibtex @@ -43,7 +43,7 @@ BibsonomyFetcher::~BibsonomyFetcher() { } TQString BibsonomyFetcher::defaultName() { - return TQString::fromLatin1("Bibsonomy"); + return TQString::tqfromLatin1("Bibsonomy"); } TQString BibsonomyFetcher::source() const { @@ -63,7 +63,7 @@ void BibsonomyFetcher::search(FetchKey key_, const TQString& value_) { 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; } @@ -136,13 +136,13 @@ void BibsonomyFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::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(TQString::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); } @@ -155,16 +155,16 @@ Tellico::Data::EntryPtr BibsonomyFetcher::fetchEntry(uint uid_) { } KURL BibsonomyFetcher::searchURL(FetchKey key_, const TQString& value_) const { - KURL u(TQString::fromLatin1(BIBSONOMY_BASE_URL)); - u.setPath(TQString::fromLatin1("/bib/")); + KURL u(TQString::tqfromLatin1(BIBSONOMY_BASE_URL)); + u.setPath(TQString::tqfromLatin1("/bib/")); switch(key_) { case Person: - u.addPath(TQString::fromLatin1("author/%1").arg(value_)); + u.addPath(TQString::tqfromLatin1("author/%1").tqarg(value_)); break; case Keyword: - u.addPath(TQString::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 TQString& value_) const { return KURL(); } - u.addQueryItem(TQString::fromLatin1("items"), TQString::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_) { - TQString title = entry_->field(TQString::fromLatin1("title")); + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { search(Fetch::Keyword, title); return; diff --git a/src/fetch/citebasefetcher.cpp b/src/fetch/citebasefetcher.cpp index 610d539..744950e 100644 --- a/src/fetch/citebasefetcher.cpp +++ b/src/fetch/citebasefetcher.cpp @@ -25,7 +25,7 @@ #include <klocale.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> // #define CITEBASE_TEST @@ -44,7 +44,7 @@ CitebaseFetcher::~CitebaseFetcher() { } TQString CitebaseFetcher::defaultName() { - return TQString::fromLatin1("Citebase"); + return TQString::tqfromLatin1("Citebase"); } TQString CitebaseFetcher::source() const { @@ -64,7 +64,7 @@ void CitebaseFetcher::search(FetchKey key_, const TQString& value_) { 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; } @@ -124,7 +124,7 @@ void CitebaseFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from citebasefetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.bib")); + TQFile f(TQString::tqfromLatin1("/tmp/test.bib")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -148,13 +148,13 @@ void CitebaseFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::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(TQString::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); } @@ -167,16 +167,16 @@ Tellico::Data::EntryPtr CitebaseFetcher::fetchEntry(uint uid_) { } KURL CitebaseFetcher::searchURL(FetchKey key_, const TQString& value_) const { - KURL u(TQString::fromLatin1(CITEBASE_BASE_URL)); + KURL u(TQString::tqfromLatin1(CITEBASE_BASE_URL)); switch(key_) { case ArxivID: { // remove prefix and/or version number TQString value = value_; - value.remove(TQRegExp(TQString::fromLatin1("^arxiv:"), false)); - value.remove(TQRegExp(TQString::fromLatin1("v\\d+$"))); - u.addQueryItem(TQString::fromLatin1("rft_id"), TQString::fromLatin1("oai:arXiv.org:%1").arg(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 TQString& value_) const { } #ifdef CITEBASE_TEST - u = KURL::fromPathOrURL(TQString::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_) { - TQString arxiv = entry_->field(TQString::fromLatin1("arxiv")); + TQString arxiv = entry_->field(TQString::tqfromLatin1("arxiv")); if(!arxiv.isEmpty()) { search(Fetch::ArxivID, arxiv); return; @@ -207,7 +207,7 @@ void CitebaseFetcher::updateEntrySynchronous(Data::EntryPtr entry) { if(!entry) { return; } - TQString arxiv = entry->field(TQString::fromLatin1("arxiv")); + TQString arxiv = entry->field(TQString::tqfromLatin1("arxiv")); if(arxiv.isEmpty()) { return; } diff --git a/src/fetch/configwidget.cpp b/src/fetch/configwidget.cpp index 24a1bc5..f67c39a 100644 --- a/src/fetch/configwidget.cpp +++ b/src/fetch/configwidget.cpp @@ -18,7 +18,7 @@ #include <kaccelmanager.h> #include <tqvgroupbox.h> -#include <layout.h> +#include <tqlayout.h> using Tellico::Fetch::ConfigWidget; @@ -38,7 +38,7 @@ void ConfigWidget::addFieldsWidget(const StringMap& customFields_, const TQStrin } TQVGroupBox* box = new TQVGroupBox(i18n("Available Fields"), this); - static_cast<TQBoxLayout*>(layout())->addWidget(box); + static_cast<TQBoxLayout*>(tqlayout())->addWidget(box); for(StringMap::ConstIterator it = customFields_.begin(); it != customFields_.end(); ++it) { TQCheckBox* cb = new TQCheckBox(it.data(), box); m_fields.insert(it.key(), cb); @@ -60,7 +60,7 @@ void ConfigWidget::saveFieldsConfig(KConfigGroup& config_) const { fields << it.currentKey(); } } - config_.writeEntry(TQString::fromLatin1("Custom Fields"), fields); + config_.writeEntry(TQString::tqfromLatin1("Custom Fields"), fields); } #include "configwidget.moc" diff --git a/src/fetch/crossreffetcher.cpp b/src/fetch/crossreffetcher.cpp index d888902..2969e60 100644 --- a/src/fetch/crossreffetcher.cpp +++ b/src/fetch/crossreffetcher.cpp @@ -31,7 +31,7 @@ #include <tqlabel.h> #include <tqwhatsthis.h> -#include <layout.h> +#include <tqlayout.h> #include <tqfile.h> // #define CROSSREF_TEST @@ -54,7 +54,7 @@ CrossRefFetcher::~CrossRefFetcher() { } TQString CrossRefFetcher::defaultName() { - return TQString::fromLatin1("CrossRef"); + return TQString::tqfromLatin1("CrossRef"); } TQString CrossRefFetcher::source() const { @@ -82,13 +82,13 @@ void CrossRefFetcher::search(FetchKey key_, const TQString& value_) { 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; } @@ -148,7 +148,7 @@ void CrossRefFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from crossreffetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -182,13 +182,13 @@ void CrossRefFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::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(TQString::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(TQString::fromLatin1("url")).isEmpty()) { + if(!entry->field(TQString::tqfromLatin1("url")).isEmpty()) { Data::CollPtr coll = entry->collection(); - Data::FieldPtr field = coll->fieldByName(TQString::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(TQString::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()) { - TQPixmap pix = NetAccess::filePreview(entry->field(TQString::fromLatin1("url"))); + TQPixmap pix = NetAccess::filePreview(entry->field(TQString::tqfromLatin1("url"))); if(!pix.isNull()) { - TQString id = ImageFactory::addImage(pix, TQString::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 - TQString xsltfile = locate("appdata", TQString::fromLatin1("unixref2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("unixref2tellico.xsl")); #else - TQString xsltfile = locate("appdata", TQString::fromLatin1("crossref2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("crossref2tellico.xsl")); #endif if(xsltfile.isEmpty()) { kdWarning() << "CrossRefFetcher::initXSLTHandler() - can not locate xslt file." << endl; @@ -246,15 +246,15 @@ void CrossRefFetcher::initXSLTHandler() { } KURL CrossRefFetcher::searchURL(FetchKey key_, const TQString& value_) const { - KURL u(TQString::fromLatin1(CROSSREF_BASE_URL)); + KURL u(TQString::tqfromLatin1(CROSSREF_BASE_URL)); #ifdef CROSSREF_USE_UNIXREF - u.addQueryItem(TQString::fromLatin1("format"), TQString::fromLatin1("unixref")); + u.addQueryItem(TQString::tqfromLatin1("format"), TQString::tqfromLatin1("unixref")); #endif - u.addQueryItem(TQString::fromLatin1("req_dat"), TQString::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(TQString::fromLatin1("rft_id"), TQString::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 TQString& value_) const { } #ifdef CROSSREF_TEST - u = KURL::fromPathOrURL(TQString::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_) { - TQString doi = entry_->field(TQString::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 - TQString t = entry_->field(TQString::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,7 +298,7 @@ void CrossRefFetcher::updateEntrySynchronous(Data::EntryPtr entry) { myDebug() << "CrossRefFetcher::updateEntrySynchronous() - username and password is required" << endl; return; } - TQString doi = entry->field(TQString::fromLatin1("doi")); + TQString doi = entry->field(TQString::tqfromLatin1("doi")); if(doi.isEmpty()) { return; } @@ -347,7 +347,7 @@ CrossRefFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const CrossRefFet ++row; l->addMultiCellWidget(al, row, row, 0, 1); // richtext gets weird with size - al->setMinimumWidth(al->sizeHint().width()); + al->setMinimumWidth(al->tqsizeHint().width()); TQLabel* label = new TQLabel(i18n("&Username: "), optionsWidget()); l->addWidget(label, ++row, 0); diff --git a/src/fetch/discogsfetcher.cpp b/src/fetch/discogsfetcher.cpp index c8c1de8..13341f6 100644 --- a/src/fetch/discogsfetcher.cpp +++ b/src/fetch/discogsfetcher.cpp @@ -28,7 +28,7 @@ #include <kio/job.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> #include <tqfile.h> #include <tqwhatsthis.h> @@ -45,7 +45,7 @@ using Tellico::Fetch::DiscogsFetcher; DiscogsFetcher::DiscogsFetcher(TQObject* parent_, const char* name_) : Fetcher(parent_, name_), m_xsltHandler(0), m_limit(DISCOGS_MAX_RETURNS_TOTAL), m_job(0), m_started(false), - m_apiKey(TQString::fromLatin1(DISCOGS_API_KEY)) { + m_apiKey(TQString::tqfromLatin1(DISCOGS_API_KEY)) { } DiscogsFetcher::~DiscogsFetcher() { @@ -89,31 +89,31 @@ void DiscogsFetcher::continueSearch() { } void DiscogsFetcher::doSearch() { - KURL u(TQString::fromLatin1(DISCOGS_API_URL)); - u.addQueryItem(TQString::fromLatin1("f"), TQString::fromLatin1("xml")); - u.addQueryItem(TQString::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(TQString::fromLatin1("/search")); - u.addQueryItem(TQString::fromLatin1("q"), m_value); - u.addQueryItem(TQString::fromLatin1("type"), TQString::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(TQString::fromLatin1("/artist/%1").arg(m_value)); + u.setPath(TQString::tqfromLatin1("/artist/%1").tqarg(m_value)); break; case Keyword: - u.setPath(TQString::fromLatin1("/search")); - u.addQueryItem(TQString::fromLatin1("q"), m_value); - u.addQueryItem(TQString::fromLatin1("type"), TQString::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,7 +123,7 @@ void DiscogsFetcher::doSearch() { } #ifdef DISCOGS_TEST - u = KURL(TQString::fromLatin1("/home/robby/discogs-results.xml")); + u = KURL(TQString::tqfromLatin1("/home/robby/discogs-results.xml")); #endif // myDebug() << "DiscogsFetcher::search() - url: " << u.url() << endl; @@ -168,7 +168,7 @@ void DiscogsFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from discogsfetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -192,11 +192,11 @@ void DiscogsFetcher::slotComplete(KIO::Job* job_) { return; } // total is /resp/searchresults/@numResults - TQDomNode n = dom.documentElement().namedItem(TQString::fromLatin1("resp")) - .namedItem(TQString::fromLatin1("searchresults")); + TQDomNode n = dom.documentElement().namedItem(TQString::tqfromLatin1("resp")) + .namedItem(TQString::tqfromLatin1("searchresults")); TQDomElement e = n.toElement(); if(!e.isNull()) { - m_total = e.attribute(TQString::fromLatin1("numResults")).toInt(); + m_total = e.attribute(TQString::tqfromLatin1("numResults")).toInt(); myDebug() << "total = " << m_total; } } @@ -218,9 +218,9 @@ void DiscogsFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("artist")) + TQString desc = entry->field(TQString::tqfromLatin1("artist")) + TQChar('/') - + entry->field(TQString::fromLatin1("label")); + + entry->field(TQString::tqfromLatin1("label")); SearchResult* r = new SearchResult(this, entry->title(), desc, TQString()); m_entries.insert(r->uid, Data::EntryPtr(entry)); @@ -241,24 +241,24 @@ 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(TQString::fromLatin1("cover")).isEmpty()) { + if(!entry->field(TQString::tqfromLatin1("cover")).isEmpty()) { myLog() << "DiscogsFetcher::fetchEntry() - already downloaded " << entry->title() << endl; return entry; } - TQString release = entry->field(TQString::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(TQString::fromLatin1("/home/robby/discogs-release.xml")); + KURL u(TQString::tqfromLatin1("/home/robby/discogs-release.xml")); #else - KURL u(TQString::fromLatin1(DISCOGS_API_URL)); - u.setPath(TQString::fromLatin1("/release/%1").arg(release)); - u.addQueryItem(TQString::fromLatin1("f"), TQString::fromLatin1("xml")); - u.addQueryItem(TQString::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; @@ -266,7 +266,7 @@ Tellico::Data::EntryPtr DiscogsFetcher::fetchEntry(uint uid_) { TQString output = FileHandler::readTextFile(u, true, true, true); #if 0 kdWarning() << "Remove output debug from discogsfetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -295,7 +295,7 @@ Tellico::Data::EntryPtr DiscogsFetcher::fetchEntry(uint uid_) { } // don't want to include id - coll->removeField(TQString::fromLatin1("discogs-id")); + coll->removeField(TQString::tqfromLatin1("discogs-id")); entry = coll->entries().front(); m_entries.replace(uid_, entry); @@ -303,7 +303,7 @@ Tellico::Data::EntryPtr DiscogsFetcher::fetchEntry(uint uid_) { } void DiscogsFetcher::initXSLTHandler() { - TQString xsltfile = locate("appdata", TQString::fromLatin1("discogs2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::tqfromLatin1("discogs2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "DiscogsFetcher::initXSLTHandler() - can not locate discogs2tellico.xsl." << endl; return; @@ -326,13 +326,13 @@ void DiscogsFetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "DiscogsFetcher::updateEntry()" << endl; TQString value; - TQString title = entry_->field(TQString::fromLatin1("title")); + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { search(Title, value); return; } - TQString artist = entry_->field(TQString::fromLatin1("artist")); + TQString artist = entry_->field(TQString::tqfromLatin1("artist")); if(!artist.isEmpty()) { search(Person, artist); return; @@ -382,7 +382,7 @@ DiscogsFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const DiscogsFetch m_apiKeyEdit->setText(fetcher_->m_apiKey); m_fetchImageCheck->setChecked(fetcher_->m_fetchImages); } else { - m_apiKeyEdit->setText(TQString::fromLatin1(DISCOGS_API_KEY)); + m_apiKeyEdit->setText(TQString::tqfromLatin1(DISCOGS_API_KEY)); m_fetchImageCheck->setChecked(true); } } @@ -404,9 +404,9 @@ TQString DiscogsFetcher::ConfigWidget::preferredName() const { Tellico::StringMap DiscogsFetcher::customFields() { StringMap map; - map[TQString::fromLatin1("producer")] = i18n("Producer"); - map[TQString::fromLatin1("nationality")] = i18n("Nationality"); - map[TQString::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/entrezfetcher.cpp b/src/fetch/entrezfetcher.cpp index 077ec33..6383735 100644 --- a/src/fetch/entrezfetcher.cpp +++ b/src/fetch/entrezfetcher.cpp @@ -28,7 +28,7 @@ #include <tqdom.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> #include <tqfile.h> //#define ENTREZ_TEST @@ -65,7 +65,7 @@ bool EntrezFetcher::canFetch(int type) const { } void EntrezFetcher::readConfigHook(const KConfigGroup& config_) { - TQString s = config_.readEntry("Database", TQString::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; } @@ -84,36 +84,36 @@ void EntrezFetcher::search(FetchKey key_, const TQString& value_) { return; } if(m_dbname.isEmpty()) { - m_dbname = TQString::fromLatin1(ENTREZ_DEFAULT_DATABASE); + m_dbname = TQString::tqfromLatin1(ENTREZ_DEFAULT_DATABASE); } #ifdef ENTREZ_TEST - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/esearch.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/esearch.xml")); #else - KURL u(TQString::fromLatin1(ENTREZ_BASE_URL)); - u.addPath(TQString::fromLatin1(ENTREZ_SEARCH_CGI)); - u.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico")); - u.addQueryItem(TQString::fromLatin1("retmode"), TQString::fromLatin1("xml")); - u.addQueryItem(TQString::fromLatin1("usehistory"), TQString::fromLatin1("y")); - u.addQueryItem(TQString::fromLatin1("retmax"), TQString::fromLatin1("1")); // we're just getting the count - u.addQueryItem(TQString::fromLatin1("db"), m_dbname); - u.addQueryItem(TQString::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(TQString::fromLatin1("field"), TQString::fromLatin1("titl")); + u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("titl")); break; case Person: - u.addQueryItem(TQString::fromLatin1("field"), TQString::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(TQString::fromLatin1("field"), TQString::fromLatin1("word")); +// u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("word")); break; case PubmedID: - u.addQueryItem(TQString::fromLatin1("field"), TQString::fromLatin1("pmid")); + u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("pmid")); break; case DOI: @@ -179,7 +179,7 @@ void EntrezFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from entrezfetcher.cpp: " << __LINE__ << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -239,18 +239,18 @@ void EntrezFetcher::searchResults() { void EntrezFetcher::doSummary() { #ifdef ENTREZ_TEST - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/esummary.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/esummary.xml")); #else - KURL u(TQString::fromLatin1(ENTREZ_BASE_URL)); - u.addPath(TQString::fromLatin1(ENTREZ_SUMMARY_CGI)); - u.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico")); - u.addQueryItem(TQString::fromLatin1("retmode"), TQString::fromLatin1("xml")); - u.addQueryItem(TQString::fromLatin1("retstart"), TQString::number(m_start)); - u.addQueryItem(TQString::fromLatin1("retmax"), TQString::number(TQMIN(m_total-m_start-1, ENTREZ_MAX_RETURNS_TOTAL))); - u.addQueryItem(TQString::fromLatin1("usehistory"), TQString::fromLatin1("y")); - u.addQueryItem(TQString::fromLatin1("db"), m_dbname); - u.addQueryItem(TQString::fromLatin1("query_key"), m_queryKey); - u.addQueryItem(TQString::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; @@ -270,34 +270,34 @@ void EntrezFetcher::summaryResults() { return; } // top child is eSummaryResult - // all children are DocSum + // 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; } - TQDomNodeList nodes = e.elementsByTagName(TQString::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(); TQString title, pubdate, authors; - nodes = e.elementsByTagName(TQString::fromLatin1("Item")); + nodes = e.elementsByTagName(TQString::tqfromLatin1("Item")); for(uint j = 0; j < nodes.count(); ++j) { - if(nodes.item(j).toElement().attribute(TQString::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(TQString::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(TQString::fromLatin1("Name")) == Latin1Literal("AuthorList")) { + } 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 children Items are authors + // lazy, assume all tqchildren Items are authors if(aNode.nodeName() == Latin1Literal("Item")) { list << aNode.toElement().text(); } } - authors = list.join(TQString::fromLatin1("; ")); + authors = list.join(TQString::tqfromLatin1("; ")); } if(!title.isEmpty() && !pubdate.isEmpty() && !authors.isEmpty()) { break; // done now @@ -333,15 +333,15 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { int id = m_matches[uid_]; #ifdef ENTREZ_TEST - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/pubmed.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/pubmed.xml")); #else - KURL u(TQString::fromLatin1(ENTREZ_BASE_URL)); - u.addPath(TQString::fromLatin1(ENTREZ_FETCH_CGI)); - u.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico")); - u.addQueryItem(TQString::fromLatin1("retmode"), TQString::fromLatin1("xml")); - u.addQueryItem(TQString::fromLatin1("rettype"), TQString::fromLatin1("abstract")); - u.addQueryItem(TQString::fromLatin1("db"), m_dbname); - u.addQueryItem(TQString::fromLatin1("id"), TQString::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 TQString xmlOutput = FileHandler::readTextFile(u, false /*quiet*/, true /*utf8*/); @@ -351,7 +351,7 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { } #if 0 kdWarning() << "EntrezFetcher::fetchEntry() - turn me off!" << endl; - TQFile f1(TQString::fromLatin1("/tmp/test-entry.xml")); + TQFile f1(TQString::tqfromLatin1("/tmp/test-entry.xml")); if(f1.open(IO_WriteOnly)) { TQTextStream t(&f1); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -376,33 +376,33 @@ 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(TQString::fromLatin1("url"))) { - KURL link(TQString::fromLatin1(ENTREZ_BASE_URL)); - link.addPath(TQString::fromLatin1(ENTREZ_LINK_CGI)); - link.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico")); - link.addQueryItem(TQString::fromLatin1("cmd"), TQString::fromLatin1("llinks")); - link.addQueryItem(TQString::fromLatin1("db"), m_dbname); - link.addQueryItem(TQString::fromLatin1("dbfrom"), m_dbname); - link.addQueryItem(TQString::fromLatin1("id"), TQString::number(id)); + if(m_fields.contains(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 - TQDomNode linkNode = linkDom.namedItem(TQString::fromLatin1("eLinkResult")) - .namedItem(TQString::fromLatin1("LinkSet")) - .namedItem(TQString::fromLatin1("IdUrlList")) - .namedItem(TQString::fromLatin1("IdUrlSet")) - .namedItem(TQString::fromLatin1("ObjUrl")) - .namedItem(TQString::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()) { TQString u = linkNode.toElement().text(); // myDebug() << u << endl; if(!u.isEmpty()) { - if(!coll->hasField(TQString::fromLatin1("url"))) { - Data::FieldPtr field = new Data::Field(TQString::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(TQString::fromLatin1("url"), u); + e->setField(TQString::tqfromLatin1("url"), u); } } } @@ -419,7 +419,7 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) { } void EntrezFetcher::initXSLTHandler() { - TQString xsltfile = locate("appdata", TQString::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; - TQString s = entry_->field(TQString::fromLatin1("pmid")); + TQString s = entry_->field(TQString::tqfromLatin1("pmid")); if(!s.isEmpty()) { search(PubmedID, s); return; } - s = entry_->field(TQString::fromLatin1("doi")); + s = entry_->field(TQString::tqfromLatin1("doi")); if(!s.isEmpty()) { search(DOI, s); return; } - s = entry_->field(TQString::fromLatin1("title")); + s = entry_->field(TQString::tqfromLatin1("title")); if(!s.isEmpty()) { search(Title, s); return; @@ -489,9 +489,9 @@ TQString EntrezFetcher::ConfigWidget::preferredName() const { //static Tellico::StringMap EntrezFetcher::customFields() { StringMap map; - map[TQString::fromLatin1("institution")] = i18n("Institution"); - map[TQString::fromLatin1("abstract")] = i18n("Abstract"); - map[TQString::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/execexternalfetcher.cpp b/src/fetch/execexternalfetcher.cpp index 3e40059..630abc9 100644 --- a/src/fetch/execexternalfetcher.cpp +++ b/src/fetch/execexternalfetcher.cpp @@ -31,7 +31,7 @@ #include <kurlrequester.h> #include <kaccelmanager.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqwhatsthis.h> #include <tqregexp.h> @@ -42,10 +42,10 @@ using Tellico::Fetch::ExecExternalFetcher; TQStringList ExecExternalFetcher::parseArguments(const TQString& str_) { // matching escaped quotes is too hard... :( -// TQRegExp quotes(TQString::fromLatin1("[^\\\\](['\"])(.*[^\\\\])\\1")); - TQRegExp quotes(TQString::fromLatin1("(['\"])(.*)\\1")); +// TQRegExp quotes(TQString::tqfromLatin1("[^\\\\](['\"])(.*[^\\\\])\\1")); + TQRegExp quotes(TQString::tqfromLatin1("(['\"])(.*)\\1")); quotes.setMinimal(true); - TQRegExp spaces(TQString::fromLatin1("\\s+")); + TQRegExp spaces(TQString::tqfromLatin1("\\s+")); spaces.setMinimal(true); TQStringList args; @@ -139,14 +139,14 @@ void ExecExternalFetcher::search(FetchKey key_, const TQString& value_) { value.remove('-'); // remove hyphens from isbn values // shouldn't hurt and might keep from confusing stupid search sources } - TQRegExp rx1(TQString::fromLatin1("['\"].*\\1")); + TQRegExp rx1(TQString::tqfromLatin1("['\"].*\\1")); if(!rx1.exactMatch(value)) { value.prepend('"').append('"'); } TQString args = m_args[key_]; - TQRegExp rx2(TQString::fromLatin1("['\"]%1\\1")); - args.replace(rx2, TQString::fromLatin1("%1")); - startSearch(parseArguments(args.arg(value))); // replace %1 with search value + TQRegExp rx2(TQString::tqfromLatin1("['\"]%1\\1")); + args.replace(rx2, TQString::tqfromLatin1("%1")); + startSearch(parseArguments(args.tqarg(value))); // replace %1 with search value } void ExecExternalFetcher::startSearch(const TQStringList& args_) { @@ -196,7 +196,7 @@ void ExecExternalFetcher::slotData(KProcess*, char* buffer_, int len_) { void ExecExternalFetcher::slotError(KProcess*, char* buffer_, int len_) { GUI::CursorSaver cs(TQt::arrowCursor); TQString msg = TQString::fromLocal8Bit(buffer_, len_); - msg.prepend(source() + TQString::fromLatin1(": ")); + msg.prepend(source() + TQString::tqfromLatin1(": ")); if(msg.endsWith(TQChar('\n'))) { msg.truncate(msg.length()-1); } @@ -235,7 +235,7 @@ void ExecExternalFetcher::slotProcessExited(KProcess*) { 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; @@ -256,56 +256,56 @@ void ExecExternalFetcher::slotProcessExited(KProcess*) { switch(coll->type()) { case Data::Collection::Book: case Data::Collection::Bibtex: - desc = entry->field(TQString::fromLatin1("author")) + desc = entry->field(TQString::tqfromLatin1("author")) + TQChar('/') - + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("cr_year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::fromLatin1("cr_year")); - } else if(!entry->field(TQString::fromLatin1("pub_year")).isEmpty()){ - desc += TQChar('/') + entry->field(TQString::fromLatin1("pub_year")); + + 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(TQString::fromLatin1("studio")) + desc = entry->field(TQString::tqfromLatin1("studio")) + TQChar('/') - + entry->field(TQString::fromLatin1("director")) + + entry->field(TQString::tqfromLatin1("director")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")) + + entry->field(TQString::tqfromLatin1("year")) + TQChar('/') - + entry->field(TQString::fromLatin1("medium")); + + entry->field(TQString::tqfromLatin1("medium")); break; case Data::Collection::Album: - desc = entry->field(TQString::fromLatin1("artist")) + desc = entry->field(TQString::tqfromLatin1("artist")) + TQChar('/') - + entry->field(TQString::fromLatin1("label")) + + entry->field(TQString::tqfromLatin1("label")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Game: - desc = entry->field(TQString::fromLatin1("platform")); + desc = entry->field(TQString::tqfromLatin1("platform")); break; case Data::Collection::ComicBook: - desc = entry->field(TQString::fromLatin1("publisher")) + desc = entry->field(TQString::tqfromLatin1("publisher")) + TQChar('/') - + entry->field(TQString::fromLatin1("pub_year")); + + entry->field(TQString::tqfromLatin1("pub_year")); break; case Data::Collection::BoardGame: - desc = entry->field(TQString::fromLatin1("designer")) + desc = entry->field(TQString::tqfromLatin1("designer")) + TQChar('/') - + entry->field(TQString::fromLatin1("publisher")) + + entry->field(TQString::tqfromLatin1("publisher")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; default: break; } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, entry); emit signalResultFound(r); } @@ -398,8 +398,8 @@ ExecExternalFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const ExecExt gridLayout->addWidget(cb, ++row, 0); m_cbDict.insert(key, cb); GUI::LineEdit* le = new GUI::LineEdit(grid); - le->setHint(TQString::fromLatin1("%1")); // for example - le->completionObject()->addItem(TQString::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)) { @@ -417,9 +417,9 @@ ExecExternalFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const ExecExt m_cbUpdate = new TQCheckBox(i18n("Update"), grid); gridLayout->addWidget(m_cbUpdate, ++row, 0); m_leUpdate = new GUI::LineEdit(grid); - m_leUpdate->setHint(TQString::fromLatin1("%{title}")); // for example - m_leUpdate->completionObject()->addItem(TQString::fromLatin1("%{title}")); - m_leUpdate->completionObject()->addItem(TQString::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>" diff --git a/src/fetch/fetcher.h b/src/fetch/fetcher.h index 0474299..d2fc301 100644 --- a/src/fetch/fetcher.h +++ b/src/fetch/fetcher.h @@ -117,7 +117,7 @@ public: virtual ConfigWidget* configWidget(TQWidget* parent) const = 0; signals: -// void signalStatus(const TQString& status); +// void signaltqStatus(const TQString& status); void signalResultFound(Tellico::Fetch::SearchResult* result); void signalDone(Tellico::Fetch::Fetcher::Ptr); diff --git a/src/fetch/fetchmanager.cpp b/src/fetch/fetchmanager.cpp index 4a64052..fb83e9f 100644 --- a/src/fetch/fetchmanager.cpp +++ b/src/fetch/fetchmanager.cpp @@ -94,11 +94,11 @@ void Manager::loadFetchers() { m_configMap.clear(); KConfig* config = KGlobal::config(); - if(config->hasGroup(TQString::fromLatin1("Data Sources"))) { - KConfigGroup configGroup(config, TQString::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) { - TQString group = TQString::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); @@ -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(TQString::fromLatin1("it"))) { + if(KGlobal::locale()->languagesTwoAlpha().contains(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) { - TQString group = TQString::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()) { @@ -409,8 +409,8 @@ Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const T return fetcher; } -void Manager::updateStatus(const TQString& message_) { - emit signalStatus(message_); +void Manager::updatetqStatus(const TQString& message_) { + emit signaltqStatus(message_); } Tellico::Fetch::TypePairList Manager::typeList() { @@ -440,7 +440,7 @@ Tellico::Fetch::TypePairList Manager::typeList() { list.append(TypePair(DiscogsFetcher::defaultName(), Discogs)); // now find all the scripts distributed with tellico - TQStringList files = KGlobal::dirs()->findAllResources("appdata", TQString::fromLatin1("data-sources/*.spec"), + TQStringList files = KGlobal::dirs()->findAllResources("appdata", TQString::tqfromLatin1("data-sources/*.spec"), false, true); for(TQStringList::Iterator it = files.begin(); it != files.end(); ++it) { KConfig spec(*it, false, false); @@ -587,7 +587,7 @@ TQPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int siz if(fetcher_->type() == Fetch::Z3950) { const Fetch::Z3950Fetcher* f = static_cast<const Fetch::Z3950Fetcher*>(fetcher_.data()); KURL u; - u.setProtocol(TQString::fromLatin1("http")); + u.setProtocol(TQString::tqfromLatin1("http")); u.setHost(f->host()); TQString icon = favIcon(u); if(u.isValid() && !icon.isEmpty()) { @@ -599,16 +599,16 @@ TQPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int siz const Fetch::ExecExternalFetcher* f = static_cast<const Fetch::ExecExternalFetcher*>(fetcher_.data()); const TQString p = f->execPath(); KURL u; - if(p.find(TQString::fromLatin1("allocine")) > -1) { - u = TQString::fromLatin1("http://www.allocine.fr"); - } else if(p.find(TQString::fromLatin1("ministerio_de_cultura")) > -1) { - u = TQString::fromLatin1("http://www.mcu.es"); - } else if(p.find(TQString::fromLatin1("dark_horse_comics")) > -1) { - u = TQString::fromLatin1("http://www.darkhorse.com"); - } else if(p.find(TQString::fromLatin1("boardgamegeek")) > -1) { - u = TQString::fromLatin1("http://www.boardgamegeek.com"); - } else if(f->source().find(TQString::fromLatin1("amarok"), 0, false /*case-sensitive*/) > -1) { - return LOAD_ICON(TQString::fromLatin1("amarok"), group_, size_); + if(p.find(TQString::tqfromLatin1("allocine")) > -1) { + u = TQString::tqfromLatin1("http://www.allocine.fr"); + } else if(p.find(TQString::tqfromLatin1("ministerio_de_cultura")) > -1) { + u = TQString::tqfromLatin1("http://www.mcu.es"); + } else if(p.find(TQString::tqfromLatin1("dark_horse_comics")) > -1) { + u = TQString::tqfromLatin1("http://www.darkhorse.com"); + } else if(p.find(TQString::tqfromLatin1("boardgamegeek")) > -1) { + u = TQString::tqfromLatin1("http://www.boardgamegeek.com"); + } else if(f->source().find(TQString::tqfromLatin1("amarok"), 0, false /*case-sensitive*/) > -1) { + return LOAD_ICON(TQString::tqfromLatin1("amarok"), group_, size_); } if(!u.isEmpty() && u.isValid()) { TQString icon = favIcon(u); @@ -628,13 +628,13 @@ TQPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { case IMDB: name = favIcon("http://imdb.com"); break; case Z3950: - name = TQString::fromLatin1("network"); break; // rather arbitrary + name = TQString::tqfromLatin1("network"); break; // rather arbitrary case SRU: - name = TQString::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 = TQString::fromLatin1("exec"); break; + name = TQString::tqfromLatin1("exec"); break; case Yahoo: name = favIcon("http://yahoo.com"); break; case AnimeNfo: @@ -644,7 +644,7 @@ TQPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { case ISBNdb: name = favIcon("http://isbndb.com"); break; case GCstarPlugin: - name = TQString::fromLatin1("gcstar"); break; + name = TQString::tqfromLatin1("gcstar"); break; case CrossRef: name = favIcon("http://crossref.org"); break; case Arxiv: diff --git a/src/fetch/fetchmanager.h b/src/fetch/fetchmanager.h index 8d86616..8bb7f23 100644 --- a/src/fetch/fetchmanager.h +++ b/src/fetch/fetchmanager.h @@ -74,7 +74,7 @@ public: static TQPixmap fetcherIcon(Fetch::Fetcher::CPtr ptr, int iconGroup=3 /*Small*/, int size=0 /* default*/); signals: - void signalStatus(const TQString& status); + void signaltqStatus(const TQString& status); void signalResultFound(Tellico::Fetch::SearchResult* result); void signalDone(); @@ -88,7 +88,7 @@ private: Manager(); Fetcher::Ptr createFetcher(KConfig* config, const TQString& configGroup); FetcherVec defaultFetchers(); - void updateStatus(const TQString& message); + void updatetqStatus(const TQString& message); static TQString favIcon(const KURL& url); static bool bundledScriptHasExecPath(const TQString& specFile, KConfig* config); diff --git a/src/fetch/gcstarpluginfetcher.cpp b/src/fetch/gcstarpluginfetcher.cpp index a1f6140..ccb963d 100644 --- a/src/fetch/gcstarpluginfetcher.cpp +++ b/src/fetch/gcstarpluginfetcher.cpp @@ -32,7 +32,7 @@ #include <kaccelmanager.h> #include <tqdir.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqwhatsthis.h> @@ -45,23 +45,23 @@ GCstarPluginFetcher::PluginParse GCstarPluginFetcher::pluginParse = NotYet; GCstarPluginFetcher::PluginList GCstarPluginFetcher::plugins(int collType_) { if(!pluginMap.contains(collType_)) { GUI::CursorSaver cs; - TQString gcstar = KStandardDirs::findExe(TQString::fromLatin1("gcstar")); + TQString gcstar = KStandardDirs::findExe(TQString::tqfromLatin1("gcstar")); if(pluginParse == NotYet) { KProcIO proc; - proc << gcstar << TQString::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)) { TQString output; proc.readln(output); if(!output.isEmpty()) { // always going to be x.y[.z] ? - TQRegExp versionRx(TQString::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() << TQString::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; } @@ -94,9 +94,9 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const TQString& gcstar_) KProcIO proc; proc << gcstar_ - << TQString::fromLatin1("-x") - << TQString::fromLatin1("--list-plugins") - << TQString::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; @@ -117,10 +117,10 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const TQString& gcstar_) // authors have \t at beginning line = line.stripWhiteSpace(); if(!hasName) { - info.insert(TQString::fromLatin1("name"), line); + info.insert(TQString::tqfromLatin1("name"), line); hasName = true; } else { - info.insert(TQString::fromLatin1("author"), line); + info.insert(TQString::tqfromLatin1("author"), line); } // myDebug() << line << endl; } @@ -130,10 +130,10 @@ void GCstarPluginFetcher::readPluginsNew(int collType_, const TQString& gcstar_) } void GCstarPluginFetcher::readPluginsOld(int collType_, const TQString& gcstar_) { - TQDir dir(gcstar_, TQString::fromLatin1("GC*.pm")); - dir.cd(TQString::fromLatin1("../../lib/gcstar/GCPlugins/")); + TQDir dir(gcstar_, TQString::tqfromLatin1("GC*.pm")); + dir.cd(TQString::tqfromLatin1("../../lib/gcstar/GCPlugins/")); - TQRegExp rx(TQString::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; @@ -156,7 +156,7 @@ void GCstarPluginFetcher::readPluginsOld(int collType_, const TQString& gcstar_) info.insert(rx.cap(1).lower(), rx.cap(2)); } // only add if it has a name - if(info.contains(TQString::fromLatin1("name"))) { + if(info.contains(TQString::tqfromLatin1("name"))) { plugins << info; } } @@ -166,13 +166,13 @@ void GCstarPluginFetcher::readPluginsOld(int collType_, const TQString& gcstar_) TQString GCstarPluginFetcher::gcstarType(int collType_) { switch(collType_) { - case Data::Collection::Book: return TQString::fromLatin1("GCbooks"); - case Data::Collection::Video: return TQString::fromLatin1("GCfilms"); - case Data::Collection::Game: return TQString::fromLatin1("GCgames"); - case Data::Collection::Album: return TQString::fromLatin1("GCmusics"); - case Data::Collection::Coin: return TQString::fromLatin1("GCcoins"); - case Data::Collection::Wine: return TQString::fromLatin1("GCwines"); - case Data::Collection::BoardGame: return TQString::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 TQString(); @@ -213,7 +213,7 @@ void GCstarPluginFetcher::search(FetchKey key_, const TQString& value_) { return; } - TQString gcstar = KStandardDirs::findExe(TQString::fromLatin1("gcstar")); + TQString gcstar = KStandardDirs::findExe(TQString::tqfromLatin1("gcstar")); if(gcstar.isEmpty()) { myWarning() << "GCstarPluginFetcher::search() - gcstar not found!" << endl; stop(); @@ -233,11 +233,11 @@ void GCstarPluginFetcher::search(FetchKey key_, const TQString& value_) { 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::fromLatin1("-x") - << TQString::fromLatin1("--collection") << gcstarCollection - << TQString::fromLatin1("--export") << TQString::fromLatin1("Tellico") - << TQString::fromLatin1("--website") << m_plugin - << TQString::fromLatin1("--download") << KProcess::quote(value_); + 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)) { @@ -268,7 +268,7 @@ void GCstarPluginFetcher::slotData(KProcess*, char* buffer_, int len_) { void GCstarPluginFetcher::slotError(KProcess*, char* buffer_, int len_) { TQString msg = TQString::fromLocal8Bit(buffer_, len_); - msg.prepend(source() + TQString::fromLatin1(": ")); + msg.prepend(source() + TQString::tqfromLatin1(": ")); myDebug() << "GCstarPluginFetcher::slotError() - " << msg << endl; m_errors << msg; } @@ -298,7 +298,7 @@ void GCstarPluginFetcher::slotProcessExited(KProcess*) { 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(); @@ -311,56 +311,56 @@ void GCstarPluginFetcher::slotProcessExited(KProcess*) { switch(coll->type()) { case Data::Collection::Book: case Data::Collection::Bibtex: - desc = entry->field(TQString::fromLatin1("author")) + desc = entry->field(TQString::tqfromLatin1("author")) + TQChar('/') - + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("cr_year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::fromLatin1("cr_year")); - } else if(!entry->field(TQString::fromLatin1("pub_year")).isEmpty()){ - desc += TQChar('/') + entry->field(TQString::fromLatin1("pub_year")); + + 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(TQString::fromLatin1("studio")) + desc = entry->field(TQString::tqfromLatin1("studio")) + TQChar('/') - + entry->field(TQString::fromLatin1("director")) + + entry->field(TQString::tqfromLatin1("director")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")) + + entry->field(TQString::tqfromLatin1("year")) + TQChar('/') - + entry->field(TQString::fromLatin1("medium")); + + entry->field(TQString::tqfromLatin1("medium")); break; case Data::Collection::Album: - desc = entry->field(TQString::fromLatin1("artist")) + desc = entry->field(TQString::tqfromLatin1("artist")) + TQChar('/') - + entry->field(TQString::fromLatin1("label")) + + entry->field(TQString::tqfromLatin1("label")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Game: - desc = entry->field(TQString::fromLatin1("platform")); + desc = entry->field(TQString::tqfromLatin1("platform")); break; case Data::Collection::ComicBook: - desc = entry->field(TQString::fromLatin1("publisher")) + desc = entry->field(TQString::tqfromLatin1("publisher")) + TQChar('/') - + entry->field(TQString::fromLatin1("pub_year")); + + entry->field(TQString::tqfromLatin1("pub_year")); break; case Data::Collection::BoardGame: - desc = entry->field(TQString::fromLatin1("designer")) + desc = entry->field(TQString::tqfromLatin1("designer")) + TQChar('/') - + entry->field(TQString::fromLatin1("publisher")) + + entry->field(TQString::tqfromLatin1("publisher")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; default: break; } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::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 - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -449,7 +449,7 @@ void GCstarPluginFetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { } TQString GCstarPluginFetcher::ConfigWidget::preferredName() const { - return TQString::fromLatin1("GCstar - ") + m_pluginCombo->currentText(); + return TQString::tqfromLatin1("GCstar - ") + m_pluginCombo->currentText(); } void GCstarPluginFetcher::ConfigWidget::slotTypeChanged() { @@ -458,7 +458,7 @@ void GCstarPluginFetcher::ConfigWidget::slotTypeChanged() { TQStringList pluginNames; GCstarPluginFetcher::PluginList list = GCstarPluginFetcher::plugins(collType); for(GCstarPluginFetcher::PluginList::ConstIterator it = list.begin(); it != list.end(); ++it) { - pluginNames << (*it)[TQString::fromLatin1("name")].toString(); + pluginNames << (*it)[TQString::tqfromLatin1("name")].toString(); m_pluginCombo->insertItem(pluginNames.last(), *it); } slotPluginChanged(); @@ -467,8 +467,8 @@ void GCstarPluginFetcher::ConfigWidget::slotTypeChanged() { void GCstarPluginFetcher::ConfigWidget::slotPluginChanged() { PluginInfo info = m_pluginCombo->currentData().toMap(); - m_authorLabel->setText(info[TQString::fromLatin1("author")].toString()); -// m_langLabel->setText(info[TQString::fromLatin1("lang")].toString()); + m_authorLabel->setText(info[TQString::tqfromLatin1("author")].toString()); +// m_langLabel->setText(info[TQString::tqfromLatin1("lang")].toString()); emit signalName(preferredName()); } diff --git a/src/fetch/googlescholarfetcher.cpp b/src/fetch/googlescholarfetcher.cpp index bb5e372..e93c7cd 100644 --- a/src/fetch/googlescholarfetcher.cpp +++ b/src/fetch/googlescholarfetcher.cpp @@ -25,7 +25,7 @@ #include <kio/job.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> namespace { static const int GOOGLE_MAX_RETURNS_TOTAL = 20; @@ -38,7 +38,7 @@ GoogleScholarFetcher::GoogleScholarFetcher(TQObject* parent_, const char* name_) : Fetcher(parent_, name_), m_limit(GOOGLE_MAX_RETURNS_TOTAL), m_start(0), m_job(0), m_started(false), m_cookieIsSet(false) { - m_bibtexRx = TQRegExp(TQString::fromLatin1("<a\\s.*href\\s*=\\s*\"([^>]*scholar\\.bib[^>]*)\"")); + m_bibtexRx = TQRegExp(TQString::tqfromLatin1("<a\\s.*href\\s*=\\s*\"([^>]*scholar\\.bib[^>]*)\"")); m_bibtexRx.setMinimal(true); } @@ -47,7 +47,7 @@ GoogleScholarFetcher::~GoogleScholarFetcher() { TQString GoogleScholarFetcher::defaultName() { // no i18n - return TQString::fromLatin1("Google Scholar"); + return TQString::tqfromLatin1("Google Scholar"); } TQString GoogleScholarFetcher::source() const { @@ -65,7 +65,7 @@ void GoogleScholarFetcher::readConfigHook(const KConfigGroup& config_) { void GoogleScholarFetcher::search(FetchKey key_, const TQString& value_) { if(!m_cookieIsSet) { // have to set preferences to have bibtex output - FileHandler::readTextFile(TQString::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(TQString::fromLatin1(SCHOLAR_BASE_URL)); - u.addQueryItem(TQString::fromLatin1("start"), TQString::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(TQString::fromLatin1("q"), TQString::fromLatin1("allintitle:%1").arg(m_value)); + u.addQueryItem(TQString::tqfromLatin1("q"), TQString::tqfromLatin1("allintitle:%1").tqarg(m_value)); break; case Keyword: - u.addQueryItem(TQString::fromLatin1("q"), m_value); + u.addQueryItem(TQString::tqfromLatin1("q"), m_value); break; case Person: - u.addQueryItem(TQString::fromLatin1("q"), TQString::fromLatin1("author:%1").arg(m_value)); + u.addQueryItem(TQString::tqfromLatin1("q"), TQString::tqfromLatin1("author:%1").tqarg(m_value)); break; default: @@ -159,7 +159,7 @@ void GoogleScholarFetcher::slotComplete(KIO::Job* job_) { 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(TQString::fromLatin1(SCHOLAR_BASE_URL), m_bibtexRx.cap(1)); + 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; } - TQString desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::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(TQString::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; - TQString title = entry_->field(TQString::fromLatin1("title")); + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { search(Title, title); return; diff --git a/src/fetch/ibsfetcher.cpp b/src/fetch/ibsfetcher.cpp index 0872056..4c86ef3 100644 --- a/src/fetch/ibsfetcher.cpp +++ b/src/fetch/ibsfetcher.cpp @@ -27,7 +27,7 @@ #include <kio/job.h> #include <tqregexp.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqfile.h> @@ -64,25 +64,25 @@ void IBSFetcher::search(FetchKey key_, const TQString& value_) { m_matches.clear(); #ifdef IBS_TEST - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/ibs.html")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/ibs.html")); #else - KURL u(TQString::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(TQString::fromLatin1("Type"), TQString::fromLatin1("keyword")); - u.addQueryItem(TQString::fromLatin1("T"), value_); + u.addQueryItem(TQString::tqfromLatin1("Type"), TQString::tqfromLatin1("keyword")); + u.addQueryItem(TQString::tqfromLatin1("T"), value_); break; case Person: - u.addQueryItem(TQString::fromLatin1("Type"), TQString::fromLatin1("keyword")); - u.addQueryItem(TQString::fromLatin1("A"), value_); + u.addQueryItem(TQString::tqfromLatin1("Type"), TQString::tqfromLatin1("keyword")); + u.addQueryItem(TQString::tqfromLatin1("A"), value_); break; case ISBN: @@ -91,14 +91,14 @@ void IBSFetcher::search(FetchKey key_, const TQString& value_) { s.remove('-'); // limit to first isbn s = s.section(';', 0, 0); - u.setFileName(TQString::fromLatin1("serdsp.asp")); - u.addQueryItem(TQString::fromLatin1("isbn"), s); + u.setFileName(TQString::tqfromLatin1("serdsp.asp")); + u.addQueryItem(TQString::tqfromLatin1("isbn"), s); } break; case Keyword: - u.addQueryItem(TQString::fromLatin1("Type"), TQString::fromLatin1("keyword")); - u.addQueryItem(TQString::fromLatin1("S"), value_); + u.addQueryItem(TQString::tqfromLatin1("Type"), TQString::tqfromLatin1("keyword")); + u.addQueryItem(TQString::tqfromLatin1("S"), value_); break; default: @@ -156,12 +156,12 @@ void IBSFetcher::slotComplete(KIO::Job* job_) { TQString s = Tellico::decodeHTML(TQString(m_data)); // really specific regexp - TQString pat = TQString::fromLatin1("http://www.internetbookshop.it/code/"); - TQRegExp anchorRx(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](") + + TQString pat = TQString::tqfromLatin1("http://www.internetbookshop.it/code/"); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](") + TQRegExp::escape(pat) + - TQString::fromLatin1("[^\"]*)\"[^>]*><b>([^<]+)<"), false); + TQString::tqfromLatin1("[^\"]*)\"[^>]*><b>([^<]+)<"), false); anchorRx.setMinimal(true); - TQRegExp tagRx(TQString::fromLatin1("<.*>")); + TQRegExp tagRx(TQString::tqfromLatin1("<.*>")); tagRx.setMinimal(true); TQString u, t, d; @@ -172,10 +172,10 @@ void IBSFetcher::slotComplete(KIO::Job* job_) { emit signalResultFound(r); #ifdef IBS_TEST - KURL url = KURL::fromPathOrURL(TQString::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(TQString::fromLatin1("&"), TQChar('&')); + KURL url = u.replace(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(TQString::fromLatin1("<br>"), pos, false); + pos2 = s.find(TQString::tqfromLatin1("<br>"), pos, false); if(pos2 > -1) { - int pos3 = s.find(TQString::fromLatin1("<br>"), pos2+1, false); + int pos3 = s.find(TQString::tqfromLatin1("<br>"), pos2+1, false); if(pos3 > -1) { d = s.mid(pos2, pos3-pos2).remove(tagRx).simplifyWhiteSpace(); } @@ -197,7 +197,7 @@ void IBSFetcher::slotComplete(KIO::Job* job_) { if(!u.isEmpty()) { SearchResult* r = new SearchResult(this, t, d, TQString()); emit signalResultFound(r); - m_matches.insert(r->uid, u.replace(TQString::fromLatin1("&"), TQChar('&'))); + m_matches.insert(r->uid, u.replace(TQString::tqfromLatin1("&"), TQChar('&'))); } #endif @@ -221,15 +221,15 @@ void IBSFetcher::slotCompleteISBN(KIO::Job* job_) { } TQString str = Tellico::decodeHTML(TQString(m_data)); - if(str.find(TQString::fromLatin1("Libro non presente"), 0, false /* cas-sensitive */) > -1) { + if(str.find(TQString::tqfromLatin1("Libro non presente"), 0, false /* cas-sensitive */) > -1) { stop(); return; } Data::EntryPtr entry = parseEntry(str); if(entry) { - TQString desc = entry->field(TQString::fromLatin1("author")) - + '/' + entry->field(TQString::fromLatin1("publisher")); - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::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()); } @@ -259,7 +259,7 @@ Tellico::Data::EntryPtr IBSFetcher::fetchEntry(uint uid_) { // myDebug() << url.url() << endl; #if 0 kdWarning() << "Remove debug from ibsfetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.html")); + TQFile f(TQString::tqfromLatin1("/tmp/test.html")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -280,9 +280,9 @@ Tellico::Data::EntryPtr IBSFetcher::fetchEntry(uint uid_) { Tellico::Data::EntryPtr IBSFetcher::parseEntry(const TQString& str_) { // myDebug() << "IBSFetcher::parseEntry()" << endl; // class might be anime_info_top - TQString pat = TQString::fromLatin1("%1(?:<[^>]+>)+([^<>\\s][^<>]+)"); + TQString pat = TQString::tqfromLatin1("%1(?:<[^>]+>)+([^<>\\s][^<>]+)"); - TQRegExp isbnRx(TQString::fromLatin1("isbn=([\\dxX]{13})"), false); + TQRegExp isbnRx(TQString::tqfromLatin1("isbn=([\\dxX]{13})"), false); TQString isbn; int pos = isbnRx.search(str_); if(pos > -1) { @@ -293,25 +293,25 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const TQString& str_) { // map captions in HTML to field names TQMap<TQString, TQString> fieldMap; - fieldMap.insert(TQString::fromLatin1("Titolo"), TQString::fromLatin1("title")); - fieldMap.insert(TQString::fromLatin1("Autore"), TQString::fromLatin1("author")); - fieldMap.insert(TQString::fromLatin1("Anno"), TQString::fromLatin1("pub_year")); - fieldMap.insert(TQString::fromLatin1("Categoria"), TQString::fromLatin1("genre")); - fieldMap.insert(TQString::fromLatin1("Rilegatura"), TQString::fromLatin1("binding")); - fieldMap.insert(TQString::fromLatin1("Editore"), TQString::fromLatin1("publisher")); - fieldMap.insert(TQString::fromLatin1("Dati"), TQString::fromLatin1("edition")); - - TQRegExp pagesRx(TQString::fromLatin1("(\\d+) p\\.(\\s*,\\s*)?")); + 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(TQMap<TQString, TQString>::Iterator it = fieldMap.begin(); it != fieldMap.end(); ++it) { - TQRegExp infoRx(pat.arg(it.key())); + 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(TQString::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,44 +324,44 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const TQString& str_) { // image if(!isbn.isEmpty()) { - entry->setField(TQString::fromLatin1("isbn"), isbn); + entry->setField(TQString::tqfromLatin1("isbn"), isbn); #if 1 - TQString imgURL = TQString::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; - TQString id = ImageFactory::addImage(imgURL, true, TQString::fromLatin1("http://internetbookshop.it")); + TQString id = ImageFactory::addImage(imgURL, true, TQString::tqfromLatin1("http://internetbookshop.it")); if(!id.isEmpty()) { - entry->setField(TQString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } #else - TQRegExp imgRx(TQString::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; - TQString id = ImageFactory::addImage(imgRx.cap(1), true, TQString::fromLatin1("http://internetbookshop.it")); + TQString id = ImageFactory::addImage(imgRx.cap(1), true, TQString::tqfromLatin1("http://internetbookshop.it")); if(!id.isEmpty()) { - entry->setField(TQString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } #endif } // now look for description - TQRegExp descRx(TQString::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(TQString::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(TQString::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 - TQStringList names = entry->fields(TQString::fromLatin1("author"), false); + TQStringList names = entry->fields(TQString::tqfromLatin1("author"), false); if(!names.isEmpty() && !names[0].isEmpty()) { for(TQStringList::Iterator it = names.begin(); it != names.end(); ++it) { if((*it).find(',') > -1) { @@ -376,18 +376,18 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const TQString& str_) { words.pop_front(); *it = words.join(TQChar(' ')); } - entry->setField(TQString::fromLatin1("author"), names.join(TQString::fromLatin1("; "))); + entry->setField(TQString::tqfromLatin1("author"), names.join(TQString::tqfromLatin1("; "))); } return entry; } void IBSFetcher::updateEntry(Data::EntryPtr entry_) { - TQString isbn = entry_->field(TQString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp index 2ddbc10..682ae1f 100644 --- a/src/fetch/imdbfetcher.cpp +++ b/src/fetch/imdbfetcher.cpp @@ -36,7 +36,7 @@ #include <tqlabel.h> #include <tqlistbox.h> #include <tqwhatsthis.h> -#include <layout.h> +#include <tqlayout.h> #include <tqcheckbox.h> #include <tqvgroupbox.h> @@ -45,7 +45,7 @@ namespace { static const char* IMDB_SERVER = "akas.imdb.com"; static const uint IMDB_MAX_RESULTS = 20; - static const TQString sep = TQString::fromLatin1("; "); + static const TQString sep = TQString::tqfromLatin1("; "); } using Tellico::Fetch::IMDBFetcher; @@ -58,24 +58,24 @@ TQRegExp* IMDBFetcher::s_titleRx = 0; // static void IMDBFetcher::initRegExps() { - s_tagRx = new TQRegExp(TQString::fromLatin1("<.*>")); + s_tagRx = new TQRegExp(TQString::tqfromLatin1("<.*>")); s_tagRx->setMinimal(true); - s_anchorRx = new TQRegExp(TQString::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 TQRegExp(TQString::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 TQRegExp(TQString::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 TQRegExp(TQString::fromLatin1("<title>(.*)</title>"), false); + s_titleRx = new TQRegExp(TQString::tqfromLatin1("<title>(.*)</title>"), false); s_titleRx->setMinimal(true); } IMDBFetcher::IMDBFetcher(TQObject* parent_, const char* name_) : Fetcher(parent_, name_), - m_job(0), m_started(false), m_fetchImages(true), m_host(TQString::fromLatin1(IMDB_SERVER)), + 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(); @@ -130,25 +130,25 @@ void IMDBFetcher::search(FetchKey key_, const TQString& value_) { #ifdef IMDB_TEST if(m_key == Title) { - m_url = KURL::fromPathOrURL(TQString::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(TQString::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(TQString::fromLatin1("http")); - m_url.setHost(m_host.isEmpty() ? TQString::fromLatin1(IMDB_SERVER) : m_host); - m_url.setPath(TQString::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("/find")); switch(key_) { case Title: - m_url.addQueryItem(TQString::fromLatin1("s"), TQString::fromLatin1("tt")); + m_url.addQueryItem(TQString::tqfromLatin1("s"), TQString::tqfromLatin1("tt")); break; case Person: - m_url.addQueryItem(TQString::fromLatin1("s"), TQString::fromLatin1("nm")); + m_url.addQueryItem(TQString::tqfromLatin1("s"), TQString::tqfromLatin1("nm")); break; default: @@ -159,7 +159,7 @@ void IMDBFetcher::search(FetchKey key_, const TQString& value_) { // as far as I can tell, the url encoding should always be iso-8859-1 // not utf-8 - m_url.addQueryItem(TQString::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 @@ -282,9 +282,9 @@ void IMDBFetcher::parseMultipleTitleResults() { // 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(TQString::fromLatin1("Popular Titles"), 0, false); - int pos_exact = output.find(TQString::fromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false); - int pos_partial = output.find(TQString::fromLatin1("Partial Matches"), TQMAX(pos_exact, 0), false); + int pos_popular = output.find(TQString::tqfromLatin1("Popular Titles"), 0, false); + int pos_exact = output.find(TQString::tqfromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false); + int pos_partial = output.find(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; @@ -336,7 +336,7 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) { } // myDebug() << "IMDBFetcher::parseTitleBlock() - " << m_currentTitleBlock << endl; - TQRegExp akaRx(TQString::fromLatin1("aka (.*)(</li>|<br)"), false); + TQRegExp akaRx(TQString::tqfromLatin1("aka (.*)(</li>|<br)"), false); akaRx.setMinimal(true); m_hasMoreResults = false; @@ -364,7 +364,7 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) { TQString text = str_.mid(start, end-start); pPos = text.find('('); if(pPos > -1) { - int pNewLine = text.find(TQString::fromLatin1("<br")); + int pNewLine = text.find(TQString::tqfromLatin1("<br")); if(pNewLine == -1 || pPos < pNewLine) { int pPos2 = text.find(')', pPos); desc = text.mid(pPos+1, pPos2-pPos-1); @@ -382,7 +382,7 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) { // limit to 50 chars desc += TQChar(' ') + akaRx.cap(1).stripWhiteSpace().remove(*s_tagRx); if(desc.length() > 50) { - desc = desc.left(50) + TQString::fromLatin1("..."); + desc = desc.left(50) + TQString::tqfromLatin1("..."); } } @@ -425,7 +425,7 @@ void IMDBFetcher::parseSingleNameResult() { return; } - TQRegExp tvRegExp(TQString::fromLatin1("TV\\sEpisode"), false); + TQRegExp tvRegExp(TQString::tqfromLatin1("TV\\sEpisode"), false); int len = 0; int count = 0; @@ -441,7 +441,7 @@ void IMDBFetcher::parseSingleNameResult() { desc = cap2.mid(pPos); } else { // look until the next <a - int aPos = output.find(TQString::fromLatin1("<a"), pos+len, false); + int aPos = output.find(TQString::tqfromLatin1("<a"), pos+len, false); if(aPos == -1) { aPos = output.length(); } @@ -451,7 +451,7 @@ void IMDBFetcher::parseSingleNameResult() { } pPos = tmp.find('('); if(pPos > -1) { - int pNewLine = tmp.find(TQString::fromLatin1("<br")); + int pNewLine = tmp.find(TQString::tqfromLatin1("<br")); if(pNewLine == -1 || pPos < pNewLine) { int pEnd = tmp.find(')', pPos+1); desc = tmp.mid(pPos+1, pEnd-pPos-1).remove(*s_tagRx); @@ -501,17 +501,17 @@ void IMDBFetcher::parseMultipleNameResults() { // the exact results are in the first table after the "exact results" text TQString output = Tellico::decodeHTML(TQString(m_data)); - int pos = output.find(TQString::fromLatin1("Popular Results"), 0, false); + int pos = output.find(TQString::tqfromLatin1("Popular Results"), 0, false); if(pos == -1) { - pos = output.find(TQString::fromLatin1("Exact Matches"), 0, false); + pos = output.find(TQString::tqfromLatin1("Exact Matches"), 0, false); } // find beginning of partial matches - int end = output.find(TQString::fromLatin1("Other Results"), TQMAX(pos, 0), false); + int end = output.find(TQString::tqfromLatin1("Other Results"), TQMAX(pos, 0), false); if(end == -1) { - end = output.find(TQString::fromLatin1("Partial Matches"), TQMAX(pos, 0), false); + end = output.find(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos, 0), false); if(end == -1) { - end = output.find(TQString::fromLatin1("Approx Matches"), TQMAX(pos, 0), false); + end = output.find(TQString::tqfromLatin1("Approx Matches"), TQMAX(pos, 0), false); if(end == -1) { end = output.length(); } @@ -538,7 +538,7 @@ void IMDBFetcher::parseMultipleNameResults() { } nameMap.insert(s, nameMap[s] + 1); // check for duplicate names - s += TQString::fromLatin1("(%1) ").arg(nameMap[s]); + s += TQString::tqfromLatin1("(%1) ").tqarg(nameMap[s]); } else { nameMap.insert(s, 1); } @@ -561,7 +561,7 @@ void IMDBFetcher::parseMultipleNameResults() { } nameMap.insert(s, nameMap[s] + 1); // check for duplicate names - s += TQString::fromLatin1(" (%1)").arg(nameMap[s]); + s += TQString::tqfromLatin1(" (%1)").tqarg(nameMap[s]); } else { nameMap.insert(s, 1); } @@ -641,7 +641,7 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntry(uint uid_) { } else { // now it's sychronous #ifdef IMDB_TEST - KURL u = KURL::fromPathOrURL(TQString::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 @@ -675,8 +675,8 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) { doAlsoKnownAs(str_, entry); doPlot(str_, entry, m_url); doLists(str_, entry); - doPerson(str_, entry, TQString::fromLatin1("Director"), TQString::fromLatin1("director")); - doPerson(str_, entry, TQString::fromLatin1("Writer"), TQString::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,7 +684,7 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) { doCover(str_, entry, m_url); } - const TQString imdb = TQString::fromLatin1("imdb"); + const TQString imdb = TQString::tqfromLatin1("imdb"); if(!coll->hasField(imdb) && m_fields.findIndex(imdb) > -1) { Data::FieldPtr field = new Data::Field(imdb, i18n("IMDB Link"), Data::Field::URL); field->setCategory(i18n("General")); @@ -707,7 +707,7 @@ void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) { if(title.startsWith(TQChar('"')) && title.endsWith(TQChar('"'))) { title = title.mid(1, title.length()-2); } - entry_->setField(TQString::fromLatin1("title"), title); + entry_->setField(TQString::tqfromLatin1("title"), title); // remove parenthesis uint pPos2 = pPos+1; while(pPos2 < cap1.length() && cap1[pPos2].isDigit()) { @@ -715,62 +715,62 @@ void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) { } TQString year = cap1.mid(pPos+1, pPos2-pPos-1); if(!year.isEmpty()) { - entry_->setField(TQString::fromLatin1("year"), year); + entry_->setField(TQString::tqfromLatin1("year"), year); } } } void IMDBFetcher::doRunningTime(const TQString& str_, Data::EntryPtr entry_) { // running time - TQRegExp runtimeRx(TQString::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(TQString::fromLatin1("running-time"), runtimeRx.cap(1)); + entry_->setField(TQString::tqfromLatin1("running-time"), runtimeRx.cap(1)); } } void IMDBFetcher::doAspectRatio(const TQString& str_, Data::EntryPtr entry_) { - TQRegExp rx(TQString::fromLatin1("aspect ratio:.*([\\d\\.]+\\s*:\\s*[\\d\\.]+)"), false); + 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(TQString::fromLatin1("aspect-ratio"), rx.cap(1).stripWhiteSpace()); + entry_->setField(TQString::tqfromLatin1("aspect-ratio"), rx.cap(1).stripWhiteSpace()); } } void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) { - if(m_fields.findIndex(TQString::fromLatin1("alttitle")) == -1) { + if(m_fields.findIndex(TQString::tqfromLatin1("alttitle")) == -1) { return; } // match until next b tag -// TQRegExp akaRx(TQString::fromLatin1("also known as(.*)<b(?:\\s.*)?>")); - TQRegExp akaRx(TQString::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(TQString::fromLatin1("alttitle")); + Data::FieldPtr f = entry_->collection()->fieldByName(TQString::tqfromLatin1("alttitle")); if(!f) { - f = new Data::Field(TQString::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! - TQRegExp brRx(TQString::fromLatin1("<br[\\s/]*>"), false); + TQRegExp brRx(TQString::tqfromLatin1("<br[\\s/]*>"), false); brRx.setMinimal(true); TQStringList list = TQStringList::split(brRx, akaRx.cap(1)); // lang could be included with [fr] -// const TQRegExp parRx(TQString::fromLatin1("\\(.+\\)")); - const TQRegExp brackRx(TQString::fromLatin1("\\[\\w+\\]")); +// 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(TQString::fromLatin1("releaseinfo")) > -1) { + if(s.find(TQString::tqfromLatin1("releaseinfo")) > -1) { continue; } s.remove(*s_tagRx); @@ -786,7 +786,7 @@ void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) { } } if(!values.isEmpty()) { - entry_->setField(TQString::fromLatin1("alttitle"), values.join(sep)); + entry_->setField(TQString::tqfromLatin1("alttitle"), values.join(sep)); } } } @@ -799,36 +799,36 @@ void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL TQString thisPlot; // match until next opening tag - TQRegExp plotRx(TQString::fromLatin1("plot (?:outline|summary):(.*)<[^/].*</"), false); + TQRegExp plotRx(TQString::tqfromLatin1("plot (?:outline|summary):(.*)<[^/].*</"), false); plotRx.setMinimal(true); - TQRegExp plotURLRx(TQString::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(TQString::fromLatin1("plot"), thisPlot); + entry_->setField(TQString::tqfromLatin1("plot"), thisPlot); // if thisPlot ends with (more) or contains // a url that ends with plotsummary, then we'll grab it, otherwise not - if(plotRx.cap(0).endsWith(TQString::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) { - TQRegExp idRx(TQString::fromLatin1("title/(tt\\d+)")); + TQRegExp idRx(TQString::tqfromLatin1("title/(tt\\d+)")); idRx.search(baseURL_.path()); KURL plotURL = baseURL_; - plotURL.setPath(TQString::fromLatin1("/title/") + idRx.cap(1) + TQString::fromLatin1("/plotsummary")); + plotURL.setPath(TQString::tqfromLatin1("/title/") + idRx.cap(1) + TQString::tqfromLatin1("/plotsummary")); // be quiet about failure TQString plotPage = FileHandler::readTextFile(plotURL, true); if(!plotPage.isEmpty()) { - TQRegExp plotRx(TQString::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) { TQString userPlot = plotRx.cap(1); userPlot.remove(*s_tagRx); // remove HTML tags - entry_->setField(TQString::fromLatin1("plot"), Tellico::decodeHTML(userPlot)); + entry_->setField(TQString::tqfromLatin1("plot"), Tellico::decodeHTML(userPlot)); } } } @@ -836,11 +836,11 @@ void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL void IMDBFetcher::doPerson(const TQString& str_, Data::EntryPtr entry_, const TQString& imdbHeader_, const TQString& fieldName_) { - TQRegExp br2Rx(TQString::fromLatin1("<br[\\s/]*>\\s*<br[\\s/]*>"), false); + TQRegExp br2Rx(TQString::tqfromLatin1("<br[\\s/]*>\\s*<br[\\s/]*>"), false); br2Rx.setMinimal(true); - TQRegExp divRx(TQString::fromLatin1("<[/]*div"), false); + TQRegExp divRx(TQString::tqfromLatin1("<[/]*div"), false); divRx.setMinimal(true); - TQString name = TQString::fromLatin1("/name/"); + TQString name = TQString::tqfromLatin1("/name/"); StringSet people; for(int pos = str_.find(imdbHeader_); pos > 0; pos = str_.find(imdbHeader_, pos)) { @@ -866,13 +866,13 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL // 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 - TQRegExp idRx(TQString::fromLatin1("title/(tt\\d+)")); + TQRegExp idRx(TQString::tqfromLatin1("title/(tt\\d+)")); idRx.search(baseURL_.path()); #ifdef IMDB_TEST - KURL castURL = KURL::fromPathOrURL(TQString::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(TQString::fromLatin1("/title/") + idRx.cap(1) + TQString::fromLatin1("/fullcredits")); + castURL.setPath(TQString::tqfromLatin1("/title/") + idRx.cap(1) + TQString::tqfromLatin1("/fullcredits")); #endif // be quiet about failure and be sure to translate entities TQString castPage = Tellico::decodeHTML(FileHandler::readTextFile(castURL, true)); @@ -883,28 +883,28 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL if(castText.isEmpty()) { // fall back to short list castText = str_; - pos = castText.find(TQString::fromLatin1("cast overview"), 0, false); + pos = castText.find(TQString::tqfromLatin1("cast overview"), 0, false); if(pos == -1) { - pos = castText.find(TQString::fromLatin1("credited cast"), 0, false); + pos = castText.find(TQString::tqfromLatin1("credited cast"), 0, false); } } else { // first look for anchor - TQRegExp castAnchorRx(TQString::fromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false); + TQRegExp castAnchorRx(TQString::tqfromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false); pos = castText.find(castAnchorRx); if(pos < 0) { - TQRegExp tableClassRx(TQString::fromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false); + TQRegExp tableClassRx(TQString::tqfromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false); pos = castText.find(tableClassRx); if(pos < 0) { // fragile, the word "cast" appears in the title, but need to find // 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(TQString::fromLatin1("cast</"), 0, false); + pos = castText.find(TQString::tqfromLatin1("cast</"), 0, false); if(pos > 9) { // back up 9 places - if(castText.mid(pos-9, 9).startsWith(TQString::fromLatin1("episodes"))) { + if(castText.mid(pos-9, 9).startsWith(TQString::tqfromLatin1("episodes"))) { // find next cast list - pos = castText.find(TQString::fromLatin1("cast</"), pos+6, false); + pos = castText.find(TQString::tqfromLatin1("cast</"), pos+6, false); } } } @@ -915,13 +915,13 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL return; } - const TQString name = TQString::fromLatin1("/name/"); - TQRegExp tdRx(TQString::fromLatin1("<td[^>]*>(.*)</td>"), false); + const TQString name = TQString::tqfromLatin1("/name/"); + TQRegExp tdRx(TQString::tqfromLatin1("<td[^>]*>(.*)</td>"), false); tdRx.setMinimal(true); TQStringList cast; // loop until closing table tag - const int endPos = castText.find(TQString::fromLatin1("</table"), pos, false); + const int endPos = castText.find(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) { @@ -930,7 +930,7 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL const int pos2 = tdRx.search(castText, pos); if(pos2 > -1 && tdRx.search(castText, pos2+1) > -1) { cast += s_anchorRx->cap(2).stripWhiteSpace() - + TQString::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,46 +939,46 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL } if(!cast.isEmpty()) { - entry_->setField(TQString::fromLatin1("cast"), cast.join(sep)); + entry_->setField(TQString::tqfromLatin1("cast"), cast.join(sep)); } } void IMDBFetcher::doRating(const TQString& str_, Data::EntryPtr entry_) { - if(m_fields.findIndex(TQString::fromLatin1("imdb-rating")) == -1) { + if(m_fields.findIndex(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 - TQRegExp rx(TQString::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(TQString::fromLatin1("imdb-rating")); + Data::FieldPtr f = entry_->collection()->fieldByName(TQString::tqfromLatin1("imdb-rating")); if(!f) { - f = new Data::Field(TQString::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(TQString::fromLatin1("maximum"), TQString::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(TQString::fromLatin1("imdb-rating"), TQString::number(value)); + entry_->setField(TQString::tqfromLatin1("imdb-rating"), TQString::number(value)); } } } void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KURL& baseURL_) { // cover is the img with the "cover" alt text - TQRegExp imgRx(TQString::fromLatin1("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), false); + TQRegExp imgRx(TQString::tqfromLatin1("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), false); imgRx.setMinimal(true); - TQRegExp posterRx(TQString::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 TQString cover = TQString::fromLatin1("cover"); + const TQString cover = TQString::tqfromLatin1("cover"); int pos = posterRx.search(str_); while(pos > -1) { @@ -1011,14 +1011,14 @@ void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KUR // end up reparsing whole string, but it's not really that slow // loook at every anchor tag in the string void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { - const TQString genre = TQString::fromLatin1("/Genres/"); - const TQString country = TQString::fromLatin1("/Countries/"); - const TQString lang = TQString::fromLatin1("/Languages/"); - const TQString colorInfo = TQString::fromLatin1("color-info"); - const TQString cert = TQString::fromLatin1("certificates="); - const TQString soundMix = TQString::fromLatin1("sound-mix="); - const TQString year = TQString::fromLatin1("/Years/"); - const TQString company = TQString::fromLatin1("/company/"); + 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 @@ -1027,19 +1027,19 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { for(int pos = s_anchorRx->search(str_); pos > -1; pos = s_anchorRx->search(str_, pos+1)) { const TQString cap1 = s_anchorRx->cap(1); if(cap1.find(genre) > -1) { - if(s_anchorRx->cap(2).find(TQString::fromLatin1(" section"), 0, false) == -1) { + if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) { genres += s_anchorRx->cap(2).stripWhiteSpace(); } } else if(cap1.find(country) > -1) { - if(s_anchorRx->cap(2).find(TQString::fromLatin1(" section"), 0, false) == -1) { + if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) { countries += s_anchorRx->cap(2).stripWhiteSpace(); } } else if(cap1.find(lang) > -1) { langs += s_anchorRx->cap(2).stripWhiteSpace(); } else if(cap1.find(colorInfo) > -1) { // change "black and white" to "black & white" - entry_->setField(TQString::fromLatin1("color"), - s_anchorRx->cap(2).replace(TQString::fromLatin1("and"), TQChar('&')).stripWhiteSpace()); + entry_->setField(TQString::tqfromLatin1("color"), + s_anchorRx->cap(2).replace(TQString::tqfromLatin1("and"), TQChar('&')).stripWhiteSpace()); } else if(cap1.find(cert) > -1) { certs += s_anchorRx->cap(2).stripWhiteSpace(); } else if(cap1.find(soundMix) > -1) { @@ -1047,34 +1047,34 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { } else if(cap1.find(company) > -1) { studios += s_anchorRx->cap(2).stripWhiteSpace(); // if year field wasn't set before, do it now - } else if(entry_->field(TQString::fromLatin1("year")).isEmpty() && cap1.find(year) > -1) { - entry_->setField(TQString::fromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace()); + } else if(entry_->field(TQString::tqfromLatin1("year")).isEmpty() && cap1.find(year) > -1) { + entry_->setField(TQString::tqfromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace()); } } - entry_->setField(TQString::fromLatin1("genre"), genres.join(sep)); - entry_->setField(TQString::fromLatin1("nationality"), countries.join(sep)); - entry_->setField(TQString::fromLatin1("language"), langs.join(sep)); - entry_->setField(TQString::fromLatin1("audio-track"), tracks.join(sep)); - entry_->setField(TQString::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 TQStringList& certsAllowed = entry_->collection()->fieldByName(TQString::fromLatin1("certification"))->allowed(); + 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 = TQChar('U'); } - cert += TQString::fromLatin1(" (") + country + ')'; + cert += TQString::tqfromLatin1(" (") + country + ')'; if(certsAllowed.findIndex(cert) > -1) { - entry_->setField(TQString::fromLatin1("certification"), cert); + entry_->setField(TQString::tqfromLatin1("certification"), cert); break; } } // now add new field for all certifications - const TQString allc = TQString::fromLatin1("allcertification"); + const TQString allc = TQString::tqfromLatin1("allcertification"); if(m_fields.findIndex(allc) > -1) { Data::FieldPtr f = entry_->collection()->fieldByName(allc); if(!f) { @@ -1082,7 +1082,7 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { f->setFlags(Data::Field::AllowGrouped); entry_->collection()->addField(f); } - entry_->setField(TQString::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; - TQString t = entry_->field(TQString::fromLatin1("title")); - KURL link = entry_->field(TQString::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) { @@ -1173,7 +1173,7 @@ IMDBFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const IMDBFetcher* fe m_numCast->setValue(fetcher_->m_numCast); m_fetchImageCheck->setChecked(fetcher_->m_fetchImages); } else { //defaults - m_hostEdit->setText(TQString::fromLatin1(IMDB_SERVER)); + m_hostEdit->setText(TQString::tqfromLatin1(IMDB_SERVER)); m_numCast->setValue(10); m_fetchImageCheck->setChecked(true); } @@ -1198,10 +1198,10 @@ TQString IMDBFetcher::ConfigWidget::preferredName() const { //static Tellico::StringMap IMDBFetcher::customFields() { StringMap map; - map[TQString::fromLatin1("imdb")] = i18n("IMDB Link"); - map[TQString::fromLatin1("imdb-rating")] = i18n("IMDB Rating"); - map[TQString::fromLatin1("alttitle")] = i18n("Alternative Titles"); - map[TQString::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/isbndbfetcher.cpp b/src/fetch/isbndbfetcher.cpp index ce3ed08..3c6c093 100644 --- a/src/fetch/isbndbfetcher.cpp +++ b/src/fetch/isbndbfetcher.cpp @@ -27,7 +27,7 @@ #include <tqdom.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> #include <tqfile.h> namespace { @@ -76,7 +76,7 @@ void ISBNdbFetcher::search(FetchKey key_, const TQString& 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(TQString::fromLatin1(ISBNDB_BASE_URL)); - u.addQueryItem(TQString::fromLatin1("access_key"), TQString::fromLatin1(ISBNDB_APP_ID)); - u.addQueryItem(TQString::fromLatin1("results"), TQString::fromLatin1("details,authors,subjects,texts")); - u.addQueryItem(TQString::fromLatin1("page_number"), TQString::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(TQString::fromLatin1("index1"), TQString::fromLatin1("title")); - u.addQueryItem(TQString::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(TQString::fromLatin1("index1"), TQString::fromLatin1("combined")); - u.addQueryItem(TQString::fromLatin1("value1"), m_value); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("combined")); + u.addQueryItem(TQString::tqfromLatin1("value1"), m_value); break; case Keyword: - u.addQueryItem(TQString::fromLatin1("index1"), TQString::fromLatin1("full")); - u.addQueryItem(TQString::fromLatin1("value1"), m_value); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("full")); + u.addQueryItem(TQString::tqfromLatin1("value1"), m_value); break; case ISBN: - u.addQueryItem(TQString::fromLatin1("index1"), TQString::fromLatin1("isbn")); + u.addQueryItem(TQString::tqfromLatin1("index1"), TQString::tqfromLatin1("isbn")); { // only grab first value TQString v = m_value.section(TQChar(';'), 0); v.remove('-'); - u.addQueryItem(TQString::fromLatin1("value1"), v); + u.addQueryItem(TQString::tqfromLatin1("value1"), v); } break; @@ -178,7 +178,7 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from isbndbfetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -194,10 +194,10 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { } if(m_total == -1) { - TQDomNode n = dom.documentElement().namedItem(TQString::fromLatin1("BookList")); + TQDomNode n = dom.documentElement().namedItem(TQString::tqfromLatin1("BookList")); TQDomElement e = n.toElement(); if(!e.isNull()) { - m_total = e.attribute(TQString::fromLatin1("total_results"), TQString::number(-1)).toInt(); + m_total = e.attribute(TQString::tqfromLatin1("total_results"), TQString::number(-1)).toInt(); } } @@ -224,15 +224,15 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("author")) - + TQChar('/') + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("cr_year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::fromLatin1("cr_year")); - } else if(!entry->field(TQString::fromLatin1("pub_year")).isEmpty()){ - desc += TQChar('/') + entry->field(TQString::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(TQString::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; @@ -244,7 +244,7 @@ void ISBNdbFetcher::slotComplete(KIO::Job* job_) { 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 TQString id = entry->field(TQString::fromLatin1("pub_id")); + const TQString id = entry->field(TQString::tqfromLatin1("pub_id")); if(!id.isEmpty()) { - KURL u(TQString::fromLatin1(ISBNDB_BASE_URL)); - u.setFileName(TQString::fromLatin1("publishers.xml")); - u.addQueryItem(TQString::fromLatin1("access_key"), TQString::fromLatin1(ISBNDB_APP_ID)); - u.addQueryItem(TQString::fromLatin1("index1"), TQString::fromLatin1("publisher_id")); - u.addQueryItem(TQString::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); TQDomDocument dom = FileHandler::readXMLFile(u, true); if(!dom.isNull()) { - TQString pub = dom.documentElement().namedItem(TQString::fromLatin1("PublisherList")) - .namedItem(TQString::fromLatin1("PublisherData")) - .namedItem(TQString::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(TQString::fromLatin1("publisher"), pub); + entry->setField(TQString::tqfromLatin1("publisher"), pub); } } - entry->setField(TQString::fromLatin1("pub_id"), TQString()); + entry->setField(TQString::tqfromLatin1("pub_id"), TQString()); } return entry; } void ISBNdbFetcher::initXSLTHandler() { - TQString xsltfile = locate("appdata", TQString::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; - TQString isbn = entry_->field(TQString::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 - TQString t = entry_->field(TQString::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); diff --git a/src/fetch/messagehandler.cpp b/src/fetch/messagehandler.cpp index 287d689..5510480 100644 --- a/src/fetch/messagehandler.cpp +++ b/src/fetch/messagehandler.cpp @@ -21,7 +21,7 @@ using Tellico::Fetch::ManagerMessage; // all messages go to manager void ManagerMessage::send(const TQString& message_, Type type_) { - Fetch::Manager::self()->updateStatus(message_); + Fetch::Manager::self()->updatetqStatus(message_); // plus errors get a message box if(type_ == Error) { KMessageBox::sorry(Kernel::self()->widget(), message_); diff --git a/src/fetch/messagehandler.h b/src/fetch/messagehandler.h index 7cf525a..804d574 100644 --- a/src/fetch/messagehandler.h +++ b/src/fetch/messagehandler.h @@ -25,7 +25,7 @@ namespace Tellico { */ class MessageHandler { public: - enum Type { Status, Warning, Error, ListError }; + enum Type { tqStatus, Warning, Error, ListError }; MessageHandler() {} virtual ~MessageHandler() {} diff --git a/src/fetch/scripts/dark_horse_comics.py b/src/fetch/scripts/dark_horse_comics.py index 4f3b651..513127c 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])) 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..7f949ba 100644 --- a/src/fetch/scripts/ministerio_de_cultura.py +++ b/src/fetch/scripts/ministerio_de_cultura.py @@ -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)) diff --git a/src/fetch/srufetcher.cpp b/src/fetch/srufetcher.cpp index 3410c0c..99529c3 100644 --- a/src/fetch/srufetcher.cpp +++ b/src/fetch/srufetcher.cpp @@ -36,7 +36,7 @@ #include <knuminput.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> #include <tqwhatsthis.h> //#define SRU_DEBUG @@ -95,7 +95,7 @@ void SRUFetcher::readConfigHook(const KConfigGroup& config_) { if(!m_path.startsWith(TQChar('/'))) { m_path.prepend('/'); } - m_format = config_.readEntry("Format", TQString::fromLatin1("mods")); + m_format = config_.readEntry("Format", TQString::tqfromLatin1("mods")); m_fields = config_.readListEntry("Custom Fields"); } @@ -109,35 +109,35 @@ void SRUFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; #ifdef SRU_DEBUG - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/sru.xml")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/sru.xml")); #else KURL u; - u.setProtocol(TQString::fromLatin1("http")); + u.setProtocol(TQString::tqfromLatin1("http")); u.setHost(m_host); u.setPort(m_port); u.setPath(m_path); - u.addQueryItem(TQString::fromLatin1("operation"), TQString::fromLatin1("searchRetrieve")); - u.addQueryItem(TQString::fromLatin1("version"), TQString::fromLatin1("1.1")); - u.addQueryItem(TQString::fromLatin1("maximumRecords"), TQString::number(SRU_MAX_RECORDS)); - u.addQueryItem(TQString::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(); TQString str = TQChar('"') + value_ + TQChar('"'); switch(key_) { case Title: - u.addQueryItem(TQString::fromLatin1("query"), TQString::fromLatin1("dc.title=") + str); + u.addQueryItem(TQString::tqfromLatin1("query"), TQString::tqfromLatin1("dc.title=") + str); break; case Person: { TQString s; if(type == Data::Collection::Book || type == Data::Collection::Bibtex) { - s = TQString::fromLatin1("author=") + str + TQString::fromLatin1(" or dc.author=") + str; + s = TQString::tqfromLatin1("author=") + str + TQString::tqfromLatin1(" or dc.author=") + str; } else { - s = TQString::fromLatin1("dc.creator=") + str + TQString::fromLatin1(" or dc.editor=") + str; + s = TQString::tqfromLatin1("dc.creator=") + str + TQString::tqfromLatin1(" or dc.editor=") + str; } - u.addQueryItem(TQString::fromLatin1("query"), s); + u.addQueryItem(TQString::tqfromLatin1("query"), s); } break; @@ -146,7 +146,7 @@ void SRUFetcher::search(FetchKey key_, const TQString& value_) { str.remove('-'); // limit to first isbn str = str.section(';', 0, 0); - u.addQueryItem(TQString::fromLatin1("query"), TQString::fromLatin1("bath.isbn=") + str); + u.addQueryItem(TQString::tqfromLatin1("query"), TQString::tqfromLatin1("bath.isbn=") + str); break; case LCCN: @@ -156,15 +156,15 @@ void SRUFetcher::search(FetchKey key_, const TQString& value_) { str = str.section(';', 0, 0); // also try formalized lccn TQString lccn = LCCNValidator::formalize(str); - u.addQueryItem(TQString::fromLatin1("query"), - TQString::fromLatin1("bath.lccn=") + str + - TQString::fromLatin1(" or bath.lccn=") + lccn + u.addQueryItem(TQString::tqfromLatin1("query"), + TQString::tqfromLatin1("bath.lccn=") + str + + TQString::tqfromLatin1(" or bath.lccn=") + lccn ); } break; case Keyword: - u.addQueryItem(TQString::fromLatin1("query"), str); + u.addQueryItem(TQString::tqfromLatin1("query"), str); break; case Raw: @@ -233,11 +233,11 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { Import::XMLImporter xmlImporter(result); TQDomDocument dom = xmlImporter.domDocument(); - TQDomNodeList diagList = dom.elementsByTagNameNS(diag, TQString::fromLatin1("diagnostic")); + TQDomNodeList diagList = dom.elementsByTagNameNS(diag, TQString::tqfromLatin1("diagnostic")); for(uint i = 0; i < diagList.count(); ++i) { TQDomElement elem = diagList.item(i).toElement(); - TQDomNodeList nodeList1 = elem.elementsByTagNameNS(diag, TQString::fromLatin1("message")); - TQDomNodeList nodeList2 = elem.elementsByTagNameNS(diag, TQString::fromLatin1("details")); + TQDomNodeList nodeList1 = elem.elementsByTagNameNS(diag, TQString::tqfromLatin1("message")); + TQDomNodeList nodeList2 = elem.elementsByTagNameNS(diag, TQString::tqfromLatin1("details")); for(uint j = 0; j < nodeList1.count(); ++j) { TQString d = nodeList1.item(j).toElement().text(); if(!d.isEmpty()) { @@ -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) { @@ -299,36 +299,36 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { TQString desc; switch(coll->type()) { case Data::Collection::Book: - desc = entry->field(TQString::fromLatin1("author")) + desc = entry->field(TQString::tqfromLatin1("author")) + TQChar('/') - + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("cr_year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::fromLatin1("cr_year")); - } else if(!entry->field(TQString::fromLatin1("pub_year")).isEmpty()){ - desc += TQChar('/') + entry->field(TQString::fromLatin1("pub_year")); + + 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(TQString::fromLatin1("studio")) + desc = entry->field(TQString::tqfromLatin1("studio")) + TQChar('/') - + entry->field(TQString::fromLatin1("director")) + + entry->field(TQString::tqfromLatin1("director")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; case Data::Collection::Album: - desc = entry->field(TQString::fromLatin1("artist")) + desc = entry->field(TQString::tqfromLatin1("artist")) + TQChar('/') - + entry->field(TQString::fromLatin1("label")) + + entry->field(TQString::tqfromLatin1("label")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); break; default: break; } - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::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; - TQString isbn = entry_->field(TQString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - TQString lccn = entry_->field(TQString::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 - TQString t = entry_->field(TQString::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; } - TQString xsltfile = locate("appdata", TQString::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; } - TQString xsltfile = locate("appdata", TQString::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; @@ -413,15 +413,15 @@ bool SRUFetcher::initMODSHandler() { } Tellico::Fetch::Fetcher::Ptr SRUFetcher::libraryOfCongress(TQObject* parent_) { - return new SRUFetcher(i18n("Library of Congress (US)"), TQString::fromLatin1("z3950.loc.gov"), 7090, - TQString::fromLatin1("voyager"), parent_); + return new SRUFetcher(i18n("Library of Congress (US)"), TQString::tqfromLatin1("z3950.loc.gov"), 7090, + TQString::tqfromLatin1("voyager"), parent_); } // static Tellico::StringMap SRUFetcher::customFields() { StringMap map; - map[TQString::fromLatin1("address")] = i18n("Address"); - map[TQString::fromLatin1("abstract")] = i18n("Abstract"); + map[TQString::tqfromLatin1("address")] = i18n("Address"); + map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); return map; } @@ -453,7 +453,7 @@ SRUConfigWidget::SRUConfigWidget(TQWidget* parent_, const SRUFetcher* fetcher_ / m_portSpinBox = new KIntSpinBox(0, 999999, 1, SRU_DEFAULT_PORT, 10, optionsWidget()); 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); + 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); @@ -471,9 +471,9 @@ SRUConfigWidget::SRUConfigWidget(TQWidget* parent_, const SRUFetcher* fetcher_ / label = new TQLabel(i18n("Format: "), optionsWidget()); l->addWidget(label, ++row, 0); m_formatCombo = new GUI::ComboBox(optionsWidget()); - m_formatCombo->insertItem(TQString::fromLatin1("MODS"), TQString::fromLatin1("mods")); - m_formatCombo->insertItem(TQString::fromLatin1("MARCXML"), TQString::fromLatin1("marcxml")); - m_formatCombo->insertItem(TQString::fromLatin1("Dublin Core"), TQString::fromLatin1("dc")); + 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."); diff --git a/src/fetch/yahoofetcher.cpp b/src/fetch/yahoofetcher.cpp index b3ddf77..dcd1823 100644 --- a/src/fetch/yahoofetcher.cpp +++ b/src/fetch/yahoofetcher.cpp @@ -29,7 +29,7 @@ #include <tqdom.h> #include <tqlabel.h> -#include <layout.h> +#include <tqlayout.h> #include <tqfile.h> namespace { @@ -83,32 +83,32 @@ void YahooFetcher::continueSearch() { void YahooFetcher::doSearch() { // myDebug() << "YahooFetcher::search() - value = " << value_ << endl; - KURL u(TQString::fromLatin1(YAHOO_BASE_URL)); - u.addQueryItem(TQString::fromLatin1("appid"), TQString::fromLatin1(YAHOO_APP_ID)); - u.addQueryItem(TQString::fromLatin1("type"), TQString::fromLatin1("all")); - u.addQueryItem(TQString::fromLatin1("output"), TQString::fromLatin1("xml")); - u.addQueryItem(TQString::fromLatin1("start"), TQString::number(m_start)); - u.addQueryItem(TQString::fromLatin1("results"), TQString::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(TQString::fromLatin1("album"), m_value); + u.addQueryItem(TQString::tqfromLatin1("album"), m_value); break; case Person: - u.addQueryItem(TQString::fromLatin1("artist"), m_value); + u.addQueryItem(TQString::tqfromLatin1("artist"), m_value); break; // raw is used for the entry updates case Raw: -// u.removeQueryItem(TQString::fromLatin1("type")); -// u.addQueryItem(TQString::fromLatin1("type"), TQString::fromLatin1("phrase")); +// u.removeQueryItem(TQString::tqfromLatin1("type")); +// u.addQueryItem(TQString::tqfromLatin1("type"), TQString::tqfromLatin1("phrase")); u.setQuery(u.query() + '&' + m_value); break; @@ -163,7 +163,7 @@ void YahooFetcher::slotComplete(KIO::Job* job_) { #if 0 kdWarning() << "Remove debug from yahoofetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -189,7 +189,7 @@ void YahooFetcher::slotComplete(KIO::Job* job_) { // total is top level element, with attribute totalResultsAvailable TQDomElement e = dom.documentElement(); if(!e.isNull()) { - m_total = e.attribute(TQString::fromLatin1("totalResultsAvailable")).toInt(); + m_total = e.attribute(TQString::tqfromLatin1("totalResultsAvailable")).toInt(); } } @@ -210,13 +210,13 @@ void YahooFetcher::slotComplete(KIO::Job* job_) { // might get aborted break; } - TQString desc = entry->field(TQString::fromLatin1("artist")) + TQString desc = entry->field(TQString::tqfromLatin1("artist")) + TQChar('/') - + entry->field(TQString::fromLatin1("label")) + + entry->field(TQString::tqfromLatin1("label")) + TQChar('/') - + entry->field(TQString::fromLatin1("year")); + + entry->field(TQString::tqfromLatin1("year")); - SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::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(TQString::fromLatin1("image")); + KURL imageURL = entry->field(TQString::tqfromLatin1("image")); if(!imageURL.isEmpty()) { 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(TQString::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(TQString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } getTracks(entry); // don't want to show image urls in the fetch dialog - entry->setField(TQString::fromLatin1("image"), TQString()); + entry->setField(TQString::tqfromLatin1("image"), TQString()); // no need for album id now ? - entry->setField(TQString::fromLatin1("yahoo"), TQString()); + entry->setField(TQString::tqfromLatin1("yahoo"), TQString()); return entry; } void YahooFetcher::initXSLTHandler() { - TQString xsltfile = locate("appdata", TQString::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,20 +276,20 @@ void YahooFetcher::initXSLTHandler() { void YahooFetcher::getTracks(Data::EntryPtr entry_) { // get album id - if(!entry_ || entry_->field(TQString::fromLatin1("yahoo")).isEmpty()) { + if(!entry_ || entry_->field(TQString::tqfromLatin1("yahoo")).isEmpty()) { return; } - const TQString albumid = entry_->field(TQString::fromLatin1("yahoo")); + const TQString albumid = entry_->field(TQString::tqfromLatin1("yahoo")); - KURL u(TQString::fromLatin1(YAHOO_BASE_URL)); - u.setFileName(TQString::fromLatin1("songSearch")); - u.addQueryItem(TQString::fromLatin1("appid"), TQString::fromLatin1(YAHOO_APP_ID)); - u.addQueryItem(TQString::fromLatin1("type"), TQString::fromLatin1("all")); - u.addQueryItem(TQString::fromLatin1("output"), TQString::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(TQString::fromLatin1("results"), TQString::number(50)); - u.addQueryItem(TQString::fromLatin1("albumid"), albumid); + u.addQueryItem(TQString::tqfromLatin1("results"), TQString::number(50)); + u.addQueryItem(TQString::tqfromLatin1("albumid"), albumid); // myDebug() << "YahooFetcher::getTracks() - url: " << u.url() << endl; TQDomDocument dom = FileHandler::readXMLFile(u, false /*no namespace*/, true /*quiet*/); @@ -300,7 +300,7 @@ void YahooFetcher::getTracks(Data::EntryPtr entry_) { #if 0 kdWarning() << "Remove debug from yahoofetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.xml")); + TQFile f(TQString::tqfromLatin1("/tmp/test.xml")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -309,7 +309,7 @@ void YahooFetcher::getTracks(Data::EntryPtr entry_) { f.close(); #endif - const TQString track = TQString::fromLatin1("track"); + const TQString track = TQString::tqfromLatin1("track"); TQDomNodeList nodes = dom.documentElement().childNodes(); for(uint i = 0; i < nodes.count(); ++i) { @@ -317,16 +317,16 @@ void YahooFetcher::getTracks(Data::EntryPtr entry_) { if(e.isNull()) { continue; } - TQString t = e.namedItem(TQString::fromLatin1("Title")).toElement().text(); - TQString n = e.namedItem(TQString::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; } - TQString a = e.namedItem(TQString::fromLatin1("Artist")).toElement().text(); - TQString l = e.namedItem(TQString::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); TQString value = t + "::" + a; @@ -346,14 +346,14 @@ TQString YahooFetcher::insertValue(const TQString& str_, const TQString& value_, 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(TQString::fromLatin1("::")) < 2) { // means no length value + if(value_.contains(TQString::tqfromLatin1("::")) < 2) { // means no length value write = false; } } if(!value_.isEmpty() && write) { list[pos_-1] = value_; } - return list.join(TQString::fromLatin1("; ")); + return list.join(TQString::tqfromLatin1("; ")); } void YahooFetcher::updateEntry(Data::EntryPtr entry_) { @@ -362,16 +362,16 @@ void YahooFetcher::updateEntry(Data::EntryPtr entry_) { m_limit = 5; TQString value; - TQString title = entry_->field(TQString::fromLatin1("title")); + TQString title = entry_->field(TQString::tqfromLatin1("title")); if(!title.isEmpty()) { - value += TQString::fromLatin1("album=") + title; + value += TQString::tqfromLatin1("album=") + title; } - TQString artist = entry_->field(TQString::fromLatin1("artist")); + TQString artist = entry_->field(TQString::tqfromLatin1("artist")); if(!artist.isEmpty()) { if(!value.isEmpty()) { value += '&'; } - value += TQString::fromLatin1("artist=") + artist; + value += TQString::tqfromLatin1("artist=") + artist; } if(!value.isEmpty()) { search(Fetch::Raw, value); diff --git a/src/fetch/z3950connection.cpp b/src/fetch/z3950connection.cpp index 7817762..5bf77ac 100644 --- a/src/fetch/z3950connection.cpp +++ b/src/fetch/z3950connection.cpp @@ -149,7 +149,7 @@ void Z3950Connection::run() { // if syntax is mods, set esn to mods too TQCString type = "raw"; if(m_syntax == Latin1Literal("mods")) { - m_syntax = TQString::fromLatin1("xml"); + m_syntax = TQString::tqfromLatin1("xml"); ZOOM_resultset_option_set(resultSet, "elementSetName", "mods"); type = "xml"; } else { @@ -170,7 +170,7 @@ void Z3950Connection::run() { ZOOM_query_destroy(query); m_connected = false; - TQString s = i18n("Connection search error %1: %2").arg(errcode).arg(toString(errmsg)); + TQString s = i18n("Connection search error %1: %2").tqarg(errcode).tqarg(toString(errmsg)); if(!TQCString(addinfo).isEmpty()) { s += " (" + toString(addinfo) + ")"; } @@ -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 = TQString::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 = TQString::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 = TQString::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 = TQString::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 = TQString::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 = TQString::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 = TQString::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 = TQString::fromLatin1("mods"); + m_syntax = TQString::tqfromLatin1("mods"); } if(newSyntax == Latin1Literal("xml")) { - newSyntax = TQString::fromLatin1("mods"); + newSyntax = TQString::tqfromLatin1("mods"); } // save syntax change for next time if(m_syntax != newSyntax) { @@ -268,7 +268,7 @@ void Z3950Connection::run() { } if(m_sourceCharSet.isEmpty()) { - m_sourceCharSet = TQString::fromLatin1("marc-8"); + m_sourceCharSet = TQString::tqfromLatin1("marc-8"); } const size_t realLimit = TQMIN(numResults, m_limit); @@ -291,7 +291,7 @@ void Z3950Connection::run() { #if 0 kdWarning() << "Remove debug from z3950connection.cpp" << endl; { - TQFile f1(TQString::fromLatin1("/tmp/z3950.raw")); + TQFile f1(TQString::tqfromLatin1("/tmp/z3950.raw")); if(f1.open(IO_WriteOnly)) { TQDataStream t(&f1); t << ZOOM_record_get(rec, "raw", &len); @@ -342,7 +342,7 @@ bool Z3950Connection::makeConnection() { ZOOM_connection_destroy(d->conn); m_connected = false; - TQString s = i18n("Connection error %1: %2").arg(errcode).arg(toString(errmsg)); + TQString s = i18n("Connection error %1: %2").tqarg(errcode).tqarg(toString(errmsg)); if(!TQCString(addinfo).isEmpty()) { s += " (" + toString(addinfo) + ")"; } @@ -378,12 +378,12 @@ void Z3950Connection::checkPendingEvents() { inline TQCString Z3950Connection::toCString(const TQString& text_) { - return iconvRun(text_.utf8(), TQString::fromLatin1("utf-8"), m_sourceCharSet); + return iconvRun(text_.utf8(), TQString::tqfromLatin1("utf-8"), m_sourceCharSet); } inline TQString Z3950Connection::toString(const TQCString& text_) { - return TQString::fromUtf8(iconvRun(text_, m_sourceCharSet, TQString::fromLatin1("utf-8"))); + return TQString::fromUtf8(iconvRun(text_, m_sourceCharSet, TQString::tqfromLatin1("utf-8"))); } // static @@ -403,9 +403,9 @@ TQCString Z3950Connection::iconvRun(const TQCString& text_, const TQString& from TQString charSetLower = fromCharSet_.lower(); charSetLower.remove('-').remove(' '); if(charSetLower == Latin1Literal("iso5426")) { - return iconvRun(Iso5426Converter::toUtf8(text_).utf8(), TQString::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(), TQString::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; @@ -453,9 +453,9 @@ TQString Z3950Connection::toXML(const TQCString& marc_, const TQString& charSet_ TQString charSetLower = charSet_.lower(); charSetLower.remove('-').remove(' '); if(charSetLower == Latin1Literal("iso5426")) { - return toXML(Iso5426Converter::toUtf8(marc_).utf8(), TQString::fromLatin1("utf-8")); + return toXML(Iso5426Converter::toUtf8(marc_).utf8(), TQString::tqfromLatin1("utf-8")); } else if(charSetLower == Latin1Literal("iso6937")) { - return toXML(Iso6937Converter::toUtf8(marc_).utf8(), TQString::fromLatin1("utf-8")); + return toXML(Iso6937Converter::toUtf8(marc_).utf8(), TQString::tqfromLatin1("utf-8")); } kdWarning() << "Z3950Connection::toXML() - conversion from " << charSet_ << " is unsupported" << endl; return TQString(); @@ -488,7 +488,7 @@ TQString Z3950Connection::toXML(const TQCString& marc_, const TQString& charSet_ return TQString(); } - TQString output = TQString::fromLatin1("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + 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; diff --git a/src/fetch/z3950fetcher.cpp b/src/fetch/z3950fetcher.cpp index f24b030..2496b5b 100644 --- a/src/fetch/z3950fetcher.cpp +++ b/src/fetch/z3950fetcher.cpp @@ -47,14 +47,14 @@ #include <kseparator.h> #include <tqfile.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqwhatsthis.h> #include <tqdom.h> namespace { static const int Z3950_DEFAULT_PORT = 210; - static const TQString Z3950_DEFAULT_ESN = TQString::fromLatin1("F"); + static const TQString Z3950_DEFAULT_ESN = TQString::tqfromLatin1("F"); } using Tellico::Fetch::Z3950Fetcher; @@ -103,7 +103,7 @@ void Z3950Fetcher::readConfigHook(const KConfigGroup& config_) { m_password = config_.readEntry("Password"); } else { m_preset = preset; - TQString serverFile = locate("appdata", TQString::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 TQStringList servers = cfg.groupList(); @@ -147,29 +147,29 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { m_started = true; TQString svalue = m_value; - TQRegExp rx1(TQString::fromLatin1("['\"].*\\1")); + TQRegExp rx1(TQString::tqfromLatin1("['\"].*\\1")); if(!rx1.exactMatch(svalue)) { svalue.prepend('"').append('"'); } switch(key_) { case Title: - m_pqn = TQString::fromLatin1("@attr 1=4 ") + svalue; + m_pqn = TQString::tqfromLatin1("@attr 1=4 ") + svalue; break; case Person: -// m_pqn = TQString::fromLatin1("@or "); -// m_pqn += TQString::fromLatin1("@attr 1=1 \"") + m_value + '"'; - m_pqn = TQString::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); TQString s = m_value; s.remove('-'); - TQStringList isbnList = TQStringList::split(TQString::fromLatin1("; "), s); + TQStringList isbnList = TQStringList::split(TQString::tqfromLatin1("; "), s); // also going to search for isbn10 values for(TQStringList::Iterator it = isbnList.begin(); it != isbnList.end(); ++it) { - if((*it).startsWith(TQString::fromLatin1("978"))) { + if((*it).startsWith(TQString::tqfromLatin1("978"))) { TQString isbn10 = ISBNValidator::isbn10(*it); isbn10.remove('-'); isbnList.insert(it, isbn10); @@ -177,12 +177,12 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { } const int count = isbnList.count(); if(count > 1) { - m_pqn = TQString::fromLatin1("@or "); + m_pqn = TQString::tqfromLatin1("@or "); } for(int i = 0; i < count; ++i) { - m_pqn += TQString::fromLatin1(" @attr 1=7 ") + isbnList[i]; + m_pqn += TQString::tqfromLatin1(" @attr 1=7 ") + isbnList[i]; if(i < count-2) { - m_pqn += TQString::fromLatin1(" @or"); + m_pqn += TQString::tqfromLatin1(" @or"); } } } @@ -192,19 +192,19 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { m_pqn.truncate(0); TQString s = m_value; s.remove('-'); - TQStringList lccnList = TQStringList::split(TQString::fromLatin1("; "), s); + TQStringList lccnList = TQStringList::split(TQString::tqfromLatin1("; "), s); while(!lccnList.isEmpty()) { - m_pqn += TQString::fromLatin1(" @or @attr 1=9 ") + lccnList.front(); + m_pqn += TQString::tqfromLatin1(" @or @attr 1=9 ") + lccnList.front(); if(lccnList.count() > 1) { - m_pqn += TQString::fromLatin1(" @or"); + m_pqn += TQString::tqfromLatin1(" @or"); } - m_pqn += TQString::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 = TQString::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 TQString& value_) { stop(); return; } -// m_pqn = TQString::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; } - TQString xsltfile = locate("appdata", TQString::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; } - TQString xsltfile = locate("appdata", TQString::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; } - TQString xsltfile = locate("appdata", TQString::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; @@ -351,7 +351,7 @@ void Z3950Fetcher::handleResult(const TQString& result_) { #if 0 kdWarning() << "Remove debug from z3950fetcher.cpp" << endl; { - TQFile f1(TQString::fromLatin1("/tmp/marc.xml")); + TQFile f1(TQString::tqfromLatin1("/tmp/marc.xml")); if(f1.open(IO_WriteOnly)) { // if(f1.open(IO_WriteOnly | IO_Append)) { TQTextStream t(&f1); @@ -385,7 +385,7 @@ void Z3950Fetcher::handleResult(const TQString& result_) { #if 0 kdWarning() << "Remove debug from z3950fetcher.cpp" << endl; { - TQFile f2(TQString::fromLatin1("/tmp/mods.xml")); + TQFile f2(TQString::tqfromLatin1("/tmp/mods.xml")); // if(f2.open(IO_WriteOnly)) { if(f2.open(IO_WriteOnly | IO_Append)) { TQTextStream t(&f2); @@ -423,14 +423,14 @@ void Z3950Fetcher::handleResult(const TQString& result_) { Data::EntryVec entries = coll->entries(); for(Data::EntryVec::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - TQString desc = entry->field(TQString::fromLatin1("author")) + '/' - + entry->field(TQString::fromLatin1("publisher")); - if(!entry->field(TQString::fromLatin1("cr_year")).isEmpty()) { - desc += TQChar('/') + entry->field(TQString::fromLatin1("cr_year")); - } else if(!entry->field(TQString::fromLatin1("pub_year")).isEmpty()){ - desc += TQChar('/') + entry->field(TQString::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(TQString::fromLatin1("isbn"))); + SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn"))); m_entries.insert(r->uid, entry); emit signalResultFound(r); } @@ -480,20 +480,20 @@ void Z3950Fetcher::customEvent(TQCustomEvent* event_) { void Z3950Fetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "Z3950Fetcher::updateEntry() - " << source() << ": " << entry_->title() << endl; - TQString isbn = entry_->field(TQString::fromLatin1("isbn")); + TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - TQString lccn = entry_->field(TQString::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 - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Title, t); return; @@ -541,7 +541,7 @@ Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const Z3950Fetcher* m_portSpinBox = new KIntSpinBox(0, 999999, 1, Z3950_DEFAULT_PORT, 10, optionsWidget()); 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); + 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); @@ -560,9 +560,9 @@ Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const Z3950Fetcher* l->addWidget(label, ++row, 0); m_charSetCombo = new KComboBox(true, optionsWidget()); m_charSetCombo->insertItem(TQString()); - m_charSetCombo->insertItem(TQString::fromLatin1("marc8")); - m_charSetCombo->insertItem(TQString::fromLatin1("iso-8859-1")); - m_charSetCombo->insertItem(TQString::fromLatin1("utf-8")); + 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 " @@ -575,11 +575,11 @@ Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const Z3950Fetcher* l->addWidget(label, ++row, 0); m_syntaxCombo = new GUI::ComboBox(optionsWidget()); m_syntaxCombo->insertItem(i18n("Auto-detect"), TQString()); - m_syntaxCombo->insertItem(TQString::fromLatin1("MODS"), TQString::fromLatin1("mods")); - m_syntaxCombo->insertItem(TQString::fromLatin1("MARC21"), TQString::fromLatin1("marc21")); - m_syntaxCombo->insertItem(TQString::fromLatin1("UNIMARC"), TQString::fromLatin1("unimarc")); - m_syntaxCombo->insertItem(TQString::fromLatin1("USMARC"), TQString::fromLatin1("usmarc")); - m_syntaxCombo->insertItem(TQString::fromLatin1("GRS-1"), TQString::fromLatin1("grs-1")); + 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 " @@ -689,9 +689,9 @@ void Z3950Fetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { // static Tellico::StringMap Z3950Fetcher::customFields() { StringMap map; - map[TQString::fromLatin1("address")] = i18n("Address"); - map[TQString::fromLatin1("abstract")] = i18n("Abstract"); - map[TQString::fromLatin1("illustrator")] = i18n("Illustrator"); + map[TQString::tqfromLatin1("address")] = i18n("Address"); + map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); + map[TQString::tqfromLatin1("illustrator")] = i18n("Illustrator"); return map; } @@ -727,7 +727,7 @@ void Z3950Fetcher::ConfigWidget::loadPresets(const TQString& current_) { KGlobal::locale()->splitLocale(lang, lang2A, dummy, dummy); } - TQString serverFile = locate("appdata", TQString::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; |