diff options
Diffstat (limited to 'src/fetch/fetchmanager.cpp')
-rw-r--r-- | src/fetch/fetchmanager.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/src/fetch/fetchmanager.cpp b/src/fetch/fetchmanager.cpp index 84f4f39..f7bc4c3 100644 --- a/src/fetch/fetchmanager.cpp +++ b/src/fetch/fetchmanager.cpp @@ -56,8 +56,8 @@ #include <ktempfile.h> #include <kio/netaccess.h> -#include <qfileinfo.h> -#include <qdir.h> +#include <tqfileinfo.h> +#include <tqdir.h> #define LOAD_ICON(name, group, size) \ KGlobal::iconLoader()->loadIcon(name, static_cast<KIcon::Group>(group), size_) @@ -65,11 +65,11 @@ using Tellico::Fetch::Manager; Manager* Manager::s_self = 0; -Manager::Manager() : QObject(), m_currentFetcherIndex(-1), m_messager(new ManagerMessage()), +Manager::Manager() : TQObject(), m_currentFetcherIndex(-1), m_messager(new ManagerMessage()), m_count(0), m_loadDefaults(false) { loadFetchers(); -// m_keyMap.insert(FetchFirst, QString::null); +// m_keyMap.insert(FetchFirst, TQString()); m_keyMap.insert(Title, i18n("Title")); m_keyMap.insert(Person, i18n("Person")); m_keyMap.insert(ISBN, i18n("ISBN")); @@ -81,7 +81,7 @@ Manager::Manager() : QObject(), m_currentFetcherIndex(-1), m_messager(new Manage // to keep from having a new i18n string, just remove octothorpe m_keyMap.insert(LCCN, i18n("LCCN#").remove('#')); m_keyMap.insert(Raw, i18n("Raw Query")); -// m_keyMap.insert(FetchLast, QString::null); +// m_keyMap.insert(FetchLast, TQString()); } Manager::~Manager() { @@ -94,11 +94,11 @@ void Manager::loadFetchers() { m_configMap.clear(); KConfig* config = KGlobal::config(); - if(config->hasGroup(QString::fromLatin1("Data Sources"))) { - KConfigGroup configGroup(config, QString::fromLatin1("Data Sources")); + if(config->hasGroup(TQString::tqfromLatin1("Data Sources"))) { + KConfigGroup configGroup(config, TQString::tqfromLatin1("Data Sources")); int nSources = configGroup.readNumEntry("Sources Count", 0); for(int i = 0; i < nSources; ++i) { - QString group = QString::fromLatin1("Data Source %1").arg(i); + TQString group = TQString::tqfromLatin1("Data Source %1").tqarg(i); Fetcher::Ptr f = createFetcher(config, group); if(f) { m_configMap.insert(f, group); @@ -123,7 +123,7 @@ Tellico::Fetch::FetcherVec Manager::fetchers(int type_) { return vec; } -Tellico::Fetch::KeyMap Manager::keyMap(const QString& source_) const { +Tellico::Fetch::KeyMap Manager::keyMap(const TQString& source_) const { // an empty string means return all if(source_.isEmpty()) { return m_keyMap; @@ -151,7 +151,7 @@ Tellico::Fetch::KeyMap Manager::keyMap(const QString& source_) const { return map; } -void Manager::startSearch(const QString& source_, FetchKey key_, const QString& value_) { +void Manager::startSearch(const TQString& source_, FetchKey key_, const TQString& value_) { if(value_.isEmpty()) { emit signalDone(); return; @@ -163,10 +163,10 @@ void Manager::startSearch(const QString& source_, FetchKey key_, const QString& for(FetcherVec::Iterator it = m_fetchers.begin(); it != m_fetchers.end(); ++it, ++i) { if(source_ == it->source()) { ++m_count; // Fetcher::search() might emit done(), so increment before calling search() - connect(it.data(), SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), - SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); - connect(it.data(), SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), - SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); + connect(it.data(), TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), + TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); + connect(it.data(), TQT_SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), + TQT_SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); it->search(key_, value_); m_currentFetcherIndex = i; break; @@ -183,10 +183,10 @@ void Manager::continueSearch() { Fetcher::Ptr f = m_fetchers[m_currentFetcherIndex]; if(f && f->hasMoreResults()) { ++m_count; - connect(f, SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), - SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); - connect(f, SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), - SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); + connect(f, TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*)), + TQT_SIGNAL(signalResultFound(Tellico::Fetch::SearchResult*))); + connect(f, TQT_SIGNAL(signalDone(Tellico::Fetch::Fetcher::Ptr)), + TQT_SLOT(slotFetcherDone(Tellico::Fetch::Fetcher::Ptr))); f->continueSearch(); } else { emit signalDone(); @@ -217,7 +217,7 @@ void Manager::stop() { } void Manager::slotFetcherDone(Fetcher::Ptr fetcher_) { -// myDebug() << "Manager::slotFetcherDone() - " << (fetcher_ ? fetcher_->source() : QString::null) +// myDebug() << "Manager::slotFetcherDone() - " << (fetcher_ ? fetcher_->source() : TQString()) // << " :" << m_count << endl; fetcher_->disconnect(); // disconnect all signals --m_count; @@ -235,7 +235,7 @@ bool Manager::canFetch() const { return false; } -Tellico::Fetch::Fetcher::Ptr Manager::createFetcher(KConfig* config_, const QString& group_) { +Tellico::Fetch::Fetcher::Ptr Manager::createFetcher(KConfig* config_, const TQString& group_) { if(!config_->hasGroup(group_)) { myDebug() << "Manager::createFetcher() - no config group for " << group_ << endl; return 0; @@ -359,7 +359,7 @@ Tellico::Fetch::FetcherVec Manager::defaultFetchers() { vec.append(new GoogleScholarFetcher(this)); vec.append(new DiscogsFetcher(this)); // only add IBS if user includes italian - if(KGlobal::locale()->languagesTwoAlpha().contains(QString::fromLatin1("it"))) { + if(KGlobal::locale()->languagesTwoAlpha().tqcontains(TQString::tqfromLatin1("it"))) { vec.append(new IBSFetcher(this)); } return vec; @@ -374,7 +374,7 @@ Tellico::Fetch::FetcherVec Manager::createUpdateFetchers(int collType_) { KConfigGroup config(KGlobal::config(), "Data Sources"); int nSources = config.readNumEntry("Sources Count", 0); for(int i = 0; i < nSources; ++i) { - QString group = QString::fromLatin1("Data Source %1").arg(i); + TQString group = TQString::tqfromLatin1("Data Source %1").tqarg(i); // needs the KConfig* Fetcher::Ptr f = createFetcher(KGlobal::config(), group); if(f && f->canFetch(collType_) && f->canUpdate()) { @@ -396,7 +396,7 @@ Tellico::Fetch::FetcherVec Manager::createUpdateFetchers(int collType_, FetchKey return fetchers; } -Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const QString& source_) { +Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const TQString& source_) { Fetcher::Ptr fetcher = 0; // creates new fetchers FetcherVec fetchers = createUpdateFetchers(collType_); @@ -409,8 +409,8 @@ Tellico::Fetch::Fetcher::Ptr Manager::createUpdateFetcher(int collType_, const Q return fetcher; } -void Manager::updateStatus(const QString& message_) { - emit signalStatus(message_); +void Manager::updatetqStatus(const TQString& message_) { + emit signaltqStatus(message_); } Tellico::Fetch::TypePairList Manager::typeList() { @@ -440,11 +440,11 @@ Tellico::Fetch::TypePairList Manager::typeList() { list.append(TypePair(DiscogsFetcher::defaultName(), Discogs)); // now find all the scripts distributed with tellico - QStringList files = KGlobal::dirs()->findAllResources("appdata", QString::fromLatin1("data-sources/*.spec"), + TQStringList files = KGlobal::dirs()->findAllResources("appdata", TQString::tqfromLatin1("data-sources/*.spec"), false, true); - for(QStringList::Iterator it = files.begin(); it != files.end(); ++it) { + for(TQStringList::Iterator it = files.begin(); it != files.end(); ++it) { KConfig spec(*it, false, false); - QString name = spec.readEntry("Name"); + TQString name = spec.readEntry("Name"); if(name.isEmpty()) { myDebug() << "Fetch::Manager::typeList() - no Name for " << *it << endl; continue; @@ -463,33 +463,33 @@ Tellico::Fetch::TypePairList Manager::typeList() { // called when creating a new fetcher -Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* parent_, Type type_, const QString& name_) { +Tellico::Fetch::ConfigWidget* Manager::configWidget(TQWidget* tqparent_, Type type_, const TQString& name_) { ConfigWidget* w = 0; switch(type_) { #ifdef AMAZON_SUPPORT case Amazon: - w = new AmazonFetcher::ConfigWidget(parent_); + w = new AmazonFetcher::ConfigWidget(tqparent_); break; #endif #ifdef IMDB_SUPPORT case IMDB: - w = new IMDBFetcher::ConfigWidget(parent_); + w = new IMDBFetcher::ConfigWidget(tqparent_); break; #endif #ifdef HAVE_YAZ case Z3950: - w = new Z3950Fetcher::ConfigWidget(parent_); + w = new Z3950Fetcher::ConfigWidget(tqparent_); break; #endif case SRU: - w = new SRUConfigWidget(parent_); + w = new SRUConfigWidget(tqparent_); break; case Entrez: - w = new EntrezFetcher::ConfigWidget(parent_); + w = new EntrezFetcher::ConfigWidget(tqparent_); break; case ExecExternal: - w = new ExecExternalFetcher::ConfigWidget(parent_); - if(!name_.isEmpty() && m_scriptMap.contains(name_)) { + w = new ExecExternalFetcher::ConfigWidget(tqparent_); + if(!name_.isEmpty() && m_scriptMap.tqcontains(name_)) { // bundledScriptHasExecPath() actually needs to write the exec path // back to the config so the configWidget can read it. But if the spec file // is not readablle, that doesn't work. So work around it with a copy to a temp file @@ -512,37 +512,37 @@ Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* parent_, Type type_ } break; case Yahoo: - w = new YahooFetcher::ConfigWidget(parent_); + w = new YahooFetcher::ConfigWidget(tqparent_); break; case AnimeNfo: - w = new AnimeNfoFetcher::ConfigWidget(parent_); + w = new AnimeNfoFetcher::ConfigWidget(tqparent_); break; case IBS: - w = new IBSFetcher::ConfigWidget(parent_); + w = new IBSFetcher::ConfigWidget(tqparent_); break; case ISBNdb: - w = new ISBNdbFetcher::ConfigWidget(parent_); + w = new ISBNdbFetcher::ConfigWidget(tqparent_); break; case GCstarPlugin: - w = new GCstarPluginFetcher::ConfigWidget(parent_); + w = new GCstarPluginFetcher::ConfigWidget(tqparent_); break; case CrossRef: - w = new CrossRefFetcher::ConfigWidget(parent_); + w = new CrossRefFetcher::ConfigWidget(tqparent_); break; case Arxiv: - w = new ArxivFetcher::ConfigWidget(parent_); + w = new ArxivFetcher::ConfigWidget(tqparent_); break; case Citebase: - w = new CitebaseFetcher::ConfigWidget(parent_); + w = new CitebaseFetcher::ConfigWidget(tqparent_); break; case Bibsonomy: - w = new BibsonomyFetcher::ConfigWidget(parent_); + w = new BibsonomyFetcher::ConfigWidget(tqparent_); break; case GoogleScholar: - w = new GoogleScholarFetcher::ConfigWidget(parent_); + w = new GoogleScholarFetcher::ConfigWidget(tqparent_); break; case Discogs: - w = new DiscogsFetcher::ConfigWidget(parent_); + w = new DiscogsFetcher::ConfigWidget(tqparent_); break; case Unknown: kdWarning() << "Fetch::Manager::configWidget() - no widget defined for type = " << type_ << endl; @@ -551,7 +551,7 @@ Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* parent_, Type type_ } // static -QString Manager::typeName(Fetch::Type type_) { +TQString Manager::typeName(Fetch::Type type_) { switch(type_) { #ifdef AMAZON_SUPPORT case Amazon: return AmazonFetcher::defaultName(); @@ -579,17 +579,17 @@ QString Manager::typeName(Fetch::Type type_) { case Unknown: break; } myWarning() << "Manager::typeName() - none found for " << type_ << endl; - return QString::null; + return TQString(); } -QPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size_) { +TQPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size_) { #ifdef HAVE_YAZ if(fetcher_->type() == Fetch::Z3950) { const Fetch::Z3950Fetcher* f = static_cast<const Fetch::Z3950Fetcher*>(fetcher_.data()); KURL u; - u.setProtocol(QString::fromLatin1("http")); + u.setProtocol(TQString::tqfromLatin1("http")); u.setHost(f->host()); - QString icon = favIcon(u); + TQString icon = favIcon(u); if(u.isValid() && !icon.isEmpty()) { return LOAD_ICON(icon, group_, size_); } @@ -597,21 +597,21 @@ QPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size #endif if(fetcher_->type() == Fetch::ExecExternal) { const Fetch::ExecExternalFetcher* f = static_cast<const Fetch::ExecExternalFetcher*>(fetcher_.data()); - const QString p = f->execPath(); + const TQString p = f->execPath(); KURL u; - if(p.find(QString::fromLatin1("allocine")) > -1) { - u = QString::fromLatin1("http://www.allocine.fr"); - } else if(p.find(QString::fromLatin1("ministerio_de_cultura")) > -1) { - u = QString::fromLatin1("http://www.mcu.es"); - } else if(p.find(QString::fromLatin1("dark_horse_comics")) > -1) { - u = QString::fromLatin1("http://www.darkhorse.com"); - } else if(p.find(QString::fromLatin1("boardgamegeek")) > -1) { - u = QString::fromLatin1("http://www.boardgamegeek.com"); - } else if(f->source().find(QString::fromLatin1("amarok"), 0, false /*case-sensitive*/) > -1) { - return LOAD_ICON(QString::fromLatin1("amarok"), group_, size_); + if(p.tqfind(TQString::tqfromLatin1("allocine")) > -1) { + u = TQString::tqfromLatin1("http://www.allocine.fr"); + } else if(p.tqfind(TQString::tqfromLatin1("ministerio_de_cultura")) > -1) { + u = TQString::tqfromLatin1("http://www.mcu.es"); + } else if(p.tqfind(TQString::tqfromLatin1("dark_horse_comics")) > -1) { + u = TQString::tqfromLatin1("http://www.darkhorse.com"); + } else if(p.tqfind(TQString::tqfromLatin1("boardgamegeek")) > -1) { + u = TQString::tqfromLatin1("http://www.boardgamegeek.com"); + } else if(f->source().tqfind(TQString::tqfromLatin1("amarok"), 0, false /*case-sensitive*/) > -1) { + return LOAD_ICON(TQString::tqfromLatin1("amarok"), group_, size_); } if(!u.isEmpty() && u.isValid()) { - QString icon = favIcon(u); + TQString icon = favIcon(u); if(!icon.isEmpty()) { return LOAD_ICON(icon, group_, size_); } @@ -620,21 +620,21 @@ QPixmap Manager::fetcherIcon(Fetch::Fetcher::CPtr fetcher_, int group_, int size return fetcherIcon(fetcher_->type(), group_); } -QPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { - QString name; +TQPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { + TQString name; switch(type_) { case Amazon: name = favIcon("http://amazon.com"); break; case IMDB: name = favIcon("http://imdb.com"); break; case Z3950: - name = QString::fromLatin1("network"); break; // rather arbitrary + name = TQString::tqfromLatin1("network"); break; // rather arbitrary case SRU: - name = QString::fromLatin1("network_local"); break; // just to be different than z3950 + name = TQString::tqfromLatin1("network_local"); break; // just to be different than z3950 case Entrez: name = favIcon("http://www.ncbi.nlm.nih.gov"); break; case ExecExternal: - name = QString::fromLatin1("exec"); break; + name = TQString::tqfromLatin1("exec"); break; case Yahoo: name = favIcon("http://yahoo.com"); break; case AnimeNfo: @@ -644,7 +644,7 @@ QPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { case ISBNdb: name = favIcon("http://isbndb.com"); break; case GCstarPlugin: - name = QString::fromLatin1("gcstar"); break; + name = TQString::tqfromLatin1("gcstar"); break; case CrossRef: name = favIcon("http://crossref.org"); break; case Arxiv: @@ -661,13 +661,13 @@ QPixmap Manager::fetcherIcon(Fetch::Type type_, int group_, int size_) { kdWarning() << "Fetch::Manager::fetcherIcon() - no pixmap defined for type = " << type_ << endl; } - return name.isEmpty() ? QPixmap() : LOAD_ICON(name, group_, size_); + return name.isEmpty() ? TQPixmap() : LOAD_ICON(name, group_, size_); } -QString Manager::favIcon(const KURL& url_) { +TQString Manager::favIcon(const KURL& url_) { DCOPRef kded("kded", "favicons"); DCOPReply reply = kded.call("iconForURL(KURL)", url_); - QString iconName = reply.isValid() ? reply : QString(); + TQString iconName = reply.isValid() ? reply : TQString(); if(!iconName.isEmpty()) { return iconName; } else { @@ -677,15 +677,15 @@ QString Manager::favIcon(const KURL& url_) { return KMimeType::iconForURL(url_); } -bool Manager::bundledScriptHasExecPath(const QString& specFile_, KConfig* config_) { +bool Manager::bundledScriptHasExecPath(const TQString& specFile_, KConfig* config_) { // make sure ExecPath is set and executable // for the bundled scripts, either the exec name is not set, in which case it is the // name of the spec file, minus the .spec, or the exec is set, and is local to the dir // if not, look for it - QString exec = config_->readPathEntry("ExecPath"); - QFileInfo specInfo(specFile_), execInfo(exec); + TQString exec = config_->readPathEntry("ExecPath"); + TQFileInfo specInfo(specFile_), execInfo(exec); if(exec.isEmpty() || !execInfo.exists()) { - exec = specInfo.dirPath(true) + QDir::separator() + specInfo.baseName(true); // remove ".spec" + exec = specInfo.dirPath(true) + TQDir::separator() + specInfo.baseName(true); // remove ".spec" } else if(execInfo.isRelative()) { exec = specInfo.dirPath(true) + exec; } else if(!execInfo.isExecutable()) { |