summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabeldict/modules/dbsearchengine/database.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
commit4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch)
treeb0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbabel/kbabeldict/modules/dbsearchengine/database.cpp
parent1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff)
downloadtdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz
tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbabel/kbabeldict/modules/dbsearchengine/database.cpp')
-rw-r--r--kbabel/kbabeldict/modules/dbsearchengine/database.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/kbabel/kbabeldict/modules/dbsearchengine/database.cpp b/kbabel/kbabeldict/modules/dbsearchengine/database.cpp
index 003a3a95..0847d594 100644
--- a/kbabel/kbabeldict/modules/dbsearchengine/database.cpp
+++ b/kbabel/kbabeldict/modules/dbsearchengine/database.cpp
@@ -36,12 +36,12 @@
#include "database.h"
#include <unistd.h>
-#include <qfile.h>
+#include <tqfile.h>
#include <ktempfile.h>
#include <kio/netaccess.h>
-WordItem::WordItem (char *data, QString w)
+WordItem::WordItem (char *data, TQString w)
{
word = w;
@@ -58,7 +58,7 @@ WordItem::WordItem (char *data, QString w)
}
-WordItem::WordItem (QString w)
+WordItem::WordItem (TQString w)
{
locations = NULL;
count = 0;
@@ -100,7 +100,7 @@ InfoItem::InfoItem ()
language = "No language";
}
-InfoItem::InfoItem (const char *rawData, QString lang)
+InfoItem::InfoItem (const char *rawData, TQString lang)
{
const char *rd;
rd = rawData;
@@ -110,16 +110,16 @@ InfoItem::InfoItem (const char *rawData, QString lang)
charset = "Utf8";
- catalogName = QString::fromUtf8 (rd);
+ catalogName = TQString::fromUtf8 (rd);
len = strlen (rd) + 1;
rd += len;
- lastTranslator = QString::fromUtf8 (rd);
+ lastTranslator = TQString::fromUtf8 (rd);
len = strlen (rd) + 1;
rd += len;
secs = *(unsigned int *) rd;
revisionDate.setTime_t (secs);
rd += 4;
- lastFullPath = QString::fromUtf8 (rd);
+ lastFullPath = TQString::fromUtf8 (rd);
len = strlen (rd) + 1;
rd += len;
@@ -139,8 +139,8 @@ InfoItem::rawData (char *rawData)
rd += strlen (rd) + 1;
- //QDate Time problem!!!!!!!!!!!
- QDateTime zeroDate;
+ //TQDate Time problem!!!!!!!!!!!
+ TQDateTime zeroDate;
zeroDate.setTime_t (0);
*(unsigned int *) rd = -revisionDate.secsTo (zeroDate);
rd += 4;
@@ -168,7 +168,7 @@ InfoItem::size ()
// this is a quick hack to copy a local file
int
-copy_hack (QFile & input, QFile & output)
+copy_hack (TQFile & input, TQFile & output)
{
if (!input.isOpen ())
{
@@ -204,7 +204,7 @@ DataBaseItem::DataBaseItem (char *_key, char *_data)
{
char *data = _data;
- key = QString::fromUtf8 (_key);
+ key = TQString::fromUtf8 (_key);
unsigned int i, r;
numTra = *(uint32 *) data;
@@ -228,7 +228,7 @@ DataBaseItem::DataBaseItem (char *_key, char *_data)
tr.infoRef.append (ref);
}
- tr.translation = QString::fromUtf8 ((const char *) data);
+ tr.translation = TQString::fromUtf8 ((const char *) data);
translations.append (tr);
data += strlen (data) + 1;
@@ -293,11 +293,11 @@ DataBaseItem::toRawData (char *_data)
}
-DataBaseManager::DataBaseManager (QString directory, QString lang,
- QObject * parent, const char *name):
-QObject (parent, name)
+DataBaseManager::DataBaseManager (TQString directory, TQString lang,
+ TQObject * parent, const char *name):
+TQObject (parent, name)
{
- QString filename;
+ TQString filename;
language = lang;
iAmOk = true;
@@ -312,22 +312,22 @@ void
DataBaseManager::openDataBase ()
{
kdDebug () << "Opendatabase" << endl;
- QString directory;
+ TQString directory;
directory = basedir;
- QString ll = "." + language;
+ TQString ll = "." + language;
if (ll == ".")
ll = ".NOLANG";
- QString transfilename = "%1/translations%2.db";
+ TQString transfilename = "%1/translations%2.db";
transfilename = transfilename.arg (directory).arg (ll);
- QString infofilename = "%1/catalogsinfo%2.db";
+ TQString infofilename = "%1/catalogsinfo%2.db";
infofilename = infofilename.arg (directory).arg (ll);
- QString wordsfilename = "%1/wordsindex%2.db";
+ TQString wordsfilename = "%1/wordsindex%2.db";
wordsfilename = wordsfilename.arg (directory).arg (ll);
- QString keysfilename = "%1/keysindex%2.db";
+ TQString keysfilename = "%1/keysindex%2.db";
keysfilename = keysfilename.arg (directory).arg (ll);
cursor = 0;
@@ -354,7 +354,7 @@ DataBaseManager::openDataBase ()
KTempFile transFile, infoFile, keysFile, wordsFile;
// do the upgrade on the translation file
- QFile transfilenameFile (transfilename);
+ TQFile transfilenameFile (transfilename);
if ((ret = copy_hack (transfilenameFile, *transFile.file ())) == 0)
{
@@ -373,7 +373,7 @@ DataBaseManager::openDataBase ()
}
// do the upgrade on the info file
- QFile infofilenameFile (infofilename);
+ TQFile infofilenameFile (infofilename);
if ((ret = copy_hack (infofilenameFile, *infoFile.file ())) == 0)
{
ret =
@@ -394,7 +394,7 @@ DataBaseManager::openDataBase ()
}
// do the upgrade on the words file
- QFile wordfilenameFile (wordsfilename);
+ TQFile wordfilenameFile (wordsfilename);
if ((ret = copy_hack (wordfilenameFile, *wordsFile.file ())) == 0)
{
ret =
@@ -415,7 +415,7 @@ DataBaseManager::openDataBase ()
}
// do the upgrade on the keys file
- QFile keysfilenameFile (keysfilename);
+ TQFile keysfilenameFile (keysfilename);
if ((ret = copy_hack (keysfilenameFile, *keysFile.file ())) == 0)
{
ret =
@@ -620,11 +620,11 @@ DataBaseManager::putItem (DataBaseItem * item, bool ow)
{
uint32 location = loc;
- QValueList < QString > wlist;
+ TQValueList < TQString > wlist;
wlist = wordsIn (item->key);
- QValueList < QString >::Iterator wlistit;
+ TQValueList < TQString >::Iterator wlistit;
for (wlistit = wlist.begin (); wlistit != wlist.end (); ++wlistit)
{
@@ -641,7 +641,7 @@ DataBaseManager::putItem (DataBaseItem * item, bool ow)
}
DataBaseItem
-DataBaseManager::getItem (QString key)
+DataBaseManager::getItem (TQString key)
{
if (!iAmOk)
return DataBaseItem ();
@@ -702,7 +702,7 @@ DataBaseManager::cursorGet (uint32 flags)
}
else
{
- kdDebug (KBABEL_SEARCH) << QString ("...cursor getting...%1").
+ kdDebug (KBABEL_SEARCH) << TQString ("...cursor getting...%1").
arg (ret) << endl;
return DataBaseItem ();
@@ -770,11 +770,11 @@ DataBaseManager::current ()
}
int
-DataBaseManager::createDataBase (QString directory,
- QString language, int mode)
+DataBaseManager::createDataBase (TQString directory,
+ TQString language, int mode)
{
- QString filename;
- QString ll = "." + language;
+ TQString filename;
+ TQString ll = "." + language;
if (ll == ".")
ll = ".NOLANG";
filename = "%1/translations%2.db";
@@ -782,7 +782,7 @@ DataBaseManager::createDataBase (QString directory,
rename (filename.local8Bit (), filename.local8Bit () + ",old");
-//kdDebug(0) << QString("Creating %1").arg(filename) << endl;
+//kdDebug(0) << TQString("Creating %1").arg(filename) << endl;
iAmOk = true;
@@ -860,7 +860,7 @@ DataBaseManager::createDataBase (QString directory,
if (iAmOk)
loadInfo ();
else
- kdDebug (KBABEL_SEARCH) << QString ("I am NOT ok : %1").
+ kdDebug (KBABEL_SEARCH) << TQString ("I am NOT ok : %1").
arg (ret) << endl;
//THIS IS WRONG, rewrite the error handling.
@@ -889,7 +889,7 @@ DataBaseManager::getCatalogInfo (int n)
return InfoItem ();
}
-// kdDebug(0) << QString("Trad %1").arg(ret) << endl;
+// kdDebug(0) << TQString("Trad %1").arg(ret) << endl;
InfoItem it ((char *) data.data, language);
//free(data.data); // Read docu for this!!!!
@@ -936,10 +936,10 @@ DataBaseManager::addCatalogInfo (InfoItem * catInfo, int cat = -1)
}
int
-DataBaseManager::searchCatalogInfo (QString location)
+DataBaseManager::searchCatalogInfo (TQString location)
{
int n = 0;
- QValueList < InfoItem >::Iterator it;
+ TQValueList < InfoItem >::Iterator it;
for (it = info.begin (); it != info.end (); ++it)
{
n++;
@@ -998,11 +998,11 @@ DataBaseManager::loadInfo ()
}
-QValueList < QString > DataBaseManager::wordsIn (QString string)
+TQValueList < TQString > DataBaseManager::wordsIn (TQString string)
{
QString
a;
- QValueList < QString > words;
+ TQValueList < TQString > words;
int
i,
l;
@@ -1036,10 +1036,10 @@ QValueList < QString > DataBaseManager::wordsIn (QString string)
WordItem
-DataBaseManager::getWordLocations (QString word)
+DataBaseManager::getWordLocations (TQString word)
{
- QString keystring = word.lower ();
+ TQString keystring = word.lower ();
DBT key;
DBT data;
@@ -1080,10 +1080,10 @@ DataBaseManager::getWordLocations (QString word)
bool
-DataBaseManager::addLocation (QString word, unsigned int location)
+DataBaseManager::addLocation (TQString word, unsigned int location)
{
- QString keystring = word.lower ();
+ TQString keystring = word.lower ();
DBT key;
@@ -1289,7 +1289,7 @@ DataBaseManager::addLocation (QString word, unsigned int location)
bool
-DataBaseManager::removeLocation (QString /*word */ , int /*location */ )
+DataBaseManager::removeLocation (TQString /*word */ , int /*location */ )
{
//#warning TODO: REMOVE LOCATION
@@ -1298,7 +1298,7 @@ DataBaseManager::removeLocation (QString /*word */ , int /*location */ )
}
uint32
-DataBaseManager::appendKey (QString _key)
+DataBaseManager::appendKey (TQString _key)
{
DBT key;
@@ -1324,7 +1324,7 @@ DataBaseManager::appendKey (QString _key)
else
ret = *(uint32 *) key.data;
-//kdDebug(0) << QString("Append result %1,err = %1").arg(ret).arg(err) << endl;
+//kdDebug(0) << TQString("Append result %1,err = %1").arg(ret).arg(err) << endl;
free (data.data);
@@ -1349,16 +1349,16 @@ DataBaseManager::getKey (uint32 n)
//Check for errors
int ret = indexDb->get (indexDb, 0, &key, &data, 0); //DB_SET_RECNO);
if (ret)
- return QString::null;
+ return TQString::null;
- return QString::fromUtf8 ((char *) data.data);
+ return TQString::fromUtf8 ((char *) data.data);
-// kdDebug(0) << QString("Trad %1").arg(ret) << endl;
+// kdDebug(0) << TQString("Trad %1").arg(ret) << endl;
}
int
-DataBaseManager::catalogRef (QString location, QString author, QString path)
+DataBaseManager::catalogRef (TQString location, TQString author, TQString path)
{
InfoItem cinfo;
int cat, catnum;
@@ -1397,19 +1397,19 @@ DataBaseManager::catalogRef (QString location, QString author, QString path)
}
int
-DataBaseManager::putNewTranslation (QString key, QString tran, int catalog,
+DataBaseManager::putNewTranslation (TQString key, TQString tran, int catalog,
bool ow)
{
int catnum = catalog;
int count = 0;
- QString msgid = key;
+ TQString msgid = key;
DataBaseItem dbit = getItem (msgid);
if (dbit.numTra == 0) //Not found
{
dbit.numTra += 1;
- // use local variable, dbit.translations is QValueList and
+ // use local variable, dbit.translations is TQValueList and
// will create own copy
TranslationItem tra;
tra.numRef = 1;
@@ -1423,16 +1423,16 @@ DataBaseManager::putNewTranslation (QString key, QString tran, int catalog,
int aa = putItem (&dbit);
if (aa)
- kdDebug (0) << QString ("-----------put code ") << aa << endl;
+ kdDebug (0) << TQString ("-----------put code ") << aa << endl;
}
else
{
// key exists
- QString msgstr = tran;
+ TQString msgstr = tran;
bool found_catalog_info = false, foundTr = false, isThisOne = false;
- QValueList < TranslationItem >::Iterator ittr;
+ TQValueList < TranslationItem >::Iterator ittr;
bool rem = false;
// check all translations in the list
@@ -1493,7 +1493,7 @@ DataBaseManager::putNewTranslation (QString key, QString tran, int catalog,
//Check ret value
int aa = putItem (&dbit, true);
if (aa)
- kdDebug (0) << QString ("-----------put code ") << aa << endl;
+ kdDebug (0) << TQString ("-----------put code ") << aa << endl;
}
return count;
@@ -1513,11 +1513,11 @@ DataBaseManager::rebuildIndexes ()
uint32 location = loc;
- QValueList < QString > wlist;
+ TQValueList < TQString > wlist;
wlist = wordsIn (item->key);
- QValueList < QString >::Iterator wlistit;
+ TQValueList < TQString >::Iterator wlistit;
for (wlistit = wlist.begin (); wlistit != wlist.end (); ++wlistit)
{