summaryrefslogtreecommitdiffstats
path: root/src/fetch/entrezfetcher.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-18 18:15:24 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-18 18:15:24 -0600
commit8d9b90ca794ffabf151719c2edebe9278a2d3f36 (patch)
tree55f446de8694c45be6bf0f1178920c2b92b0c9f5 /src/fetch/entrezfetcher.cpp
parent2781e27b871150395a5a82e221684108641002b2 (diff)
downloadtellico-8d9b90ca794ffabf151719c2edebe9278a2d3f36.tar.gz
tellico-8d9b90ca794ffabf151719c2edebe9278a2d3f36.zip
Rename old tq methods that no longer need a unique name
Diffstat (limited to 'src/fetch/entrezfetcher.cpp')
-rw-r--r--src/fetch/entrezfetcher.cpp132
1 files changed, 66 insertions, 66 deletions
diff --git a/src/fetch/entrezfetcher.cpp b/src/fetch/entrezfetcher.cpp
index 6383735..9c83f7c 100644
--- a/src/fetch/entrezfetcher.cpp
+++ b/src/fetch/entrezfetcher.cpp
@@ -65,7 +65,7 @@ bool EntrezFetcher::canFetch(int type) const {
}
void EntrezFetcher::readConfigHook(const KConfigGroup& config_) {
- TQString s = config_.readEntry("Database", TQString::tqfromLatin1(ENTREZ_DEFAULT_DATABASE)); // default to pubmed
+ TQString s = config_.readEntry("Database", TQString::fromLatin1(ENTREZ_DEFAULT_DATABASE)); // default to pubmed
if(!s.isEmpty()) {
m_dbname = s;
}
@@ -84,36 +84,36 @@ void EntrezFetcher::search(FetchKey key_, const TQString& value_) {
return;
}
if(m_dbname.isEmpty()) {
- m_dbname = TQString::tqfromLatin1(ENTREZ_DEFAULT_DATABASE);
+ m_dbname = TQString::fromLatin1(ENTREZ_DEFAULT_DATABASE);
}
#ifdef ENTREZ_TEST
- KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/esearch.xml"));
+ KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/esearch.xml"));
#else
- KURL u(TQString::tqfromLatin1(ENTREZ_BASE_URL));
- u.addPath(TQString::tqfromLatin1(ENTREZ_SEARCH_CGI));
- u.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico"));
- u.addQueryItem(TQString::tqfromLatin1("retmode"), TQString::tqfromLatin1("xml"));
- u.addQueryItem(TQString::tqfromLatin1("usehistory"), TQString::tqfromLatin1("y"));
- u.addQueryItem(TQString::tqfromLatin1("retmax"), TQString::tqfromLatin1("1")); // we're just getting the count
- u.addQueryItem(TQString::tqfromLatin1("db"), m_dbname);
- u.addQueryItem(TQString::tqfromLatin1("term"), value_);
+ KURL u(TQString::fromLatin1(ENTREZ_BASE_URL));
+ u.addPath(TQString::fromLatin1(ENTREZ_SEARCH_CGI));
+ u.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico"));
+ u.addQueryItem(TQString::fromLatin1("retmode"), TQString::fromLatin1("xml"));
+ u.addQueryItem(TQString::fromLatin1("usehistory"), TQString::fromLatin1("y"));
+ u.addQueryItem(TQString::fromLatin1("retmax"), TQString::fromLatin1("1")); // we're just getting the count
+ u.addQueryItem(TQString::fromLatin1("db"), m_dbname);
+ u.addQueryItem(TQString::fromLatin1("term"), value_);
switch(key_) {
case Title:
- u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("titl"));
+ u.addQueryItem(TQString::fromLatin1("field"), TQString::fromLatin1("titl"));
break;
case Person:
- u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("auth"));
+ u.addQueryItem(TQString::fromLatin1("field"), TQString::fromLatin1("auth"));
break;
case Keyword:
// for Tellico Keyword searches basically mean search for any field matching
-// u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("word"));
+// u.addQueryItem(TQString::fromLatin1("field"), TQString::fromLatin1("word"));
break;
case PubmedID:
- u.addQueryItem(TQString::tqfromLatin1("field"), TQString::tqfromLatin1("pmid"));
+ u.addQueryItem(TQString::fromLatin1("field"), TQString::fromLatin1("pmid"));
break;
case DOI:
@@ -179,7 +179,7 @@ void EntrezFetcher::slotComplete(KIO::Job* job_) {
#if 0
kdWarning() << "Remove debug from entrezfetcher.cpp: " << __LINE__ << endl;
- TQFile f(TQString::tqfromLatin1("/tmp/test.xml"));
+ TQFile f(TQString::fromLatin1("/tmp/test.xml"));
if(f.open(IO_WriteOnly)) {
TQTextStream t(&f);
t.setEncoding(TQTextStream::UnicodeUTF8);
@@ -239,18 +239,18 @@ void EntrezFetcher::searchResults() {
void EntrezFetcher::doSummary() {
#ifdef ENTREZ_TEST
- KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/esummary.xml"));
+ KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/esummary.xml"));
#else
- KURL u(TQString::tqfromLatin1(ENTREZ_BASE_URL));
- u.addPath(TQString::tqfromLatin1(ENTREZ_SUMMARY_CGI));
- u.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico"));
- u.addQueryItem(TQString::tqfromLatin1("retmode"), TQString::tqfromLatin1("xml"));
- u.addQueryItem(TQString::tqfromLatin1("retstart"), TQString::number(m_start));
- u.addQueryItem(TQString::tqfromLatin1("retmax"), TQString::number(TQMIN(m_total-m_start-1, ENTREZ_MAX_RETURNS_TOTAL)));
- u.addQueryItem(TQString::tqfromLatin1("usehistory"), TQString::tqfromLatin1("y"));
- u.addQueryItem(TQString::tqfromLatin1("db"), m_dbname);
- u.addQueryItem(TQString::tqfromLatin1("query_key"), m_queryKey);
- u.addQueryItem(TQString::tqfromLatin1("WebEnv"), m_webEnv);
+ KURL u(TQString::fromLatin1(ENTREZ_BASE_URL));
+ u.addPath(TQString::fromLatin1(ENTREZ_SUMMARY_CGI));
+ u.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico"));
+ u.addQueryItem(TQString::fromLatin1("retmode"), TQString::fromLatin1("xml"));
+ u.addQueryItem(TQString::fromLatin1("retstart"), TQString::number(m_start));
+ u.addQueryItem(TQString::fromLatin1("retmax"), TQString::number(TQMIN(m_total-m_start-1, ENTREZ_MAX_RETURNS_TOTAL)));
+ u.addQueryItem(TQString::fromLatin1("usehistory"), TQString::fromLatin1("y"));
+ u.addQueryItem(TQString::fromLatin1("db"), m_dbname);
+ u.addQueryItem(TQString::fromLatin1("query_key"), m_queryKey);
+ u.addQueryItem(TQString::fromLatin1("WebEnv"), m_webEnv);
#endif
m_step = Summary;
@@ -276,20 +276,20 @@ void EntrezFetcher::summaryResults() {
if(e.isNull() || e.tagName() != Latin1Literal("DocSum")) {
continue;
}
- TQDomNodeList nodes = e.elementsByTagName(TQString::tqfromLatin1("Id"));
+ TQDomNodeList nodes = e.elementsByTagName(TQString::fromLatin1("Id"));
if(nodes.count() == 0) {
myDebug() << "EntrezFetcher::summaryResults() - no Id elements" << endl;
continue;
}
int id = nodes.item(0).toElement().text().toInt();
TQString title, pubdate, authors;
- nodes = e.elementsByTagName(TQString::tqfromLatin1("Item"));
+ nodes = e.elementsByTagName(TQString::fromLatin1("Item"));
for(uint j = 0; j < nodes.count(); ++j) {
- if(nodes.item(j).toElement().attribute(TQString::tqfromLatin1("Name")) == Latin1Literal("Title")) {
+ if(nodes.item(j).toElement().attribute(TQString::fromLatin1("Name")) == Latin1Literal("Title")) {
title = nodes.item(j).toElement().text();
- } else if(nodes.item(j).toElement().attribute(TQString::tqfromLatin1("Name")) == Latin1Literal("PubDate")) {
+ } else if(nodes.item(j).toElement().attribute(TQString::fromLatin1("Name")) == Latin1Literal("PubDate")) {
pubdate = nodes.item(j).toElement().text();
- } else if(nodes.item(j).toElement().attribute(TQString::tqfromLatin1("Name")) == Latin1Literal("AuthorList")) {
+ } else if(nodes.item(j).toElement().attribute(TQString::fromLatin1("Name")) == Latin1Literal("AuthorList")) {
TQStringList list;
for(TQDomNode aNode = nodes.item(j).firstChild(); !aNode.isNull(); aNode = aNode.nextSibling()) {
// lazy, assume all tqchildren Items are authors
@@ -297,7 +297,7 @@ void EntrezFetcher::summaryResults() {
list << aNode.toElement().text();
}
}
- authors = list.join(TQString::tqfromLatin1("; "));
+ authors = list.join(TQString::fromLatin1("; "));
}
if(!title.isEmpty() && !pubdate.isEmpty() && !authors.isEmpty()) {
break; // done now
@@ -333,15 +333,15 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) {
int id = m_matches[uid_];
#ifdef ENTREZ_TEST
- KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/pubmed.xml"));
+ KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/pubmed.xml"));
#else
- KURL u(TQString::tqfromLatin1(ENTREZ_BASE_URL));
- u.addPath(TQString::tqfromLatin1(ENTREZ_FETCH_CGI));
- u.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico"));
- u.addQueryItem(TQString::tqfromLatin1("retmode"), TQString::tqfromLatin1("xml"));
- u.addQueryItem(TQString::tqfromLatin1("rettype"), TQString::tqfromLatin1("abstract"));
- u.addQueryItem(TQString::tqfromLatin1("db"), m_dbname);
- u.addQueryItem(TQString::tqfromLatin1("id"), TQString::number(id));
+ KURL u(TQString::fromLatin1(ENTREZ_BASE_URL));
+ u.addPath(TQString::fromLatin1(ENTREZ_FETCH_CGI));
+ u.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico"));
+ u.addQueryItem(TQString::fromLatin1("retmode"), TQString::fromLatin1("xml"));
+ u.addQueryItem(TQString::fromLatin1("rettype"), TQString::fromLatin1("abstract"));
+ u.addQueryItem(TQString::fromLatin1("db"), m_dbname);
+ u.addQueryItem(TQString::fromLatin1("id"), TQString::number(id));
#endif
// now it's sychronous, and we know that it's utf8
TQString xmlOutput = FileHandler::readTextFile(u, false /*quiet*/, true /*utf8*/);
@@ -351,7 +351,7 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) {
}
#if 0
kdWarning() << "EntrezFetcher::fetchEntry() - turn me off!" << endl;
- TQFile f1(TQString::tqfromLatin1("/tmp/test-entry.xml"));
+ TQFile f1(TQString::fromLatin1("/tmp/test-entry.xml"));
if(f1.open(IO_WriteOnly)) {
TQTextStream t(&f1);
t.setEncoding(TQTextStream::UnicodeUTF8);
@@ -376,33 +376,33 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) {
Data::EntryPtr e = coll->entries().front();
// try to get a link, but only if necessary
- if(m_fields.contains(TQString::tqfromLatin1("url"))) {
- KURL link(TQString::tqfromLatin1(ENTREZ_BASE_URL));
- link.addPath(TQString::tqfromLatin1(ENTREZ_LINK_CGI));
- link.addQueryItem(TQString::tqfromLatin1("tool"), TQString::tqfromLatin1("Tellico"));
- link.addQueryItem(TQString::tqfromLatin1("cmd"), TQString::tqfromLatin1("llinks"));
- link.addQueryItem(TQString::tqfromLatin1("db"), m_dbname);
- link.addQueryItem(TQString::tqfromLatin1("dbfrom"), m_dbname);
- link.addQueryItem(TQString::tqfromLatin1("id"), TQString::number(id));
+ if(m_fields.contains(TQString::fromLatin1("url"))) {
+ KURL link(TQString::fromLatin1(ENTREZ_BASE_URL));
+ link.addPath(TQString::fromLatin1(ENTREZ_LINK_CGI));
+ link.addQueryItem(TQString::fromLatin1("tool"), TQString::fromLatin1("Tellico"));
+ link.addQueryItem(TQString::fromLatin1("cmd"), TQString::fromLatin1("llinks"));
+ link.addQueryItem(TQString::fromLatin1("db"), m_dbname);
+ link.addQueryItem(TQString::fromLatin1("dbfrom"), m_dbname);
+ link.addQueryItem(TQString::fromLatin1("id"), TQString::number(id));
TQDomDocument linkDom = FileHandler::readXMLFile(link, false /* namespace */, true /* quiet */);
// need eLinkResult/LinkSet/IdUrlList/IdUrlSet/ObjUrl/Url
- TQDomNode linkNode = linkDom.namedItem(TQString::tqfromLatin1("eLinkResult"))
- .namedItem(TQString::tqfromLatin1("LinkSet"))
- .namedItem(TQString::tqfromLatin1("IdUrlList"))
- .namedItem(TQString::tqfromLatin1("IdUrlSet"))
- .namedItem(TQString::tqfromLatin1("ObjUrl"))
- .namedItem(TQString::tqfromLatin1("Url"));
+ TQDomNode linkNode = linkDom.namedItem(TQString::fromLatin1("eLinkResult"))
+ .namedItem(TQString::fromLatin1("LinkSet"))
+ .namedItem(TQString::fromLatin1("IdUrlList"))
+ .namedItem(TQString::fromLatin1("IdUrlSet"))
+ .namedItem(TQString::fromLatin1("ObjUrl"))
+ .namedItem(TQString::fromLatin1("Url"));
if(!linkNode.isNull()) {
TQString u = linkNode.toElement().text();
// myDebug() << u << endl;
if(!u.isEmpty()) {
- if(!coll->hasField(TQString::tqfromLatin1("url"))) {
- Data::FieldPtr field = new Data::Field(TQString::tqfromLatin1("url"), i18n("URL"), Data::Field::URL);
+ if(!coll->hasField(TQString::fromLatin1("url"))) {
+ Data::FieldPtr field = new Data::Field(TQString::fromLatin1("url"), i18n("URL"), Data::Field::URL);
field->setCategory(i18n("Miscellaneous"));
coll->addField(field);
}
- e->setField(TQString::tqfromLatin1("url"), u);
+ e->setField(TQString::fromLatin1("url"), u);
}
}
}
@@ -419,7 +419,7 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntry(uint uid_) {
}
void EntrezFetcher::initXSLTHandler() {
- TQString xsltfile = locate("appdata", TQString::tqfromLatin1("pubmed2tellico.xsl"));
+ TQString xsltfile = locate("appdata", TQString::fromLatin1("pubmed2tellico.xsl"));
if(xsltfile.isEmpty()) {
kdWarning() << "EntrezFetcher::initXSLTHandler() - can not locate pubmed2tellico.xsl." << endl;
return;
@@ -441,19 +441,19 @@ void EntrezFetcher::initXSLTHandler() {
void EntrezFetcher::updateEntry(Data::EntryPtr entry_) {
// myDebug() << "EntrezFetcher::updateEntry()" << endl;
- TQString s = entry_->field(TQString::tqfromLatin1("pmid"));
+ TQString s = entry_->field(TQString::fromLatin1("pmid"));
if(!s.isEmpty()) {
search(PubmedID, s);
return;
}
- s = entry_->field(TQString::tqfromLatin1("doi"));
+ s = entry_->field(TQString::fromLatin1("doi"));
if(!s.isEmpty()) {
search(DOI, s);
return;
}
- s = entry_->field(TQString::tqfromLatin1("title"));
+ s = entry_->field(TQString::fromLatin1("title"));
if(!s.isEmpty()) {
search(Title, s);
return;
@@ -489,9 +489,9 @@ TQString EntrezFetcher::ConfigWidget::preferredName() const {
//static
Tellico::StringMap EntrezFetcher::customFields() {
StringMap map;
- map[TQString::tqfromLatin1("institution")] = i18n("Institution");
- map[TQString::tqfromLatin1("abstract")] = i18n("Abstract");
- map[TQString::tqfromLatin1("url")] = i18n("URL");
+ map[TQString::fromLatin1("institution")] = i18n("Institution");
+ map[TQString::fromLatin1("abstract")] = i18n("Abstract");
+ map[TQString::fromLatin1("url")] = i18n("URL");
return map;
}