diff options
Diffstat (limited to 'src/fetch/z3950fetcher.cpp')
-rw-r--r-- | src/fetch/z3950fetcher.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/fetch/z3950fetcher.cpp b/src/fetch/z3950fetcher.cpp index 2496b5b..f24b030 100644 --- a/src/fetch/z3950fetcher.cpp +++ b/src/fetch/z3950fetcher.cpp @@ -47,14 +47,14 @@ #include <kseparator.h> #include <tqfile.h> -#include <tqlayout.h> +#include <layout.h> #include <tqlabel.h> #include <tqwhatsthis.h> #include <tqdom.h> namespace { static const int Z3950_DEFAULT_PORT = 210; - static const TQString Z3950_DEFAULT_ESN = TQString::tqfromLatin1("F"); + static const TQString Z3950_DEFAULT_ESN = TQString::fromLatin1("F"); } using Tellico::Fetch::Z3950Fetcher; @@ -103,7 +103,7 @@ void Z3950Fetcher::readConfigHook(const KConfigGroup& config_) { m_password = config_.readEntry("Password"); } else { m_preset = preset; - TQString serverFile = locate("appdata", TQString::tqfromLatin1("z3950-servers.cfg")); + TQString serverFile = locate("appdata", TQString::fromLatin1("z3950-servers.cfg")); if(!serverFile.isEmpty()) { KConfig cfg(serverFile, true /* read-only */, false /* read KDE */); const TQStringList servers = cfg.groupList(); @@ -147,29 +147,29 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { m_started = true; TQString svalue = m_value; - TQRegExp rx1(TQString::tqfromLatin1("['\"].*\\1")); + TQRegExp rx1(TQString::fromLatin1("['\"].*\\1")); if(!rx1.exactMatch(svalue)) { svalue.prepend('"').append('"'); } switch(key_) { case Title: - m_pqn = TQString::tqfromLatin1("@attr 1=4 ") + svalue; + m_pqn = TQString::fromLatin1("@attr 1=4 ") + svalue; break; case Person: -// m_pqn = TQString::tqfromLatin1("@or "); -// m_pqn += TQString::tqfromLatin1("@attr 1=1 \"") + m_value + '"'; - m_pqn = TQString::tqfromLatin1(" @attr 1=1003 ") + svalue; +// m_pqn = TQString::fromLatin1("@or "); +// m_pqn += TQString::fromLatin1("@attr 1=1 \"") + m_value + '"'; + m_pqn = TQString::fromLatin1(" @attr 1=1003 ") + svalue; break; case ISBN: { m_pqn.truncate(0); TQString s = m_value; s.remove('-'); - TQStringList isbnList = TQStringList::split(TQString::tqfromLatin1("; "), s); + TQStringList isbnList = TQStringList::split(TQString::fromLatin1("; "), s); // also going to search for isbn10 values for(TQStringList::Iterator it = isbnList.begin(); it != isbnList.end(); ++it) { - if((*it).startsWith(TQString::tqfromLatin1("978"))) { + if((*it).startsWith(TQString::fromLatin1("978"))) { TQString isbn10 = ISBNValidator::isbn10(*it); isbn10.remove('-'); isbnList.insert(it, isbn10); @@ -177,12 +177,12 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { } const int count = isbnList.count(); if(count > 1) { - m_pqn = TQString::tqfromLatin1("@or "); + m_pqn = TQString::fromLatin1("@or "); } for(int i = 0; i < count; ++i) { - m_pqn += TQString::tqfromLatin1(" @attr 1=7 ") + isbnList[i]; + m_pqn += TQString::fromLatin1(" @attr 1=7 ") + isbnList[i]; if(i < count-2) { - m_pqn += TQString::tqfromLatin1(" @or"); + m_pqn += TQString::fromLatin1(" @or"); } } } @@ -192,19 +192,19 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { m_pqn.truncate(0); TQString s = m_value; s.remove('-'); - TQStringList lccnList = TQStringList::split(TQString::tqfromLatin1("; "), s); + TQStringList lccnList = TQStringList::split(TQString::fromLatin1("; "), s); while(!lccnList.isEmpty()) { - m_pqn += TQString::tqfromLatin1(" @or @attr 1=9 ") + lccnList.front(); + m_pqn += TQString::fromLatin1(" @or @attr 1=9 ") + lccnList.front(); if(lccnList.count() > 1) { - m_pqn += TQString::tqfromLatin1(" @or"); + m_pqn += TQString::fromLatin1(" @or"); } - m_pqn += TQString::tqfromLatin1(" @attr 1=9 ") + LCCNValidator::formalize(lccnList.front()); + m_pqn += TQString::fromLatin1(" @attr 1=9 ") + LCCNValidator::formalize(lccnList.front()); lccnList.pop_front(); } } break; case Keyword: - m_pqn = TQString::tqfromLatin1("@attr 1=1016 ") + svalue; + m_pqn = TQString::fromLatin1("@attr 1=1016 ") + svalue; break; case Raw: m_pqn = m_value; @@ -214,7 +214,7 @@ void Z3950Fetcher::search(FetchKey key_, const TQString& value_) { stop(); return; } -// m_pqn = TQString::tqfromLatin1("@attr 1=7 0253333490"); +// m_pqn = TQString::fromLatin1("@attr 1=7 0253333490"); myLog() << "Z3950Fetcher::search() - PQN query = " << m_pqn << endl; if(m_conn) { @@ -256,7 +256,7 @@ bool Z3950Fetcher::initMARC21Handler() { return true; } - TQString xsltfile = locate("appdata", TQString::tqfromLatin1("MARC21slim2MODS3.xsl")); + TQString xsltfile = locate("appdata", TQString::fromLatin1("MARC21slim2MODS3.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "Z3950Fetcher::initHandlers() - can not locate MARC21slim2MODS3.xsl." << endl; return false; @@ -280,7 +280,7 @@ bool Z3950Fetcher::initUNIMARCHandler() { return true; } - TQString xsltfile = locate("appdata", TQString::tqfromLatin1("UNIMARC2MODS3.xsl")); + TQString xsltfile = locate("appdata", TQString::fromLatin1("UNIMARC2MODS3.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "Z3950Fetcher::initHandlers() - can not locate UNIMARC2MODS3.xsl." << endl; return false; @@ -304,7 +304,7 @@ bool Z3950Fetcher::initMODSHandler() { return true; } - TQString xsltfile = locate("appdata", TQString::tqfromLatin1("mods2tellico.xsl")); + TQString xsltfile = locate("appdata", TQString::fromLatin1("mods2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "Z3950Fetcher::initHandlers() - can not locate mods2tellico.xsl." << endl; return false; @@ -351,7 +351,7 @@ void Z3950Fetcher::handleResult(const TQString& result_) { #if 0 kdWarning() << "Remove debug from z3950fetcher.cpp" << endl; { - TQFile f1(TQString::tqfromLatin1("/tmp/marc.xml")); + TQFile f1(TQString::fromLatin1("/tmp/marc.xml")); if(f1.open(IO_WriteOnly)) { // if(f1.open(IO_WriteOnly | IO_Append)) { TQTextStream t(&f1); @@ -385,7 +385,7 @@ void Z3950Fetcher::handleResult(const TQString& result_) { #if 0 kdWarning() << "Remove debug from z3950fetcher.cpp" << endl; { - TQFile f2(TQString::tqfromLatin1("/tmp/mods.xml")); + TQFile f2(TQString::fromLatin1("/tmp/mods.xml")); // if(f2.open(IO_WriteOnly)) { if(f2.open(IO_WriteOnly | IO_Append)) { TQTextStream t(&f2); @@ -423,14 +423,14 @@ void Z3950Fetcher::handleResult(const TQString& result_) { Data::EntryVec entries = coll->entries(); for(Data::EntryVec::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - TQString desc = entry->field(TQString::tqfromLatin1("author")) + '/' - + 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")); + TQString desc = entry->field(TQString::fromLatin1("author")) + '/' + + 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")); } - 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); } @@ -480,20 +480,20 @@ void Z3950Fetcher::customEvent(TQCustomEvent* event_) { void Z3950Fetcher::updateEntry(Data::EntryPtr entry_) { // myDebug() << "Z3950Fetcher::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; @@ -541,7 +541,7 @@ Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const Z3950Fetcher* m_portSpinBox = new KIntSpinBox(0, 999999, 1, Z3950_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(Z3950_DEFAULT_PORT); + w = i18n("Enter the port number of the server. The default is %1.").arg(Z3950_DEFAULT_PORT); TQWhatsThis::add(label, w); TQWhatsThis::add(m_portSpinBox, w); label->setBuddy(m_portSpinBox); @@ -560,9 +560,9 @@ Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const Z3950Fetcher* l->addWidget(label, ++row, 0); m_charSetCombo = new KComboBox(true, optionsWidget()); m_charSetCombo->insertItem(TQString()); - m_charSetCombo->insertItem(TQString::tqfromLatin1("marc8")); - m_charSetCombo->insertItem(TQString::tqfromLatin1("iso-8859-1")); - m_charSetCombo->insertItem(TQString::tqfromLatin1("utf-8")); + m_charSetCombo->insertItem(TQString::fromLatin1("marc8")); + m_charSetCombo->insertItem(TQString::fromLatin1("iso-8859-1")); + m_charSetCombo->insertItem(TQString::fromLatin1("utf-8")); connect(m_charSetCombo, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_charSetCombo, row, 1); w = i18n("Enter the character set encoding used by the z39.50 server. The most likely choice " @@ -575,11 +575,11 @@ Z3950Fetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const Z3950Fetcher* l->addWidget(label, ++row, 0); m_syntaxCombo = new GUI::ComboBox(optionsWidget()); m_syntaxCombo->insertItem(i18n("Auto-detect"), TQString()); - m_syntaxCombo->insertItem(TQString::tqfromLatin1("MODS"), TQString::tqfromLatin1("mods")); - m_syntaxCombo->insertItem(TQString::tqfromLatin1("MARC21"), TQString::tqfromLatin1("marc21")); - m_syntaxCombo->insertItem(TQString::tqfromLatin1("UNIMARC"), TQString::tqfromLatin1("unimarc")); - m_syntaxCombo->insertItem(TQString::tqfromLatin1("USMARC"), TQString::tqfromLatin1("usmarc")); - m_syntaxCombo->insertItem(TQString::tqfromLatin1("GRS-1"), TQString::tqfromLatin1("grs-1")); + m_syntaxCombo->insertItem(TQString::fromLatin1("MODS"), TQString::fromLatin1("mods")); + m_syntaxCombo->insertItem(TQString::fromLatin1("MARC21"), TQString::fromLatin1("marc21")); + m_syntaxCombo->insertItem(TQString::fromLatin1("UNIMARC"), TQString::fromLatin1("unimarc")); + m_syntaxCombo->insertItem(TQString::fromLatin1("USMARC"), TQString::fromLatin1("usmarc")); + m_syntaxCombo->insertItem(TQString::fromLatin1("GRS-1"), TQString::fromLatin1("grs-1")); connect(m_syntaxCombo, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotSetModified())); l->addWidget(m_syntaxCombo, row, 1); w = i18n("Enter the data format used by the z39.50 server. Tellico will attempt to " @@ -689,9 +689,9 @@ void Z3950Fetcher::ConfigWidget::saveConfig(KConfigGroup& config_) { // static Tellico::StringMap Z3950Fetcher::customFields() { StringMap map; - map[TQString::tqfromLatin1("address")] = i18n("Address"); - map[TQString::tqfromLatin1("abstract")] = i18n("Abstract"); - map[TQString::tqfromLatin1("illustrator")] = i18n("Illustrator"); + map[TQString::fromLatin1("address")] = i18n("Address"); + map[TQString::fromLatin1("abstract")] = i18n("Abstract"); + map[TQString::fromLatin1("illustrator")] = i18n("Illustrator"); return map; } @@ -727,7 +727,7 @@ void Z3950Fetcher::ConfigWidget::loadPresets(const TQString& current_) { KGlobal::locale()->splitLocale(lang, lang2A, dummy, dummy); } - TQString serverFile = locate("appdata", TQString::tqfromLatin1("z3950-servers.cfg")); + TQString serverFile = locate("appdata", TQString::fromLatin1("z3950-servers.cfg")); if(serverFile.isEmpty()) { kdWarning() << "Z3950Fetcher::loadPresets() - no z3950 servers file found" << endl; return; |