diff options
Diffstat (limited to 'src/fetch/isbndbfetcher.cpp')
-rw-r--r-- | src/fetch/isbndbfetcher.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
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); |