diff options
Diffstat (limited to 'src/fetch/srufetcher.cpp')
-rw-r--r-- | src/fetch/srufetcher.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/fetch/srufetcher.cpp b/src/fetch/srufetcher.cpp index 99529c3..3410c0c 100644 --- a/src/fetch/srufetcher.cpp +++ b/src/fetch/srufetcher.cpp @@ -36,7 +36,7 @@ #include <knuminput.h> #include <tqlabel.h> -#include <tqlayout.h> +#include <layout.h> #include <tqwhatsthis.h> //#define SRU_DEBUG @@ -95,7 +95,7 @@ void SRUFetcher::readConfigHook(const KConfigGroup& config_) { if(!m_path.startsWith(TQChar('/'))) { m_path.prepend('/'); } - m_format = config_.readEntry("Format", TQString::tqfromLatin1("mods")); + m_format = config_.readEntry("Format", TQString::fromLatin1("mods")); m_fields = config_.readListEntry("Custom Fields"); } @@ -109,35 +109,35 @@ void SRUFetcher::search(FetchKey key_, const TQString& value_) { m_started = true; #ifdef SRU_DEBUG - KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/sru.xml")); + KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/sru.xml")); #else KURL u; - u.setProtocol(TQString::tqfromLatin1("http")); + u.setProtocol(TQString::fromLatin1("http")); u.setHost(m_host); u.setPort(m_port); u.setPath(m_path); - u.addQueryItem(TQString::tqfromLatin1("operation"), TQString::tqfromLatin1("searchRetrieve")); - u.addQueryItem(TQString::tqfromLatin1("version"), TQString::tqfromLatin1("1.1")); - u.addQueryItem(TQString::tqfromLatin1("maximumRecords"), TQString::number(SRU_MAX_RECORDS)); - u.addQueryItem(TQString::tqfromLatin1("recordSchema"), m_format); + u.addQueryItem(TQString::fromLatin1("operation"), TQString::fromLatin1("searchRetrieve")); + u.addQueryItem(TQString::fromLatin1("version"), TQString::fromLatin1("1.1")); + u.addQueryItem(TQString::fromLatin1("maximumRecords"), TQString::number(SRU_MAX_RECORDS)); + u.addQueryItem(TQString::fromLatin1("recordSchema"), m_format); const int type = Kernel::self()->collectionType(); TQString str = TQChar('"') + value_ + TQChar('"'); switch(key_) { case Title: - u.addQueryItem(TQString::tqfromLatin1("query"), TQString::tqfromLatin1("dc.title=") + str); + u.addQueryItem(TQString::fromLatin1("query"), TQString::fromLatin1("dc.title=") + str); break; case Person: { TQString s; if(type == Data::Collection::Book || type == Data::Collection::Bibtex) { - s = TQString::tqfromLatin1("author=") + str + TQString::tqfromLatin1(" or dc.author=") + str; + s = TQString::fromLatin1("author=") + str + TQString::fromLatin1(" or dc.author=") + str; } else { - s = TQString::tqfromLatin1("dc.creator=") + str + TQString::tqfromLatin1(" or dc.editor=") + str; + s = TQString::fromLatin1("dc.creator=") + str + TQString::fromLatin1(" or dc.editor=") + str; } - u.addQueryItem(TQString::tqfromLatin1("query"), s); + u.addQueryItem(TQString::fromLatin1("query"), s); } break; @@ -146,7 +146,7 @@ void SRUFetcher::search(FetchKey key_, const TQString& value_) { str.remove('-'); // limit to first isbn str = str.section(';', 0, 0); - u.addQueryItem(TQString::tqfromLatin1("query"), TQString::tqfromLatin1("bath.isbn=") + str); + u.addQueryItem(TQString::fromLatin1("query"), TQString::fromLatin1("bath.isbn=") + str); break; case LCCN: @@ -156,15 +156,15 @@ void SRUFetcher::search(FetchKey key_, const TQString& value_) { str = str.section(';', 0, 0); // also try formalized lccn TQString lccn = LCCNValidator::formalize(str); - u.addQueryItem(TQString::tqfromLatin1("query"), - TQString::tqfromLatin1("bath.lccn=") + str + - TQString::tqfromLatin1(" or bath.lccn=") + lccn + u.addQueryItem(TQString::fromLatin1("query"), + TQString::fromLatin1("bath.lccn=") + str + + TQString::fromLatin1(" or bath.lccn=") + lccn ); } break; case Keyword: - u.addQueryItem(TQString::tqfromLatin1("query"), str); + u.addQueryItem(TQString::fromLatin1("query"), str); break; case Raw: @@ -233,11 +233,11 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { Import::XMLImporter xmlImporter(result); TQDomDocument dom = xmlImporter.domDocument(); - TQDomNodeList diagList = dom.elementsByTagNameNS(diag, TQString::tqfromLatin1("diagnostic")); + TQDomNodeList diagList = dom.elementsByTagNameNS(diag, TQString::fromLatin1("diagnostic")); for(uint i = 0; i < diagList.count(); ++i) { TQDomElement elem = diagList.item(i).toElement(); - TQDomNodeList nodeList1 = elem.elementsByTagNameNS(diag, TQString::tqfromLatin1("message")); - TQDomNodeList nodeList2 = elem.elementsByTagNameNS(diag, TQString::tqfromLatin1("details")); + TQDomNodeList nodeList1 = elem.elementsByTagNameNS(diag, TQString::fromLatin1("message")); + TQDomNodeList nodeList2 = elem.elementsByTagNameNS(diag, TQString::fromLatin1("details")); for(uint j = 0; j < nodeList1.count(); ++j) { TQString d = nodeList1.item(j).toElement().text(); if(!d.isEmpty()) { @@ -275,7 +275,7 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { } if(coll && !msg.isEmpty()) { - message(msg, coll->entryCount() == 0 ? MessageHandler::Warning : MessageHandler::tqStatus); + message(msg, coll->entryCount() == 0 ? MessageHandler::Warning : MessageHandler::Status); } if(!coll) { @@ -299,36 +299,36 @@ void SRUFetcher::slotComplete(KIO::Job* job_) { TQString desc; switch(coll->type()) { case Data::Collection::Book: - desc = entry->field(TQString::tqfromLatin1("author")) + desc = entry->field(TQString::fromLatin1("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")); + + 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")); 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; default: break; } - 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, entry); emit signalResultFound(r); } @@ -341,20 +341,20 @@ Tellico::Data::EntryPtr SRUFetcher::fetchEntry(uint uid_) { void SRUFetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "SRUFetcher::updateEntry() - " << source() << ": " << entry_->title() << endl; - TQString isbn = entry_->field(TQString::tqfromLatin1("isbn")); + TQString isbn = entry_->field(TQString::fromLatin1("isbn")); if(!isbn.isEmpty()) { search(Fetch::ISBN, isbn); return; } - TQString lccn = entry_->field(TQString::tqfromLatin1("lccn")); + TQString lccn = entry_->field(TQString::fromLatin1("lccn")); if(!lccn.isEmpty()) { search(Fetch::LCCN, lccn); return; } // 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; @@ -369,7 +369,7 @@ bool SRUFetcher::initMARCXMLHandler() { return true; } - TQString xsltfile = locate("appdata", TQString::tqfromLatin1("MARC21slim2MODS3.xsl")); + TQString xsltfile = locate("appdata", TQString::fromLatin1("MARC21slim2MODS3.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "SRUFetcher::initHandlers() - can not locate MARC21slim2MODS3.xsl." << endl; return false; @@ -393,7 +393,7 @@ bool SRUFetcher::initMODSHandler() { return true; } - TQString xsltfile = locate("appdata", TQString::tqfromLatin1("mods2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::fromLatin1("mods2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "SRUFetcher::initHandlers() - can not locate mods2tellico.xsl." << endl; return false; @@ -413,15 +413,15 @@ bool SRUFetcher::initMODSHandler() { } Tellico::Fetch::Fetcher::Ptr SRUFetcher::libraryOfCongress(TQObject* parent_) { - return new SRUFetcher(i18n("Library of Congress (US)"), TQString::tqfromLatin1("z3950.loc.gov"), 7090, - TQString::tqfromLatin1("voyager"), parent_); + return new SRUFetcher(i18n("Library of Congress (US)"), TQString::fromLatin1("z3950.loc.gov"), 7090, + TQString::fromLatin1("voyager"), parent_); } // static Tellico::StringMap SRUFetcher::customFields() { StringMap map; - map[TQString::tqfromLatin1("address")] = i18n("Address"); - map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); + map[TQString::fromLatin1("address")] = i18n("Address"); + map[TQString::fromLatin1("abstract")] = i18n("Abstract"); return map; } @@ -453,7 +453,7 @@ SRUConfigWidget::SRUConfigWidget(TQWidget* parent_, const SRUFetcher* fetcher_ / m_portSpinBox = new KIntSpinBox(0, 999999, 1, SRU_DEFAULT_PORT, 10, optionsWidget()); connect(m_portSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_portSpinBox, row, 1); - w = i18n("Enter the port number of the server. The default is %1.").tqarg(SRU_DEFAULT_PORT); + w = i18n("Enter the port number of the server. The default is %1.").arg(SRU_DEFAULT_PORT); TQWhatsThis::add(label, w); TQWhatsThis::add(m_portSpinBox, w); label->setBuddy(m_portSpinBox); @@ -471,9 +471,9 @@ SRUConfigWidget::SRUConfigWidget(TQWidget* parent_, const SRUFetcher* fetcher_ / label = new TQLabel(i18n("Format: "), optionsWidget()); l->addWidget(label, ++row, 0); m_formatCombo = new GUI::ComboBox(optionsWidget()); - m_formatCombo->insertItem(TQString::tqfromLatin1("MODS"), TQString::tqfromLatin1("mods")); - m_formatCombo->insertItem(TQString::tqfromLatin1("MARCXML"), TQString::tqfromLatin1("marcxml")); - m_formatCombo->insertItem(TQString::tqfromLatin1("Dublin Core"), TQString::tqfromLatin1("dc")); + m_formatCombo->insertItem(TQString::fromLatin1("MODS"), TQString::fromLatin1("mods")); + m_formatCombo->insertItem(TQString::fromLatin1("MARCXML"), TQString::fromLatin1("marcxml")); + m_formatCombo->insertItem(TQString::fromLatin1("Dublin Core"), TQString::fromLatin1("dc")); connect(m_formatCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSetModified())); l->addWidget(m_formatCombo, row, 1); w = i18n("Enter the result format used by the server."); |