summaryrefslogtreecommitdiffstats
path: root/src/fetch/googlescholarfetcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fetch/googlescholarfetcher.cpp')
-rw-r--r--src/fetch/googlescholarfetcher.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/fetch/googlescholarfetcher.cpp b/src/fetch/googlescholarfetcher.cpp
index 21979c4..1d14043 100644
--- a/src/fetch/googlescholarfetcher.cpp
+++ b/src/fetch/googlescholarfetcher.cpp
@@ -24,8 +24,8 @@
#include <kconfig.h>
#include <kio/job.h>
-#include <qlabel.h>
-#include <qlayout.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
namespace {
static const int GOOGLE_MAX_RETURNS_TOTAL = 20;
@@ -34,23 +34,23 @@ namespace {
using Tellico::Fetch::GoogleScholarFetcher;
-GoogleScholarFetcher::GoogleScholarFetcher(QObject* parent_, const char* name_)
- : Fetcher(parent_, name_),
+GoogleScholarFetcher::GoogleScholarFetcher(TQObject* tqparent_, const char* name_)
+ : Fetcher(tqparent_, name_),
m_limit(GOOGLE_MAX_RETURNS_TOTAL), m_start(0), m_job(0), m_started(false),
m_cookieIsSet(false) {
- m_bibtexRx = QRegExp(QString::fromLatin1("<a\\s.*href\\s*=\\s*\"([^>]*scholar\\.bib[^>]*)\""));
+ m_bibtexRx = TQRegExp(TQString::tqfromLatin1("<a\\s.*href\\s*=\\s*\"([^>]*scholar\\.bib[^>]*)\""));
m_bibtexRx.setMinimal(true);
}
GoogleScholarFetcher::~GoogleScholarFetcher() {
}
-QString GoogleScholarFetcher::defaultName() {
+TQString GoogleScholarFetcher::defaultName() {
// no i18n
- return QString::fromLatin1("Google Scholar");
+ return TQString::tqfromLatin1("Google Scholar");
}
-QString GoogleScholarFetcher::source() const {
+TQString GoogleScholarFetcher::source() const {
return m_name.isEmpty() ? defaultName() : m_name;
}
@@ -62,10 +62,10 @@ void GoogleScholarFetcher::readConfigHook(const KConfigGroup& config_) {
Q_UNUSED(config_);
}
-void GoogleScholarFetcher::search(FetchKey key_, const QString& value_) {
+void GoogleScholarFetcher::search(FetchKey key_, const TQString& value_) {
if(!m_cookieIsSet) {
// have to set preferences to have bibtex output
- FileHandler::readTextFile(QString::fromLatin1("http://scholar.google.com/scholar_setprefs?num=100&scis=yes&scisf=4&submit=Save+Preferences"), true);
+ FileHandler::readTextFile(TQString::tqfromLatin1("http://scholar.google.com/scholar_setprefs?num=100&scis=yes&scisf=4&submit=Save+Preferences"), true);
m_cookieIsSet = true;
}
m_key = key_;
@@ -85,25 +85,25 @@ void GoogleScholarFetcher::doSearch() {
// myDebug() << "GoogleScholarFetcher::search() - value = " << value_ << endl;
if(!canFetch(Kernel::self()->collectionType())) {
- message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning);
+ message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning);
stop();
return;
}
- KURL u(QString::fromLatin1(SCHOLAR_BASE_URL));
- u.addQueryItem(QString::fromLatin1("start"), QString::number(m_start));
+ KURL u(TQString::tqfromLatin1(SCHOLAR_BASE_URL));
+ u.addQueryItem(TQString::tqfromLatin1("start"), TQString::number(m_start));
switch(m_key) {
case Title:
- u.addQueryItem(QString::fromLatin1("q"), QString::fromLatin1("allintitle:%1").arg(m_value));
+ u.addQueryItem(TQString::tqfromLatin1("q"), TQString::tqfromLatin1("allintitle:%1").tqarg(m_value));
break;
case Keyword:
- u.addQueryItem(QString::fromLatin1("q"), m_value);
+ u.addQueryItem(TQString::tqfromLatin1("q"), m_value);
break;
case Person:
- u.addQueryItem(QString::fromLatin1("q"), QString::fromLatin1("author:%1").arg(m_value));
+ u.addQueryItem(TQString::tqfromLatin1("q"), TQString::tqfromLatin1("author:%1").tqarg(m_value));
break;
default:
@@ -114,10 +114,10 @@ void GoogleScholarFetcher::doSearch() {
// myDebug() << "GoogleScholarFetcher::search() - url: " << u.url() << endl;
m_job = KIO::get(u, false, false);
- connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)),
- SLOT(slotData(KIO::Job*, const QByteArray&)));
- connect(m_job, SIGNAL(result(KIO::Job*)),
- SLOT(slotComplete(KIO::Job*)));
+ connect(m_job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
+ TQT_SLOT(slotData(KIO::Job*, const TQByteArray&)));
+ connect(m_job, TQT_SIGNAL(result(KIO::Job*)),
+ TQT_SLOT(slotComplete(KIO::Job*)));
}
void GoogleScholarFetcher::stop() {
@@ -133,8 +133,8 @@ void GoogleScholarFetcher::stop() {
emit signalDone(this);
}
-void GoogleScholarFetcher::slotData(KIO::Job*, const QByteArray& data_) {
- QDataStream stream(m_data, IO_WriteOnly | IO_Append);
+void GoogleScholarFetcher::slotData(KIO::Job*, const TQByteArray& data_) {
+ TQDataStream stream(m_data, IO_WriteOnly | IO_Append);
stream.writeRawBytes(data_.data(), data_.size());
}
@@ -155,11 +155,11 @@ void GoogleScholarFetcher::slotComplete(KIO::Job* job_) {
return;
}
- QString text = QString::fromUtf8(m_data, m_data.size());
- QString bibtex;
+ TQString text = TQString::fromUtf8(m_data, m_data.size());
+ TQString bibtex;
int count = 0;
- for(int pos = text.find(m_bibtexRx); count < m_limit && pos > -1; pos = text.find(m_bibtexRx, pos+m_bibtexRx.matchedLength()), ++count) {
- KURL bibtexUrl(QString::fromLatin1(SCHOLAR_BASE_URL), m_bibtexRx.cap(1));
+ for(int pos = text.tqfind(m_bibtexRx); count < m_limit && pos > -1; pos = text.tqfind(m_bibtexRx, pos+m_bibtexRx.matchedLength()), ++count) {
+ KURL bibtexUrl(TQString::tqfromLatin1(SCHOLAR_BASE_URL), m_bibtexRx.cap(1));
// myDebug() << bibtexUrl << endl;
bibtex += FileHandler::readTextFile(bibtexUrl, true);
}
@@ -179,13 +179,13 @@ void GoogleScholarFetcher::slotComplete(KIO::Job* job_) {
// might get aborted
break;
}
- QString desc = entry->field(QString::fromLatin1("author"))
- + QChar('/') + entry->field(QString::fromLatin1("publisher"));
- if(!entry->field(QString::fromLatin1("year")).isEmpty()) {
- desc += QChar('/') + entry->field(QString::fromLatin1("year"));
+ TQString desc = entry->field(TQString::tqfromLatin1("author"))
+ + TQChar('/') + entry->field(TQString::tqfromLatin1("publisher"));
+ if(!entry->field(TQString::tqfromLatin1("year")).isEmpty()) {
+ desc += TQChar('/') + entry->field(TQString::tqfromLatin1("year"));
}
- SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(QString::fromLatin1("isbn")));
+ SearchResult* r = new SearchResult(this, entry->title(), desc, entry->field(TQString::tqfromLatin1("isbn")));
m_entries.insert(r->uid, Data::EntryPtr(entry));
emit signalResultFound(r);
}
@@ -205,7 +205,7 @@ void GoogleScholarFetcher::updateEntry(Data::EntryPtr entry_) {
// limit to top 5 results
m_limit = 5;
- QString title = entry_->field(QString::fromLatin1("title"));
+ TQString title = entry_->field(TQString::tqfromLatin1("title"));
if(!title.isEmpty()) {
search(Title, title);
return;
@@ -215,18 +215,18 @@ void GoogleScholarFetcher::updateEntry(Data::EntryPtr entry_) {
emit signalDone(this); // always need to emit this if not continuing with the search
}
-Tellico::Fetch::ConfigWidget* GoogleScholarFetcher::configWidget(QWidget* parent_) const {
- return new GoogleScholarFetcher::ConfigWidget(parent_, this);
+Tellico::Fetch::ConfigWidget* GoogleScholarFetcher::configWidget(TQWidget* tqparent_) const {
+ return new GoogleScholarFetcher::ConfigWidget(tqparent_, this);
}
-GoogleScholarFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const GoogleScholarFetcher*/*=0*/)
- : Fetch::ConfigWidget(parent_) {
- QVBoxLayout* l = new QVBoxLayout(optionsWidget());
- l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget()));
+GoogleScholarFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const GoogleScholarFetcher*/*=0*/)
+ : Fetch::ConfigWidget(tqparent_) {
+ TQVBoxLayout* l = new TQVBoxLayout(optionsWidget());
+ l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget()));
l->addStretch();
}
-QString GoogleScholarFetcher::ConfigWidget::preferredName() const {
+TQString GoogleScholarFetcher::ConfigWidget::preferredName() const {
return GoogleScholarFetcher::defaultName();
}