diff options
Diffstat (limited to 'tools/thesaurus/main.cc')
-rw-r--r-- | tools/thesaurus/main.cc | 338 |
1 files changed, 169 insertions, 169 deletions
diff --git a/tools/thesaurus/main.cc b/tools/thesaurus/main.cc index f12ed071..e7edffa7 100644 --- a/tools/thesaurus/main.cc +++ b/tools/thesaurus/main.cc @@ -33,7 +33,7 @@ TODO: -Maybe remove more uncommon words. However, the "polysemy/familiarity count" is sometimes very low for quite common word, e.g. "sky". --Fix "no mimesource" warning of QTextBrowser? Seems really harmless. +-Fix "no mimesource" warning of TQTextBrowser? Seems really harmless. NOT TODO: -Add part of speech information -- I think this would blow up the @@ -42,8 +42,8 @@ NOT TODO: #include "main.h" -#include <qfile.h> -#include <qtoolbutton.h> +#include <tqfile.h> +#include <tqtoolbutton.h> #include <kiconloader.h> #include <kfiledialog.h> #include <kdeversion.h> @@ -62,13 +62,13 @@ K_EXPORT_COMPONENT_FACTORY( libthesaurustool, ThesaurusFactory("thesaurus_tool") * Thesaurus * ***************************************************/ -Thesaurus::Thesaurus(QObject* parent, const char* name, const QStringList &) - : KDataTool(parent, name) +Thesaurus::Thesaurus(TQObject* tqparent, const char* name, const TQStringList &) + : KDataTool(tqparent, name) { - m_dialog = new KDialogBase(KJanusWidget::Plain, QString::null, + m_dialog = new KDialogBase(KJanusWidget::Plain, TQString(), KDialogBase::Help|KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok); - m_dialog->setHelp(QString::null, "thesaurus"); + m_dialog->setHelp(TQString(), "thesaurus"); m_dialog->resize(600, 400); m_config = new KConfig("kthesaurusrc"); @@ -85,110 +85,110 @@ Thesaurus::Thesaurus(QObject* parent, const char* name, const QStringList &) m_history_pos = 1; m_page = m_dialog->plainPage(); - QVBoxLayout *m_top_layout = new QVBoxLayout(m_page, KDialog::marginHint(), KDialog::spacingHint()); + TQVBoxLayout *m_top_layout = new TQVBoxLayout(m_page, KDialog::marginHint(), KDialog::spacingHint()); - QHBoxLayout *row1 = new QHBoxLayout(m_top_layout); + TQHBoxLayout *row1 = new TQHBoxLayout(m_top_layout); m_edit = new KHistoryCombo(m_page); - m_edit_label = new QLabel(m_edit, i18n("&Search for:"), m_page); + m_edit_label = new TQLabel(m_edit, i18n("&Search for:"), m_page); m_search = new KPushButton(i18n("S&earch"), m_page); - connect(m_search, SIGNAL(clicked()), - this, SLOT(slotFindTerm())); + connect(m_search, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotFindTerm())); row1->addWidget(m_edit_label, 0); row1->addWidget(m_edit, 1); row1->addWidget(m_search, 0); - m_back = new QToolButton(m_page); - m_back->setIconSet(BarIconSet(QString::fromLatin1("back"))); - QToolTip::add(m_back, i18n("Back")); + m_back = new TQToolButton(m_page); + m_back->setIconSet(BarIconSet(TQString::tqfromLatin1("back"))); + TQToolTip::add(m_back, i18n("Back")); row1->addWidget(m_back, 0); - m_forward = new QToolButton(m_page); - m_forward->setIconSet(BarIconSet(QString::fromLatin1("forward"))); - QToolTip::add(m_forward, i18n("Forward")); + m_forward = new TQToolButton(m_page); + m_forward->setIconSet(BarIconSet(TQString::tqfromLatin1("forward"))); + TQToolTip::add(m_forward, i18n("Forward")); row1->addWidget(m_forward, 0); m_lang = new KPushButton(i18n("Change Language..."), m_page); - connect(m_lang, SIGNAL(clicked()), this, SLOT(slotChangeLanguage())); + connect(m_lang, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotChangeLanguage())); row1->addWidget(m_lang, 0); - connect(m_back, SIGNAL(clicked()), this, SLOT(slotBack())); - connect(m_forward, SIGNAL(clicked()), this, SLOT(slotForward())); + connect(m_back, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBack())); + connect(m_forward, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotForward())); - m_tab = new QTabWidget(m_page); + m_tab = new TQTabWidget(m_page); m_top_layout->addWidget(m_tab); // // Thesaurus Tab // - vbox = new QVBox(m_tab); + vbox = new TQVBox(m_tab); m_tab->addTab(vbox, i18n("&Thesaurus")); vbox->setMargin(KDialog::marginHint()); vbox->setSpacing(KDialog::spacingHint()); - QHBox *hbox = new QHBox(vbox); + TQHBox *hbox = new TQHBox(vbox); hbox->setSpacing(KDialog::spacingHint()); - grpbox_syn = new QGroupBox( 1, Qt::Horizontal, i18n("Synonyms"), hbox); - m_thes_syn = new QListBox(grpbox_syn); + grpbox_syn = new TQGroupBox( 1, Qt::Horizontal, i18n("Synonyms"), hbox); + m_thes_syn = new TQListBox(grpbox_syn); - grpbox_hyper = new QGroupBox( 1, Qt::Horizontal, i18n("More General Words"), hbox); - m_thes_hyper = new QListBox(grpbox_hyper); + grpbox_hyper = new TQGroupBox( 1, Qt::Horizontal, i18n("More General Words"), hbox); + m_thes_hyper = new TQListBox(grpbox_hyper); - grpbox_hypo = new QGroupBox( 1, Qt::Horizontal, i18n("More Specific Words"), hbox); - m_thes_hypo = new QListBox(grpbox_hypo); + grpbox_hypo = new TQGroupBox( 1, Qt::Horizontal, i18n("More Specific Words"), hbox); + m_thes_hypo = new TQListBox(grpbox_hypo); // single click -- keep display unambiguous by removing other selections: - connect(m_thes_syn, SIGNAL(clicked(QListBoxItem *)), m_thes_hyper, SLOT(clearSelection())); - connect(m_thes_syn, SIGNAL(clicked(QListBoxItem *)), m_thes_hypo, SLOT(clearSelection())); - connect(m_thes_syn, SIGNAL(selectionChanged(QListBoxItem *)), - this, SLOT(slotSetReplaceTerm(QListBoxItem *))); + connect(m_thes_syn, TQT_SIGNAL(clicked(TQListBoxItem *)), m_thes_hyper, TQT_SLOT(clearSelection())); + connect(m_thes_syn, TQT_SIGNAL(clicked(TQListBoxItem *)), m_thes_hypo, TQT_SLOT(clearSelection())); + connect(m_thes_syn, TQT_SIGNAL(selectionChanged(TQListBoxItem *)), + this, TQT_SLOT(slotSetReplaceTerm(TQListBoxItem *))); - connect(m_thes_hyper, SIGNAL(clicked(QListBoxItem *)), m_thes_syn, SLOT(clearSelection())); - connect(m_thes_hyper, SIGNAL(clicked(QListBoxItem *)), m_thes_hypo, SLOT(clearSelection())); - connect(m_thes_hyper, SIGNAL(selectionChanged(QListBoxItem *)), - this, SLOT(slotSetReplaceTerm(QListBoxItem *))); + connect(m_thes_hyper, TQT_SIGNAL(clicked(TQListBoxItem *)), m_thes_syn, TQT_SLOT(clearSelection())); + connect(m_thes_hyper, TQT_SIGNAL(clicked(TQListBoxItem *)), m_thes_hypo, TQT_SLOT(clearSelection())); + connect(m_thes_hyper, TQT_SIGNAL(selectionChanged(TQListBoxItem *)), + this, TQT_SLOT(slotSetReplaceTerm(TQListBoxItem *))); - connect(m_thes_hypo, SIGNAL(clicked(QListBoxItem *)), m_thes_syn, SLOT(clearSelection())); - connect(m_thes_hypo, SIGNAL(clicked(QListBoxItem *)), m_thes_hyper, SLOT(clearSelection())); - connect(m_thes_hypo, SIGNAL(selectionChanged(QListBoxItem *)), - this, SLOT(slotSetReplaceTerm(QListBoxItem *))); + connect(m_thes_hypo, TQT_SIGNAL(clicked(TQListBoxItem *)), m_thes_syn, TQT_SLOT(clearSelection())); + connect(m_thes_hypo, TQT_SIGNAL(clicked(TQListBoxItem *)), m_thes_hyper, TQT_SLOT(clearSelection())); + connect(m_thes_hypo, TQT_SIGNAL(selectionChanged(TQListBoxItem *)), + this, TQT_SLOT(slotSetReplaceTerm(TQListBoxItem *))); // double click: - connect(m_thes_syn, SIGNAL(selected(const QString &)), - this, SLOT(slotFindTerm(const QString &))); - connect(m_thes_hyper, SIGNAL(selected(const QString &)), - this, SLOT(slotFindTerm(const QString &))); - connect(m_thes_hypo, SIGNAL(selected(const QString &)), - this, SLOT(slotFindTerm(const QString &))); + connect(m_thes_syn, TQT_SIGNAL(selected(const TQString &)), + this, TQT_SLOT(slotFindTerm(const TQString &))); + connect(m_thes_hyper, TQT_SIGNAL(selected(const TQString &)), + this, TQT_SLOT(slotFindTerm(const TQString &))); + connect(m_thes_hypo, TQT_SIGNAL(selected(const TQString &)), + this, TQT_SLOT(slotFindTerm(const TQString &))); // // WordNet Tab // - vbox2 = new QVBox(m_tab); + vbox2 = new TQVBox(m_tab); m_tab->addTab(vbox2, i18n("&WordNet")); vbox2->setMargin(KDialog::marginHint()); vbox2->setSpacing(KDialog::spacingHint()); - m_combobox = new QComboBox(vbox2); + m_combobox = new TQComboBox(vbox2); m_combobox->setEditable(false); - connect(m_combobox, SIGNAL(activated(int)), this, SLOT(slotFindTerm())); + connect(m_combobox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotFindTerm())); - m_resultbox = new QTextBrowser(vbox2); - m_resultbox->setTextFormat(Qt::RichText); + m_resultbox = new TQTextBrowser(vbox2); + m_resultbox->setTextFormat(TQt::RichText); // TODO?: m_resultbox->setMimeSourceFactory(...); to avoid warning - connect(m_resultbox, SIGNAL(linkClicked(const QString &)), - this, SLOT(slotFindTerm(const QString &))); + connect(m_resultbox, TQT_SIGNAL(linkClicked(const TQString &)), + this, TQT_SLOT(slotFindTerm(const TQString &))); // Connect for the history box m_edit->setTrapReturnKey(true); // Do not use Return as default key... - connect(m_edit, SIGNAL(returnPressed(const QString&)), this, SLOT(slotFindTerm(const QString&))); - connect(m_edit, SIGNAL(activated(int)), this, SLOT(slotGotoHistory(int))); + connect(m_edit, TQT_SIGNAL(returnPressed(const TQString&)), this, TQT_SLOT(slotFindTerm(const TQString&))); + connect(m_edit, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotGotoHistory(int))); - QHBoxLayout *row2 = new QHBoxLayout( m_top_layout ); - m_replace = new KLineEdit(m_page); - m_replace_label = new QLabel(m_replace, i18n("&Replace with:"), m_page); + TQHBoxLayout *row2 = new TQHBoxLayout( m_top_layout ); + m_tqreplace = new KLineEdit(m_page); + m_replace_label = new TQLabel(m_tqreplace, i18n("&Replace with:"), m_page); row2->addWidget(m_replace_label, 0); - row2->addWidget(m_replace, 1); + row2->addWidget(m_tqreplace, 1); // Set focus m_edit->setFocus(); @@ -200,19 +200,19 @@ Thesaurus::Thesaurus(QObject* parent, const char* name, const QStringList &) // calling the 'wn' binary m_wnproc = new KProcess; - connect(m_wnproc, SIGNAL(processExited(KProcess*)), this, SLOT(wnExited(KProcess*))); - connect(m_wnproc, SIGNAL(receivedStdout(KProcess*,char*,int)), - this, SLOT(receivedWnStdout(KProcess*, char*, int))); - connect(m_wnproc, SIGNAL(receivedStderr(KProcess*,char*,int)), - this, SLOT(receivedWnStderr(KProcess*, char*, int))); + connect(m_wnproc, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(wnExited(KProcess*))); + connect(m_wnproc, TQT_SIGNAL(receivedStdout(KProcess*,char*,int)), + this, TQT_SLOT(receivedWnStdout(KProcess*, char*, int))); + connect(m_wnproc, TQT_SIGNAL(receivedStderr(KProcess*,char*,int)), + this, TQT_SLOT(receivedWnStderr(KProcess*, char*, int))); // grep'ing the text file m_thesproc = new KProcess; - connect(m_thesproc, SIGNAL(processExited(KProcess*)), this, SLOT(thesExited(KProcess*))); - connect(m_thesproc, SIGNAL(receivedStdout(KProcess*,char*,int)), - this, SLOT(receivedThesStdout(KProcess*, char*, int))); - connect(m_thesproc, SIGNAL(receivedStderr(KProcess*,char*,int)), - this, SLOT(receivedThesStderr(KProcess*, char*, int))); + connect(m_thesproc, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(thesExited(KProcess*))); + connect(m_thesproc, TQT_SIGNAL(receivedStdout(KProcess*,char*,int)), + this, TQT_SLOT(receivedThesStdout(KProcess*, char*, int))); + connect(m_thesproc, TQT_SIGNAL(receivedStderr(KProcess*,char*,int)), + this, TQT_SLOT(receivedThesStderr(KProcess*, char*, int))); } @@ -225,19 +225,19 @@ Thesaurus::~Thesaurus() // FIXME?: this hopefully fixes the problem of a wrong cursor // and a crash (when closing e.g. konqueror) when the thesaurus dialog // gets close while it was still working and showing the wait cursor - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); delete m_thesproc; delete m_wnproc; delete m_dialog; } -bool Thesaurus::run(const QString& command, void* data, const QString& datatype, const QString& mimetype) +bool Thesaurus::run(const TQString& command, void* data, const TQString& datatype, const TQString& mimetype) { // Check whether we can accept the data - if ( datatype != "QString" ) { - kdDebug(31000) << "Thesaurus only accepts datatype QString" << endl; + if ( datatype != TQSTRING_OBJECT_NAME_STRING ) { + kdDebug(31000) << "Thesaurus only accepts datatype TQString" << endl; return FALSE; } if ( mimetype != "text/plain" ) { @@ -255,7 +255,7 @@ bool Thesaurus::run(const QString& command, void* data, const QString& datatype, m_replacement = false; m_dialog->showButtonOK(false); m_dialog->setButtonCancelText(i18n("&Close")); - m_replace->setEnabled(false); + m_tqreplace->setEnabled(false); m_replace_label->setEnabled(false); } else { kdDebug(31000) << "Thesaurus does only accept the command 'thesaurus' or 'thesaurus_standalone'" << endl; @@ -264,9 +264,9 @@ bool Thesaurus::run(const QString& command, void* data, const QString& datatype, } // Get data and clean it up: - QString buffer = *((QString *)data); + TQString buffer = *((TQString *)data); buffer = buffer.stripWhiteSpace(); - QRegExp re("[.,;!?\"'()\\[\\]]"); + TQRegExp re("[.,;!?\"'()\\[\\]]"); buffer.remove(re); buffer = buffer.left(100); // limit maximum length @@ -280,8 +280,8 @@ bool Thesaurus::run(const QString& command, void* data, const QString& datatype, slotFindTerm(buffer); } - if( m_dialog->exec() == QDialog::Accepted ) { // "Replace" - *((QString*)data) = m_replace->text(); + if( m_dialog->exec() == TQDialog::Accepted ) { // "Replace" + *((TQString*)data) = m_tqreplace->text(); } return TRUE; @@ -290,7 +290,7 @@ bool Thesaurus::run(const QString& command, void* data, const QString& datatype, void Thesaurus::slotChangeLanguage() { - QString filename = KFileDialog::getOpenFileName( + TQString filename = KFileDialog::getOpenFileName( KGlobal::dirs()->findResourceDir("data", "thesaurus/")+"thesaurus/"); if( !filename.isNull() ) { m_data_file = filename; @@ -302,7 +302,7 @@ void Thesaurus::setCaption() { KURL url = KURL(); url.setPath(m_data_file); - m_dialog->setCaption(i18n("Related Words - %1").arg(url.fileName())); + m_dialog->setCaption(i18n("Related Words - %1").tqarg(url.fileName())); } // Enbale or disable back and forward button @@ -346,17 +346,17 @@ void Thesaurus::slotForward() } // Triggered when a word is selected in the list box. -void Thesaurus::slotSetReplaceTerm(QListBoxItem *item) +void Thesaurus::slotSetReplaceTerm(TQListBoxItem *item) { if( ! item ) return; - m_replace->setText(item->text()); + m_tqreplace->setText(item->text()); } -void Thesaurus::slotSetReplaceTerm(const QString &term) +void Thesaurus::slotSetReplaceTerm(const TQString &term) { if( m_replacement && term != m_no_match ) { - m_replace->setText(term); + m_tqreplace->setText(term); } } @@ -367,7 +367,7 @@ void Thesaurus::slotFindTerm() } // Triggered when a word is clicked / a list item is double-clicked. -void Thesaurus::slotFindTerm(const QString &term, bool add_to_history) +void Thesaurus::slotFindTerm(const TQString &term, bool add_to_history) { slotSetReplaceTerm(term); if( term.startsWith("http://") ) { @@ -383,7 +383,7 @@ void Thesaurus::slotFindTerm(const QString &term, bool add_to_history) } } -void Thesaurus::findTerm(const QString &term) +void Thesaurus::findTerm(const TQString &term) { findTermThesaurus(term); findTermWordnet(term); @@ -393,31 +393,31 @@ void Thesaurus::findTerm(const QString &term) // // Thesaurus // -void Thesaurus::findTermThesaurus(const QString &term) +void Thesaurus::findTermThesaurus(const TQString &term) { - if( !QFile::exists(m_data_file) ) { + if( !TQFile::exists(m_data_file) ) { KMessageBox::error(0, i18n("The thesaurus file '%1' was not found. " "Please use 'Change Language...' to select a thesaurus file."). arg(m_data_file)); return; } - QApplication::setOverrideCursor(KCursor::waitCursor()); + TQApplication::setOverrideCursor(KCursor::waitCursor()); m_thesproc_stdout = ""; m_thesproc_stderr = ""; // Find only whole words. Looks clumsy, but this way we don't have to rely on // features that might only be in certain versions of grep: - QString term_tmp = ";" + term.stripWhiteSpace() + ";"; + TQString term_tmp = ";" + term.stripWhiteSpace() + ";"; m_thesproc->clearArguments(); *m_thesproc << "grep" << "-i" << term_tmp; *m_thesproc << m_data_file; if( !m_thesproc->start(KProcess::NotifyOnExit, KProcess::AllOutput) ) { KMessageBox::error(0, i18n("Failed to execute grep.")); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return; } } @@ -429,49 +429,49 @@ void Thesaurus::thesExited(KProcess *) if( !m_thesproc_stderr.isEmpty() ) { KMessageBox::error(0, i18n("<b>Error:</b> Failed to execute grep. " - "Output:<br>%1").arg(m_thesproc_stderr)); - QApplication::restoreOverrideCursor(); + "Output:<br>%1").tqarg(m_thesproc_stderr)); + TQApplication::restoreOverrideCursor(); return; } - QString search_term = m_edit->currentText().stripWhiteSpace(); + TQString search_term = m_edit->currentText().stripWhiteSpace(); - QStringList syn; - QStringList hyper; - QStringList hypo; + TQStringList syn; + TQStringList hyper; + TQStringList hypo; - QStringList lines = lines.split(QChar('\n'), m_thesproc_stdout, false); - for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { - QString line = (*it); + TQStringList lines = lines.split(TQChar('\n'), m_thesproc_stdout, false); + for ( TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { + TQString line = (*it); if( line.startsWith(" ") ) { // ignore license (two spaces) continue; } - int sep_pos = line.find("#"); - QString syn_part = line.left(sep_pos); - QString hyper_part = line.right(line.length()-sep_pos-1); - QStringList syn_tmp = QStringList::split(QChar(';'), syn_part); - QStringList hyper_tmp = QStringList::split(QChar(';'), hyper_part); + int sep_pos = line.tqfind("#"); + TQString syn_part = line.left(sep_pos); + TQString hyper_part = line.right(line.length()-sep_pos-1); + TQStringList syn_tmp = TQStringList::split(TQChar(';'), syn_part); + TQStringList hyper_tmp = TQStringList::split(TQChar(';'), hyper_part); if( syn_tmp.grep(search_term, false).size() > 0 ) { // match on the left side of the '#' -- synonyms - for ( QStringList::Iterator it2 = syn_tmp.begin(); it2 != syn_tmp.end(); ++it2 ) { + for ( TQStringList::Iterator it2 = syn_tmp.begin(); it2 != syn_tmp.end(); ++it2 ) { // add if it's not the term itself and if it's not yet in the list - QString term = (*it2); - if( term.lower() != search_term.lower() && syn.contains(term) == 0 ) { + TQString term = (*it2); + if( term.lower() != search_term.lower() && syn.tqcontains(term) == 0 ) { syn.append(term); } } - for ( QStringList::Iterator it2 = hyper_tmp.begin(); it2 != hyper_tmp.end(); ++it2 ) { - QString term = (*it2); - if( term.lower() != search_term.lower() && hyper.contains(term) == 0 ) { + for ( TQStringList::Iterator it2 = hyper_tmp.begin(); it2 != hyper_tmp.end(); ++it2 ) { + TQString term = (*it2); + if( term.lower() != search_term.lower() && hyper.tqcontains(term) == 0 ) { hyper.append(term); } } } if( hyper_tmp.grep(search_term, false).size() > 0 ) { // match on the right side of the '#' -- hypernyms - for ( QStringList::Iterator it2 = syn_tmp.begin(); it2 != syn_tmp.end(); ++it2 ) { - QString term = (*it2); - if( term.lower() != search_term && hypo.contains(term) == 0 ) { + for ( TQStringList::Iterator it2 = syn_tmp.begin(); it2 != syn_tmp.end(); ++it2 ) { + TQString term = (*it2); + if( term.lower() != search_term && hypo.tqcontains(term) == 0 ) { hypo.append(term); } } @@ -480,7 +480,7 @@ void Thesaurus::thesExited(KProcess *) m_thes_syn->clear(); if( syn.size() > 0 ) { - syn = sortQStringList(syn); + syn = sortTQStringList(syn); m_thes_syn->insertStringList(syn); m_thes_syn->setEnabled(true); } else { @@ -490,7 +490,7 @@ void Thesaurus::thesExited(KProcess *) m_thes_hyper->clear(); if( hyper.size() > 0 ) { - hyper = sortQStringList(hyper); + hyper = sortTQStringList(hyper); m_thes_hyper->insertStringList(hyper); m_thes_hyper->setEnabled(true); } else { @@ -500,7 +500,7 @@ void Thesaurus::thesExited(KProcess *) m_thes_hypo->clear(); if( hypo.size() > 0 ) { - hypo = sortQStringList(hypo); + hypo = sortTQStringList(hypo); m_thes_hypo->insertStringList(hypo); m_thes_hypo->setEnabled(true); } else { @@ -508,26 +508,26 @@ void Thesaurus::thesExited(KProcess *) m_thes_hypo->setEnabled(false); } - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } void Thesaurus::receivedThesStdout(KProcess *, char *result, int len) { - m_thesproc_stdout += QString::fromLocal8Bit( QCString(result, len+1) ); + m_thesproc_stdout += TQString::fromLocal8Bit( TQCString(result, len+1) ); } void Thesaurus::receivedThesStderr(KProcess *, char *result, int len) { - m_thesproc_stderr += QString::fromLocal8Bit( QCString(result, len+1) ); + m_thesproc_stderr += TQString::fromLocal8Bit( TQCString(result, len+1) ); } // // WordNet // -void Thesaurus::findTermWordnet(const QString &term) +void Thesaurus::findTermWordnet(const TQString &term) { - QApplication::setOverrideCursor(KCursor::waitCursor()); + TQApplication::setOverrideCursor(KCursor::waitCursor()); m_wnproc_stdout = ""; m_wnproc_stderr = ""; @@ -590,10 +590,10 @@ void Thesaurus::findTermWordnet(const QString &term) m_combobox->insertItem(i18n("Synonyms/Hypernyms - Ordered by Frequency")); m_combobox->insertItem(i18n("Synonyms - Ordered by Similarity of Meaning (verbs only)")); m_combobox->insertItem(i18n("Antonyms - Words with Opposite Meanings")); - m_combobox->insertItem(i18n("Hyponyms - ... is a (kind of) %1").arg(m_edit->currentText())); - m_combobox->insertItem(i18n("Meronyms - %1 has a ...").arg(m_edit->currentText())); + m_combobox->insertItem(i18n("Hyponyms - ... is a (kind of) %1").tqarg(m_edit->currentText())); + m_combobox->insertItem(i18n("Meronyms - %1 has a ...").tqarg(m_edit->currentText())); // 5: - m_combobox->insertItem(i18n("Holonyms - ... has a %1").arg(m_edit->currentText())); + m_combobox->insertItem(i18n("Holonyms - ... has a %1").tqarg(m_edit->currentText())); m_combobox->insertItem(i18n("Attributes")); m_combobox->insertItem(i18n("Cause To (for some verbs only)")); m_combobox->insertItem(i18n("Verb Entailment (for some verbs only)")); @@ -604,7 +604,7 @@ void Thesaurus::findTermWordnet(const QString &term) m_combobox->insertItem(i18n("Overview of Senses")); /** NOT todo: - * -Hypernym tree: layout is difficult, you can get the same information + * -Hypernym tree: tqlayout is difficult, you can get the same information * by following links * -Coordinate terms (sisters): just go to synset and then use hyponyms * -Has Part Meronyms, Has Substance Meronyms, Has Member Meronyms, @@ -624,7 +624,7 @@ void Thesaurus::findTermWordnet(const QString &term) if( m_wnproc->isRunning() ) { // should never happen kdDebug(31000) << "Warning: findTerm(): process is already running?!" << endl; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return; } @@ -636,48 +636,48 @@ void Thesaurus::findTermWordnet(const QString &term) "http://www.cogsci.princeton.edu/~wn/</a>. Note that WordNet only supports " "the English language.")); m_combobox->setEnabled(false); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return; } } -// The process has ended, so parse its result and display it as Qt richtext. +// The process has ended, so parse its result and display it as TQt richtext. void Thesaurus::wnExited(KProcess *) { if( !m_wnproc_stderr.isEmpty() ) { m_resultbox->setText(i18n("<b>Error:</b> Failed to execute WordNet program 'wn'. " - "Output:<br>%1").arg(m_wnproc_stderr)); - QApplication::restoreOverrideCursor(); + "Output:<br>%1").tqarg(m_wnproc_stderr)); + TQApplication::restoreOverrideCursor(); return; } if( m_wnproc_stdout.isEmpty() ) { - m_resultbox->setText(i18n("No match for '%1'.").arg(m_edit->currentText())); + m_resultbox->setText(i18n("No match for '%1'.").tqarg(m_edit->currentText())); } else { // render in a table, each line one row: - QStringList lines = lines.split(QChar('\n'), m_wnproc_stdout, false); - QString result = "<qt><table>\n"; - // TODO in Qt > 3.01: try without the following line (it's necessary to ensure the + TQStringList lines = lines.split(TQChar('\n'), m_wnproc_stdout, false); + TQString result = "<qt><table>\n"; + // TODO in TQt > 3.01: try without the following line (it's necessary to ensure the // first column is really always quite small): result += "<tr><td width=\"10%\"></td><td width=\"90%\"></td></tr>\n"; uint ct = 0; - for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { - QString l = (*it); + for ( TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { + TQString l = (*it); // Remove some lines: - QRegExp re("^\\d+( of \\d+)? senses? of \\w+"); + TQRegExp re("^\\d+( of \\d+)? senses? of \\w+"); if( re.search(l) != -1 ) { continue; } // Escape XML: - l = l.replace('&', "&"); - l = l.replace('<', "<"); - l = l.replace('>', ">"); + l = l.tqreplace('&', "&"); + l = l.tqreplace('<', "<"); + l = l.tqreplace('>', ">"); // TODO?: // move "=>" in own column? l = formatLine(l); - // Table layout: + // Table tqlayout: result += "<tr>"; if( l.startsWith(" ") ) { result += "\t<td width=\"15\"></td>"; @@ -696,17 +696,17 @@ void Thesaurus::wnExited(KProcess *) //kdDebug() << result << endl; } - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } void Thesaurus::receivedWnStdout(KProcess *, char *result, int len) { - m_wnproc_stdout += QString::fromLocal8Bit( QCString(result, len+1) ); + m_wnproc_stdout += TQString::fromLocal8Bit( TQCString(result, len+1) ); } void Thesaurus::receivedWnStderr(KProcess *, char *result, int len) { - m_wnproc_stderr += QString::fromLocal8Bit( QCString(result, len+1) ); + m_wnproc_stderr += TQString::fromLocal8Bit( TQCString(result, len+1) ); } @@ -714,15 +714,15 @@ void Thesaurus::receivedWnStderr(KProcess *, char *result, int len) // Tools // -// Format lines using Qt's simple richtext. -QString Thesaurus::formatLine(QString l) +// Format lines using TQt's simple richtext. +TQString Thesaurus::formatLine(TQString l) { if( l == "--------------" ) { - return QString("<hr>"); + return TQString("<hr>"); } - QRegExp re; + TQRegExp re; re.setPattern("^(\\d+\\.)(.*)$"); if( re.search(l) != -1 ) { @@ -738,7 +738,7 @@ QString Thesaurus::formatLine(QString l) if( m_mode == grep ) { l = l.stripWhiteSpace(); - return QString("<a href=\"" +l+ "\">" +l+ "</a>"); + return TQString("<a href=\"" +l+ "\">" +l+ "</a>"); } re.setPattern("^(Sense \\d+)"); @@ -752,14 +752,14 @@ QString Thesaurus::formatLine(QString l) if( re.search(l) != -1 ) { l = re.cap(1); l += re.cap(2); - QStringList links = links.split(QChar(';'), re.cap(3), false); - for ( QStringList::Iterator it = links.begin(); it != links.end(); ++it ) { - QString link = (*it); + TQStringList links = links.split(TQChar(';'), re.cap(3), false); + for ( TQStringList::Iterator it = links.begin(); it != links.end(); ++it ) { + TQString link = (*it); if( it != links.begin() ) { l += ", "; } link = link.stripWhiteSpace(); - link = link.remove(QRegExp("#\\d+")); + link = link.remove(TQRegExp("#\\d+")); l += "<a href=\"" +link+ "\">" +link+ "</a>"; } l.prepend (' '); // indent in table @@ -768,13 +768,13 @@ QString Thesaurus::formatLine(QString l) re.setPattern("(.*)(=>|HAS \\w+:|PART OF:)(.*) --"); re.setMinimal(true); // non-greedy if( re.search(l) != -1 ) { - int dash_pos = l.find("--"); - QString line_end = l.mid(dash_pos+2, l.length()-dash_pos); + int dash_pos = l.tqfind("--"); + TQString line_end = l.mid(dash_pos+2, l.length()-dash_pos); l = re.cap(1); l += re.cap(2) + " "; - QStringList links = links.split(QChar(','), re.cap(3), false); - for ( QStringList::Iterator it = links.begin(); it != links.end(); ++it ) { - QString link = (*it); + TQStringList links = links.split(TQChar(','), re.cap(3), false); + for ( TQStringList::Iterator it = links.begin(); it != links.end(); ++it ) { + TQString link = (*it); if( it != links.begin() ) { l += ", "; } @@ -795,18 +795,18 @@ QString Thesaurus::formatLine(QString l) * Be careful: @p list is modified * TODO: use ksortablevaluelist? */ -QStringList Thesaurus::sortQStringList(QStringList list) +TQStringList Thesaurus::sortTQStringList(TQStringList list) { - // Sort list case-insensitive. This looks strange but using a QMap - // is even suggested by the Qt documentation. - QMap<QString,QString> map_list; - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { - QString str = *it; + // Sort list case-insensitive. This looks strange but using a TQMap + // is even suggested by the TQt documentation. + TQMap<TQString,TQString> map_list; + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) { + TQString str = *it; map_list[str.lower()] = str; } list.clear(); - QMap<QString,QString>::Iterator it; - // Qt doc: "the items are alphabetically sorted [by key] when iterating over the map": + TQMap<TQString,TQString>::Iterator it; + // TQt doc: "the items are alphabetically sorted [by key] when iterating over the map": for( it = map_list.begin(); it != map_list.end(); ++it ) { list.append(it.data()); } |