summaryrefslogtreecommitdiffstats
path: root/src/fetch/amazonfetcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fetch/amazonfetcher.cpp')
-rw-r--r--src/fetch/amazonfetcher.cpp252
1 files changed, 126 insertions, 126 deletions
diff --git a/src/fetch/amazonfetcher.cpp b/src/fetch/amazonfetcher.cpp
index e5f50b8..9484581 100644
--- a/src/fetch/amazonfetcher.cpp
+++ b/src/fetch/amazonfetcher.cpp
@@ -37,12 +37,12 @@
#include <kaccelmanager.h>
#include <tqdom.h>
-#include <tqlayout.h>
+#include <layout.h>
#include <tqlabel.h>
#include <tqwhatsthis.h>
#include <tqcheckbox.h>
#include <tqfile.h>
-#include <tqtextcodec.h>
+#include <textcodec.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::tqfromLatin1(AMAZON_ACCESS_KEY)),
- m_assoc(TQString::tqfromLatin1(AMAZON_ASSOC_TOKEN)), m_addLinkField(true), m_limit(AMAZON_MAX_RETURNS_TOTAL),
+ m_access(TQString::fromLatin1(AMAZON_ACCESS_KEY)),
+ m_assoc(TQString::fromLatin1(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::tqfromLatin1("keyword"));
+ m_fields = config_.readListEntry("Custom Fields", TQString::fromLatin1("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::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"));
+ 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"));
const int type = Kernel::self()->collectionType();
switch(type) {
case Data::Collection::Book:
case Data::Collection::ComicBook:
case Data::Collection::Bibtex:
- u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Books"));
- u.addQueryItem(TQString::tqfromLatin1("SortIndex"), TQString::tqfromLatin1("relevancerank"));
+ u.addQueryItem(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("Books"));
+ u.addQueryItem(TQString::fromLatin1("SortIndex"), TQString::fromLatin1("relevancerank"));
break;
case Data::Collection::Album:
- u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Music"));
+ u.addQueryItem(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("Music"));
break;
case Data::Collection::Video:
- u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("Video"));
- u.addQueryItem(TQString::tqfromLatin1("SortIndex"), TQString::tqfromLatin1("relevancerank"));
+ u.addQueryItem(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("Video"));
+ u.addQueryItem(TQString::fromLatin1("SortIndex"), TQString::fromLatin1("relevancerank"));
break;
case Data::Collection::Game:
- u.addQueryItem(TQString::tqfromLatin1("SearchIndex"), TQString::tqfromLatin1("VideoGames"));
+ u.addQueryItem(TQString::fromLatin1("SearchIndex"), TQString::fromLatin1("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.").tqarg(source()), MessageHandler::Warning);
+ message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning);
stop();
return;
}
@@ -207,40 +207,40 @@ void AmazonFetcher::doSearch() {
switch(m_key) {
case Title:
- u.addQueryItem(TQString::tqfromLatin1("Title"), value, mib);
+ u.addQueryItem(TQString::fromLatin1("Title"), value, mib);
break;
case Person:
if(type == Data::Collection::Video) {
- u.addQueryItem(TQString::tqfromLatin1("Actor"), value, mib);
- u.addQueryItem(TQString::tqfromLatin1("Director"), value, mib);
+ u.addQueryItem(TQString::fromLatin1("Actor"), value, mib);
+ u.addQueryItem(TQString::fromLatin1("Director"), value, mib);
} else if(type == Data::Collection::Album) {
- u.addQueryItem(TQString::tqfromLatin1("Artist"), value, mib);
+ u.addQueryItem(TQString::fromLatin1("Artist"), value, mib);
} else if(type == Data::Collection::Game) {
- u.addQueryItem(TQString::tqfromLatin1("Manufacturer"), value, mib);
+ u.addQueryItem(TQString::fromLatin1("Manufacturer"), value, mib);
} else { // books and bibtex
- 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);
+ 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);
}
break;
case ISBN:
{
- u.removeQueryItem(TQString::tqfromLatin1("Operation"));
- u.addQueryItem(TQString::tqfromLatin1("Operation"), TQString::tqfromLatin1("ItemLookup"));
+ u.removeQueryItem(TQString::fromLatin1("Operation"));
+ u.addQueryItem(TQString::fromLatin1("Operation"), TQString::fromLatin1("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::tqfromLatin1("; "), s);
+ TQStringList isbns = TQStringList::split(TQString::fromLatin1("; "), 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::tqfromLatin1("979"))) {
+ if(m_value.startsWith(TQString::fromLatin1("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::tqfromLatin1("SearchIndex"));
+ u.removeQueryItem(TQString::fromLatin1("SearchIndex"));
}
// limit to first 10
while(isbns.size() > 10) {
isbns.pop_back();
}
- u.addQueryItem(TQString::tqfromLatin1("ItemId"), isbns.join(TQString::tqfromLatin1(",")));
+ u.addQueryItem(TQString::fromLatin1("ItemId"), isbns.join(TQString::fromLatin1(",")));
if(isbn13) {
- u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("EAN"));
+ u.addQueryItem(TQString::fromLatin1("IdType"), TQString::fromLatin1("EAN"));
}
}
break;
case UPC:
{
- u.removeQueryItem(TQString::tqfromLatin1("Operation"));
- u.addQueryItem(TQString::tqfromLatin1("Operation"), TQString::tqfromLatin1("ItemLookup"));
+ u.removeQueryItem(TQString::fromLatin1("Operation"));
+ u.addQueryItem(TQString::fromLatin1("Operation"), TQString::fromLatin1("ItemLookup"));
// US allows UPC, all others are EAN
if(m_site == US) {
- u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("UPC"));
+ u.addQueryItem(TQString::fromLatin1("IdType"), TQString::fromLatin1("UPC"));
} else {
- u.addQueryItem(TQString::tqfromLatin1("IdType"), TQString::tqfromLatin1("EAN"));
+ u.addQueryItem(TQString::fromLatin1("IdType"), TQString::fromLatin1("EAN"));
}
TQString s = m_value; // not encValue!!!
s.remove('-');
// limit to first 10
- s.replace(TQString::tqfromLatin1("; "), TQString::tqfromLatin1(","));
+ s.replace(TQString::fromLatin1("; "), TQString::fromLatin1(","));
s = s.section(',', 0, 9);
- u.addQueryItem(TQString::tqfromLatin1("ItemId"), s);
+ u.addQueryItem(TQString::fromLatin1("ItemId"), s);
}
break;
case Keyword:
- u.addQueryItem(TQString::tqfromLatin1("Keywords"), m_value, mib);
+ u.addQueryItem(TQString::fromLatin1("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::tqfromLatin1("/tmp/test%1.xml").tqarg(m_page));
+ TQFile f(TQString::fromLatin1("/tmp/test%1.xml").arg(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::tqfromLatin1("Items"))
- .namedItem(TQString::tqfromLatin1("TotalResults"));
+ TQDomNode n = dom.documentElement().namedItem(TQString::fromLatin1("Items"))
+ .namedItem(TQString::fromLatin1("TotalResults"));
TQDomElement e = n.toElement();
if(!e.isNull()) {
m_total = e.text().toInt();
}
- n = dom.documentElement().namedItem(TQString::tqfromLatin1("Items"))
- .namedItem(TQString::tqfromLatin1("Request"))
- .namedItem(TQString::tqfromLatin1("Errors"));
+ n = dom.documentElement().namedItem(TQString::fromLatin1("Items"))
+ .namedItem(TQString::fromLatin1("Request"))
+ .namedItem(TQString::fromLatin1("Errors"));
e = n.toElement();
if(!e.isNull()) {
- TQDomNodeList nodes = e.elementsByTagName(TQString::tqfromLatin1("Error"));
+ TQDomNodeList nodes = e.elementsByTagName(TQString::fromLatin1("Error"));
for(uint i = 0; i < nodes.count(); ++i) {
- e = nodes.item(i).toElement().namedItem(TQString::tqfromLatin1("Code")).toElement();
+ e = nodes.item(i).toElement().namedItem(TQString::fromLatin1("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::tqfromLatin1("IsValid"));
+ TQDomNode isValidNode = n.parentNode().namedItem(TQString::fromLatin1("IsValid"));
if(m_key == ISBN && isValidNode.toElement().text().lower() == Latin1Literal("true")) {
continue;
}
- e = nodes.item(i).toElement().namedItem(TQString::tqfromLatin1("Message")).toElement();
+ e = nodes.item(i).toElement().namedItem(TQString::fromLatin1("Message")).toElement();
if(!e.isNull()) {
errors << e.text();
}
@@ -417,7 +417,7 @@ void AmazonFetcher::slotComplete(KIO::Job* job_) {
}
}
-// TQRegExp stripHTML(TQString::tqfromLatin1("<.*>"), true);
+// TQRegExp stripHTML(TQString::fromLatin1("<.*>"), 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::tqfromLatin1("amazon"));
+ coll->removeField(TQString::fromLatin1("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::tqfromLatin1("\\.([^\\s])"));
- TQStringList values = entry->fields(TQString::tqfromLatin1("author"), false);
+ TQRegExp rx(TQString::fromLatin1("\\.([^\\s])"));
+ TQStringList values = entry->fields(TQString::fromLatin1("author"), false);
for(TQStringList::Iterator it = values.begin(); it != values.end(); ++it) {
- (*it).replace(rx, TQString::tqfromLatin1(". \\1"));
+ (*it).replace(rx, TQString::fromLatin1(". \\1"));
}
- entry->setField(TQString::tqfromLatin1("author"), values.join(TQString::tqfromLatin1("; ")));
+ entry->setField(TQString::fromLatin1("author"), values.join(TQString::fromLatin1("; ")));
}
// UK puts the year in the title for some reason
if(m_site == UK && coll->type() == Data::Collection::Video) {
- TQRegExp rx(TQString::tqfromLatin1("\\[(\\d{4})\\]"));
+ TQRegExp rx(TQString::fromLatin1("\\[(\\d{4})\\]"));
TQString t = entry->title();
if(t.find(rx) > -1) {
TQString y = rx.cap(1);
t.remove(rx).simplifyWhiteSpace();
- entry->setField(TQString::tqfromLatin1("title"), t);
- if(entry->field(TQString::tqfromLatin1("year")).isEmpty()) {
- entry->setField(TQString::tqfromLatin1("year"), y);
+ entry->setField(TQString::fromLatin1("title"), t);
+ if(entry->field(TQString::fromLatin1("year")).isEmpty()) {
+ entry->setField(TQString::fromLatin1("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::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"));
+ 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"));
}
break;
case Data::Collection::Video:
- desc = entry->field(TQString::tqfromLatin1("studio"))
+ desc = entry->field(TQString::fromLatin1("studio"))
+ TQChar('/')
- + entry->field(TQString::tqfromLatin1("director"))
+ + entry->field(TQString::fromLatin1("director"))
+ TQChar('/')
- + entry->field(TQString::tqfromLatin1("year"))
+ + entry->field(TQString::fromLatin1("year"))
+ TQChar('/')
- + entry->field(TQString::tqfromLatin1("medium"));
+ + entry->field(TQString::fromLatin1("medium"));
break;
case Data::Collection::Album:
- desc = entry->field(TQString::tqfromLatin1("artist"))
+ desc = entry->field(TQString::fromLatin1("artist"))
+ TQChar('/')
- + entry->field(TQString::tqfromLatin1("label"))
+ + entry->field(TQString::fromLatin1("label"))
+ TQChar('/')
- + entry->field(TQString::tqfromLatin1("year"));
+ + entry->field(TQString::fromLatin1("year"));
break;
case Data::Collection::Game:
- desc = entry->field(TQString::tqfromLatin1("platform"))
+ desc = entry->field(TQString::fromLatin1("platform"))
+ TQChar('/')
- + entry->field(TQString::tqfromLatin1("year"));
+ + entry->field(TQString::fromLatin1("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::tqfromLatin1("plot"));
+ TQString plot = entry->field(TQString::fromLatin1("plot"));
plot.remove(stripHTML);
- entry->setField(TQString::tqfromLatin1("plot"), plot);
+ entry->setField(TQString::fromLatin1("plot"), plot);
} else if(coll->type() == Data::Collection::Game) {
- TQString desc = entry->field(TQString::tqfromLatin1("description"));
+ TQString desc = entry->field(TQString::fromLatin1("description"));
desc.remove(stripHTML);
- entry->setField(TQString::tqfromLatin1("description"), desc);
+ entry->setField(TQString::fromLatin1("description"), desc);
} else {
- TQString comments = entry->field(TQString::tqfromLatin1("comments"));
+ TQString comments = entry->field(TQString::fromLatin1("comments"));
comments.remove(stripHTML);
- entry->setField(TQString::tqfromLatin1("comments"), comments);
+ entry->setField(TQString::fromLatin1("comments"), comments);
}
*/
// myDebug() << "AmazonFetcher::slotComplete() - " << entry->title() << endl;
- SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn")));
+ SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::fromLatin1("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").tqarg(source()).tqarg(foundCount).tqarg(m_total), MessageHandler::tqStatus);
+ message(i18n("Results from %1: %2/%3").arg(source()).arg(foundCount).arg(m_total), MessageHandler::Status);
++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::tqfromLatin1("keyword");
+ const TQString keywords = TQString::fromLatin1("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::tqfromLatin1("Authors"))) {
+ (*it2).startsWith(TQString::fromLatin1("Authors"))) {
continue;
}
words.add(*it2);
}
}
- entry->setField(keywords, words.toList().join(TQString::tqfromLatin1("; ")));
+ entry->setField(keywords, words.toList().join(TQString::fromLatin1("; ")));
}
- entry->setField(TQString::tqfromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("comments"))));
+ entry->setField(TQString::fromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("comments"))));
break;
case Data::Collection::Video:
{
- const TQString genres = TQString::tqfromLatin1("genre");
+ const TQString genres = TQString::fromLatin1("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::tqfromLatin1("Genres")) == -1) {
+ if((*it).find(TQString::fromLatin1("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::tqfromLatin1("; ")));
+ entry->setField(genres, words.toList().join(TQString::fromLatin1("; ")));
// language tracks get duplicated, too
- TQStringList langs = entry->fields(TQString::tqfromLatin1("language"), false);
+ TQStringList langs = entry->fields(TQString::fromLatin1("language"), false);
words.clear();
for(TQStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it) {
words.add(*it);
}
- entry->setField(TQString::tqfromLatin1("language"), words.toList().join(TQString::tqfromLatin1("; ")));
+ entry->setField(TQString::fromLatin1("language"), words.toList().join(TQString::fromLatin1("; ")));
}
- entry->setField(TQString::tqfromLatin1("plot"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("plot"))));
+ entry->setField(TQString::fromLatin1("plot"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("plot"))));
break;
case Data::Collection::Album:
{
- const TQString genres = TQString::tqfromLatin1("genre");
+ const TQString genres = TQString::fromLatin1("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::tqfromLatin1("Styles")) == -1) {
+ if((*it).find(TQString::fromLatin1("Styles")) == -1) {
continue;
}
@@ -682,13 +682,13 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntry(uint uid_) {
}
}
}
- entry->setField(genres, words.toList().join(TQString::tqfromLatin1("; ")));
+ entry->setField(genres, words.toList().join(TQString::fromLatin1("; ")));
}
- entry->setField(TQString::tqfromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("comments"))));
+ entry->setField(TQString::fromLatin1("comments"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("comments"))));
break;
case Data::Collection::Game:
- entry->setField(TQString::tqfromLatin1("description"), Tellico::decodeHTML(entry->field(TQString::tqfromLatin1("description"))));
+ entry->setField(TQString::fromLatin1("description"), Tellico::decodeHTML(entry->field(TQString::fromLatin1("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::tqfromLatin1("[\\s:;]+")); // only white space, column separators and row separators
+ TQRegExp blank(TQString::fromLatin1("[\\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::tqfromLatin1("small-image"));
+ imageURL = entry->field(TQString::fromLatin1("small-image"));
break;
case MediumImage:
- imageURL = entry->field(TQString::tqfromLatin1("medium-image"));
+ imageURL = entry->field(TQString::fromLatin1("medium-image"));
break;
case LargeImage:
- imageURL = entry->field(TQString::tqfromLatin1("large-image"));
+ imageURL = entry->field(TQString::fromLatin1("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::tqfromLatin1("cover"), id);
+ entry->setField(TQString::fromLatin1("cover"), id);
}
}
// don't want to show image urls in the fetch dialog
- entry->setField(TQString::tqfromLatin1("small-image"), TQString());
- entry->setField(TQString::tqfromLatin1("medium-image"), TQString());
- entry->setField(TQString::tqfromLatin1("large-image"), TQString());
+ entry->setField(TQString::fromLatin1("small-image"), TQString());
+ entry->setField(TQString::fromLatin1("medium-image"), TQString());
+ entry->setField(TQString::fromLatin1("large-image"), TQString());
return entry;
}
void AmazonFetcher::initXSLTHandler() {
- TQString xsltfile = locate("appdata", TQString::tqfromLatin1("amazon2tellico.xsl"));
+ TQString xsltfile = locate("appdata", TQString::fromLatin1("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::tqfromLatin1("isbn"));
+ TQString isbn = entry_->field(TQString::fromLatin1("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::tqfromLatin1("artist"));
+ TQString a = entry_->field(TQString::fromLatin1("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::tqfromLatin1("title"));
+ TQString t = entry_->field(TQString::fromLatin1("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::tqfromLatin1("[\\(\\[](.*)[\\)\\]]"));
+ TQRegExp rx(TQString::fromLatin1("[\\(\\[](.*)[\\)\\]]"));
rx.setMinimal(true);
- TQString title = entry->field(TQString::tqfromLatin1("title"));
+ TQString title = entry->field(TQString::fromLatin1("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::tqfromLatin1("title"), title.stripWhiteSpace());
+ entry->setField(TQString::fromLatin1("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::tqfromLatin1("widescreen"), 0, false /* case-insensitive*/) > -1 ||
+ if(token.find(TQString::fromLatin1("widescreen"), 0, false /* case-insensitive*/) > -1 ||
token.find(i18n("Widescreen"), 0, false) > -1) {
- entry->setField(TQString::tqfromLatin1("widescreen"), TQString::tqfromLatin1("true"));
+ entry->setField(TQString::fromLatin1("widescreen"), TQString::fromLatin1("true"));
// res = true; leave it in the title
- } else if(token.find(TQString::tqfromLatin1("full screen"), 0, false) > -1) {
+ } else if(token.find(TQString::fromLatin1("full screen"), 0, false) > -1) {
// skip, but go ahead and remove from title
res = true;
}
- if(token.find(TQString::tqfromLatin1("blu-ray"), 0, false) > -1) {
- entry->setField(TQString::tqfromLatin1("medium"), i18n("Blu-ray"));
+ if(token.find(TQString::fromLatin1("blu-ray"), 0, false) > -1) {
+ entry->setField(TQString::fromLatin1("medium"), i18n("Blu-ray"));
res = true;
- } else if(token.find(TQString::tqfromLatin1("hd dvd"), 0, false) > -1) {
- entry->setField(TQString::tqfromLatin1("medium"), i18n("HD DVD"));
+ } else if(token.find(TQString::fromLatin1("hd dvd"), 0, false) > -1) {
+ entry->setField(TQString::fromLatin1("medium"), i18n("HD DVD"));
res = true;
}
- if(token.find(TQString::tqfromLatin1("director's cut"), 0, false) > -1 ||
+ if(token.find(TQString::fromLatin1("director's cut"), 0, false) > -1 ||
token.find(i18n("Director's Cut"), 0, false) > -1) {
- entry->setField(TQString::tqfromLatin1("directors-cut"), TQString::tqfromLatin1("true"));
+ entry->setField(TQString::fromLatin1("directors-cut"), TQString::fromLatin1("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::tqfromLatin1(AMAZON_ASSOC_TOKEN));
+ m_assocEdit->setText(TQString::fromLatin1(AMAZON_ASSOC_TOKEN));
m_imageCombo->setCurrentData(MediumImage);
}
@@ -930,7 +930,7 @@ void AmazonFetcher::ConfigWidget::slotSiteChanged() {
//static
Tellico::StringMap AmazonFetcher::customFields() {
StringMap map;
- map[TQString::tqfromLatin1("keyword")] = i18n("Keywords");
+ map[TQString::fromLatin1("keyword")] = i18n("Keywords");
return map;
}