summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp')
-rw-r--r--kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp196
1 files changed, 98 insertions, 98 deletions
diff --git a/kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp b/kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp
index 0cd79fb3..5220f88a 100644
--- a/kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp
+++ b/kbabel/kbabeldict/modules/pocompendium/pocompendium.cpp
@@ -41,9 +41,9 @@
#include <kinstance.h>
#include <kio/netaccess.h>
-#include <qregexp.h>
-#include <qtextstream.h>
-#include <qtimer.h>
+#include <tqregexp.h>
+#include <tqtextstream.h>
+#include <tqtimer.h>
#include "resources.h"
#include "compendiumdata.h"
@@ -60,10 +60,10 @@
using namespace KBabel;
-static KStaticDeleter< QDict<CompendiumData> > compDataDeleter;
-QDict<CompendiumData> *PoCompendium::_compDict = 0;
+static KStaticDeleter< TQDict<CompendiumData> > compDataDeleter;
+TQDict<CompendiumData> *PoCompendium::_compDict = 0;
-PoCompendium::PoCompendium(QObject *parent, const char *name)
+PoCompendium::PoCompendium(TQObject *parent, const char *name)
: SearchEngine(parent, name)
{
prefWidget=0;
@@ -87,8 +87,8 @@ PoCompendium::PoCompendium(QObject *parent, const char *name)
matchWords=true;
- loadTimer = new QTimer(this);
- connect(loadTimer,SIGNAL(timeout()),this,SLOT(slotLoadCompendium()));
+ loadTimer = new TQTimer(this);
+ connect(loadTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(slotLoadCompendium()));
}
PoCompendium::~PoCompendium()
@@ -145,7 +145,7 @@ void PoCompendium::readSettings(KConfigBase *config)
matchWords = config->readBoolEntry("MatchWords",true);
matchNGram = config->readBoolEntry("MatchNGram",true);
- QString newPath = config->readEntry("Compendium","http://i18n.kde.org/po_overview/@[email protected]");
+ TQString newPath = config->readEntry("Compendium","http://i18n.kde.org/po_overview/@[email protected]");
if(!initialized)
{
url = newPath;
@@ -160,13 +160,13 @@ void PoCompendium::readSettings(KConfigBase *config)
restoreSettings();
}
-PrefWidget *PoCompendium::preferencesWidget(QWidget *parent)
+PrefWidget *PoCompendium::preferencesWidget(TQWidget *parent)
{
prefWidget = new CompendiumPreferencesWidget(parent,"pocompendium_prefwidget");
kdDebug(KBABEL_SEARCH) << "PreferencesWidget is " << prefWidget << endl;
- connect(prefWidget, SIGNAL(applySettings()), this, SLOT(applySettings()));
- connect(prefWidget, SIGNAL(restoreSettings())
- , this, SLOT(restoreSettings()));
+ connect(prefWidget, TQT_SIGNAL(applySettings()), this, TQT_SLOT(applySettings()));
+ connect(prefWidget, TQT_SIGNAL(restoreSettings())
+ , this, TQT_SLOT(restoreSettings()));
restoreSettings();
@@ -179,22 +179,22 @@ const KAboutData *PoCompendium::about() const
}
-QString PoCompendium::name() const
+TQString PoCompendium::name() const
{
return i18n("PO Compendium");
}
-QString PoCompendium::id() const
+TQString PoCompendium::id() const
{
return "pocompendium";
}
-QString PoCompendium::lastError()
+TQString PoCompendium::lastError()
{
return errorMsg;
}
-bool PoCompendium::searchExact(const QString& text, uint pluralForm, QPtrList<SearchResult>& results, QValueList<int>& foundIndices, QValueList<int>& )
+bool PoCompendium::searchExact(const TQString& text, uint pluralForm, TQPtrList<SearchResult>& results, TQValueList<int>& foundIndices, TQValueList<int>& )
{
const int *index = data->exactDict(text);
if(index)
@@ -222,14 +222,14 @@ bool PoCompendium::searchExact(const QString& text, uint pluralForm, QPtrList<Se
}
-bool PoCompendium::searchCaseInsensitive(const QString& text, uint pluralForm, QPtrList<SearchResult>& results, QValueList<int>& foundIndices, QValueList<int>& )
+bool PoCompendium::searchCaseInsensitive(const TQString& text, uint pluralForm, TQPtrList<SearchResult>& results, TQValueList<int>& foundIndices, TQValueList<int>& )
{
- QString searchStr = text.lower();
+ TQString searchStr = text.lower();
- const QValueList<int> *indexList = data->allDict(text.lower());
+ const TQValueList<int> *indexList = data->allDict(text.lower());
if(indexList)
{
- QValueList<int>::ConstIterator it;
+ TQValueList<int>::ConstIterator it;
for( it = indexList->begin(); it != indexList->end(); ++it )
{
if(foundIndices.contains(*it))
@@ -243,7 +243,7 @@ bool PoCompendium::searchCaseInsensitive(const QString& text, uint pluralForm, Q
}
- QString origStr = data->catalog()->msgid(*it).first();
+ TQString origStr = data->catalog()->msgid(*it).first();
origStr = CompendiumData::simplify(origStr);
@@ -276,16 +276,16 @@ bool PoCompendium::searchCaseInsensitive(const QString& text, uint pluralForm, Q
return false;
}
-bool PoCompendium::searchTextOnly(const QString& text, uint pluralForm, QPtrList<SearchResult>& results, QValueList<int>& foundIndices, QValueList<int>& )
+bool PoCompendium::searchTextOnly(const TQString& text, uint pluralForm, TQPtrList<SearchResult>& results, TQValueList<int>& foundIndices, TQValueList<int>& )
{
- QString searchStr = text.lower();
- QString t = text;
+ TQString searchStr = text.lower();
+ TQString t = text;
t.remove( " " );
- const QValueList<int> *indexList = data->textonlyDict(t.lower());
+ const TQValueList<int> *indexList = data->textonlyDict(t.lower());
if(indexList)
{
- QValueList<int>::ConstIterator it;
+ TQValueList<int>::ConstIterator it;
for( it = indexList->begin(); it != indexList->end(); ++it )
{
if(foundIndices.contains(*it))
@@ -299,7 +299,7 @@ bool PoCompendium::searchTextOnly(const QString& text, uint pluralForm, QPtrList
}
- QString origStr = data->catalog()->msgid(*it).first();
+ TQString origStr = data->catalog()->msgid(*it).first();
origStr = CompendiumData::simplify(origStr);
@@ -325,22 +325,22 @@ bool PoCompendium::searchTextOnly(const QString& text, uint pluralForm, QPtrList
return false;
}
-bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrList<SearchResult>& results, QValueList<int>& foundIndices, QValueList<int>& checkedIndices )
+bool PoCompendium::searchWords(const TQString& searchStr, uint pluralForm, TQPtrList<SearchResult>& results, TQValueList<int>& foundIndices, TQValueList<int>& checkedIndices )
{
uint checkCounter = 0;
bool foundResults = false;
- QStringList wList = CompendiumData::wordList(searchStr);
- for ( QStringList::Iterator wit = wList.begin()
+ TQStringList wList = CompendiumData::wordList(searchStr);
+ for ( TQStringList::Iterator wit = wList.begin()
; wit != wList.end(); ++wit )
{
if(stop)
break;
- const QValueList<int> *indexList = data->wordDict((*wit).lower());
+ const TQValueList<int> *indexList = data->wordDict((*wit).lower());
if(indexList)
{
- QValueList<int>::ConstIterator it;
+ TQValueList<int>::ConstIterator it;
for( it = indexList->begin(); it != indexList->end(); ++it )
{
if(stop)
@@ -371,7 +371,7 @@ bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrLi
kapp->processEvents(100);
- QString origStr = data->catalog()->msgid(*it).first();
+ TQString origStr = data->catalog()->msgid(*it).first();
origStr = CompendiumData::simplify(origStr);
@@ -389,8 +389,8 @@ bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrLi
}
else
{
- QString s=*wit;
- QString o=origStr;
+ TQString s=*wit;
+ TQString o=origStr;
if(wholeWords)
{
@@ -421,8 +421,8 @@ bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrLi
if(!found && matchContains && !wholeWords)
{
- QString s=maskString(searchStr);
- QRegExp searchReg(s);
+ TQString s=maskString(searchStr);
+ TQRegExp searchReg(s);
if(searchReg.search(origStr) >= 0)
found=true;
@@ -430,8 +430,8 @@ bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrLi
if(!found && matchIsContained && !wholeWords)
{
- QString s=maskString(origStr);
- QRegExp reg(s);
+ TQString s=maskString(origStr);
+ TQRegExp reg(s);
if(reg.search(searchStr) >= 0)
{
@@ -440,13 +440,13 @@ bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrLi
}
if(!found && matchWords && !wholeWords)
{
- QStringList list = CompendiumData::wordList(searchStr);
+ TQStringList list = CompendiumData::wordList(searchStr);
- for ( QStringList::Iterator wit2 = list.begin()
+ for ( TQStringList::Iterator wit2 = list.begin()
; wit2 != list.end(); ++wit2 )
{
- QString s=maskString(*wit2);
- QRegExp reg(s);
+ TQString s=maskString(*wit2);
+ TQRegExp reg(s);
if(reg.search(origStr) >= 0)
{
@@ -483,15 +483,15 @@ bool PoCompendium::searchWords(const QString& searchStr, uint pluralForm, QPtrLi
return foundResults;
}
-bool PoCompendium::searchNGram(const QString& searchStr, uint pluralForm, QPtrList<SearchResult>& results, QValueList<int>& foundIndices, QValueList<int>& checkedIndices )
+bool PoCompendium::searchNGram(const TQString& searchStr, uint pluralForm, TQPtrList<SearchResult>& results, TQValueList<int>& foundIndices, TQValueList<int>& checkedIndices )
{
uint checkCounter = 0;
bool foundResults = false;
- QRegExp searchReg;
+ TQRegExp searchReg;
if(matchContains)
{
- QString s=maskString(searchStr);
+ TQString s=maskString(searchStr);
searchReg.setPattern(s);
}
@@ -539,7 +539,7 @@ bool PoCompendium::searchNGram(const QString& searchStr, uint pluralForm, QPtrLi
kapp->processEvents(100);
- QString origStr = data->catalog()->msgid(i).first();
+ TQString origStr = data->catalog()->msgid(i).first();
origStr = CompendiumData::simplify(origStr);
if(!caseSensitive)
@@ -564,8 +564,8 @@ bool PoCompendium::searchNGram(const QString& searchStr, uint pluralForm, QPtrLi
if(!found && matchIsContained)
{
- QString s=maskString(origStr);
- QRegExp reg(s);
+ TQString s=maskString(origStr);
+ TQRegExp reg(s);
if(reg.search(searchStr) >= 0)
{
@@ -575,19 +575,19 @@ bool PoCompendium::searchNGram(const QString& searchStr, uint pluralForm, QPtrLi
if(!found && matchWords)
{
- QStringList list = CompendiumData::wordList(searchStr);
+ TQStringList list = CompendiumData::wordList(searchStr);
- for ( QStringList::Iterator wit2 = list.begin()
+ for ( TQStringList::Iterator wit2 = list.begin()
; wit2 != list.end(); ++wit2 )
{
- QString s=maskString(*wit2);
+ TQString s=maskString(*wit2);
if(wholeWords)
{
origStr = " "+origStr+" ";
s=" "+s+" ";
}
- QRegExp reg(s);
+ TQRegExp reg(s);
if(reg.search(origStr) >= 0)
{
@@ -632,7 +632,7 @@ bool PoCompendium::searchNGram(const QString& searchStr, uint pluralForm, QPtrLi
return foundResults;
}
-bool PoCompendium::startSearch(const QString& text, uint pluralForm, const SearchFilter* filter)
+bool PoCompendium::startSearch(const TQString& text, uint pluralForm, const SearchFilter* filter)
{
if(autoUpdate && prefWidget && prefWidget->settingsChanged())
{
@@ -669,13 +669,13 @@ bool PoCompendium::startSearch(const QString& text, uint pluralForm, const Searc
emit started();
- QValueList<int> foundIndices;
- QValueList<int> checkedIndices;
+ TQValueList<int> foundIndices;
+ TQValueList<int> checkedIndices;
// first, exact search
searchExact(text, pluralForm, results, foundIndices, checkedIndices);
- QString searchStr=CompendiumData::simplify(text);
+ TQString searchStr=CompendiumData::simplify(text);
if(!caseSensitive)
@@ -738,7 +738,7 @@ void PoCompendium::applySettings()
bool needLoading=false;
- QString newPath = prefWidget->url();
+ TQString newPath = prefWidget->url();
if(!initialized)
{
url = newPath;
@@ -795,7 +795,7 @@ void PoCompendium::slotLoadCompendium()
}
- QString path=url;
+ TQString path=url;
if(path.contains("@LANG@"))
{
@@ -828,7 +828,7 @@ void PoCompendium::slotLoadCompendium()
}
else
{
- connect(data, SIGNAL(progressEnds()), this, SLOT(recheckData()));
+ connect(data, TQT_SIGNAL(progressEnds()), this, TQT_SLOT(recheckData()));
}
}
else
@@ -847,7 +847,7 @@ void PoCompendium::recheckData()
{
if(data)
{
- disconnect(data, SIGNAL(progressEnds()), this, SLOT(recheckData()));
+ disconnect(data, TQT_SIGNAL(progressEnds()), this, TQT_SLOT(recheckData()));
error = data->hasErrors();
errorMsg = data->errorMsg();
@@ -864,7 +864,7 @@ void PoCompendium::recheckData()
loading=false;
}
-QString PoCompendium::maskString(QString s)
+TQString PoCompendium::maskString(TQString s)
{
s.replace("\\","\\\\");
s.replace("\?","\\?");
@@ -883,7 +883,7 @@ QString PoCompendium::maskString(QString s)
return s;
}
-void PoCompendium::addResult(SearchResult *result, QPtrList<SearchResult>& res)
+void PoCompendium::addResult(SearchResult *result, TQPtrList<SearchResult>& res)
{
if(res.last() && res.last()->score >= result->score)
{
@@ -915,7 +915,7 @@ void PoCompendium::addResult(SearchResult *result, QPtrList<SearchResult>& res)
}
-void PoCompendium::setLanguageCode(const QString& lang)
+void PoCompendium::setLanguageCode(const TQString& lang)
{
if(initialized && url.contains("@LANG@") && lang!=langCode
&& !loadTimer->isActive() )
@@ -926,7 +926,7 @@ void PoCompendium::setLanguageCode(const QString& lang)
langCode=lang;
}
-QString PoCompendium::translate(const QString& text, uint pluralForm)
+TQString PoCompendium::translate(const TQString& text, uint pluralForm)
{
if(!initialized)
{
@@ -938,7 +938,7 @@ QString PoCompendium::translate(const QString& text, uint pluralForm)
if(error || !data || data->active())
{
- return QString::null;
+ return TQString::null;
}
@@ -950,10 +950,10 @@ QString PoCompendium::translate(const QString& text, uint pluralForm)
return data->catalog()->msgstr(*index).first();
}
- return QString::null;
+ return TQString::null;
}
-QString PoCompendium::fuzzyTranslation(const QString& text, int &score, const uint pluralForm)
+TQString PoCompendium::fuzzyTranslation(const TQString& text, int &score, const uint pluralForm)
{
if(!initialized)
{
@@ -965,7 +965,7 @@ QString PoCompendium::fuzzyTranslation(const QString& text, int &score, const ui
if(error || !data || data->active())
{
- return QString::null;
+ return TQString::null;
}
// try to find fuzzy string
@@ -976,7 +976,7 @@ QString PoCompendium::fuzzyTranslation(const QString& text, int &score, const ui
int best_match = 0;
int total = data->catalog()->numberOfEntries();
- QString searchStr = CompendiumData::simplify(text);
+ TQString searchStr = CompendiumData::simplify(text);
//kdDebug(750) << "find best match for " << searchStr << endl;
@@ -1004,7 +1004,7 @@ QString PoCompendium::fuzzyTranslation(const QString& text, int &score, const ui
}
// get a message from the catalog FIXME: plurals
- QString origStr = data->catalog()->msgid(i).first();
+ TQString origStr = data->catalog()->msgid(i).first();
origStr = CompendiumData::simplify(origStr);
// don't match too long strings for short search string
@@ -1029,11 +1029,11 @@ QString PoCompendium::fuzzyTranslation(const QString& text, int &score, const ui
return data->catalog()->msgstr(best_matching).first();
}
- return QString::null;
+ return TQString::null;
}
-QString PoCompendium::searchTranslation(const QString& text, int &sc, const uint pluralForm)
+TQString PoCompendium::searchTranslation(const TQString& text, int &sc, const uint pluralForm)
{
if(autoUpdate && prefWidget && prefWidget->settingsChanged())
{
@@ -1041,7 +1041,7 @@ QString PoCompendium::searchTranslation(const QString& text, int &sc, const uint
}
if(isSearching())
- return QString::null;
+ return TQString::null;
clearResults();
stop = false;
@@ -1058,21 +1058,21 @@ QString PoCompendium::searchTranslation(const QString& text, int &sc, const uint
if(error || !data)
{
active = false;
- return QString::null;
+ return TQString::null;
}
if(data->active())
{
active = false;
- return QString::null;
+ return TQString::null;
}
emit started();
- QPtrList<SearchResult> res;
+ TQPtrList<SearchResult> res;
- QValueList<int> foundIndices;
- QValueList<int> checkedIndices;
+ TQValueList<int> foundIndices;
+ TQValueList<int> checkedIndices;
// first, exact search
if( searchExact(text, pluralForm, res, foundIndices, checkedIndices) )
@@ -1086,7 +1086,7 @@ QString PoCompendium::searchTranslation(const QString& text, int &sc, const uint
return res.first()->translation;
}
- QString searchStr=CompendiumData::simplify(text);
+ TQString searchStr=CompendiumData::simplify(text);
if(!caseSensitive)
@@ -1107,7 +1107,7 @@ QString PoCompendium::searchTranslation(const QString& text, int &sc, const uint
}
// search without whitespace
- QString s = searchStr;
+ TQString s = searchStr;
s.remove( ' ' );
if( searchTextOnly(s, pluralForm, res, foundIndices, checkedIndices) )
{
@@ -1145,7 +1145,7 @@ QString PoCompendium::searchTranslation(const QString& text, int &sc, const uint
sc = 0;
- return QString::null;
+ return TQString::null;
}
@@ -1153,14 +1153,14 @@ void PoCompendium::unregisterData()
{
if(data)
{
- disconnect(data, SIGNAL(progressStarts(const QString&)), this
- , SIGNAL(progressStarts(const QString&)));
- disconnect(data, SIGNAL(progressEnds()), this , SIGNAL(progressEnds()));
- disconnect(data, SIGNAL(progress(int)), this , SIGNAL(progress(int)));
+ disconnect(data, TQT_SIGNAL(progressStarts(const TQString&)), this
+ , TQT_SIGNAL(progressStarts(const TQString&)));
+ disconnect(data, TQT_SIGNAL(progressEnds()), this , TQT_SIGNAL(progressEnds()));
+ disconnect(data, TQT_SIGNAL(progress(int)), this , TQT_SIGNAL(progress(int)));
if(data->active())
{
- disconnect(data,SIGNAL(progressEnds()),this,SLOT(recheckData()));
+ disconnect(data,TQT_SIGNAL(progressEnds()),this,TQT_SLOT(recheckData()));
}
if(data->unregisterObject(this))
@@ -1171,7 +1171,7 @@ void PoCompendium::unregisterData()
}
else
{
- connect(data,SIGNAL(progressEnds()),this,SLOT(removeData()));
+ connect(data,TQT_SIGNAL(progressEnds()),this,TQT_SLOT(removeData()));
}
}
@@ -1195,22 +1195,22 @@ void PoCompendium::registerData()
emit progressStarts(i18n("Loading PO compendium"));
}
- connect(data, SIGNAL(
- progressStarts(const QString&)), this
- , SIGNAL(progressStarts(const QString&)));
- connect(data, SIGNAL(progressEnds()), this , SIGNAL(progressEnds()));
- connect(data, SIGNAL(progress(int)), this , SIGNAL(progress(int)));
+ connect(data, TQT_SIGNAL(
+ progressStarts(const TQString&)), this
+ , TQT_SIGNAL(progressStarts(const TQString&)));
+ connect(data, TQT_SIGNAL(progressEnds()), this , TQT_SIGNAL(progressEnds()));
+ connect(data, TQT_SIGNAL(progress(int)), this , TQT_SIGNAL(progress(int)));
}
void PoCompendium::removeData()
{
- const QObject *s=sender();
+ const TQObject *s=sender();
if(s && s->inherits("CompendiumData"))
{
const CompendiumData *d=static_cast<const CompendiumData*>(s);
if(d)
{
- QDictIterator<CompendiumData> it(*compendiumDict());
+ TQDictIterator<CompendiumData> it(*compendiumDict());
while(it.current())
{
if(it.current() == d)
@@ -1230,11 +1230,11 @@ void PoCompendium::removeData()
}
}
-QDict<CompendiumData> *PoCompendium::compendiumDict()
+TQDict<CompendiumData> *PoCompendium::compendiumDict()
{
if(!_compDict)
{
- _compDict=compDataDeleter.setObject( new QDict<CompendiumData> );
+ _compDict=compDataDeleter.setObject( new TQDict<CompendiumData> );
_compDict->setAutoDelete(true);
}