summaryrefslogtreecommitdiffstats
path: root/src/fetch/citebasefetcher.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
commit2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch)
tree18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/fetch/citebasefetcher.cpp
parent1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff)
downloadtellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz
tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip
TQt4 port tellico
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/fetch/citebasefetcher.cpp')
-rw-r--r--src/fetch/citebasefetcher.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/fetch/citebasefetcher.cpp b/src/fetch/citebasefetcher.cpp
index 798d690..177530c 100644
--- a/src/fetch/citebasefetcher.cpp
+++ b/src/fetch/citebasefetcher.cpp
@@ -24,8 +24,8 @@
#include <klocale.h>
-#include <qlabel.h>
-#include <qlayout.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
// #define CITEBASE_TEST
@@ -36,18 +36,18 @@ namespace {
using Tellico::Fetch::CitebaseFetcher;
-CitebaseFetcher::CitebaseFetcher(QObject* parent_)
- : Fetcher(parent_), m_job(0), m_started(false) {
+CitebaseFetcher::CitebaseFetcher(TQObject* tqparent_)
+ : Fetcher(tqparent_), m_job(0), m_started(false) {
}
CitebaseFetcher::~CitebaseFetcher() {
}
-QString CitebaseFetcher::defaultName() {
- return QString::fromLatin1("Citebase");
+TQString CitebaseFetcher::defaultName() {
+ return TQString::tqfromLatin1("Citebase");
}
-QString CitebaseFetcher::source() const {
+TQString CitebaseFetcher::source() const {
return m_name.isEmpty() ? defaultName() : m_name;
}
@@ -58,13 +58,13 @@ bool CitebaseFetcher::canFetch(int type) const {
void CitebaseFetcher::readConfigHook(const KConfigGroup&) {
}
-void CitebaseFetcher::search(FetchKey key_, const QString& value_) {
+void CitebaseFetcher::search(FetchKey key_, const TQString& value_) {
m_key = key_;
m_value = value_.stripWhiteSpace();
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;
}
@@ -80,10 +80,10 @@ void CitebaseFetcher::search(FetchKey key_, const QString& value_) {
}
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 CitebaseFetcher::stop() {
@@ -100,8 +100,8 @@ void CitebaseFetcher::stop() {
emit signalDone(this);
}
-void CitebaseFetcher::slotData(KIO::Job*, const QByteArray& data_) {
- QDataStream stream(m_data, IO_WriteOnly | IO_Append);
+void CitebaseFetcher::slotData(KIO::Job*, const TQByteArray& data_) {
+ TQDataStream stream(m_data, IO_WriteOnly | IO_Append);
stream.writeRawBytes(data_.data(), data_.size());
}
@@ -124,16 +124,16 @@ void CitebaseFetcher::slotComplete(KIO::Job* job_) {
#if 0
kdWarning() << "Remove debug from citebasefetcher.cpp" << endl;
- QFile f(QString::fromLatin1("/tmp/test.bib"));
+ TQFile f(TQString::tqfromLatin1("/tmp/test.bib"));
if(f.open(IO_WriteOnly)) {
- QTextStream t(&f);
- t.setEncoding(QTextStream::UnicodeUTF8);
- t << QCString(m_data, m_data.size()+1);
+ TQTextStream t(&f);
+ t.setEncoding(TQTextStream::UnicodeUTF8);
+ t << TQCString(m_data, m_data.size()+1);
}
f.close();
#endif
- Import::BibtexImporter imp(QString::fromUtf8(m_data, m_data.size()));
+ Import::BibtexImporter imp(TQString::fromUtf8(m_data, m_data.size()));
Data::CollPtr coll = imp.collection();
if(!coll) {
@@ -148,13 +148,13 @@ void CitebaseFetcher::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);
}
@@ -166,17 +166,17 @@ Tellico::Data::EntryPtr CitebaseFetcher::fetchEntry(uint uid_) {
return m_entries[uid_];
}
-KURL CitebaseFetcher::searchURL(FetchKey key_, const QString& value_) const {
- KURL u(QString::fromLatin1(CITEBASE_BASE_URL));
+KURL CitebaseFetcher::searchURL(FetchKey key_, const TQString& value_) const {
+ KURL u(TQString::tqfromLatin1(CITEBASE_BASE_URL));
switch(key_) {
case ArxivID:
{
// remove prefix and/or version number
- QString value = value_;
- value.remove(QRegExp(QString::fromLatin1("^arxiv:"), false));
- value.remove(QRegExp(QString::fromLatin1("v\\d+$")));
- u.addQueryItem(QString::fromLatin1("rft_id"), QString::fromLatin1("oai:arXiv.org:%1").arg(value));
+ TQString value = 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 QString& value_) const {
}
#ifdef CITEBASE_TEST
- u = KURL::fromPathOrURL(QString::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_) {
- QString arxiv = entry_->field(QString::fromLatin1("arxiv"));
+ TQString arxiv = entry_->field(TQString::tqfromLatin1("arxiv"));
if(!arxiv.isEmpty()) {
search(Fetch::ArxivID, arxiv);
return;
@@ -207,13 +207,13 @@ void CitebaseFetcher::updateEntrySynchronous(Data::EntryPtr entry) {
if(!entry) {
return;
}
- QString arxiv = entry->field(QString::fromLatin1("arxiv"));
+ TQString arxiv = entry->field(TQString::tqfromLatin1("arxiv"));
if(arxiv.isEmpty()) {
return;
}
KURL u = searchURL(ArxivID, arxiv);
- QString bibtex = FileHandler::readTextFile(u, true);
+ TQString bibtex = FileHandler::readTextFile(u, true);
if(bibtex.isEmpty()) {
return;
}
@@ -227,21 +227,21 @@ void CitebaseFetcher::updateEntrySynchronous(Data::EntryPtr entry) {
}
}
-Tellico::Fetch::ConfigWidget* CitebaseFetcher::configWidget(QWidget* parent_) const {
- return new CitebaseFetcher::ConfigWidget(parent_, this);
+Tellico::Fetch::ConfigWidget* CitebaseFetcher::configWidget(TQWidget* tqparent_) const {
+ return new CitebaseFetcher::ConfigWidget(tqparent_, this);
}
-CitebaseFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const CitebaseFetcher*)
- : Fetch::ConfigWidget(parent_) {
- QVBoxLayout* l = new QVBoxLayout(optionsWidget());
- l->addWidget(new QLabel(i18n("This source has no options."), optionsWidget()));
+CitebaseFetcher::ConfigWidget::ConfigWidget(TQWidget* tqparent_, const CitebaseFetcher*)
+ : Fetch::ConfigWidget(tqparent_) {
+ TQVBoxLayout* l = new TQVBoxLayout(optionsWidget());
+ l->addWidget(new TQLabel(i18n("This source has no options."), optionsWidget()));
l->addStretch();
}
void CitebaseFetcher::ConfigWidget::saveConfig(KConfigGroup&) {
}
-QString CitebaseFetcher::ConfigWidget::preferredName() const {
+TQString CitebaseFetcher::ConfigWidget::preferredName() const {
return CitebaseFetcher::defaultName();
}