diff options
Diffstat (limited to 'kiten')
-rw-r--r-- | kiten/asyndeta.cpp | 18 | ||||
-rw-r--r-- | kiten/asyndeta.h | 2 | ||||
-rw-r--r-- | kiten/configdictionaries.cpp | 46 | ||||
-rw-r--r-- | kiten/configdictionaries.h | 6 | ||||
-rw-r--r-- | kiten/deinf.cpp | 40 | ||||
-rw-r--r-- | kiten/deinf.h | 14 | ||||
-rw-r--r-- | kiten/dict.cpp | 182 | ||||
-rw-r--r-- | kiten/dict.h | 100 | ||||
-rw-r--r-- | kiten/kiten.cpp | 242 | ||||
-rw-r--r-- | kiten/kiten.h | 28 | ||||
-rw-r--r-- | kiten/kloader.cpp | 32 | ||||
-rw-r--r-- | kiten/kloader.h | 14 | ||||
-rw-r--r-- | kiten/kromajiedit.cpp | 54 | ||||
-rw-r--r-- | kiten/kromajiedit.h | 16 | ||||
-rw-r--r-- | kiten/ksaver.cpp | 28 | ||||
-rw-r--r-- | kiten/ksaver.h | 14 | ||||
-rw-r--r-- | kiten/learn.cpp | 194 | ||||
-rw-r--r-- | kiten/learn.h | 38 | ||||
-rw-r--r-- | kiten/main.cpp | 4 | ||||
-rw-r--r-- | kiten/optiondialog.cpp | 18 | ||||
-rw-r--r-- | kiten/optiondialog.h | 2 | ||||
-rw-r--r-- | kiten/rad.cpp | 132 | ||||
-rw-r--r-- | kiten/rad.h | 52 | ||||
-rw-r--r-- | kiten/widgets.cpp | 156 | ||||
-rw-r--r-- | kiten/widgets.h | 38 |
25 files changed, 735 insertions, 735 deletions
diff --git a/kiten/asyndeta.cpp b/kiten/asyndeta.cpp index 387a84ce..4a377eb0 100644 --- a/kiten/asyndeta.cpp +++ b/kiten/asyndeta.cpp @@ -23,7 +23,7 @@ #include <klocale.h> #include <kstandarddirs.h> -#include <qfile.h> +#include <tqfile.h> #include "asyndeta.h" #include "dict.h" @@ -62,23 +62,23 @@ void Asyndeta::readKitenConfiguration() KStandardDirs *dirs = KGlobal::dirs(); KConfig config(dirs->findResource("config", "kitenrc")); - QString globaledict = dirs->findResource("data", "kiten/edict"); - QString globalkanjidic = dirs->findResource("data", "kiten/kanjidic"); + TQString globaledict = dirs->findResource("data", "kiten/edict"); + TQString globalkanjidic = dirs->findResource("data", "kiten/kanjidic"); config.setGroup("edict"); bool edictUseGlobal = config.readBoolEntry("__useGlobal", true); - QStringList DictNameList = config.readListEntry("__NAMES"); - QStringList DictList; + TQStringList DictNameList = config.readListEntry("__NAMES"); + TQStringList DictList; - QStringList::Iterator it; + TQStringList::Iterator it; for (it = DictNameList.begin(); it != DictNameList.end(); ++it) DictList.append(config.readEntry(*it)); - QString personalDict(personalDictionaryLocation()); - if (QFile::exists(personalDict)) + TQString personalDict(personalDictionaryLocation()); + if (TQFile::exists(personalDict)) { DictList.prepend(personalDict); DictNameList.prepend(i18n("Personal")); @@ -111,7 +111,7 @@ void Asyndeta::readKitenConfiguration() index->setKanjiDictList(DictList, DictNameList); } -QString Asyndeta::personalDictionaryLocation() +TQString Asyndeta::personalDictionaryLocation() { return KGlobal::dirs()->saveLocation("data", "kiten/dictionaries/", true).append("personal"); } diff --git a/kiten/asyndeta.h b/kiten/asyndeta.h index 450e5524..aa02cff1 100644 --- a/kiten/asyndeta.h +++ b/kiten/asyndeta.h @@ -42,7 +42,7 @@ public: // and set the index to use them void readKitenConfiguration(); - static QString personalDictionaryLocation(); + static TQString personalDictionaryLocation(); protected: static int refCount; diff --git a/kiten/configdictionaries.cpp b/kiten/configdictionaries.cpp index 80020e23..7829e44c 100644 --- a/kiten/configdictionaries.cpp +++ b/kiten/configdictionaries.cpp @@ -21,20 +21,20 @@ #include <kdebug.h> #include <klistview.h> #include <kfiledialog.h> -#include <qpushbutton.h> -#include <qstringlist.h> +#include <tqpushbutton.h> +#include <tqstringlist.h> #include "configdictionaries.moc" -ConfigDictionaries::ConfigDictionaries(QWidget *parent, const char* name, WFlags f) : +ConfigDictionaries::ConfigDictionaries(TQWidget *parent, const char* name, WFlags f) : ConfigDictionariesBase(parent, name, f) { changed = false; config = Config::self(); - connect(delSelEdictButton, SIGNAL(clicked()), SLOT(slotDelSelEdict())); - connect(addEdictButton, SIGNAL(clicked()), SLOT(slotAddEdict())); - connect(delSelKanjidicButton, SIGNAL(clicked()), SLOT(slotDelSelKanjidic())); - connect(addKanjidicButton, SIGNAL(clicked()), SLOT(slotAddKanjidic())); + connect(delSelEdictButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotDelSelEdict())); + connect(addEdictButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddEdict())); + connect(delSelKanjidicButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotDelSelKanjidic())); + connect(addKanjidicButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddKanjidic())); } void ConfigDictionaries::updateWidgets() @@ -74,10 +74,10 @@ void ConfigDictionaries::writeDictionaries() changed = false; } -void ConfigDictionaries::readDictionaryList(const QString& group) +void ConfigDictionaries::readDictionaryList(const TQString& group) { KListView* list; - QStringList names; + TQStringList names; if (group == "edict") { list = edictList; @@ -89,20 +89,20 @@ void ConfigDictionaries::readDictionaryList(const QString& group) names = config->kanjidic__NAMES(); } - QStringList::Iterator it; + TQStringList::Iterator it; for (it = names.begin(); it != names.end(); ++it) { - QString name = group + "_" + *it; + TQString name = group + "_" + *it; if (!config->findItem(name)) - config->addItem(new KConfigSkeleton::ItemString(group, *it, *new QString()), name); + config->addItem(new KConfigSkeleton::ItemString(group, *it, *new TQString()), name); } config->readConfig(); list->clear(); for (it = names.begin(); it != names.end(); ++it) - (void) new QListViewItem(list, *it, config->findItem(group + "_" + *it)->property().asString()); + (void) new TQListViewItem(list, *it, config->findItem(group + "_" + *it)->property().asString()); } -void ConfigDictionaries::writeDictionaryList(const QString& group) +void ConfigDictionaries::writeDictionaryList(const TQString& group) { KListView* list; if (group == "edict") @@ -110,17 +110,17 @@ void ConfigDictionaries::writeDictionaryList(const QString& group) else //if (group == "kanjidic") list = kanjidicList; - QStringList names; + TQStringList names; - QListViewItemIterator it(list); + TQListViewItemIterator it(list); for (; it.current(); ++it ) { names.append(it.current()->text(0)); - QString name = group + "_" + it.current()->text(0); + TQString name = group + "_" + it.current()->text(0); KConfigSkeletonItem* item = config->findItem(name); if (!item) { - item = new KConfigSkeleton::ItemString(group, it.current()->text(0), *new QString()); + item = new KConfigSkeleton::ItemString(group, it.current()->text(0), *new TQString()); config->addItem(item, name); } item->setProperty(it.current()->text(1)); @@ -140,18 +140,18 @@ void ConfigDictionaries::slotDelSelKanjidic() { delSel(kanjidicList); } void ConfigDictionaries::add(KListView* list) { - QListViewItem *item = list->firstChild(); - QString filename = KFileDialog::getOpenFileName(item? QFileInfo(item->text(1)).dirPath(true).append("/") : QString::null); - QString name = QFileInfo(filename).fileName(); + TQListViewItem *item = list->firstChild(); + TQString filename = KFileDialog::getOpenFileName(item? TQFileInfo(item->text(1)).dirPath(true).append("/") : TQString::null); + TQString name = TQFileInfo(filename).fileName(); - (void) new QListViewItem(list, name, filename); + (void) new TQListViewItem(list, name, filename); changed = true; emit widgetChanged(); } void ConfigDictionaries::delSel(KListView* list) { - QListViewItem *file = list->selectedItem(); + TQListViewItem *file = list->selectedItem(); if (!file) return; diff --git a/kiten/configdictionaries.h b/kiten/configdictionaries.h index ca301ee5..48089fe9 100644 --- a/kiten/configdictionaries.h +++ b/kiten/configdictionaries.h @@ -28,7 +28,7 @@ class ConfigDictionaries : public ConfigDictionariesBase { Q_OBJECT public: - ConfigDictionaries(QWidget *parent = 0, const char* name = 0, WFlags f = 0); + ConfigDictionaries(TQWidget *parent = 0, const char* name = 0, WFlags f = 0); void readDictionaries(); // KConfig stuff @@ -51,8 +51,8 @@ private slots: private: bool changed; Config* config; - void readDictionaryList(const QString& group); - void writeDictionaryList(const QString& group); + void readDictionaryList(const TQString& group); + void writeDictionaryList(const TQString& group); void add(KListView* list); void delSel(KListView* list); }; diff --git a/kiten/deinf.cpp b/kiten/deinf.cpp index 226f815b..52d1f8f2 100644 --- a/kiten/deinf.cpp +++ b/kiten/deinf.cpp @@ -22,9 +22,9 @@ #include <kstandarddirs.h> #include <kmessagebox.h> #include <klocale.h> -#include <qfile.h> -#include <qregexp.h> -#include <qtextcodec.h> +#include <tqfile.h> +#include <tqregexp.h> +#include <tqtextcodec.h> #include "deinf.h" Deinf::Index::Index() @@ -38,14 +38,14 @@ void Deinf::Index::load() return; KStandardDirs *dirs = KGlobal::dirs(); - QString vconj = dirs->findResource("data", "kiten/vconj"); + TQString vconj = dirs->findResource("data", "kiten/vconj"); if (vconj.isNull()) { KMessageBox::error(0, i18n("Verb deinflection information not found, so verb deinflection cannot be used.")); return; } - QFile f(vconj); + TQFile f(vconj); if (!f.open(IO_ReadOnly)) { @@ -53,24 +53,24 @@ void Deinf::Index::load() return; } - QTextStream t(&f); - t.setCodec(QTextCodec::codecForName("eucJP")); + TQTextStream t(&f); + t.setCodec(TQTextCodec::codecForName("eucJP")); - for(QString text = t.readLine(); !t.eof() && text.at(0) != '$'; text = t.readLine()) + for(TQString text = t.readLine(); !t.eof() && text.at(0) != '$'; text = t.readLine()) { if(text.at(0) != '#') { unsigned int number = text.left(2).stripWhiteSpace().toUInt(); - QString name = text.right(text.length() - 2).stripWhiteSpace(); + TQString name = text.right(text.length() - 2).stripWhiteSpace(); names[number] = name; } } - for(QString text = t.readLine(); !text.isEmpty(); text = t.readLine()) + for(TQString text = t.readLine(); !text.isEmpty(); text = t.readLine()) { if(text.at(0) != '#') { - QStringList things(QStringList::split(QChar('\t'), text)); + TQStringList things(TQStringList::split(TQChar('\t'), text)); Conjugation conj; conj.ending = things.first(); @@ -87,24 +87,24 @@ void Deinf::Index::load() namespace { -QStringList possibleConjugations(const QString &text) +TQStringList possibleConjugations(const TQString &text) { - QStringList endings; + TQStringList endings; for (unsigned i = 0; i < text.length(); ++i) endings.append(text.right(i)); return endings; } } -QStringList Deinf::Index::deinflect(const QString &text, QStringList &name) +TQStringList Deinf::Index::deinflect(const TQString &text, TQStringList &name) { load(); - QStringList endings = possibleConjugations(text); - QStringList ret; + TQStringList endings = possibleConjugations(text); + TQStringList ret; - for (QValueListIterator <Conjugation> it = list.begin(); it != list.end(); ++it) + for (TQValueListIterator <Conjugation> it = list.begin(); it != list.end(); ++it) { - QStringList matches(endings.grep(QRegExp(QString("^") + (*it).ending))); + TQStringList matches(endings.grep(TQRegExp(TQString("^") + (*it).ending))); if (matches.size() > 0) // a match { @@ -112,8 +112,8 @@ QStringList Deinf::Index::deinflect(const QString &text, QStringList &name) //kdDebug() << "match ending: " << (*it).ending << "; replace: " << (*it).replace << "; name: " << names[(*it).num] << endl; - QString tmp(text); - tmp.replace(QRegExp((*it).ending + "*", false, true), (*it).replace); + TQString tmp(text); + tmp.replace(TQRegExp((*it).ending + "*", false, true), (*it).replace); ret.append(tmp); } } diff --git a/kiten/deinf.h b/kiten/deinf.h index 8db2e811..ca776289 100644 --- a/kiten/deinf.h +++ b/kiten/deinf.h @@ -21,16 +21,16 @@ #ifndef DEFINF_H #define DEFINF_H -#include <qmap.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqstringlist.h> namespace Deinf { struct Conjugation { - QString ending; - QString replace; + TQString ending; + TQString replace; unsigned int num; }; @@ -39,12 +39,12 @@ class KDE_EXPORT Index public: Index(); - QStringList deinflect(const QString &, QStringList &); + TQStringList deinflect(const TQString &, TQStringList &); private: void load(); - QMap<unsigned int, QString> names; - QValueList<Conjugation> list; + TQMap<unsigned int, TQString> names; + TQValueList<Conjugation> list; bool loaded; }; diff --git a/kiten/dict.cpp b/kiten/dict.cpp index ad282807..23da1a9e 100644 --- a/kiten/dict.cpp +++ b/kiten/dict.cpp @@ -24,9 +24,9 @@ #include <kprocess.h> #include <kstandarddirs.h> -#include <qfileinfo.h> -#include <qregexp.h> -#include <qtextcodec.h> +#include <tqfileinfo.h> +#include <tqregexp.h> +#include <tqtextcodec.h> #include "dict.h" @@ -37,9 +37,9 @@ namespace { -void msgerr(const QString &msg, const QString &dict = QString::null) +void msgerr(const TQString &msg, const TQString &dict = TQString::null) { - QString output = msg; + TQString output = msg; if (!dict.isNull()) output = msg.arg(dict); KMessageBox::error(0, output); @@ -48,7 +48,7 @@ void msgerr(const QString &msg, const QString &dict = QString::null) using namespace Dict; -TextType Dict::textType(const QString &text) +TextType Dict::textType(const TQString &text) { ushort first = text.at(0).unicode(); @@ -65,11 +65,11 @@ TextType Dict::textType(const QString &text) return Text_Kanji; } -File::File(QString path, QString n) +File::File(TQString path, TQString n) : myName(n) , dictFile(path) , dictPtr((const unsigned char *)MAP_FAILED) - , indexFile(KGlobal::dirs()->saveLocation("data", "kiten/xjdx/", true) + QFileInfo(path).baseName() + ".xjdx") + , indexFile(KGlobal::dirs()->saveLocation("data", "kiten/xjdx/", true) + TQFileInfo(path).baseName() + ".xjdx") , indexPtr((const uint32_t *)MAP_FAILED) , valid(false) { @@ -86,7 +86,7 @@ File::File(QString path, QString n) // remade int dictionaryLength; - QFile dictionary(path); + TQFile dictionary(path); dictionaryLength = dictionary.size(); dictionaryLength++; //kdDebug() << "dictionaryLength = " << dictionaryLength << endl; @@ -150,7 +150,7 @@ File::~File(void) indexFile.close(); } -QString File::name(void) +TQString File::name(void) { return myName; } @@ -190,7 +190,7 @@ unsigned char File::lookup(unsigned i, int offset) return dictPtr[pos]; } -QCString File::lookup(unsigned i) +TQCString File::lookup(unsigned i) { uint32_t start = indexPtr[i] - 1; uint32_t pos = start; @@ -199,7 +199,7 @@ QCString File::lookup(unsigned i) while(pos <= size && dictPtr[pos] != 0 && dictPtr[pos] != 0x0a) ++pos; // put the word in the QCString - QCString retval((const char *)(dictPtr + start), pos - start); + TQCString retval((const char *)(dictPtr + start), pos - start); // tack on a null char null = 0; retval.append(&null); @@ -209,7 +209,7 @@ QCString File::lookup(unsigned i) // And last, Index itself is the API presented to the rest of Kiten Index::Index() - : QObject() + : TQObject() { dictFiles.setAutoDelete(true); kanjiDictFiles.setAutoDelete(true); @@ -219,17 +219,17 @@ Index::~Index() { } -void Index::setDictList(const QStringList &list, const QStringList &names) +void Index::setDictList(const TQStringList &list, const TQStringList &names) { loadDictList(dictFiles, list, names); } -void Index::setKanjiDictList(const QStringList &list, const QStringList &names) +void Index::setKanjiDictList(const TQStringList &list, const TQStringList &names) { loadDictList(kanjiDictFiles, list, names); } -void Index::loadDictList(QPtrList<File> &fileList, const QStringList &dictList, const QStringList &dictNameList) +void Index::loadDictList(TQPtrList<File> &fileList, const TQStringList &dictList, const TQStringList &dictNameList) { fileList.clear(); @@ -240,8 +240,8 @@ void Index::loadDictList(QPtrList<File> &fileList, const QStringList &dictList, return; } - QStringList::ConstIterator it; - QStringList::ConstIterator dictIt; + TQStringList::ConstIterator it; + TQStringList::ConstIterator dictIt; for (it = dictList.begin(), dictIt = dictNameList.begin(); it != dictList.end(); ++it, ++dictIt) { File *f = new File(*it, *dictIt); @@ -253,13 +253,13 @@ void Index::loadDictList(QPtrList<File> &fileList, const QStringList &dictList, } } -QStringList Index::doSearch(File &file, const QString &text) +TQStringList Index::doSearch(File &file, const TQString &text) { // Do a binary search to find an entry that matches text - QTextCodec &codec = *QTextCodec::codecForName("eucJP"); - QCString eucString = codec.fromUnicode(text); + TQTextCodec &codec = *TQTextCodec::codecForName("eucJP"); + TQCString eucString = codec.fromUnicode(text); - QString prevResult; + TQString prevResult; Array<const uint32_t> index = file.index(); Array<const unsigned char> dict = file.dict(); @@ -279,7 +279,7 @@ QStringList Index::doSearch(File &file, const QString &text) lo = cur + 1; } while(hi >= lo && comp != 0 && !(hi == 0 && lo == 0)); - QStringList results; + TQStringList results; // A match? if (comp == 0) { @@ -296,7 +296,7 @@ QStringList Index::doSearch(File &file, const QString &text) int i = 0; while(file.lookup(cur, i - 1) != 0x0a) --i; - QByteArray bytes(0); + TQByteArray bytes(0); while(file.lookup(cur, i) != 0x0a) // get to end of our line { const char eucchar = file.lookup(cur, i); @@ -305,7 +305,7 @@ QStringList Index::doSearch(File &file, const QString &text) ++i; } - QString result = codec.toUnicode(bytes) + QString("\n"); + TQString result = codec.toUnicode(bytes) + TQString("\n"); if (prevResult != result) { results.append(result); @@ -320,7 +320,7 @@ QStringList Index::doSearch(File &file, const QString &text) return results; } -SearchResult Index::scanResults(QRegExp regexp, QStringList results, bool common) +SearchResult Index::scanResults(TQRegExp regexp, TQStringList results, bool common) { unsigned int num = 0; unsigned int fullNum = 0; @@ -329,7 +329,7 @@ SearchResult Index::scanResults(QRegExp regexp, QStringList results, bool common //ret.results = results; //not here.. - for (QStringList::Iterator itr = results.begin(); itr != results.end(); ++itr) + for (TQStringList::Iterator itr = results.begin(); itr != results.end(); ++itr) { if ((*itr).left(5) == "DICT " || (*itr).left(8) == "HEADING ") { @@ -342,7 +342,7 @@ SearchResult Index::scanResults(QRegExp regexp, QStringList results, bool common if (found >= 0) { ++fullNum; - if ((*itr).find(QString("(P)")) >= 0 || !common) + if ((*itr).find(TQString("(P)")) >= 0 || !common) { // we append HERE, so we get the exact // results we have in ret.list @@ -360,12 +360,12 @@ SearchResult Index::scanResults(QRegExp regexp, QStringList results, bool common return ret; } -SearchResult Index::search(QRegExp regexp, const QString &text, bool common) +SearchResult Index::search(TQRegExp regexp, const TQString &text, bool common) { - QStringList results; - for (QPtrListIterator<File> file(dictFiles); *file; ++file) + TQStringList results; + for (TQPtrListIterator<File> file(dictFiles); *file; ++file) { - results.append(QString("DICT ") + (*file)->name()); + results.append(TQString("DICT ") + (*file)->name()); results += doSearch(**file, text); } @@ -375,7 +375,7 @@ SearchResult Index::search(QRegExp regexp, const QString &text, bool common) return res; } -SearchResult Index::scanKanjiResults(QRegExp regexp, QStringList results, bool common) +SearchResult Index::scanKanjiResults(TQRegExp regexp, TQStringList results, bool common) { unsigned int num = 0; unsigned int fullNum = 0; @@ -383,7 +383,7 @@ SearchResult Index::scanKanjiResults(QRegExp regexp, QStringList results, bool c SearchResult ret; ret.results = results; - for (QStringList::Iterator itr = results.begin(); itr != results.end(); ++itr) + for (TQStringList::Iterator itr = results.begin(); itr != results.end(); ++itr) { if ((*itr).left(5) == "DICT " || (*itr).left(8) == "HEADING ") { @@ -397,7 +397,7 @@ SearchResult Index::scanKanjiResults(QRegExp regexp, QStringList results, bool c { ++fullNum; // common entries have G[1-8] (jouyou) - QRegExp comregexp(jmyCount ? "G[1-9]" : "G[1-8]"); + TQRegExp comregexp(jmyCount ? "G[1-9]" : "G[1-8]"); if ((*itr).find(comregexp) >= 0 || !common) { ret.list.append(kanjiParse(*itr)); @@ -412,12 +412,12 @@ SearchResult Index::scanKanjiResults(QRegExp regexp, QStringList results, bool c return ret; } -SearchResult Index::searchKanji(QRegExp regexp, const QString &text, bool common) +SearchResult Index::searchKanji(TQRegExp regexp, const TQString &text, bool common) { - QStringList results; - for (QPtrListIterator<File> file(kanjiDictFiles); *file; ++file) + TQStringList results; + for (TQPtrListIterator<File> file(kanjiDictFiles); *file; ++file) { - results.append(QString("DICT ") + (*file)->name()); + results.append(TQString("DICT ") + (*file)->name()); results += doSearch(**file, text); } @@ -427,7 +427,7 @@ SearchResult Index::searchKanji(QRegExp regexp, const QString &text, bool commo return res; } -SearchResult Index::searchPrevious(QRegExp regexp, const QString &text, SearchResult list, bool common) +SearchResult Index::searchPrevious(TQRegExp regexp, const TQString &text, SearchResult list, bool common) { SearchResult res; @@ -440,9 +440,9 @@ SearchResult Index::searchPrevious(QRegExp regexp, const QString &text, SearchRe return res; } -QRegExp Dict::Index::createRegExp(SearchType type, const QString &text, DictionaryType dictionaryType, bool caseSensitive) +TQRegExp Dict::Index::createRegExp(SearchType type, const TQString &text, DictionaryType dictionaryType, bool caseSensitive) { - QString regExp; + TQString regExp; switch (type) { case Search_Beginning: @@ -487,10 +487,10 @@ QRegExp Dict::Index::createRegExp(SearchType type, const QString &text, Dictiona regExp = "%1"; } - return QRegExp(regExp.arg(text), caseSensitive); + return TQRegExp(regExp.arg(text), caseSensitive); } -int Index::stringCompare(File &file, int index, QCString str) +int Index::stringCompare(File &file, int index, TQCString str) { return eucStringCompare(file.lookup(index), str); } @@ -530,7 +530,7 @@ bool Dict::isEUC(unsigned char c) return (c & 0x80); } -Entry Dict::parse(const QString &raw) +Entry Dict::parse(const TQString &raw) { unsigned int length = raw.length(); if (raw.left(5) == "DICT ") @@ -538,17 +538,17 @@ Entry Dict::parse(const QString &raw) if (raw.left(8) == "HEADING ") return Entry(raw.right(length - 8), true); - QString reading; - QString kanji; - QStringList meanings; - QString curmeaning; + TQString reading; + TQString kanji; + TQStringList meanings; + TQString curmeaning; bool firstmeaning = true; - QCString parsemode("kanji"); + TQCString parsemode("kanji"); unsigned int i; for (i = 0; i < length; i++) { - QChar ichar(raw.at(i)); + TQChar ichar(raw.at(i)); if (ichar == '[') { @@ -593,7 +593,7 @@ Entry Dict::parse(const QString &raw) return (Entry(kanji, reading, meanings)); } -Entry Dict::kanjiParse(const QString &raw) +Entry Dict::kanjiParse(const TQString &raw) { unsigned int length = raw.length(); if (raw.left(5) == "DICT ") @@ -601,26 +601,26 @@ Entry Dict::kanjiParse(const QString &raw) if (raw.left(8) == "HEADING ") return Entry(raw.right(length - 8), true); - QStringList readings; - QString kanji; - QStringList meanings; - QString curmeaning; - QString curreading; + TQStringList readings; + TQString kanji; + TQStringList meanings; + TQString curmeaning; + TQString curreading; - QString strfreq; - QString strgrade; - QString strstrokes; - QString strmiscount = ""; + TQString strfreq; + TQString strgrade; + TQString strstrokes; + TQString strmiscount = ""; bool prevwasspace = true; - QChar detailname; - QCString parsemode("kanji"); + TQChar detailname; + TQCString parsemode("kanji"); // if there are two S entries, second is common miscount bool strokesset = false; unsigned int i; - QChar ichar; + TQChar ichar; for (i = 0; i < length; i++) { ichar = raw.at(i); @@ -691,7 +691,7 @@ Entry Dict::kanjiParse(const QString &raw) } else if (parsemode == "misc" && prevwasspace) { - if (QRegExp("[A-Za-z0-9]").search(QString(ichar)) >= 0) + if (TQRegExp("[A-Za-z0-9]").search(TQString(ichar)) >= 0) // is non-japanese? { detailname = ichar; @@ -699,7 +699,7 @@ Entry Dict::kanjiParse(const QString &raw) } else { - curreading = QString(ichar); + curreading = TQString(ichar); parsemode = "reading"; } } @@ -708,10 +708,10 @@ Entry Dict::kanjiParse(const QString &raw) return (Entry(kanji, readings, meanings, strgrade.toUInt(), strfreq.toUInt(), strstrokes.toUInt(), strmiscount.toUInt())); } -QString Dict::prettyMeaning(QStringList Meanings) +TQString Dict::prettyMeaning(TQStringList Meanings) { - QString meanings; - QStringList::Iterator it; + TQString meanings; + TQStringList::Iterator it; for (it = Meanings.begin(); it != Meanings.end(); ++it) meanings.append((*it).stripWhiteSpace()).append("; "); @@ -719,10 +719,10 @@ QString Dict::prettyMeaning(QStringList Meanings) return meanings; } -QString Dict::prettyKanjiReading(QStringList Readings) +TQString Dict::prettyKanjiReading(TQStringList Readings) { - QStringList::Iterator it; - QString html; + TQStringList::Iterator it; + TQString html; for (it = Readings.begin(); it != Readings.end(); ++it) { @@ -746,7 +746,7 @@ QString Dict::prettyKanjiReading(QStringList Readings) Dict::Entry Dict::firstEntry(Dict::SearchResult result) { - for (QValueListIterator<Dict::Entry> it = result.list.begin(); it != result.list.end(); ++it) + for (TQValueListIterator<Dict::Entry> it = result.list.begin(); it != result.list.end(); ++it) { if ((*it).dictName() == "__NOTSET" && (*it).header() == "__NOTSET") return (*it); @@ -755,22 +755,22 @@ Dict::Entry Dict::firstEntry(Dict::SearchResult result) return Dict::Entry("__NOTHING"); } -QString Dict::firstEntryText(Dict::SearchResult result) +TQString Dict::firstEntryText(Dict::SearchResult result) { - for (QStringList::Iterator it = result.results.begin(); it != result.results.end(); ++it) + for (TQStringList::Iterator it = result.results.begin(); it != result.results.end(); ++it) { if ((*it).left(5) != "DICT " && (*it).left(7) != "HEADER ") return (*it); } - return QString("NONE "); + return TQString("NONE "); } /////////////////////////////////////////////////////////////// -Entry::Entry(const QString & kanji, const QString & reading, const QStringList &meanings) - : DictName(QString::fromLatin1("__NOTSET")) - , Header(QString::fromLatin1("__NOTSET")) +Entry::Entry(const TQString & kanji, const TQString & reading, const TQStringList &meanings) + : DictName(TQString::fromLatin1("__NOTSET")) + , Header(TQString::fromLatin1("__NOTSET")) , Meanings(meanings) , Kanji(kanji) , KanaOnly(reading.isEmpty()) @@ -783,9 +783,9 @@ Entry::Entry(const QString & kanji, const QString & reading, const QStringList & { } -Entry::Entry(const QString &kanji, QStringList &readings, QStringList &meanings, unsigned int grade, unsigned int freq, unsigned int strokes, unsigned int miscount) - : DictName(QString::fromLatin1("__NOTSET")) - , Header(QString::fromLatin1("__NOTSET")) +Entry::Entry(const TQString &kanji, TQStringList &readings, TQStringList &meanings, unsigned int grade, unsigned int freq, unsigned int strokes, unsigned int miscount) + : DictName(TQString::fromLatin1("__NOTSET")) + , Header(TQString::fromLatin1("__NOTSET")) , Meanings(meanings) , Kanji(kanji) , KanaOnly(false) @@ -798,27 +798,27 @@ Entry::Entry(const QString &kanji, QStringList &readings, QStringList &meanings, { } -Entry::Entry(const QString &dictname) +Entry::Entry(const TQString &dictname) : KanaOnly(true) , ExtendedKanjiInfo(false) { DictName = dictname; } -Entry::Entry(const QString &headername, bool) - : DictName(QString::fromLatin1("__NOTSET")) +Entry::Entry(const TQString &headername, bool) + : DictName(TQString::fromLatin1("__NOTSET")) , Header(headername) , KanaOnly(true) , ExtendedKanjiInfo(false) { } -QString Entry::dictName() +TQString Entry::dictName() { return DictName; } -QString Entry::header() +TQString Entry::header() { return Header; } @@ -828,22 +828,22 @@ bool Entry::kanaOnly() return KanaOnly; } -QString Entry::kanji() +TQString Entry::kanji() { return Kanji; } -QStringList Entry::readings() +TQStringList Entry::readings() { return Readings; } -QString Entry::firstReading() +TQString Entry::firstReading() { return *Readings.at(0); } -QStringList Entry::meanings() +TQStringList Entry::meanings() { return Meanings; } diff --git a/kiten/dict.h b/kiten/dict.h index 80fa8113..f510d0c1 100644 --- a/kiten/dict.h +++ b/kiten/dict.h @@ -22,11 +22,11 @@ #ifndef DICT_H #define DICT_H -#include <qfile.h> -#include <qmemarray.h> -#include <qptrlist.h> -#include <qregexp.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqmemarray.h> +#include <tqptrlist.h> +#include <tqregexp.h> +#include <tqstringlist.h> #include <sys/types.h> #ifdef __osf__ @@ -42,14 +42,14 @@ namespace Dict enum TextType { Text_Kanji, Text_Kana, Text_Latin }; // returns the TextType of the first part of the text -KDE_EXPORT TextType textType(const QString &text); +KDE_EXPORT TextType textType(const TQString &text); // File needs to be able to give out Arrays based on its mmap'd data. // But, we don't want the users of the arrays to have to remember to // resetRawData() after using them, since that's bound to fail sooner or later. // // This class handles it for us. -template<class T> class Array : public QMemArray<T> +template<class T> class Array : public TQMemArray<T> { public: Array(T *, int); @@ -61,7 +61,7 @@ private: }; template<class T> Array<T>::Array(T *d, int s) - : QMemArray<T>() + : TQMemArray<T>() , data(d) , dataSize(s) { @@ -78,10 +78,10 @@ template<class T> Array<T>::~Array() class File { public: - File(QString path, QString name); + File(TQString path, TQString name); ~File(); - QString name(void); + TQString name(void); Array<const unsigned char> dict(void); Array<const uint32_t> index(void); @@ -93,14 +93,14 @@ public: bool isValid(void); unsigned char lookup(unsigned i, int offset); - QCString lookup(unsigned i); + TQCString lookup(unsigned i); private: - QString myName; + TQString myName; - QFile dictFile; + TQFile dictFile; const unsigned char * dictPtr; - QFile indexFile; + TQFile indexFile; const uint32_t * indexPtr; bool valid; @@ -110,22 +110,22 @@ class KDE_EXPORT Entry { public: // EDict ctor - Entry(const QString &, const QString &, const QStringList &); + Entry(const TQString &, const TQString &, const TQStringList &); // Kanjidict ctor - Entry(const QString &, QStringList &, QStringList &, unsigned int grade, unsigned int freq, unsigned int strokes, unsigned int miscount); + Entry(const TQString &, TQStringList &, TQStringList &, unsigned int grade, unsigned int freq, unsigned int strokes, unsigned int miscount); // default (for containers) - Entry(const QString & = QString::null); + Entry(const TQString & = TQString::null); // for a heading - Entry(const QString &, bool header); + Entry(const TQString &, bool header); - QString dictName(); - QString header(); - QStringList meanings(); - QStringList readings(); - QString firstReading(); + TQString dictName(); + TQString header(); + TQStringList meanings(); + TQStringList readings(); + TQString firstReading(); bool kanaOnly(); - QString kanji(); + TQString kanji(); bool extendedKanjiInfo(); unsigned int grade(); @@ -134,13 +134,13 @@ public: unsigned int freq(); protected: - QString DictName; - QString Header; - QStringList Meanings; + TQString DictName; + TQString Header; + TQStringList Meanings; - QString Kanji; + TQString Kanji; bool KanaOnly; - QStringList Readings; + TQStringList Readings; bool ExtendedKanjiInfo; unsigned int Grade; @@ -151,11 +151,11 @@ protected: struct SearchResult { - QValueList<Entry> list; - QStringList results; + TQValueList<Entry> list; + TQStringList results; int count, outOf; bool common; - QString text; + TQString text; }; enum SearchType { Search_Beginning, Search_FullWord, Search_Anywhere }; @@ -169,35 +169,35 @@ public: Index(); virtual ~Index(); - void setDictList(const QStringList &files, const QStringList &names); - void setKanjiDictList(const QStringList &files, const QStringList &names); + void setDictList(const TQStringList &files, const TQStringList &names); + void setKanjiDictList(const TQStringList &files, const TQStringList &names); - SearchResult search(QRegExp, const QString &, bool common); - SearchResult searchKanji(QRegExp, const QString &, bool common); - SearchResult searchPrevious(QRegExp, const QString &, SearchResult, bool common); + SearchResult search(TQRegExp, const TQString &, bool common); + SearchResult searchKanji(TQRegExp, const TQString &, bool common); + SearchResult searchPrevious(TQRegExp, const TQString &, SearchResult, bool common); // convenience function to create suitable regexps - static QRegExp createRegExp(SearchType type, const QString &text, DictionaryType dictionaryType, bool caseSensitive = false); + static TQRegExp createRegExp(SearchType type, const TQString &text, DictionaryType dictionaryType, bool caseSensitive = false); private: - QPtrList<File> dictFiles; - QPtrList<File> kanjiDictFiles; + TQPtrList<File> dictFiles; + TQPtrList<File> kanjiDictFiles; - void loadDictList(QPtrList<File> &fileList, const QStringList &dictList, const QStringList &dictNameList); + void loadDictList(TQPtrList<File> &fileList, const TQStringList &dictList, const TQStringList &dictNameList); - QStringList doSearch(File &, const QString &); - SearchResult scanResults(QRegExp regexp, QStringList results, bool common); - SearchResult scanKanjiResults(QRegExp regexp, QStringList results, bool common); - int stringCompare(File &, int index, QCString); + TQStringList doSearch(File &, const TQString &); + SearchResult scanResults(TQRegExp regexp, TQStringList results, bool common); + SearchResult scanKanjiResults(TQRegExp regexp, TQStringList results, bool common); + int stringCompare(File &, int index, TQCString); }; // lotsa helper functions -KDE_EXPORT QString prettyKanjiReading(QStringList); -KDE_EXPORT QString prettyMeaning(QStringList); -KDE_EXPORT Entry parse(const QString &); -KDE_EXPORT Entry kanjiParse(const QString &); +KDE_EXPORT TQString prettyKanjiReading(TQStringList); +KDE_EXPORT TQString prettyMeaning(TQStringList); +KDE_EXPORT Entry parse(const TQString &); +KDE_EXPORT Entry kanjiParse(const TQString &); KDE_EXPORT Dict::Entry firstEntry(Dict::SearchResult); -KDE_EXPORT QString firstEntryText(Dict::SearchResult); +KDE_EXPORT TQString firstEntryText(Dict::SearchResult); int eucStringCompare(const char *str1, const char *str2); bool isEUC(unsigned char c); diff --git a/kiten/kiten.cpp b/kiten/kiten.cpp index 434f02e1..5e54a9af 100644 --- a/kiten/kiten.cpp +++ b/kiten/kiten.cpp @@ -34,10 +34,10 @@ #include <kstandarddirs.h> #include <kstatusbar.h> -#include <qclipboard.h> -#include <qregexp.h> -#include <qtextcodec.h> -#include <qtimer.h> +#include <tqclipboard.h> +#include <tqregexp.h> +#include <tqtextcodec.h> +#include <tqtimer.h> #include "kiten.h" #include "learn.h" @@ -46,7 +46,7 @@ #include <cassert> -TopLevel::TopLevel(QWidget *parent, const char *name) : KMainWindow(parent, name) +TopLevel::TopLevel(TQWidget *parent, const char *name) : KMainWindow(parent, name) { #if KDE_VERSION > 305 setStandardToolBarMenuEnabled(true); @@ -55,42 +55,42 @@ TopLevel::TopLevel(QWidget *parent, const char *name) : KMainWindow(parent, name config = Config::self(); config->readConfig(); Accel = new KGlobalAccel(this); - (void) Accel->insert("Lookup Kanji (Kanjidic)", i18n("Lookup Kanji (Kanjidic)"), i18n("Gives detailed information about Kanji currently on clipboard."), CTRL + ALT + Key_K, CTRL + ALT + Key_K, this, SLOT(kanjiSearchAccel())); - (void) Accel->insert("Lookup English/Japanese word", i18n("Lookup English/Japanese Word"), i18n("Looks up current text on clipboard in the same way as if you used Kiten's regular search."), CTRL + ALT + Key_S, CTRL + ALT + Key_S, this, SLOT(searchAccel())); + (void) Accel->insert("Lookup Kanji (Kanjidic)", i18n("Lookup Kanji (Kanjidic)"), i18n("Gives detailed information about Kanji currently on clipboard."), CTRL + ALT + Key_K, CTRL + ALT + Key_K, this, TQT_SLOT(kanjiSearchAccel())); + (void) Accel->insert("Lookup English/Japanese word", i18n("Lookup English/Japanese Word"), i18n("Looks up current text on clipboard in the same way as if you used Kiten's regular search."), CTRL + ALT + Key_S, CTRL + ALT + Key_S, this, TQT_SLOT(searchAccel())); Accel->readSettings(KGlobal::config()); Accel->updateConnections(); _ResultView = new ResultView(true, this, "_ResultView"); setCentralWidget(_ResultView); - (void) KStdAction::quit(this, SLOT(close()), actionCollection()); - (void) KStdAction::print(this, SLOT(print()), actionCollection()); - (void) KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection()); - KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); - (void) new KAction(i18n("&Learn"), "pencil", CTRL+Key_L, this, SLOT(createLearn()), actionCollection(), "file_learn"); - (void) new KAction(i18n("&Dictionary Editor..."), "edit", 0, this, SLOT(createEEdit()), actionCollection(), "dict_editor"); - (void) new KAction(i18n("Ra&dical Search..."), "gear", CTRL+Key_R, this, SLOT(radicalSearch()), actionCollection(), "search_radical"); - Edit = new EditAction(i18n("Search Edit"), 0, this, SLOT(search()), actionCollection(), "search_edit"); - (void) new KAction(i18n("&Clear Search Bar"), BarIcon("locationbar_erase", 16), CTRL+Key_N, Edit, SLOT(clear()), actionCollection(), "clear_search"); - (void) new KAction(i18n("S&earch"), "key_enter", 0, this, SLOT(search()), actionCollection(), "search"); - (void) new KAction(i18n("Search with &Beginning of Word"), 0, this, SLOT(searchBeginning()), actionCollection(), "search_beginning"); - (void) new KAction(i18n("Search &Anywhere"), 0, this, SLOT(searchAnywhere()), actionCollection(), "search_anywhere"); - (void) new KAction(i18n("Stro&kes"), "paintbrush", CTRL+Key_S, this, SLOT(strokeSearch()), actionCollection(), "search_stroke"); - (void) new KAction(i18n("&Grade"), "leftjust", CTRL+Key_G, this, SLOT(gradeSearch()), actionCollection(), "search_grade"); - kanjiCB = new KToggleAction(i18n("&Kanjidic"), "kanjidic", CTRL+Key_K, this, SLOT(kanjiDictChange()), actionCollection(), "kanji_toggle"); - deinfCB = new KToggleAction(i18n("&Deinflect Verbs in Regular Search"), 0, this, SLOT(kanjiDictChange()), actionCollection(), "deinf_toggle"); - comCB = new KToggleAction(i18n("&Filter Rare"), "filter", CTRL+Key_F, this, SLOT(toggleCom()), actionCollection(), "common"); - autoSearchToggle = new KToggleAction(i18n("&Automatically Search Clipboard Selections"), "find", 0, this, SLOT(kanjiDictChange()), actionCollection(), "autosearch_toggle"); - irAction = new KAction(i18n("Search &in Results"), "find", CTRL+Key_I, this, SLOT(resultSearch()), actionCollection(), "search_in_results"); - (void) KStdAction::configureToolbars(this, SLOT(configureToolBars()), actionCollection()); - addAction = new KAction(i18n("Add &Kanji to Learning List"), 0, this, SLOT(addToList()), actionCollection(), "add"); + (void) KStdAction::quit(this, TQT_SLOT(close()), actionCollection()); + (void) KStdAction::print(this, TQT_SLOT(print()), actionCollection()); + (void) KStdAction::preferences(this, TQT_SLOT(slotConfigure()), actionCollection()); + KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); + (void) new KAction(i18n("&Learn"), "pencil", CTRL+Key_L, this, TQT_SLOT(createLearn()), actionCollection(), "file_learn"); + (void) new KAction(i18n("&Dictionary Editor..."), "edit", 0, this, TQT_SLOT(createEEdit()), actionCollection(), "dict_editor"); + (void) new KAction(i18n("Ra&dical Search..."), "gear", CTRL+Key_R, this, TQT_SLOT(radicalSearch()), actionCollection(), "search_radical"); + Edit = new EditAction(i18n("Search Edit"), 0, this, TQT_SLOT(search()), actionCollection(), "search_edit"); + (void) new KAction(i18n("&Clear Search Bar"), BarIcon("locationbar_erase", 16), CTRL+Key_N, Edit, TQT_SLOT(clear()), actionCollection(), "clear_search"); + (void) new KAction(i18n("S&earch"), "key_enter", 0, this, TQT_SLOT(search()), actionCollection(), "search"); + (void) new KAction(i18n("Search with &Beginning of Word"), 0, this, TQT_SLOT(searchBeginning()), actionCollection(), "search_beginning"); + (void) new KAction(i18n("Search &Anywhere"), 0, this, TQT_SLOT(searchAnywhere()), actionCollection(), "search_anywhere"); + (void) new KAction(i18n("Stro&kes"), "paintbrush", CTRL+Key_S, this, TQT_SLOT(strokeSearch()), actionCollection(), "search_stroke"); + (void) new KAction(i18n("&Grade"), "leftjust", CTRL+Key_G, this, TQT_SLOT(gradeSearch()), actionCollection(), "search_grade"); + kanjiCB = new KToggleAction(i18n("&Kanjidic"), "kanjidic", CTRL+Key_K, this, TQT_SLOT(kanjiDictChange()), actionCollection(), "kanji_toggle"); + deinfCB = new KToggleAction(i18n("&Deinflect Verbs in Regular Search"), 0, this, TQT_SLOT(kanjiDictChange()), actionCollection(), "deinf_toggle"); + comCB = new KToggleAction(i18n("&Filter Rare"), "filter", CTRL+Key_F, this, TQT_SLOT(toggleCom()), actionCollection(), "common"); + autoSearchToggle = new KToggleAction(i18n("&Automatically Search Clipboard Selections"), "find", 0, this, TQT_SLOT(kanjiDictChange()), actionCollection(), "autosearch_toggle"); + irAction = new KAction(i18n("Search &in Results"), "find", CTRL+Key_I, this, TQT_SLOT(resultSearch()), actionCollection(), "search_in_results"); + (void) KStdAction::configureToolbars(this, TQT_SLOT(configureToolBars()), actionCollection()); + addAction = new KAction(i18n("Add &Kanji to Learning List"), 0, this, TQT_SLOT(addToList()), actionCollection(), "add"); addAction->setEnabled(false); - (void) new KAction(i18n("Configure &Global Shortcuts..."), "configure_shortcuts", 0, this, SLOT(configureGlobalKeys()), actionCollection(), "options_configure_keybinding"); + (void) new KAction(i18n("Configure &Global Shortcuts..."), "configure_shortcuts", 0, this, TQT_SLOT(configureGlobalKeys()), actionCollection(), "options_configure_keybinding"); historyAction = new KListAction(i18n("&History"), 0, 0, 0, actionCollection(), "history"); - connect(historyAction, SIGNAL(activated(int)), this, SLOT(goInHistory(int))); - backAction = KStdAction::back(this, SLOT(back()), actionCollection()); - forwardAction = KStdAction::forward(this, SLOT(forward()), actionCollection()); + connect(historyAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(goInHistory(int))); + backAction = KStdAction::back(this, TQT_SLOT(back()), actionCollection()); + forwardAction = KStdAction::forward(this, TQT_SLOT(forward()), actionCollection()); backAction->setEnabled(false); forwardAction->setEnabled(false); currentResult = resultHistory.end(); @@ -114,10 +114,10 @@ TopLevel::TopLevel(QWidget *parent, const char *name) : KMainWindow(parent, name resize(600, 400); applyMainWindowSettings(KGlobal::config(), "TopLevelWindow"); - connect(_ResultView, SIGNAL(linkClicked(const QString &)), SLOT(ressearch(const QString &))); - connect(kapp->clipboard(), SIGNAL(selectionChanged()), this, SLOT(autoSearch())); + connect(_ResultView, TQT_SIGNAL(linkClicked(const TQString &)), TQT_SLOT(ressearch(const TQString &))); + connect(kapp->clipboard(), TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(autoSearch())); - QTimer::singleShot(10, this, SLOT(finishInit())); + TQTimer::singleShot(10, this, TQT_SLOT(finishInit())); } TopLevel::~TopLevel() @@ -133,21 +133,21 @@ void TopLevel::finishInit() if (!kapp->config()->hasGroup("app")) { if (kanjiCB->isChecked()) - Edit->setText(QString::fromUtf8("辞")); + Edit->setText(TQString::fromUtf8("辞")); else - Edit->setText(QString::fromUtf8("辞書")); + Edit->setText(TQString::fromUtf8("辞書")); search(); } Edit->clear(); // make sure the edit is focused initially StatusBar->message(i18n("Welcome to Kiten")); - setCaption(QString::null); + setCaption(TQString::null); } bool TopLevel::queryClose() { - for (QPtrListIterator<Learn> i(learnList); *i;) + for (TQPtrListIterator<Learn> i(learnList); *i;) { (*i)->show(); if (!(*i)->closeWindow()) @@ -177,7 +177,7 @@ void TopLevel::addToList() emit add(toAddKanji); } -void TopLevel::doSearch(const QString &text, QRegExp regexp) +void TopLevel::doSearch(const TQString &text, TQRegExp regexp) { if (text.isEmpty()) { @@ -215,7 +215,7 @@ void TopLevel::doSearch(const QString &text, QRegExp regexp) readingSearch = false; } -void TopLevel::doSearchInResults(const QString &text, QRegExp regexp) +void TopLevel::doSearchInResults(const TQString &text, TQRegExp regexp) { if (text.isEmpty()) { @@ -257,23 +257,23 @@ void TopLevel::handleSearchResult(Dict::SearchResult results) addAction->setEnabled(true); - _ResultView->append(QString("<p>%1</p>").arg(i18n("HTML Entity: %1").arg(QString("&#x%1;").arg(QString::number(toAddKanji.kanji().at(0).unicode(), 16))))); // show html entity + _ResultView->append(TQString("<p>%1</p>").arg(i18n("HTML Entity: %1").arg(TQString("&#x%1;").arg(TQString::number(toAddKanji.kanji().at(0).unicode(), 16))))); // show html entity // now show some compounds in which this kanji appears - QString kanji = toAddKanji.kanji(); + TQString kanji = toAddKanji.kanji(); _ResultView->addHeader(i18n("%1 in compounds").arg(kanji)); - Dict::SearchResult compounds = _Asyndeta.retrieveIndex()->search(QRegExp(kanji), kanji, true); + Dict::SearchResult compounds = _Asyndeta.retrieveIndex()->search(TQRegExp(kanji), kanji, true); bool common = true; if (compounds.count <= 0) { - compounds = _Asyndeta.retrieveIndex()->search(QRegExp(kanji), kanji, false); + compounds = _Asyndeta.retrieveIndex()->search(TQRegExp(kanji), kanji, false); _ResultView->addHeader(i18n("(No common compounds)"), 4); common = false; } - for (QValueListIterator<Dict::Entry> it = compounds.list.begin(); it != compounds.list.end(); ++it) + for (TQValueListIterator<Dict::Entry> it = compounds.list.begin(); it != compounds.list.end(); ++it) { //kdDebug() << "adding " << (*it).kanji() << endl; _ResultView->addResult(*it, common); @@ -282,7 +282,7 @@ void TopLevel::handleSearchResult(Dict::SearchResult results) } else { - for (QValueListIterator<Dict::Entry> it = results.list.begin(); it != results.list.end(); ++it) + for (TQValueListIterator<Dict::Entry> it = results.list.begin(); it != results.list.end(); ++it) { kapp->processEvents(); _ResultView->addKanjiResult(*it, results.common); @@ -291,7 +291,7 @@ void TopLevel::handleSearchResult(Dict::SearchResult results) } else { - for (QValueListIterator<Dict::Entry> it = results.list.begin(); it != results.list.end(); ++it) + for (TQValueListIterator<Dict::Entry> it = results.list.begin(); it != results.list.end(); ++it) { kapp->processEvents(); _ResultView->addResult(*it, comCB->isChecked()); @@ -303,29 +303,29 @@ void TopLevel::handleSearchResult(Dict::SearchResult results) void TopLevel::searchBeginning() { - QString text = Edit->text(); - QRegExp regexp; + TQString text = Edit->text(); + TQRegExp regexp; switch (Dict::textType(text)) { case Dict::Text_Latin: - regexp = QRegExp(QString("\\W").append(text)); + regexp = TQRegExp(TQString("\\W").append(text)); break; case Dict::Text_Kana: if (kanjiCB->isChecked()) { - regexp = QRegExp(QString("\\W").append(text)); + regexp = TQRegExp(TQString("\\W").append(text)); } else { beginningReadingSearch = true; - regexp = QRegExp(QString("\\[").append(text)); + regexp = TQRegExp(TQString("\\[").append(text)); } break; case Dict::Text_Kanji: - regexp = QRegExp(QString("^").append(text)); + regexp = TQRegExp(TQString("^").append(text)); } doSearch(text, regexp); @@ -333,7 +333,7 @@ void TopLevel::searchBeginning() void TopLevel::searchAnywhere() { - doSearch(Edit->text(), QRegExp(Edit->text())); + doSearch(Edit->text(), TQRegExp(Edit->text())); } void TopLevel::resultSearch() @@ -342,12 +342,12 @@ void TopLevel::resultSearch() } // called when a kanji is clicked on in result view -void TopLevel::ressearch(const QString &text) +void TopLevel::ressearch(const TQString &text) { //kdDebug() << "ressearch(" << text << endl; if (text.startsWith("__radical:")) { - QString radical = text.section(":", 1, 1).right(1); + TQString radical = text.section(":", 1, 1).right(1); //kdDebug() << "radical is " << radical << endl; radicalSearch()->addRadical(radical); return; @@ -359,8 +359,8 @@ void TopLevel::ressearch(const QString &text) void TopLevel::search(bool inResults) { - QString text = Edit->text(); - QRegExp regexp; + TQString text = Edit->text(); + TQRegExp regexp; switch (Dict::textType(text)) { @@ -377,8 +377,8 @@ void TopLevel::search(bool inResults) if (deinfCB->isChecked()) // deinflect { bool common = comCB->isChecked(); - QStringList names; - QStringList res(_DeinfIndex.deinflect(text, names)); + TQStringList names; + TQStringList res(_DeinfIndex.deinflect(text, names)); if (res.size() > 0) { @@ -388,19 +388,19 @@ void TopLevel::search(bool inResults) hist.common = common; hist.text = text; - QStringList done; + TQStringList done; res.prepend(text); names.prepend(i18n("No deinflection")); - QStringList::Iterator nit = names.begin(); - for (QStringList::Iterator it = res.begin(); it != res.end(); ++it, ++nit) + TQStringList::Iterator nit = names.begin(); + for (TQStringList::Iterator it = res.begin(); it != res.end(); ++it, ++nit) { if (done.contains(*it) > 0) continue; //kdDebug() << "currently on deinflection " << *it << endl; - Dict::SearchResult results = _Asyndeta.retrieveIndex()->search(QRegExp(QString("^") + (*it) + "\\W"), *it, common); + Dict::SearchResult results = _Asyndeta.retrieveIndex()->search(TQRegExp(TQString("^") + (*it) + "\\W"), *it, common); if (results.count < 1) // stop if it isn't in the dictionary continue; @@ -433,10 +433,10 @@ void TopLevel::search(bool inResults) void TopLevel::strokeSearch() { - QString strokesString; + TQString strokesString; bool ok = false; - QString text = Edit->text().stripWhiteSpace(); + TQString text = Edit->text().stripWhiteSpace(); unsigned int strokes = text.toUInt(&ok); if (!ok) @@ -470,7 +470,7 @@ void TopLevel::strokeSearch() already = true; - strokesString.append(QString::number(i)); + strokesString.append(TQString::number(i)); } strokesString.append(')'); @@ -489,21 +489,21 @@ void TopLevel::strokeSearch() } else { - strokesString = QString::number(strokes); + strokesString = TQString::number(strokes); } - QRegExp regexp = QRegExp(text); + TQRegExp regexp = TQRegExp(text); // must be in kanjidic mode kanjiCB->setChecked(true); - doSearch(QString("S%1 ").arg(strokesString), regexp); + doSearch(TQString("S%1 ").arg(strokesString), regexp); } void TopLevel::gradeSearch() { - QString editText = Edit->text().stripWhiteSpace(); + TQString editText = Edit->text().stripWhiteSpace(); unsigned int grade; if (editText.lower() == "jouyou") @@ -519,31 +519,31 @@ void TopLevel::gradeSearch() return; } - QString text = QString("G%1 ").arg(grade); - QRegExp regexp = QRegExp(text); + TQString text = TQString("G%1 ").arg(grade); + TQRegExp regexp = TQRegExp(text); kanjiCB->setChecked(true); doSearch(text, regexp); } -QString TopLevel::clipBoardText() // gets text from clipboard for globalaccels +TQString TopLevel::clipBoardText() // gets text from clipboard for globalaccels { kapp->clipboard()->setSelectionMode(true); - QString text = kapp->clipboard()->text().stripWhiteSpace(); + TQString text = kapp->clipboard()->text().stripWhiteSpace(); kapp->clipboard()->setSelectionMode(false); return text; } -QString TopLevel::filteredClipboardText() +TQString TopLevel::filteredClipboardText() { - QString newText = clipBoardText(); - QString currentText = Edit->text(); + TQString newText = clipBoardText(); + TQString currentText = Edit->text(); if (newText.length() < 80 && newText.find(':') < 0 && newText.find('#') < 0 && newText.find("-") != 0 && newText.find("+") < 0 && currentText.find(newText) < 0) return newText; else - return QString::null; + return TQString::null; } void TopLevel::autoSearch() @@ -554,7 +554,7 @@ void TopLevel::autoSearch() void TopLevel::searchAccel() { - QString newText = filteredClipboardText(); + TQString newText = filteredClipboardText(); if (!newText.isNull()) { kanjiCB->setChecked(false); @@ -568,7 +568,7 @@ void TopLevel::searchAccel() void TopLevel::kanjiSearchAccel() { - QString newText = filteredClipboardText(); + TQString newText = filteredClipboardText(); if (!newText.isNull()) { kanjiCB->setChecked(true); @@ -582,7 +582,7 @@ void TopLevel::kanjiSearchAccel() void TopLevel::setResults(unsigned int results, unsigned int fullNum) { - QString str = i18n("%n result","%n results",results); + TQString str = i18n("%n result","%n results",results); if (results < fullNum) str += i18n(" out of %1").arg(fullNum); @@ -609,9 +609,9 @@ void TopLevel::slotConfigure() //ConfigureDialog didn't find an instance of this dialog, so lets create it : optionDialog = new ConfigureDialog(this, "settings"); - connect(optionDialog, SIGNAL(hidden()),this,SLOT(slotConfigureHide())); - connect(optionDialog, SIGNAL(settingsChanged()), this, SLOT(slotConfigurationChanged())); - connect(optionDialog, SIGNAL(valueChanged()), this, SIGNAL(quizConfChanged())); + connect(optionDialog, TQT_SIGNAL(hidden()),this,TQT_SLOT(slotConfigureHide())); + connect(optionDialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(slotConfigurationChanged())); + connect(optionDialog, TQT_SIGNAL(valueChanged()), this, TQT_SIGNAL(quizConfChanged())); optionDialog->show(); return; @@ -625,7 +625,7 @@ void TopLevel::slotLearnConfigure() void TopLevel::slotConfigureHide() { - QTimer::singleShot(0, this, SLOT(slotConfigureDestroy())); + TQTimer::singleShot(0, this, TQT_SLOT(slotConfigureDestroy())); } void TopLevel::slotConfigureDestroy() @@ -641,11 +641,11 @@ void TopLevel::createLearn() { Learn *_Learn = new Learn(_Asyndeta.retrieveIndex(), 0); - connect(_Learn, SIGNAL(destroyed(Learn *)), this, SLOT(learnDestroyed(Learn *))); - connect(_Learn, SIGNAL(linkClicked(const QString &)), this, SLOT(ressearch(const QString &))); - connect(_Learn, SIGNAL(configureLearn()), this, SLOT(slotLearnConfigure())); - connect(this, SIGNAL(quizConfChanged()), _Learn, SLOT(updateQuizConfiguration())); - connect(this, SIGNAL(add(Dict::Entry)), _Learn, SLOT(add(Dict::Entry))); + connect(_Learn, TQT_SIGNAL(destroyed(Learn *)), this, TQT_SLOT(learnDestroyed(Learn *))); + connect(_Learn, TQT_SIGNAL(linkClicked(const TQString &)), this, TQT_SLOT(ressearch(const TQString &))); + connect(_Learn, TQT_SIGNAL(configureLearn()), this, TQT_SLOT(slotLearnConfigure())); + connect(this, TQT_SIGNAL(quizConfChanged()), _Learn, TQT_SLOT(updateQuizConfiguration())); + connect(this, TQT_SIGNAL(add(Dict::Entry)), _Learn, TQT_SLOT(add(Dict::Entry))); learnList.append(_Learn); @@ -668,14 +668,14 @@ void TopLevel::kanjiDictChange() // Do we even *need* something here? } -QRegExp TopLevel::readingSearchItems(bool kanji) +TQRegExp TopLevel::readingSearchItems(bool kanji) { - QString text = Edit->text(); + TQString text = Edit->text(); if (text.isEmpty()) // abandon search - return QRegExp(); //empty + return TQRegExp(); //empty //CompletionObj->addItem(text); - QString regexp; + TQString regexp; if (kanji) regexp = " %1 "; else @@ -683,17 +683,17 @@ QRegExp TopLevel::readingSearchItems(bool kanji) regexp = regexp.arg(text); - return QRegExp(regexp, Config::caseSensitive()); + return TQRegExp(regexp, Config::caseSensitive()); } -QRegExp TopLevel::kanjiSearchItems(bool beginning) +TQRegExp TopLevel::kanjiSearchItems(bool beginning) { - QString text = Edit->text(); + TQString text = Edit->text(); if (text.isEmpty()) - return QRegExp(); //empty + return TQRegExp(); //empty - QString regexp; + TQString regexp; if (beginning) regexp = "^%1"; else @@ -701,17 +701,17 @@ QRegExp TopLevel::kanjiSearchItems(bool beginning) regexp = regexp.arg(text); - return QRegExp(regexp, Config::caseSensitive()); + return TQRegExp(regexp, Config::caseSensitive()); } -QRegExp TopLevel::searchItems() +TQRegExp TopLevel::searchItems() { - QString regexp; - QString text = Edit->text(); + TQString regexp; + TQString text = Edit->text(); if (text.isEmpty()) - return QRegExp(); //empty + return TQRegExp(); //empty - unsigned int contains = text.contains(QRegExp("[A-Za-z0-9_:]")); + unsigned int contains = text.contains(TQRegExp("[A-Za-z0-9_:]")); if (Config::wholeWord() && contains == text.length()) regexp = "\\W%1\\W"; else @@ -719,7 +719,7 @@ QRegExp TopLevel::searchItems() regexp = regexp.arg(text); - return QRegExp(regexp, Config::caseSensitive()); + return TQRegExp(regexp, Config::caseSensitive()); } void TopLevel::toggleCom() @@ -730,7 +730,7 @@ void TopLevel::configureToolBars() { saveMainWindowSettings(KGlobal::config(), "TopLevelWindow"); KEditToolbar dlg(actionCollection(), "kitenui.rc"); - connect(&dlg, SIGNAL(newToolbarConfig()), SLOT(newToolBarConfig())); + connect(&dlg, TQT_SIGNAL(newToolbarConfig()), TQT_SLOT(newToolBarConfig())); dlg.exec(); } @@ -743,27 +743,27 @@ void TopLevel::newToolBarConfig() RadWidget *TopLevel::radicalSearch() { RadWidget *rw = new RadWidget(&_Rad, 0, "rw"); - connect(rw, SIGNAL(set(const QStringList &, unsigned int, unsigned int)), this, SLOT(radSearch(const QStringList &, unsigned int, unsigned int))); + connect(rw, TQT_SIGNAL(set(const TQStringList &, unsigned int, unsigned int)), this, TQT_SLOT(radSearch(const TQStringList &, unsigned int, unsigned int))); rw->show(); return rw; } -void TopLevel::radSearch(const QStringList &_list, unsigned int strokes, unsigned int errorMargin) +void TopLevel::radSearch(const TQStringList &_list, unsigned int strokes, unsigned int errorMargin) { //kdDebug() << "TopLevel::radSearch\n"; - QStringList list(_Rad.kanjiByRad(_list)); + TQStringList list(_Rad.kanjiByRad(_list)); - QStringList::iterator it; + TQStringList::iterator it; Dict::SearchResult hist; hist.count = 0; hist.outOf = 0; hist.common = comCB->isChecked(); - QString prettyRadicalString; + TQString prettyRadicalString; bool already = false; - for (QStringList::ConstIterator it = _list.begin(); it != _list.end(); ++it) + for (TQStringList::ConstIterator it = _list.begin(); it != _list.end(); ++it) { if (already) prettyRadicalString.append(", "); @@ -779,16 +779,16 @@ void TopLevel::radSearch(const QStringList &_list, unsigned int strokes, unsigne else hist.list.append(Dict::Entry(i18n("Kanji with radical(s) %1").arg(prettyRadicalString), true)); - QString strokesString; + TQString strokesString; if (strokes) { - strokesString = QString::number(strokes); + strokesString = TQString::number(strokes); for (unsigned i = 1; i <= errorMargin; ++i) { strokesString.append('|'); strokesString.prepend('|'); - strokesString.append(QString::number(strokes + i)); - strokesString.prepend(QString::number(strokes - i)); + strokesString.append(TQString::number(strokes + i)); + strokesString.prepend(TQString::number(strokes - i)); } strokesString.append(')'); @@ -800,7 +800,7 @@ void TopLevel::radSearch(const QStringList &_list, unsigned int strokes, unsigne for (it = list.begin(); it != list.end(); ++it) { - Dict::SearchResult results = _Asyndeta.retrieveIndex()->searchKanji(QRegExp(strokes? (QString("S%1 ").arg(strokesString)) : (QString("^") + (*it)) ), (*it), comCB->isChecked()); + Dict::SearchResult results = _Asyndeta.retrieveIndex()->searchKanji(TQRegExp(strokes? (TQString("S%1 ").arg(strokesString)) : (TQString("^") + (*it)) ), (*it), comCB->isChecked()); hist.outOf += results.outOf; if (results.count < 1) @@ -851,7 +851,7 @@ void TopLevel::historySpotChanged() void TopLevel::addHistory(Dict::SearchResult result) { - QStringList newHistoryList = historyAction->items(); + TQStringList newHistoryList = historyAction->items(); // remove from back till we hit currentResult while (resultHistory.fromLast() != currentResult) diff --git a/kiten/kiten.h b/kiten/kiten.h index b991b0a5..13500898 100644 --- a/kiten/kiten.h +++ b/kiten/kiten.h @@ -43,7 +43,7 @@ class KDE_EXPORT TopLevel : public KMainWindow Q_OBJECT public: - TopLevel(QWidget *parent = 0, const char *name = 0); + TopLevel(TQWidget *parent = 0, const char *name = 0); ~TopLevel(); signals: @@ -56,7 +56,7 @@ protected: private slots: void search(bool inResults = false); - void ressearch(const QString&); + void ressearch(const TQString&); void searchBeginning(); void searchAnywhere(); void resultSearch(); @@ -79,7 +79,7 @@ private slots: void toggleCom(); void addToList(); RadWidget *radicalSearch(); - void radSearch(const QStringList &, unsigned int, unsigned int); + void radSearch(const TQStringList &, unsigned int, unsigned int); void print(); @@ -111,21 +111,21 @@ private: KGlobalAccel *Accel; - void doSearch(const QString &text, QRegExp regexp); - void doSearchInResults(const QString &text, QRegExp regexp); + void doSearch(const TQString &text, TQRegExp regexp); + void doSearchInResults(const TQString &text, TQRegExp regexp); void handleSearchResult(Dict::SearchResult); - QString filteredClipboardText(); - QString clipBoardText(); + TQString filteredClipboardText(); + TQString clipBoardText(); ConfigureDialog *optionDialog; Config* config; void setResults(unsigned int, unsigned int); - QPtrList<Learn> learnList; + TQPtrList<Learn> learnList; - QRegExp searchItems(); - QRegExp readingSearchItems(bool); - QRegExp kanjiSearchItems(bool = false); + TQRegExp searchItems(); + TQRegExp readingSearchItems(bool); + TQRegExp kanjiSearchItems(bool = false); EditAction *Edit; @@ -134,13 +134,13 @@ private: Dict::Entry toAddKanji; - QValueList<Dict::SearchResult> resultHistory; - QValueListIterator<Dict::SearchResult> currentResult; + TQValueList<Dict::SearchResult> resultHistory; + TQValueListIterator<Dict::SearchResult> currentResult; int currentResultIndex; void addHistory(Dict::SearchResult); void enableHistoryButtons(); - QString personalDict; + TQString personalDict; }; #endif diff --git a/kiten/kloader.cpp b/kiten/kloader.cpp index c13aaa4b..6ae2da6c 100644 --- a/kiten/kloader.cpp +++ b/kiten/kloader.cpp @@ -43,12 +43,12 @@ public: delete dataStream; } bool isLocal; - QString tempFile; - QFile *file; + TQString tempFile; + TQFile *file; KURL url; - QString error; - QTextStream *textStream; - QDataStream *dataStream; + TQString error; + TQTextStream *textStream; + TQDataStream *dataStream; }; KLoader::KLoader(const KURL &target) @@ -59,7 +59,7 @@ KLoader::KLoader(const KURL &target) if(d->url.protocol() == "file") { d->isLocal = true; - d->file = new QFile(d->url.path()); + d->file = new TQFile(d->url.path()); } else { @@ -91,7 +91,7 @@ bool KLoader::open(void) return false; } - d->file = new QFile(d->tempFile); + d->file = new TQFile(d->tempFile); if(!d->file->open(IO_ReadOnly)) { d->error = i18n("Could not read from %1.").arg(d->tempFile); @@ -113,20 +113,20 @@ void KLoader::close(void) KIO::NetAccess::removeTempFile(d->tempFile); } -QString KLoader::error(void) +TQString KLoader::error(void) { return d->error; } -QFile &KLoader::file(void) +TQFile &KLoader::file(void) { if(d->file) return *d->file; else - return *static_cast<QFile *>(0); + return *static_cast<TQFile *>(0); } -QTextStream &KLoader::textStream() +TQTextStream &KLoader::textStream() { if(d->textStream) { @@ -134,16 +134,16 @@ QTextStream &KLoader::textStream() } else if(d->file) { - d->textStream = new QTextStream(d->file); + d->textStream = new TQTextStream(d->file); return *d->textStream; } else { - return *static_cast<QTextStream *>(0); + return *static_cast<TQTextStream *>(0); } } -QDataStream &KLoader::dataStream() +TQDataStream &KLoader::dataStream() { if(d->dataStream) { @@ -151,11 +151,11 @@ QDataStream &KLoader::dataStream() } else if(d->file) { - d->dataStream = new QDataStream(d->file); + d->dataStream = new TQDataStream(d->file); return *d->dataStream; } else { - return *static_cast<QDataStream *>(0); + return *static_cast<TQDataStream *>(0); } } diff --git a/kiten/kloader.h b/kiten/kloader.h index 5682b21f..816d29c3 100644 --- a/kiten/kloader.h +++ b/kiten/kloader.h @@ -24,7 +24,7 @@ #ifndef KLOADER_H #define KLOADER_H -#include <qfile.h> +#include <tqfile.h> /** * KLoader provides a way to load files in the most efficient way for @@ -35,7 +35,7 @@ class KLoader public: /** * The constructor takes the url and decides the best way to save, - * which will mean using something like KIO::NetAccess or QFile. + * which will mean using something like KIO::NetAccess or TQFile. */ KLoader(const KURL &_target); @@ -60,29 +60,29 @@ public: * If open or close returns false, there was an error, and error * returns what the error was, when available. */ - QString error(void); + TQString error(void); /** - * file returns a QFile open for reading, which may be for a temporary + * file returns a TQFile open for reading, which may be for a temporary * file on the local filesystem. * * If this is called before the file is opened, you will crash. */ - QFile &file(void); + TQFile &file(void); /** * You can use this to read in your data. * * If this is called before the file is opened, you will crash. */ - QTextStream &textStream(void); + TQTextStream &textStream(void); /** * You can use this to read in your data. * * If this is called before the file is opened, you will crash. */ - QDataStream &dataStream(void); + TQDataStream &dataStream(void); private: class KLoaderPrivate; KLoaderPrivate *d; diff --git a/kiten/kromajiedit.cpp b/kiten/kromajiedit.cpp index 758a1267..d58ff2e0 100644 --- a/kiten/kromajiedit.cpp +++ b/kiten/kromajiedit.cpp @@ -22,39 +22,39 @@ #include <kstandarddirs.h> #include <kmessagebox.h> #include <klocale.h> -#include <qfile.h> -#include <qpopupmenu.h> -#include <qtextcodec.h> +#include <tqfile.h> +#include <tqpopupmenu.h> +#include <tqtextcodec.h> #include "kromajiedit.h" -KRomajiEdit::KRomajiEdit(QWidget *parent, const char *name) +KRomajiEdit::KRomajiEdit(TQWidget *parent, const char *name) : KLineEdit(parent, name) { kana = "unset"; KStandardDirs *dirs = KGlobal::dirs(); - QString romkana = dirs->findResource("data", "kiten/romkana.cnv"); + TQString romkana = dirs->findResource("data", "kiten/romkana.cnv"); if (romkana.isNull()) { KMessageBox::error(0, i18n("Romaji information file not installed, so Romaji conversion cannot be used.")); return; } - QFile f(romkana); + TQFile f(romkana); if (!f.open(IO_ReadOnly)) { KMessageBox::error(0, i18n("Romaji information could not be loaded, so Romaji conversion cannot be used.")); } - QTextStream t(&f); - t.setCodec(QTextCodec::codecForName("eucJP")); + TQTextStream t(&f); + t.setCodec(TQTextCodec::codecForName("eucJP")); while (!t.eof()) { - QString s = t.readLine(); + TQString s = t.readLine(); - QChar first = s.at(0); + TQChar first = s.at(0); if (first == '#') // comment! { // nothing @@ -68,9 +68,9 @@ KRomajiEdit::KRomajiEdit(QWidget *parent, const char *name) } else // body { - QStringList things(QStringList::split(QChar(' '), s)); - QString thekana(things.first()); - QString romaji(*things.at(1)); + TQStringList things(TQStringList::split(TQChar(' '), s)); + TQString thekana(things.first()); + TQString romaji(*things.at(1)); if (kana == "hiragana") hiragana[romaji] = thekana; @@ -104,10 +104,10 @@ void KRomajiEdit::setKana(int _kana) } // TODO allow editing not only at end -void KRomajiEdit::keyPressEvent(QKeyEvent *e) +void KRomajiEdit::keyPressEvent(TQKeyEvent *e) { bool shift = e->state() & ShiftButton; - QString ji = e->text(); + TQString ji = e->text(); if (shift && e->key() == Key_Space) // switch hiragana/english { @@ -133,22 +133,22 @@ void KRomajiEdit::keyPressEvent(QKeyEvent *e) //kdDebug() << "--------------------\n"; - QString curEng; - QString curKana; - QString _text = text(); + TQString curEng; + TQString curKana; + TQString _text = text(); int i; unsigned int len = _text.length(); //kdDebug() << "length = " << len << endl; for (i = len - 1; i >= 0; i--) { - QChar at = _text.at(i); + TQChar at = _text.at(i); - //kdDebug() << "at = " << QString(at) << endl; + //kdDebug() << "at = " << TQString(at) << endl; if (at.row() == 0 && at != '.') { - //kdDebug() << "prepending " << QString(at) << endl; + //kdDebug() << "prepending " << TQString(at) << endl; curEng.prepend(at); } else @@ -163,7 +163,7 @@ void KRomajiEdit::keyPressEvent(QKeyEvent *e) ji = ji.lower(); //kdDebug() << "ji = " << ji << endl; - QString replace; + TQString replace; //kdDebug () << "kana is " << kana << endl; if (kana == "hiragana") @@ -186,7 +186,7 @@ void KRomajiEdit::keyPressEvent(QKeyEvent *e) else { //kdDebug() << "replace is empty\n"; - QString farRight(ji.right(ji.length() - 1)); + TQString farRight(ji.right(ji.length() - 1)); //kdDebug() << "ji = " << ji << endl; //kdDebug() << "farRight = " << farRight << endl; @@ -204,7 +204,7 @@ void KRomajiEdit::keyPressEvent(QKeyEvent *e) } // test for hanging n - QString newkana; + TQString newkana; if (kana == "hiragana") { newkana = hiragana[farRight]; @@ -253,9 +253,9 @@ void KRomajiEdit::keyPressEvent(QKeyEvent *e) KLineEdit::keyPressEvent(e); // don't think we'll get here :) } -QPopupMenu *KRomajiEdit::createPopupMenu() +TQPopupMenu *KRomajiEdit::createPopupMenu() { - QPopupMenu *popup = KLineEdit::createPopupMenu(); + TQPopupMenu *popup = KLineEdit::createPopupMenu(); popup->insertSeparator(); popup->insertItem(i18n("English"), 0); popup->insertItem(i18n("Kana"), 1); @@ -265,7 +265,7 @@ QPopupMenu *KRomajiEdit::createPopupMenu() else if (kana == "hiragana") popup->setItemChecked(1, true); - connect(popup, SIGNAL(activated(int)), SLOT(setKana(int))); + connect(popup, TQT_SIGNAL(activated(int)), TQT_SLOT(setKana(int))); emit aboutToShowContextMenu(popup); return popup; diff --git a/kiten/kromajiedit.h b/kiten/kromajiedit.h index fa060cd8..b8cef88c 100644 --- a/kiten/kromajiedit.h +++ b/kiten/kromajiedit.h @@ -21,8 +21,8 @@ #ifndef KROMAJIEDIT_H #define KROMAJIEDIT_H -#include <qmap.h> -#include <qcstring.h> +#include <tqmap.h> +#include <tqcstring.h> #include <klineedit.h> @@ -35,21 +35,21 @@ class KRomajiEdit : public KLineEdit Q_OBJECT public: - KRomajiEdit(QWidget *parent, const char *name); + KRomajiEdit(TQWidget *parent, const char *name); ~KRomajiEdit(); public slots: void setKana(int); protected: - void keyPressEvent(QKeyEvent *e); - QPopupMenu *createPopupMenu(); + void keyPressEvent(TQKeyEvent *e); + TQPopupMenu *createPopupMenu(); private: - QMap<QString, QString> hiragana; - QMap<QString, QString> katakana; + TQMap<TQString, TQString> hiragana; + TQMap<TQString, TQString> katakana; - QCString kana; + TQCString kana; }; #endif diff --git a/kiten/ksaver.cpp b/kiten/ksaver.cpp index 6c09ffa9..8e36f6d1 100644 --- a/kiten/ksaver.cpp +++ b/kiten/ksaver.cpp @@ -46,11 +46,11 @@ public: } bool isLocal; KTempFile *tempFile; - QFile *file; + TQFile *file; KURL url; - QString error; - QTextStream *textStream; - QDataStream *dataStream; + TQString error; + TQTextStream *textStream; + TQDataStream *dataStream; }; KSaver::KSaver(const KURL &_target) @@ -61,7 +61,7 @@ KSaver::KSaver(const KURL &_target) if(d->url.protocol() == "file") { d->isLocal = true; - d->file = new QFile(d->url.path()); + d->file = new TQFile(d->url.path()); } else { @@ -127,22 +127,22 @@ bool KSaver::close(void) } } -QString KSaver::error(void) +TQString KSaver::error(void) { return d->error; } -QFile &KSaver::file(void) +TQFile &KSaver::file(void) { if(d->isLocal && d->file) return *d->file; else if(!d->isLocal && d->tempFile) return *d->tempFile->file(); else - return *static_cast<QFile *>(0); + return *static_cast<TQFile *>(0); } -QTextStream &KSaver::textStream() +TQTextStream &KSaver::textStream() { if(d->textStream) { @@ -150,7 +150,7 @@ QTextStream &KSaver::textStream() } else if(d->isLocal && d->file) { - d->textStream = new QTextStream(d->file); + d->textStream = new TQTextStream(d->file); return *d->textStream; } else if(!d->isLocal && d->tempFile) @@ -160,11 +160,11 @@ QTextStream &KSaver::textStream() } else { - return *static_cast<QTextStream *>(0); + return *static_cast<TQTextStream *>(0); } } -QDataStream &KSaver::dataStream() +TQDataStream &KSaver::dataStream() { if(d->dataStream) { @@ -172,7 +172,7 @@ QDataStream &KSaver::dataStream() } else if(d->isLocal && d->file) { - d->dataStream = new QDataStream(d->file); + d->dataStream = new TQDataStream(d->file); return *d->dataStream; } else if(!d->isLocal && d->tempFile) @@ -182,6 +182,6 @@ QDataStream &KSaver::dataStream() } else { - return *static_cast<QDataStream *>(0); + return *static_cast<TQDataStream *>(0); } } diff --git a/kiten/ksaver.h b/kiten/ksaver.h index b4ebb890..8c73f7c1 100644 --- a/kiten/ksaver.h +++ b/kiten/ksaver.h @@ -24,7 +24,7 @@ #ifndef KSAVER_H #define KSAVER_H -#include <qfile.h> +#include <tqfile.h> /** * KSaver provides a way to save files in the most efficient way for @@ -35,7 +35,7 @@ class KSaver public: /** * The constructor takes the url and decides the best way to save, - * which will mean using something like KIO::NetAccess or QFile. + * which will mean using something like KIO::NetAccess or TQFile. */ KSaver(const KURL &_target); @@ -62,29 +62,29 @@ public: * If open or close returns false, there was an error, and error * returns what the error was, when available. */ - QString error(void); + TQString error(void); /** - * file returns a QFile open for writing, which may be for a temporary + * file returns a TQFile open for writing, which may be for a temporary * file on the local filesystem. * * If this is called before the file is opened, you will crash. */ - QFile &file(void); + TQFile &file(void); /** * You can use this to write out your data. * * If this is called before the file is opened, you will crash. */ - QTextStream &textStream(void); + TQTextStream &textStream(void); /** * You can use this to write out your data. * * If this is called before the file is opened, you will crash. */ - QDataStream &dataStream(void); + TQDataStream &dataStream(void); private: class KSaverPrivate; KSaverPrivate *d; diff --git a/kiten/learn.cpp b/kiten/learn.cpp index 30744142..02b21618 100644 --- a/kiten/learn.cpp +++ b/kiten/learn.cpp @@ -29,12 +29,12 @@ #include <kpushbutton.h> #include <kstatusbar.h> #include <kstringhandler.h> -#include <qbuttongroup.h> -#include <qheader.h> -#include <qlayout.h> -#include <qtabwidget.h> -#include <qtimer.h> -#include <qtextcodec.h> +#include <tqbuttongroup.h> +#include <tqheader.h> +#include <tqlayout.h> +#include <tqtabwidget.h> +#include <tqtimer.h> +#include <tqtextcodec.h> #include <stdlib.h> // RAND_MAX #include <cassert> @@ -46,12 +46,12 @@ #include "ksaver.h" #include "learn.h" -LearnItem::LearnItem(QListView *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) +LearnItem::LearnItem(TQListView *parent, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8) + : TQListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { } -int LearnItem::compare(QListViewItem *item, int col, bool ascending) const +int LearnItem::compare(TQListViewItem *item, int col, bool ascending) const { // "Returns < 0 if this item is less than i [item] , 0 if they // are equal and > 0 if this item is greater than i [item]." @@ -60,28 +60,28 @@ int LearnItem::compare(QListViewItem *item, int col, bool ascending) const const int Learn::numberOfAnswers = 5; -Learn::Learn(Dict::Index *parentDict, QWidget *parent, const char *name) +Learn::Learn(Dict::Index *parentDict, TQWidget *parent, const char *name) : KMainWindow(parent, name), initialized(false), isMod(false), prevItem(0), curItem(0) { index = parentDict; - QWidget *dummy = new QWidget(this); + TQWidget *dummy = new TQWidget(this); setCentralWidget(dummy); - QVBoxLayout *veryTop = new QVBoxLayout(dummy, 0, KDialog::spacingHint()); - Tabs = new QTabWidget(dummy); - connect(Tabs, SIGNAL(currentChanged(QWidget *)), SLOT(tabChanged(QWidget *))); + TQVBoxLayout *veryTop = new TQVBoxLayout(dummy, 0, KDialog::spacingHint()); + Tabs = new TQTabWidget(dummy); + connect(Tabs, TQT_SIGNAL(currentChanged(TQWidget *)), TQT_SLOT(tabChanged(TQWidget *))); veryTop->addWidget(Tabs); - listTop = new QSplitter(Tabs); + listTop = new TQSplitter(Tabs); listTop->setOrientation(Qt::Vertical); - quizTop = new QWidget(Tabs); + quizTop = new TQWidget(Tabs); Tabs->addTab(listTop, i18n("&List")); Tabs->addTab(quizTop, i18n("&Quiz")); View = new ResultView(true, listTop, "View"); View->setBasicMode(true); - connect(View, SIGNAL(linkClicked(const QString &)), this, SIGNAL(linkClicked(const QString &))); + connect(View, TQT_SIGNAL(linkClicked(const TQString &)), this, TQT_SIGNAL(linkClicked(const TQString &))); List = new KListView(listTop); @@ -92,19 +92,19 @@ Learn::Learn(Dict::Index *parentDict, QWidget *parent, const char *name) List->addColumn(i18n("Your Score")); List->setAllColumnsShowFocus(true); - List->setColumnWidthMode(0, QListView::Maximum); - List->setColumnWidthMode(1, QListView::Maximum); - List->setColumnWidthMode(2, QListView::Maximum); - List->setColumnWidthMode(3, QListView::Maximum); + List->setColumnWidthMode(0, TQListView::Maximum); + List->setColumnWidthMode(1, TQListView::Maximum); + List->setColumnWidthMode(2, TQListView::Maximum); + List->setColumnWidthMode(3, TQListView::Maximum); List->setMultiSelection(true); List->setDragEnabled(true); List->setSorting(4); List->setSelectionModeExt(KListView::Extended); - connect(List, SIGNAL(executed(QListViewItem *)), SLOT(showKanji(QListViewItem *))); - connect(List, SIGNAL(selectionChanged()), this, SLOT(itemSelectionChanged())); + connect(List, TQT_SIGNAL(executed(TQListViewItem *)), TQT_SLOT(showKanji(TQListViewItem *))); + connect(List, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(itemSelectionChanged())); - QStringList grades(i18n("Grade 1")); + TQStringList grades(i18n("Grade 1")); grades.append(i18n("Grade 2")); grades.append(i18n("Grade 3")); grades.append(i18n("Grade 4")); @@ -113,45 +113,45 @@ Learn::Learn(Dict::Index *parentDict, QWidget *parent, const char *name) grades.append(i18n("Others in Jouyou")); grades.append(i18n("Jinmeiyou")); - /*KAction *closeAction = */(void) KStdAction::close(this, SLOT(close()), actionCollection()); - printAct = KStdAction::print(this, SLOT(print()), actionCollection()); - forwardAct = KStdAction::forward(this, SLOT(next()), actionCollection()); + /*KAction *closeAction = */(void) KStdAction::close(this, TQT_SLOT(close()), actionCollection()); + printAct = KStdAction::print(this, TQT_SLOT(print()), actionCollection()); + forwardAct = KStdAction::forward(this, TQT_SLOT(next()), actionCollection()); forwardAct->plug(toolBar()); - backAct = KStdAction::back(this, SLOT(prev()), actionCollection()); + backAct = KStdAction::back(this, TQT_SLOT(prev()), actionCollection()); backAct->plug(toolBar()); - cheatAct = new KAction(i18n("&Cheat"), CTRL + Key_C, this, SLOT(cheat()), actionCollection(), "cheat"); - randomAct = new KAction(i18n("&Random"), "goto", CTRL + Key_R, this, SLOT(random()), actionCollection(), "random"); + cheatAct = new KAction(i18n("&Cheat"), CTRL + Key_C, this, TQT_SLOT(cheat()), actionCollection(), "cheat"); + randomAct = new KAction(i18n("&Random"), "goto", CTRL + Key_R, this, TQT_SLOT(random()), actionCollection(), "random"); gradeAct = new KListAction(i18n("Grade"), 0, 0, 0, actionCollection(), "grade"); gradeAct->setItems(grades); - connect(gradeAct, SIGNAL(activated(const QString&)), SLOT(updateGrade())); - removeAct = new KAction(i18n("&Delete"), "edit_remove", CTRL + Key_X, this, SLOT(del()), actionCollection(), "del"); - addAct = new KAction(i18n("&Add"), "edit_add", CTRL + Key_A, this, SLOT(add()), actionCollection(), "add"); - addAllAct = new KAction(i18n("Add A&ll"), 0, this, SLOT(addAll()), actionCollection(), "addall"); - newAct = KStdAction::openNew(this, SLOT(openNew()), actionCollection()); - openAct = KStdAction::open(this, SLOT(open()), actionCollection()); - saveAct = KStdAction::save(this, SLOT(save()), actionCollection()); - saveAsAct = KStdAction::saveAs(this, SLOT(saveAs()), actionCollection()); - (void) KStdAction::preferences(this, SIGNAL(configureLearn()), actionCollection()); + connect(gradeAct, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(updateGrade())); + removeAct = new KAction(i18n("&Delete"), "edit_remove", CTRL + Key_X, this, TQT_SLOT(del()), actionCollection(), "del"); + addAct = new KAction(i18n("&Add"), "edit_add", CTRL + Key_A, this, TQT_SLOT(add()), actionCollection(), "add"); + addAllAct = new KAction(i18n("Add A&ll"), 0, this, TQT_SLOT(addAll()), actionCollection(), "addall"); + newAct = KStdAction::openNew(this, TQT_SLOT(openNew()), actionCollection()); + openAct = KStdAction::open(this, TQT_SLOT(open()), actionCollection()); + saveAct = KStdAction::save(this, TQT_SLOT(save()), actionCollection()); + saveAsAct = KStdAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection()); + (void) KStdAction::preferences(this, TQT_SIGNAL(configureLearn()), actionCollection()); removeAct->setEnabled(false); - QVBoxLayout *quizLayout = new QVBoxLayout(quizTop, KDialog::marginHint(), KDialog::spacingHint()); + TQVBoxLayout *quizLayout = new TQVBoxLayout(quizTop, KDialog::marginHint(), KDialog::spacingHint()); quizLayout->addStretch(); - QHBoxLayout *hlayout = new QHBoxLayout(quizLayout); - qKanji = new QPushButton(quizTop); - connect(qKanji, SIGNAL(clicked()), this, SLOT(qKanjiClicked())); + TQHBoxLayout *hlayout = new TQHBoxLayout(quizLayout); + qKanji = new TQPushButton(quizTop); + connect(qKanji, TQT_SIGNAL(clicked()), this, TQT_SLOT(qKanjiClicked())); hlayout->addStretch(); hlayout->addWidget(qKanji); hlayout->addStretch(); quizLayout->addStretch(); - answers = new QButtonGroup(1, Horizontal, quizTop); + answers = new TQButtonGroup(1, Horizontal, quizTop); for (int i = 0; i < numberOfAnswers; ++i) answers->insert(new KPushButton(answers), i); quizLayout->addWidget(answers); quizLayout->addStretch(); - connect(answers, SIGNAL(clicked(int)), this, SLOT(answerClicked(int))); + connect(answers, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(answerClicked(int))); createGUI("learnui.rc"); //closeAction->plug(toolBar()); @@ -164,7 +164,7 @@ Learn::Learn(Dict::Index *parentDict, QWidget *parent, const char *name) nogood = false; // this is so learn doesn't take so long to show itself - QTimer::singleShot(200, this, SLOT(finishCtor())); + TQTimer::singleShot(200, this, TQT_SLOT(finishCtor())); } void Learn::finishCtor() @@ -181,7 +181,7 @@ void Learn::finishCtor() updateGrade(); updateQuizConfiguration(); // first - QString entry = config->lastFile(); + TQString entry = config->lastFile(); //kdDebug() << "lastFile: " << entry << endl; if (!entry.isEmpty()) { @@ -296,12 +296,12 @@ void Learn::update() // now show some compounds in which this kanji appears - QString kanji = curKanji.kanji(); + TQString kanji = curKanji.kanji(); - Dict::SearchResult compounds = index->search(QRegExp(kanji), kanji, true); + Dict::SearchResult compounds = index->search(TQRegExp(kanji), kanji, true); View->addHeader(i18n("%1 in compounds").arg(kanji)); - for (QValueListIterator<Dict::Entry> it = compounds.list.begin(); it != compounds.list.end(); ++it) + for (TQValueListIterator<Dict::Entry> it = compounds.list.begin(); it != compounds.list.end(); ++it) { kapp->processEvents(); View->addResult(*it, true); @@ -314,10 +314,10 @@ void Learn::updateGrade() { int grade = getCurrentGrade(); - QString regexp("G%1 "); + TQString regexp("G%1 "); regexp = regexp.arg(grade); - Dict::SearchResult result = index->searchKanji(QRegExp(regexp), regexp, false); + Dict::SearchResult result = index->searchKanji(TQRegExp(regexp), regexp, false); list = result.list; statusBar()->message(i18n("%1 entries in grade %2").arg(list.count()).arg(grade)); @@ -340,18 +340,18 @@ void Learn::read(const KURL &url) return; } - QTextCodec &codec = *QTextCodec::codecForName("eucJP"); - QTextStream &stream = loader.textStream(); + TQTextCodec &codec = *TQTextCodec::codecForName("eucJP"); + TQTextStream &stream = loader.textStream(); stream.setCodec(&codec); while (!stream.atEnd()) { - QChar kanji; + TQChar kanji; stream >> kanji; // ignore whitespace if (!kanji.isSpace()) { - QRegExp regexp ( QString("^%1\\W").arg(kanji) ); + TQRegExp regexp ( TQString("^%1\\W").arg(kanji) ); Dict::SearchResult res = index->searchKanji(regexp, kanji, false); Dict::Entry first = Dict::firstEntry(res); if (first.extendedKanjiInfo()) @@ -368,7 +368,7 @@ void Learn::open() return; KURL prevname = filename; - filename = KFileDialog::getOpenURL(QString::null, "*.kiten"); + filename = KFileDialog::getOpenURL(TQString::null, "*.kiten"); if (filename.isEmpty()) { filename = prevname; @@ -407,7 +407,7 @@ void Learn::openNew() void Learn::saveAs() { KURL prevname = filename; - filename = KFileDialog::getSaveURL(QString::null, "*.kiten"); + filename = KFileDialog::getSaveURL(TQString::null, "*.kiten"); if (filename.isEmpty()) { filename = prevname; @@ -439,11 +439,11 @@ void Learn::write(const KURL &url) return; } - QTextCodec &codec = *QTextCodec::codecForName("eucJP"); - QTextStream &stream = saver.textStream(); + TQTextCodec &codec = *TQTextCodec::codecForName("eucJP"); + TQTextStream &stream = saver.textStream(); stream.setCodec(&codec); - for (QListViewItemIterator it(List); it.current(); ++it) + for (TQListViewItemIterator it(List); it.current(); ++it) stream << it.current()->text(0).at(0); if (!saver.close()) @@ -463,7 +463,7 @@ void Learn::saveScores() { KConfig &config = *Config::self()->config(); config.setGroup("Learn Scores"); - for (QListViewItemIterator it(List); it.current(); ++it) + for (TQListViewItemIterator it(List); it.current(); ++it) config.writeEntry(it.current()->text(0), it.current()->text(4).toInt()); config.sync(); Config::self()->writeConfig(); @@ -472,16 +472,16 @@ void Learn::saveScores() void Learn::add(Dict::Entry toAdd, bool noEmit) { // Remove peripheral readings: This is a study mode, not a reference mode - QRegExp inNames (",\\s*[A-Za-z ]+:.*"); - QString readings = Dict::prettyKanjiReading(toAdd.readings()).replace(inNames, ""); - QString meanings = shortenString(Dict::prettyMeaning(toAdd.meanings()).replace(inNames, "")); - QString kanji = toAdd.kanji(); + TQRegExp inNames (",\\s*[A-Za-z ]+:.*"); + TQString readings = Dict::prettyKanjiReading(toAdd.readings()).replace(inNames, ""); + TQString meanings = shortenString(Dict::prettyMeaning(toAdd.meanings()).replace(inNames, "")); + TQString kanji = toAdd.kanji(); // here's a dirty rotten cheat (well, not really) // noEmit always means it's not added by the user, so this check isn't needed if (!noEmit) { - for (QListViewItemIterator it(List); it.current(); ++it) + for (TQListViewItemIterator it(List); it.current(); ++it) { if (it.current()->text(0) == kanji) { @@ -499,7 +499,7 @@ void Learn::add(Dict::Entry toAdd, bool noEmit) score = config.readNumEntry(kanji, score); unsigned int grade = toAdd.grade(); - addItem(new LearnItem(List, kanji, meanings, readings, QString::number(grade), QString::number(score)), noEmit); + addItem(new LearnItem(List, kanji, meanings, readings, TQString::number(grade), TQString::number(score)), noEmit); numChanged(); } @@ -514,11 +514,11 @@ void Learn::addAll() { int grade = getCurrentGrade(); - QString regexp("G%1 "); + TQString regexp("G%1 "); regexp = regexp.arg(grade); - Dict::SearchResult result = index->searchKanji(QRegExp(regexp), regexp, false); - for (QValueListIterator<Dict::Entry> i = result.list.begin(); i != result.list.end(); ++i) + Dict::SearchResult result = index->searchKanji(TQRegExp(regexp), regexp, false); + for (TQValueListIterator<Dict::Entry> i = result.list.begin(); i != result.list.end(); ++i) { // don't add headers if ((*i).dictName() == "__NOTSET" && (*i).header() == "__NOTSET") @@ -526,7 +526,7 @@ void Learn::addAll() } } -void Learn::addItem(QListViewItem *item, bool noEmit) +void Learn::addItem(TQListViewItem *item, bool noEmit) { // 2 is the magic jump if (List->childCount() == 2) @@ -545,11 +545,11 @@ void Learn::addItem(QListViewItem *item, bool noEmit) } } -void Learn::showKanji(QListViewItem *item) +void Learn::showKanji(TQListViewItem *item) { assert(item); - QString kanji(item->text(0)); + TQString kanji(item->text(0)); int grade = item->text(3).toUInt(); if (getCurrentGrade() != grade) @@ -575,12 +575,12 @@ void Learn::del() } else // setup page { - QPtrList<QListViewItem> selected = List->selectedItems(); + TQPtrList<TQListViewItem> selected = List->selectedItems(); assert(selected.count()); bool makenewq = false; // must make new quiz if we // delete the current item - for (QPtrListIterator<QListViewItem> i(selected); *i; ++i) + for (TQPtrListIterator<TQListViewItem> i(selected); *i; ++i) { if (curItem == i) makenewq = true; @@ -607,14 +607,14 @@ void Learn::del() void Learn::print() { View->clear(); - View->addHeader(QString("<h1>%1</h1>").arg(i18n("Learning List")), 1); + View->addHeader(TQString("<h1>%1</h1>").arg(i18n("Learning List")), 1); - QListViewItemIterator it(List); + TQListViewItemIterator it(List); for (; it.current(); ++it) { - QString kanji = it.current()->text(0); - Dict::SearchResult result = index->searchKanji(QRegExp(kanji), kanji, false); - for (QValueListIterator<Dict::Entry> i = result.list.begin(); i != result.list.end(); ++i) + TQString kanji = it.current()->text(0); + Dict::SearchResult result = index->searchKanji(TQRegExp(kanji), kanji, false); + for (TQValueListIterator<Dict::Entry> i = result.list.begin(); i != result.list.end(); ++i) { if ((*i).dictName() == "__NOTSET" && (*i).header() == "__NOTSET") { @@ -665,7 +665,7 @@ void Learn::answerClicked(int i) //config.writeEntry(curItem->text(0) + "_4", newscore); - QListViewItem *newItem = new LearnItem(List, curItem->text(0), curItem->text(1), curItem->text(2), curItem->text(3), QString::number(newscore)); + TQListViewItem *newItem = new LearnItem(List, curItem->text(0), curItem->text(1), curItem->text(2), curItem->text(3), TQString::number(newscore)); // readd, so it sorts // 20 November 2004: why?? why not List->sort() ?? @@ -677,9 +677,9 @@ void Learn::answerClicked(int i) qnew(); } -QString Learn::randomMeaning(QStringList &oldMeanings) +TQString Learn::randomMeaning(TQStringList &oldMeanings) { - QString meaning; + TQString meaning; do { @@ -717,14 +717,14 @@ QString Learn::randomMeaning(QStringList &oldMeanings) int max = (int) rand; - QListViewItemIterator it(List); + TQListViewItemIterator it(List); it += max; meaning = it.current()->text(guessOn); } //kdDebug() << "meaning: " << meaning << endl; - for (QStringList::Iterator it = oldMeanings.begin(); it != oldMeanings.end(); ++it) + for (TQStringList::Iterator it = oldMeanings.begin(); it != oldMeanings.end(); ++it) { //kdDebug() << "oldMeaning: " << *it << endl; } @@ -744,7 +744,7 @@ void Learn::qupdate() return; qKanji->setText(curItem->text(quizOn)); - QFont newFont = font(); + TQFont newFont = font(); if (quizOn == 0) newFont.setPixelSize(24); qKanji->setFont(newFont); @@ -753,7 +753,7 @@ void Learn::qupdate() float rand2 = RAND_MAX / rand; seikai = static_cast<int>(numberOfAnswers / rand2); - QStringList oldMeanings; + TQStringList oldMeanings; for (int i = 0; i < numberOfAnswers; ++i) answers->find(i)->setText(randomMeaning(oldMeanings)); @@ -762,7 +762,7 @@ void Learn::qupdate() struct Learn::scoreCompare { - bool operator()(const QListViewItem* v1, const QListViewItem* v2) + bool operator()(const TQListViewItem* v1, const TQListViewItem* v2) { return v1->text(4).toInt() < v2->text(4).toInt(); } @@ -774,7 +774,7 @@ void Learn::qnew() // new quiz kanji nogood = false; statusBar()->clear(); - statusBar()->message(QString("%1 %2 %3").arg(curItem->text(0)).arg(curItem->text(1)).arg(curItem->text(2))); + statusBar()->message(TQString("%1 %2 %3").arg(curItem->text(0)).arg(curItem->text(1)).arg(curItem->text(2))); backAct->setEnabled(true); @@ -797,14 +797,14 @@ void Learn::qnew() // new quiz kanji if (max > count) max = count; - std::multiset<const QListViewItem*, scoreCompare> scores; - QListViewItemIterator sIt(List); + std::multiset<const TQListViewItem*, scoreCompare> scores; + TQListViewItemIterator sIt(List); for (; sIt.current(); ++sIt) scores.insert(sIt.current()); - std::multiset<const QListViewItem*, scoreCompare>::iterator it = scores.begin(); - std::multiset<const QListViewItem*, scoreCompare>::iterator tmp = scores.begin(); + std::multiset<const TQListViewItem*, scoreCompare>::iterator it = scores.begin(); + std::multiset<const TQListViewItem*, scoreCompare>::iterator tmp = scores.begin(); int i; for (i = 2; i <= max; ++it) @@ -826,7 +826,7 @@ void Learn::qnew() // new quiz kanji } prevItem = curItem; - curItem = const_cast<QListViewItem*>(*it); + curItem = const_cast<TQListViewItem*>(*it); qKanji->setFocus(); qupdate(); @@ -839,12 +839,12 @@ void Learn::cheat() nogood = true; } -QString Learn::shortenString(const QString &thestring) +TQString Learn::shortenString(const TQString &thestring) { return KStringHandler::rsqueeze(thestring, 60).stripWhiteSpace(); } -void Learn::tabChanged(QWidget *widget) +void Learn::tabChanged(TQWidget *widget) { bool isQuiz = (widget == quizTop); diff --git a/kiten/learn.h b/kiten/learn.h index bd7a103a..340ece01 100644 --- a/kiten/learn.h +++ b/kiten/learn.h @@ -22,7 +22,7 @@ #ifndef LEARN_H #define LEARN_H -#include <qlistview.h> +#include <tqlistview.h> #include <kurl.h> @@ -39,8 +39,8 @@ class QTabWidget; class LearnItem : public QListViewItem { public: - LearnItem(QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null); - int compare(QListViewItem *item, int col, bool ascending) const; + LearnItem(TQListView *parent, TQString label1, TQString label2 = TQString::null, TQString label3 = TQString::null, TQString label4 = TQString::null, TQString label5 = TQString::null, TQString label6 = TQString::null, TQString label7 = TQString::null, TQString label8 = TQString::null); + int compare(TQListViewItem *item, int col, bool ascending) const; }; class Learn : public KMainWindow @@ -48,7 +48,7 @@ class Learn : public KMainWindow Q_OBJECT public: - Learn(Dict::Index *, QWidget *parent = 0, const char *name = 0); + Learn(Dict::Index *, TQWidget *parent = 0, const char *name = 0); ~Learn(); bool closeWindow(); @@ -57,11 +57,11 @@ class Learn : public KMainWindow signals: void destroyed(Learn *); - void linkClicked(const QString &); + void linkClicked(const TQString &); void configureLearn(); public slots: - void showKanji(QListViewItem *); + void showKanji(TQListViewItem *); void updateQuizConfiguration(); protected: @@ -81,7 +81,7 @@ class Learn : public KMainWindow void add(Dict::Entry, bool noEmit = false); void del(); void cheat(); - void tabChanged(QWidget *); + void tabChanged(TQWidget *); void itemSelectionChanged(); void save(); void saveAs(); @@ -107,13 +107,13 @@ class Learn : public KMainWindow KURL filename; bool warnClose(); - QTabWidget *Tabs; - QSplitter *listTop; - QWidget *quizTop; + TQTabWidget *Tabs; + TQSplitter *listTop; + TQWidget *quizTop; ResultView *View; - QValueList<Dict::Entry> list; - QValueListIterator<Dict::Entry> current; + TQValueList<Dict::Entry> list; + TQValueListIterator<Dict::Entry> current; Dict::Index *index; @@ -127,23 +127,23 @@ class Learn : public KMainWindow // Quiz, an app to itself in a tabwidget :) static const int numberOfAnswers; - QButtonGroup *answers; - QPushButton *qKanji; + TQButtonGroup *answers; + TQPushButton *qKanji; - QListViewItem *prevItem; - QListViewItem *curItem; + TQListViewItem *prevItem; + TQListViewItem *curItem; // if noEmit == true, don't emit dirty - void addItem(QListViewItem *, bool noEmit = false); + void addItem(TQListViewItem *, bool noEmit = false); void qupdate(); int seikai; bool nogood; - QString shortenString(const QString &); + TQString shortenString(const TQString &); // Creates a random meaning not on the lists and adds the meaning // to the list. - QString randomMeaning(QStringList &oldMeanings); + TQString randomMeaning(TQStringList &oldMeanings); KAction *forwardAct; KAction *printAct; diff --git a/kiten/main.cpp b/kiten/main.cpp index 91e8a23d..8d013d15 100644 --- a/kiten/main.cpp +++ b/kiten/main.cpp @@ -23,7 +23,7 @@ #include <kaboutdata.h> #include <kapplication.h> #include <kmainwindow.h> -#include <qsqlpropertymap.h> +#include <tqsqlpropertymap.h> #include "kiten.h" @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) KApplication a; // a.installKDEPropertyMap(); -// QSqlPropertyMap *map = QSqlPropertyMap::defaultMap(); +// TQSqlPropertyMap *map = TQSqlPropertyMap::defaultMap(); // map->insert("MyStringList", "value"); TopLevel *t = new TopLevel(); diff --git a/kiten/optiondialog.cpp b/kiten/optiondialog.cpp index 5ada2793..35c48b6e 100644 --- a/kiten/optiondialog.cpp +++ b/kiten/optiondialog.cpp @@ -21,34 +21,34 @@ #include <kdebug.h> #include <kapplication.h> -#include <qvgroupbox.h> +#include <tqvgroupbox.h> #include <kfontdialog.h> -#include <qtextcodec.h> +#include <tqtextcodec.h> #include <klocale.h> -#include <qcombobox.h> +#include <tqcombobox.h> #include <kfiledialog.h> #include <kstandarddirs.h> #include <kurllabel.h> #include <krun.h> -#include <qlayout.h> -#include <qcheckbox.h> -#include <qpushbutton.h> +#include <tqlayout.h> +#include <tqcheckbox.h> +#include <tqpushbutton.h> #include "optiondialog.h" #include "configfont.h" #include "configlearn.h" #include "configsearching.h" -ConfigureDialog::ConfigureDialog(QWidget *parent, const char *name) : KConfigDialog(parent, name, Config::self()) +ConfigureDialog::ConfigureDialog(TQWidget *parent, const char *name) : KConfigDialog(parent, name, Config::self()) { configDic = new ConfigDictionaries(0, "dictionaries_page"); - connect(configDic, SIGNAL(widgetChanged()), this, SLOT(updateButtons())); + connect(configDic, TQT_SIGNAL(widgetChanged()), this, TQT_SLOT(updateButtons())); addPage(configDic, i18n("Dictionaries"), "contents"); addPage(new ConfigSearching(0, "searching_page"), i18n("Searching"), "find"); addPage(new ConfigLearn(0, "learn_page"), i18n("Learn"), "pencil"); ConfigFont* configFont = new ConfigFont(0, "font_page"); - configFont->kcfg_font->setSampleText(i18n("Result View Font")+QString::fromUtf8(" - いろはにほへと 漢字")); + configFont->kcfg_font->setSampleText(i18n("Result View Font")+TQString::fromUtf8(" - いろはにほへと 漢字")); addPage(configFont, i18n("Font"), "fonts"); } diff --git a/kiten/optiondialog.h b/kiten/optiondialog.h index d3618081..fef3948a 100644 --- a/kiten/optiondialog.h +++ b/kiten/optiondialog.h @@ -42,7 +42,7 @@ class ConfigureDialog : public KConfigDialog { Q_OBJECT public: - ConfigureDialog(QWidget *parent=0, const char *name=0); + ConfigureDialog(TQWidget *parent=0, const char *name=0); ~ConfigureDialog(); signals: void settingsUpdated(); diff --git a/kiten/rad.cpp b/kiten/rad.cpp index 79986301..f3c31132 100644 --- a/kiten/rad.cpp +++ b/kiten/rad.cpp @@ -29,19 +29,19 @@ #include <kpushbutton.h> #include <kstandarddirs.h> -#include <qbuttongroup.h> -#include <qcheckbox.h> -#include <qfile.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qspinbox.h> -#include <qtextcodec.h> -#include <qtooltip.h> +#include <tqbuttongroup.h> +#include <tqcheckbox.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqspinbox.h> +#include <tqtextcodec.h> +#include <tqtooltip.h> #include "kitenconfig.h" #include "rad.h" -Rad::Rad() : QObject() +Rad::Rad() : TQObject() { loaded = false; } @@ -52,28 +52,28 @@ void Rad::load() return; KStandardDirs *dirs = KGlobal::dirs(); - QString radkfile = dirs->findResource("data", "kiten/radkfile"); + TQString radkfile = dirs->findResource("data", "kiten/radkfile"); if (radkfile.isNull()) { KMessageBox::error(0, i18n("Kanji radical information file not installed, so radical searching cannot be used.")); return; } - QFile f(radkfile); + TQFile f(radkfile); if (!f.open(IO_ReadOnly)) { KMessageBox::error(0, i18n("Kanji radical information could not be loaded, so radical searching cannot be used.")); } - QTextStream t(&f); - t.setCodec(QTextCodec::codecForName("eucJP")); + TQTextStream t(&f); + t.setCodec(TQTextCodec::codecForName("eucJP")); Radical cur; while (!t.eof()) { - QString s = t.readLine(); + TQString s = t.readLine(); - QChar first = s.at(0); + TQChar first = s.at(0); if (first == '#') // comment! { // nothing @@ -86,7 +86,7 @@ void Rad::load() //first entry is trim(last 4 chars).. <rad><space><strokes> unsigned int strokes = s.right(2).toUInt(); - QString radical = QString(s.at(2)); + TQString radical = TQString(s.at(2)); cur = Radical(radical, strokes); } else // continuation @@ -104,13 +104,13 @@ void Rad::load() loaded = true; } -QStringList Rad::radByStrokes(unsigned int strokes) +TQStringList Rad::radByStrokes(unsigned int strokes) { load(); - QStringList ret; + TQStringList ret; bool hadOne = false; - QValueListIterator<Radical> it = list.begin(); + TQValueListIterator<Radical> it = list.begin(); do { @@ -129,49 +129,49 @@ QStringList Rad::radByStrokes(unsigned int strokes) return ret; } -QStringList Rad::kanjiByRad(const QString &text) +TQStringList Rad::kanjiByRad(const TQString &text) { //kdDebug() << "kanjiByRad, text is " << text << endl; load(); - QStringList ret; + TQStringList ret; - QValueListIterator<Radical> it; + TQValueListIterator<Radical> it; for (it = list.begin(); it != list.end() && (*it).radical() != text; ++it) { //kdDebug() << "kanjiByRad, looping, radical is " << (*it).radical() << endl; } - QString kanji = (*it).kanji(); + TQString kanji = (*it).kanji(); for (unsigned i = 0; i < kanji.length(); ++i) { //kdDebug() << "kanjiByRad, i is " << i << endl; - ret.append(QString(kanji.at(i))); + ret.append(TQString(kanji.at(i))); } return ret; } -QStringList Rad::kanjiByRad(const QStringList &list) +TQStringList Rad::kanjiByRad(const TQStringList &list) { //kdDebug() << "kanjiByRad (list version)\n"; - QStringList ret; - QValueList<QStringList> lists; + TQStringList ret; + TQValueList<TQStringList> lists; - for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { //kdDebug() << "loading radical " << *it << endl; lists.append(kanjiByRad(*it)); } - QStringList first = lists.first(); + TQStringList first = lists.first(); lists.pop_front(); - for (QStringList::Iterator kit = first.begin(); kit != first.end(); ++kit) + for (TQStringList::Iterator kit = first.begin(); kit != first.end(); ++kit) { //kdDebug() << "kit is " << *kit << endl; - QValueList<bool> outcomes; - for (QValueList<QStringList>::Iterator it = lists.begin(); it != lists.end(); ++it) + TQValueList<bool> outcomes; + for (TQValueList<TQStringList>::Iterator it = lists.begin(); it != lists.end(); ++it) { //kdDebug() << "looping through lists\n"; outcomes.append((*it).contains(*kit) > 0); @@ -192,21 +192,21 @@ QStringList Rad::kanjiByRad(const QStringList &list) return ret; } -Radical Rad::radByKanji(const QString &text) +Radical Rad::radByKanji(const TQString &text) { load(); - QString ret; + TQString ret; - QValueListIterator<Radical> it; + TQValueListIterator<Radical> it; for (it = list.end(); it != list.begin() && (*it).kanji().find(text) == -1; --it); return (*it); } -unsigned int Rad::strokesByRad(const QString &text) +unsigned int Rad::strokesByRad(const TQString &text) { load(); - QValueListIterator<Radical> it; + TQValueListIterator<Radical> it; for(it = list.begin(); it != list.end() && (*it).radical() != text; ++it); return (*it).strokes(); @@ -218,15 +218,15 @@ Rad::~Rad() /////////////////////////////////////////////// -RadWidget::RadWidget(Rad *_rad, QWidget *parent, const char *name) : QWidget(parent, name) +RadWidget::RadWidget(Rad *_rad, TQWidget *parent, const char *name) : TQWidget(parent, name) { hotlistNum = 3; rad = _rad; - QHBoxLayout *hlayout = new QHBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); - QVBoxLayout *vlayout = new QVBoxLayout(hlayout, KDialog::spacingHint()); + TQHBoxLayout *hlayout = new TQHBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + TQVBoxLayout *vlayout = new TQVBoxLayout(hlayout, KDialog::spacingHint()); - hotlistGroup = new QButtonGroup(1, Horizontal, i18n("Hotlist"), this); + hotlistGroup = new TQButtonGroup(1, Horizontal, i18n("Hotlist"), this); //hotlistGroup->setRadioButtonExclusive(true); vlayout->addWidget(hotlistGroup); @@ -244,56 +244,56 @@ RadWidget::RadWidget(Rad *_rad, QWidget *parent, const char *name) : QWidget(par hotlistGroup->insert(new KPushButton(*hotlist.at(i), hotlistGroup), i); } - connect(hotlistGroup, SIGNAL(clicked(int)), SLOT(hotlistClicked(int))); + connect(hotlistGroup, TQT_SIGNAL(clicked(int)), TQT_SLOT(hotlistClicked(int))); - QVBoxLayout *layout = new QVBoxLayout(vlayout, KDialog::spacingHint()); + TQVBoxLayout *layout = new TQVBoxLayout(vlayout, KDialog::spacingHint()); - totalStrokes = new QCheckBox(i18n("Search by total strokes"), this); - connect(totalStrokes, SIGNAL(clicked()), this, SLOT(totalClicked())); + totalStrokes = new TQCheckBox(i18n("Search by total strokes"), this); + connect(totalStrokes, TQT_SIGNAL(clicked()), this, TQT_SLOT(totalClicked())); layout->addWidget(totalStrokes); - QHBoxLayout *strokesLayout = new QHBoxLayout(layout, KDialog::spacingHint()); - totalSpin = new QSpinBox(1, 30, 1, this); + TQHBoxLayout *strokesLayout = new TQHBoxLayout(layout, KDialog::spacingHint()); + totalSpin = new TQSpinBox(1, 30, 1, this); strokesLayout->addWidget(totalSpin); strokesLayout->addStretch(); - totalErrLabel = new QLabel(i18n("+/-"), this); + totalErrLabel = new TQLabel(i18n("+/-"), this); strokesLayout->addWidget(totalErrLabel); - totalErrSpin = new QSpinBox(0, 15, 1, this); + totalErrSpin = new TQSpinBox(0, 15, 1, this); strokesLayout->addWidget(totalErrSpin); ok = new KPushButton(i18n("&Look Up"), this); ok->setEnabled(false); - connect(ok, SIGNAL(clicked()), SLOT(apply())); + connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(apply())); layout->addWidget(ok); cancel = new KPushButton( KStdGuiItem::cancel(), this ); - connect(cancel, SIGNAL(clicked()), SLOT(close())); + connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(close())); layout->addWidget(cancel); - QVBoxLayout *middlevLayout = new QVBoxLayout(hlayout, KDialog::spacingHint()); + TQVBoxLayout *middlevLayout = new TQVBoxLayout(hlayout, KDialog::spacingHint()); - strokesSpin = new QSpinBox(1, 17, 1, this); - QToolTip::add(strokesSpin, i18n("Show radicals having this number of strokes")); + strokesSpin = new TQSpinBox(1, 17, 1, this); + TQToolTip::add(strokesSpin, i18n("Show radicals having this number of strokes")); middlevLayout->addWidget(strokesSpin); List = new KListBox(this); middlevLayout->addWidget(List); - connect(List, SIGNAL(executed(QListBoxItem *)), this, SLOT(executed(QListBoxItem *))); - connect(strokesSpin, SIGNAL(valueChanged(int)), this, SLOT(updateList(int))); + connect(List, TQT_SIGNAL(executed(TQListBoxItem *)), this, TQT_SLOT(executed(TQListBoxItem *))); + connect(strokesSpin, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(updateList(int))); - QVBoxLayout *rightvlayout = new QVBoxLayout(hlayout, KDialog::spacingHint()); + TQVBoxLayout *rightvlayout = new TQVBoxLayout(hlayout, KDialog::spacingHint()); selectedList = new KListBox(this); rightvlayout->addWidget(selectedList); - connect(selectedList, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); + connect(selectedList, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(selectionChanged())); remove = new KPushButton(i18n("&Remove"), this); rightvlayout->addWidget(remove); - connect(remove, SIGNAL(clicked()), this, SLOT(removeSelected())); + connect(remove, TQT_SIGNAL(clicked()), this, TQT_SLOT(removeSelected())); remove->setEnabled(false); clear = new KPushButton(KStdGuiItem::clear(), this); rightvlayout->addWidget(clear); - connect(clear, SIGNAL(clicked()), this, SLOT(clearSelected())); + connect(clear, TQT_SIGNAL(clicked()), this, TQT_SLOT(clearSelected())); clear->setEnabled(false); setCaption(kapp->makeStdCaption(i18n("Radical Selector"))); @@ -322,7 +322,7 @@ void RadWidget::hotlistClicked(int num) addToSelected(*hotlist.at(num)); } -void RadWidget::executed(QListBoxItem *item) +void RadWidget::executed(TQListBoxItem *item) { addToSelected(item->text()); } @@ -353,12 +353,12 @@ void RadWidget::numChanged() clear->setEnabled(selectedList->count() > 0); } -void RadWidget::addRadical(const QString &radical) +void RadWidget::addRadical(const TQString &radical) { addToSelected(radical); } -void RadWidget::addToSelected(const QString &text) +void RadWidget::addToSelected(const TQString &text) { if (!text.isNull() && !selected.contains(text)) { @@ -396,7 +396,7 @@ void RadWidget::apply() config->setTotalStrokesErrorMargin(totalErrSpin->value()); config->setSearchByTotal(totalStrokes->isChecked()); - for (QStringList::Iterator it = selected.begin(); it != selected.end(); ++it) + for (TQStringList::Iterator it = selected.begin(); it != selected.end(); ++it) { if (hotlist.find(*it) == hotlist.end()) { @@ -421,13 +421,13 @@ void RadWidget::totalClicked() ////////////////////////////////////////////// -Radical::Radical(QString text, unsigned int strokes) +Radical::Radical(TQString text, unsigned int strokes) { _Radical = text; Strokes = strokes; } -void Radical::addKanji(const QString &text) +void Radical::addKanji(const TQString &text) { Kanji.append(text); } diff --git a/kiten/rad.h b/kiten/rad.h index bae2f8dc..2337d7c2 100644 --- a/kiten/rad.h +++ b/kiten/rad.h @@ -22,7 +22,7 @@ #ifndef RAD_H #define RAD_H -#include <qstringlist.h> +#include <tqstringlist.h> class Config; class QCheckBox; @@ -36,18 +36,18 @@ class QButtonGroup; class KDE_EXPORT Radical { public: - Radical(QString = QString::null, unsigned int = 0); + Radical(TQString = TQString::null, unsigned int = 0); - QString radical() { return _Radical; } + TQString radical() { return _Radical; } unsigned int strokes() { return Strokes; } - QString kanji() { return Kanji; } + TQString kanji() { return Kanji; } - void addKanji(const QString &); + void addKanji(const TQString &); private: - QString _Radical; + TQString _Radical; unsigned int Strokes; - QString Kanji; + TQString Kanji; }; class KDE_EXPORT Rad : public QObject @@ -58,16 +58,16 @@ class KDE_EXPORT Rad : public QObject Rad(); ~Rad(); - QStringList radByStrokes(unsigned int); - QStringList kanjiByRad(const QString &); - QStringList kanjiByRad(const QStringList &); - Radical radByKanji(const QString &); - unsigned int strokesByRad(const QString &); + TQStringList radByStrokes(unsigned int); + TQStringList kanjiByRad(const TQString &); + TQStringList kanjiByRad(const TQStringList &); + Radical radByKanji(const TQString &); + unsigned int strokesByRad(const TQString &); private: void load(); - QValueList<Radical> list; + TQValueList<Radical> list; bool loaded; }; @@ -76,15 +76,15 @@ class KDE_EXPORT RadWidget : public QWidget Q_OBJECT public: - RadWidget(Rad *, QWidget *parent = 0, const char *name = 0); + RadWidget(Rad *, TQWidget *parent = 0, const char *name = 0); ~RadWidget(); signals: // if totalStrokes == 0, then don't search by total strokes - void set(const QStringList &radical, unsigned int totalStrokes, unsigned int totalStrokesErr); + void set(const TQStringList &radical, unsigned int totalStrokes, unsigned int totalStrokesErr); public slots: - void addRadical(const QString &); + void addRadical(const TQString &); private slots: void updateList(int); @@ -92,30 +92,30 @@ class KDE_EXPORT RadWidget : public QWidget void totalClicked(void); void selectionChanged(); void hotlistClicked(int); - void addToSelected(const QString &); - void executed(QListBoxItem *); + void addToSelected(const TQString &); + void executed(TQListBoxItem *); void removeSelected(); void clearSelected(); private: - QSpinBox *strokesSpin; - QSpinBox *totalSpin; - QSpinBox *totalErrSpin; - QLabel *totalErrLabel; + TQSpinBox *strokesSpin; + TQSpinBox *totalSpin; + TQSpinBox *totalErrSpin; + TQLabel *totalErrLabel; KPushButton *ok; KPushButton *cancel; KPushButton *remove; KPushButton *clear; - QButtonGroup *hotlistGroup; - QCheckBox *totalStrokes; + TQButtonGroup *hotlistGroup; + TQCheckBox *totalStrokes; KListBox *List; KListBox *selectedList; - QStringList selected; + TQStringList selected; Rad *rad; unsigned int hotlistNum; - QStringList hotlist; + TQStringList hotlist; void numChanged(); }; diff --git a/kiten/widgets.cpp b/kiten/widgets.cpp index 989c777d..cfe4c18a 100644 --- a/kiten/widgets.cpp +++ b/kiten/widgets.cpp @@ -29,12 +29,12 @@ #include <kprocess.h> #include <kstandarddirs.h> #include <kstatusbar.h> -#include <qfileinfo.h> -#include <qpaintdevicemetrics.h> -#include <qpainter.h> -#include <qregexp.h> -#include <qsimplerichtext.h> -#include <qtextcodec.h> +#include <tqfileinfo.h> +#include <tqpaintdevicemetrics.h> +#include <tqpainter.h> +#include <tqregexp.h> +#include <tqsimplerichtext.h> +#include <tqtextcodec.h> #include <cassert> @@ -43,7 +43,7 @@ #include "kromajiedit.h" #include "widgets.h" -ResultView::ResultView(bool showLinks, QWidget *parent, const char *name) +ResultView::ResultView(bool showLinks, TQWidget *parent, const char *name) : KTextBrowser(parent, name) { setReadOnly(true); @@ -68,14 +68,14 @@ void ResultView::addResult(Dict::Entry result, bool common) return; } - QString html; + TQString html; if (result.kanaOnly()) - html = QString("<p><font size=\"+2\">%1</font> ").arg(result.firstReading()); + html = TQString("<p><font size=\"+2\">%1</font> ").arg(result.firstReading()); else - html = QString("<p><font size=\"+2\">%1</font>: %2 ").arg(putchars(result.kanji())).arg(result.firstReading()); + html = TQString("<p><font size=\"+2\">%1</font>: %2 ").arg(putchars(result.kanji())).arg(result.firstReading()); - QStringList::Iterator it; - QStringList Meanings = result.meanings(); + TQStringList::Iterator it; + TQStringList Meanings = result.meanings(); for (it = Meanings.begin(); it != Meanings.end(); ++it) { if ((*it).find("(P)") >= 0) @@ -84,7 +84,7 @@ void ResultView::addResult(Dict::Entry result, bool common) continue; else { - html += QString("<strong>") + i18n("Common") + QString("</strong> "); + html += TQString("<strong>") + i18n("Common") + TQString("</strong> "); } } else @@ -112,8 +112,8 @@ void ResultView::addKanjiResult(Dict::Entry result, bool common, Radical rad) return; } - QString html; - html = QString("<p><font size=\"+3\">%1</font>: %2 ").arg(putchars(result.kanji())); + TQString html; + html = TQString("<p><font size=\"+3\">%1</font>: %2 ").arg(putchars(result.kanji())); unsigned int freq = result.freq(); if (freq == 0) // does it have a frequency? @@ -125,8 +125,8 @@ void ResultView::addKanjiResult(Dict::Entry result, bool common, Radical rad) html += "<br />"; - QStringList::Iterator it; - QStringList Readings = result.readings(); + TQStringList::Iterator it; + TQStringList Readings = result.readings(); for (it = Readings.begin(); it != Readings.end(); ++it) { if ((*it) == "T1") @@ -158,7 +158,7 @@ void ResultView::addKanjiResult(Dict::Entry result, bool common, Radical rad) html += "<br />"; - QStringList Meanings = result.meanings(); + TQStringList Meanings = result.meanings(); for (it = Meanings.begin(); it != Meanings.end(); ++it) { html += (*it); @@ -189,30 +189,30 @@ void ResultView::addKanjiResult(Dict::Entry result, bool common, Radical rad) html.append(i18n(" Common Miscount: %1.").arg(result.miscount())); if (!!rad.radical()) - html.append(i18n(" Largest radical: %1, with %2 strokes.").arg(QString("<a href=\"__radical:%1\">%2</a>").arg(rad.radical()).arg(rad.radical())).arg(rad.strokes())); + html.append(i18n(" Largest radical: %1, with %2 strokes.").arg(TQString("<a href=\"__radical:%1\">%2</a>").arg(rad.radical()).arg(rad.radical())).arg(rad.strokes())); html += "</p>"; append(html); } -void ResultView::addHeader(const QString &header, unsigned int degree) +void ResultView::addHeader(const TQString &header, unsigned int degree) { - append(QString("<h%1>%2</h%3>").arg(degree).arg(header).arg(degree)); + append(TQString("<h%1>%2</h%3>").arg(degree).arg(header).arg(degree)); } -QString ResultView::putchars(const QString &text) +TQString ResultView::putchars(const TQString &text) { if (!links) return text; unsigned int len = text.length(); - QString ret; + TQString ret; for (unsigned i = 0; i < len; i++) { - if (Dict::textType(QString(text.at(i))) == Dict::Text_Kanji) - ret.append(QString("<a href=\"%1\">%1</a>").arg(text.at(i)).arg(text.at(i))); + if (Dict::textType(TQString(text.at(i))) == Dict::Text_Kanji) + ret.append(TQString("<a href=\"%1\">%1</a>").arg(text.at(i)).arg(text.at(i))); else ret.append(text.at(i)); } @@ -220,7 +220,7 @@ QString ResultView::putchars(const QString &text) return ret; } -void ResultView::append(const QString &text) +void ResultView::append(const TQString &text) { printText.append(text); } @@ -237,27 +237,27 @@ void ResultView::flush() ensureCursorVisible(); } -void ResultView::print(QString title) +void ResultView::print(TQString title) { KPrinter printer; printer.setFullPage(true); if (printer.setup(this, i18n("Print Japanese Reference"))) { - QPainter p(&printer); - QPaintDeviceMetrics metrics(p.device()); + TQPainter p(&printer); + TQPaintDeviceMetrics metrics(p.device()); int dpix = metrics.logicalDpiX(); int dpiy = metrics.logicalDpiY(); const int margin = 72; // pt - QRect body(dpix, dpiy, metrics.width() - margin * dpix / margin * 2, metrics.height() - margin * dpiy / margin * 2); + TQRect body(dpix, dpiy, metrics.width() - margin * dpix / margin * 2, metrics.height() - margin * dpiy / margin * 2); - QSimpleRichText richText(title.isNull()? printText : i18n("<h1>Search for \"%1\"</h1>").arg(title) + printText, font(), context(), styleSheet(), mimeSourceFactory(), body.height(), Qt::black, false); + TQSimpleRichText richText(title.isNull()? printText : i18n("<h1>Search for \"%1\"</h1>").arg(title) + printText, font(), context(), styleSheet(), mimeSourceFactory(), body.height(), Qt::black, false); richText.setWidth(&p, body.width()); - QRect view(body); + TQRect view(body); int page = 1; - QColorGroup goodColorGroup = QColorGroup(colorGroup()); - goodColorGroup.setColor(QColorGroup::Link, Qt::black); + TQColorGroup goodColorGroup = TQColorGroup(colorGroup()); + goodColorGroup.setColor(TQColorGroup::Link, Qt::black); do { @@ -265,10 +265,10 @@ void ResultView::print(QString title) view.moveBy(0, body.height()); p.translate(0, -body.height()); - QFont myFont(font()); + TQFont myFont(font()); myFont.setPointSize(9); p.setFont(myFont); - QString footer(QString("%1 - Kiten").arg(QString::number(page))); + TQString footer(TQString("%1 - Kiten").arg(TQString::number(page))); p.drawText(view.right() - p.fontMetrics().width(footer), view.bottom() + p.fontMetrics().ascent() + 5, footer); @@ -292,7 +292,7 @@ void ResultView::updateFont() ///////////////////////////////////////////////////// // nice EDICT dictionary editor -eEdit::eEdit(const QString &_filename, QWidget *parent, const char *name) +eEdit::eEdit(const TQString &_filename, TQWidget *parent, const char *name) : KMainWindow(parent, name) , filename(_filename) { @@ -310,18 +310,18 @@ eEdit::eEdit(const QString &_filename, QWidget *parent, const char *name) List->setRenameable(3); List->setAllColumnsShowFocus(true); - List->setColumnWidthMode(0, QListView::Maximum); - List->setColumnWidthMode(1, QListView::Maximum); - List->setColumnWidthMode(2, QListView::Maximum); - List->setColumnWidthMode(3, QListView::Maximum); + List->setColumnWidthMode(0, TQListView::Maximum); + List->setColumnWidthMode(1, TQListView::Maximum); + List->setColumnWidthMode(2, TQListView::Maximum); + List->setColumnWidthMode(3, TQListView::Maximum); List->setMultiSelection(true); List->setDragEnabled(true); - saveAct = KStdAction::save(this, SLOT(save()), actionCollection()); - removeAct = new KAction(i18n("&Delete"), "edit_remove", CTRL + Key_X, this, SLOT(del()), actionCollection(), "del"); - (void) new KAction(i18n("&Disable Dictionary"), 0, this, SLOT(disable()), actionCollection(), "disable"); - addAct = new KAction(i18n("&Add"), "edit_add", CTRL + Key_A, this, SLOT(add()), actionCollection(), "add"); - (void) KStdAction::close(this, SLOT(close()), actionCollection()); + saveAct = KStdAction::save(this, TQT_SLOT(save()), actionCollection()); + removeAct = new KAction(i18n("&Delete"), "edit_remove", CTRL + Key_X, this, TQT_SLOT(del()), actionCollection(), "del"); + (void) new KAction(i18n("&Disable Dictionary"), 0, this, TQT_SLOT(disable()), actionCollection(), "disable"); + addAct = new KAction(i18n("&Add"), "edit_add", CTRL + Key_A, this, TQT_SLOT(add()), actionCollection(), "add"); + (void) KStdAction::close(this, TQT_SLOT(close()), actionCollection()); createGUI("eeditui.rc"); //closeAction->plug(toolBar()); @@ -341,14 +341,14 @@ void eEdit::add() new KListViewItem(List); } -void eEdit::openFile(const QString &file) +void eEdit::openFile(const TQString &file) { - QFile f(file); + TQFile f(file); if (!f.open(IO_ReadOnly)) return; - QTextStream t(&f); - QString s; + TQTextStream t(&f); + TQString s; while (!t.eof()) { @@ -356,42 +356,42 @@ void eEdit::openFile(const QString &file) if (s.left(1) == "#" || s.isEmpty()) continue; Dict::Entry entry = Dict::parse(s); - QString meanings = Dict::prettyMeaning(entry.meanings()); - bool common = meanings.find(QString("(P)")) >= 0; - meanings.replace(QRegExp("; "), "/"); - meanings.replace(QRegExp("/\\(P\\)"), ""); - new QListViewItem(List, entry.kanji(), Dict::prettyKanjiReading(entry.readings()), meanings, common? i18n("yes") : i18n("no")); + TQString meanings = Dict::prettyMeaning(entry.meanings()); + bool common = meanings.find(TQString("(P)")) >= 0; + meanings.replace(TQRegExp("; "), "/"); + meanings.replace(TQRegExp("/\\(P\\)"), ""); + new TQListViewItem(List, entry.kanji(), Dict::prettyKanjiReading(entry.readings()), meanings, common? i18n("yes") : i18n("no")); } } void eEdit::save() { - QFile f(filename); + TQFile f(filename); if (!f.open(IO_WriteOnly)) return; - QTextStream t(&f); + TQTextStream t(&f); t << "# Generated by Kiten's EDICT editor" << endl << "# http://katzbrown.com/kiten" << endl << endl; - QListViewItemIterator it(List); + TQListViewItemIterator it(List); for (; it.current(); ++it) { - QString kanji = it.current()->text(0); - QString reading = it.current()->text(1); - QString text = kanji.isEmpty()? reading : kanji; + TQString kanji = it.current()->text(0); + TQString reading = it.current()->text(1); + TQString text = kanji.isEmpty()? reading : kanji; - QString meanings = it.current()->text(2); + TQString meanings = it.current()->text(2); if (meanings.right(1) != "/") meanings.append("/"); if (meanings.left(1) != "/") meanings.prepend("/"); - QString commonString = it.current()->text(3).lower(); + TQString commonString = it.current()->text(3).lower(); bool common = (commonString == "true" || commonString == "yes" || commonString == "1" || commonString == "common"); text.append(" "); if (!kanji.isEmpty()) - text.append(QString("[%1] ").arg(reading)); + text.append(TQString("[%1] ").arg(reading)); text.append(meanings); if (common) @@ -404,7 +404,7 @@ void eEdit::save() // find the index generator executable KProcess proc; - proc << KStandardDirs::findExe("kitengen") << filename << KGlobal::dirs()->saveLocation("data", "kiten/xjdx/", true) + QFileInfo(filename).baseName() + ".xjdx"; + proc << KStandardDirs::findExe("kitengen") << filename << KGlobal::dirs()->saveLocation("data", "kiten/xjdx/", true) + TQFileInfo(filename).baseName() + ".xjdx"; // TODO: put up a status dialog and event loop instead of blocking proc.start(KProcess::Block, KProcess::NoCommunication); @@ -414,20 +414,20 @@ void eEdit::save() void eEdit::disable() { - int result = KMessageBox::warningYesNo(this, i18n("Disabling your personal dictionary will delete its contents.\n\n(You can however always create your dictionary again.)"), QString::null, i18n("Disable"), KStdGuiItem::cancel(), "DisableAsk", true); + int result = KMessageBox::warningYesNo(this, i18n("Disabling your personal dictionary will delete its contents.\n\n(You can however always create your dictionary again.)"), TQString::null, i18n("Disable"), KStdGuiItem::cancel(), "DisableAsk", true); if (result == KMessageBox::No) return; - QFile::remove(filename); + TQFile::remove(filename); delete this; } void eEdit::del() { - QPtrList<QListViewItem> selected = List->selectedItems(); + TQPtrList<TQListViewItem> selected = List->selectedItems(); assert(selected.count()); - for(QPtrListIterator<QListViewItem> i(selected); *i; ++i) + for(TQPtrListIterator<TQListViewItem> i(selected); *i; ++i) delete *i; isMod = true; @@ -436,7 +436,7 @@ void eEdit::del() ///////////////////////////////////////////////////// // sorta taken from konqy -EditAction::EditAction(const QString& text, int accel, const QObject *receiver, const char *member, QObject* parent, const char* name) +EditAction::EditAction(const TQString& text, int accel, const TQObject *receiver, const char *member, TQObject* parent, const char* name) : KAction(text, accel, parent, name) { m_receiver = receiver; @@ -447,7 +447,7 @@ EditAction::~EditAction() { } -int EditAction::plug( QWidget *w, int index ) +int EditAction::plug( TQWidget *w, int index ) { // if ( !w->inherits( "KToolBar" ) ) // return -1; @@ -458,11 +458,11 @@ int EditAction::plug( QWidget *w, int index ) KRomajiEdit *comboBox = new KRomajiEdit(toolBar, "search edit"); toolBar->insertWidget( id, 70, comboBox, index ); - connect( comboBox, SIGNAL( returnPressed()), m_receiver, m_member ); + connect( comboBox, TQT_SIGNAL( returnPressed()), m_receiver, m_member ); addContainer(toolBar, id); - connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); + connect( toolBar, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( slotDestroyed() ) ); toolBar->setItemAutoSized( id, true ); @@ -470,12 +470,12 @@ int EditAction::plug( QWidget *w, int index ) emit plugged(); - //QWhatsThis::add( comboBox, whatsThis() ); + //TQWhatsThis::add( comboBox, whatsThis() ); return containerCount() - 1; } -void EditAction::unplug( QWidget *w ) +void EditAction::unplug( TQWidget *w ) { // if ( !w->inherits( "KToolBar" ) ) // return; @@ -496,17 +496,17 @@ void EditAction::clear() m_combo->setFocus(); } -void EditAction::insert(const QString &text) +void EditAction::insert(const TQString &text) { m_combo->insert(text); } -void EditAction::setText(const QString &text) +void EditAction::setText(const TQString &text) { m_combo->setText(text); } -QGuardedPtr<KLineEdit> EditAction::editor() +TQGuardedPtr<KLineEdit> EditAction::editor() { return m_combo; } diff --git a/kiten/widgets.h b/kiten/widgets.h index ab9b7725..82592bae 100644 --- a/kiten/widgets.h +++ b/kiten/widgets.h @@ -21,7 +21,7 @@ #ifndef KITEN_WIDGETS_H #define KITEN_WIDGETS_H -#include <qguardedptr.h> +#include <tqguardedptr.h> #include <kaction.h> #include <klineedit.h> @@ -39,16 +39,16 @@ class KDE_EXPORT ResultView : public KTextBrowser Q_OBJECT public: - ResultView(bool showLinks, QWidget *parent = 0, const char *name = 0); + ResultView(bool showLinks, TQWidget *parent = 0, const char *name = 0); void addResult(Dict::Entry result, bool common = false); void addKanjiResult(Dict::Entry, bool common = false, Radical = Radical()); - void addHeader(const QString &, unsigned int degree = 3); + void addHeader(const TQString &, unsigned int degree = 3); public slots: - void print(QString = QString::null); - void append(const QString &); + void print(TQString = TQString::null); + void append(const TQString &); void flush(); void clear(); void setBasicMode(bool yes) { basicMode = yes; } @@ -56,8 +56,8 @@ class KDE_EXPORT ResultView : public KTextBrowser void updateFont(); private: - QString putchars(const QString &); - QString printText; + TQString putchars(const TQString &); + TQString printText; bool links; bool basicMode; @@ -68,7 +68,7 @@ class KDE_EXPORT eEdit : public KMainWindow Q_OBJECT public: - eEdit(const QString &, QWidget *parent = 0, const char *name = 0); + eEdit(const TQString &, TQWidget *parent = 0, const char *name = 0); ~eEdit(); private slots: @@ -76,11 +76,11 @@ class KDE_EXPORT eEdit : public KMainWindow void save(); void del(); void disable(); - void openFile(const QString &); + void openFile(const TQString &); private: KListView *List; - QString filename; + TQString filename; KStatusBar *StatusBar; KAction *addAct; KAction *removeAct; @@ -92,20 +92,20 @@ class KDE_EXPORT EditAction : public KAction { Q_OBJECT public: - EditAction( const QString& text, int accel, const QObject *receiver, const char *member, QObject* parent, const char* name ); + EditAction( const TQString& text, int accel, const TQObject *receiver, const char *member, TQObject* parent, const char* name ); virtual ~EditAction(); - virtual int plug( QWidget *w, int index = -1 ); + virtual int plug( TQWidget *w, int index = -1 ); - virtual void unplug( QWidget *w ); + virtual void unplug( TQWidget *w ); - QString text() { return m_combo->text(); } - void setText(const QString &text); + TQString text() { return m_combo->text(); } + void setText(const TQString &text); - QGuardedPtr<KLineEdit> editor(); + TQGuardedPtr<KLineEdit> editor(); public slots: - void insert(const QString &); + void insert(const TQString &); // also sets focus to the lineedit widget void clear(); @@ -114,8 +114,8 @@ class KDE_EXPORT EditAction : public KAction void plugged(); private: - QGuardedPtr<KLineEdit> m_combo; - const QObject *m_receiver; + TQGuardedPtr<KLineEdit> m_combo; + const TQObject *m_receiver; const char *m_member; }; |