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