diff options
Diffstat (limited to 'kdict/matchview.cpp')
-rw-r--r-- | kdict/matchview.cpp | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/kdict/matchview.cpp b/kdict/matchview.cpp index 32cd04dd..869ea383 100644 --- a/kdict/matchview.cpp +++ b/kdict/matchview.cpp @@ -13,13 +13,13 @@ ------------------------------------------------------------- */ -#include <qclipboard.h> -#include <qcombobox.h> -#include <qpushbutton.h> -#include <qheader.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qregexp.h> +#include <tqclipboard.h> +#include <tqcombobox.h> +#include <tqpushbutton.h> +#include <tqheader.h> +#include <tqlayout.h> +#include <tqpainter.h> +#include <tqregexp.h> #include <kpopupmenu.h> #include <klocale.h> @@ -35,26 +35,26 @@ //********* MatchViewItem ******************************************** -MatchViewItem::MatchViewItem(QListView *view, const QString &text) - : QListViewItem(view,text) +MatchViewItem::MatchViewItem(TQListView *view, const TQString &text) + : TQListViewItem(view,text) { } -MatchViewItem::MatchViewItem(QListView *view,QListViewItem *after,const QString &text) - : QListViewItem(view,after,text) +MatchViewItem::MatchViewItem(TQListView *view,TQListViewItem *after,const TQString &text) + : TQListViewItem(view,after,text) { } -MatchViewItem::MatchViewItem(QListViewItem *item,const QString &text,const QString &commandStr) -: QListViewItem(item,text), command(commandStr) +MatchViewItem::MatchViewItem(TQListViewItem *item,const TQString &text,const TQString &commandStr) +: TQListViewItem(item,text), command(commandStr) { } -MatchViewItem::MatchViewItem(QListViewItem *item,QListViewItem *after,const QString &text,const QString &commandStr) -: QListViewItem(item,after,text), command(commandStr) +MatchViewItem::MatchViewItem(TQListViewItem *item,TQListViewItem *after,const TQString &text,const TQString &commandStr) +: TQListViewItem(item,after,text), command(commandStr) { } @@ -70,9 +70,9 @@ void MatchViewItem::setOpen(bool o) listView()->setUpdatesEnabled(false); MatchViewItem *sub=0; - QString command, label; - QRegExp exp("\"*\"", true, true); - QStringList::iterator it; + TQString command, label; + TQRegExp exp("\"*\"", true, true); + TQStringList::iterator it; for (it = subEntrys.begin(); it != subEntrys.end(); ++it) { command = "define "; command += (*it); @@ -92,71 +92,71 @@ void MatchViewItem::setOpen(bool o) } if (childCount()) - QListViewItem::setOpen(o); + TQListViewItem::setOpen(o); } -void MatchViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) +void MatchViewItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment) { if(command.isEmpty()) { - QFont font=p->font(); + TQFont font=p->font(); font.setBold(true); p->setFont(font); } - QListViewItem::paintCell(p,cg,column,width,alignment); + TQListViewItem::paintCell(p,cg,column,width,alignment); } //********* MatchView ****************************************** -MatchView::MatchView(QWidget *parent, const char *name) - : QWidget(parent,name),getOn(false),getAllOn(false) +MatchView::MatchView(TQWidget *parent, const char *name) + : TQWidget(parent,name),getOn(false),getAllOn(false) { setCaption(kapp->makeStdCaption(i18n("Match List"))); - QVBoxLayout * boxLayout = new QVBoxLayout(this, 1, 0); + TQVBoxLayout * boxLayout = new TQVBoxLayout(this, 1, 0); boxLayout->addSpacing(1); - w_strat = new QComboBox(false,this); + w_strat = new TQComboBox(false,this); w_strat->setFixedHeight(w_strat->sizeHint().height()); - connect(w_strat,SIGNAL(activated(int)),this,SLOT(strategySelected(int))); + connect(w_strat,TQT_SIGNAL(activated(int)),this,TQT_SLOT(strategySelected(int))); boxLayout->addWidget(w_strat,0); boxLayout->addSpacing(1); - w_list = new QListView(this); - w_list->setFocusPolicy(QWidget::StrongFocus); + w_list = new TQListView(this); + w_list->setFocusPolicy(TQWidget::StrongFocus); w_list->header()->hide(); w_list->addColumn("foo"); - w_list->setColumnWidthMode(0,QListView::Maximum); + w_list->setColumnWidthMode(0,TQListView::Maximum); w_list->setColumnWidth(0,0); - w_list->setSelectionMode(QListView::Extended); + w_list->setSelectionMode(TQListView::Extended); w_list->setTreeStepSize(18); w_list->setSorting(-1); // disable sorting w_list->setMinimumHeight(w_strat->sizeHint().height()); - connect(w_list,SIGNAL(selectionChanged()),SLOT(enableGetButton())); - connect(w_list,SIGNAL(returnPressed(QListViewItem *)),SLOT(returnPressed(QListViewItem *))); - connect(w_list,SIGNAL(doubleClicked(QListViewItem *)),SLOT(getOneItem(QListViewItem *))); - connect(w_list,SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int)), - SLOT(mouseButtonPressed(int, QListViewItem *, const QPoint &, int))); - connect(w_list,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),SLOT(buildPopupMenu(QListViewItem *,const QPoint &,int))); + connect(w_list,TQT_SIGNAL(selectionChanged()),TQT_SLOT(enableGetButton())); + connect(w_list,TQT_SIGNAL(returnPressed(TQListViewItem *)),TQT_SLOT(returnPressed(TQListViewItem *))); + connect(w_list,TQT_SIGNAL(doubleClicked(TQListViewItem *)),TQT_SLOT(getOneItem(TQListViewItem *))); + connect(w_list,TQT_SIGNAL(mouseButtonPressed(int, TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(mouseButtonPressed(int, TQListViewItem *, const TQPoint &, int))); + connect(w_list,TQT_SIGNAL(rightButtonPressed(TQListViewItem *,const TQPoint &,int)),TQT_SLOT(buildPopupMenu(TQListViewItem *,const TQPoint &,int))); boxLayout->addWidget(w_list,1); boxLayout->addSpacing(1); - w_get = new QPushButton(i18n("&Get Selected"),this); + w_get = new TQPushButton(i18n("&Get Selected"),this); w_get->setFixedHeight(w_get->sizeHint().height()-3); w_get->setMinimumWidth(w_get->sizeHint().width()-20); w_get->setEnabled(false); - connect(w_get, SIGNAL(clicked()), this, SLOT(getSelected())); + connect(w_get, TQT_SIGNAL(clicked()), this, TQT_SLOT(getSelected())); boxLayout->addWidget(w_get,0); - w_getAll = new QPushButton(i18n("Get &All"),this); + w_getAll = new TQPushButton(i18n("Get &All"),this); w_getAll->setFixedHeight(w_getAll->sizeHint().height()-3); w_getAll->setMinimumWidth(w_getAll->sizeHint().width()-20); w_getAll->setEnabled(false); - connect(w_getAll, SIGNAL(clicked()), this, SLOT(getAll())); + connect(w_getAll, TQT_SIGNAL(clicked()), this, TQT_SLOT(getAll())); boxLayout->addWidget(w_getAll,0); - connect(interface,SIGNAL(matchReady(const QStringList &)),this,SLOT(newList(const QStringList &))); + connect(interface,TQT_SIGNAL(matchReady(const TQStringList &)),this,TQT_SLOT(newList(const TQStringList &))); rightBtnMenu = new KPopupMenu(); } @@ -174,7 +174,7 @@ void MatchView::updateStrategyCombo() } -bool MatchView::selectStrategy(const QString &strategy) const +bool MatchView::selectStrategy(const TQString &strategy) const { int newCurrent = global->strategies.findIndex(strategy); if (newCurrent == -1) @@ -187,13 +187,13 @@ bool MatchView::selectStrategy(const QString &strategy) const } -void MatchView::match(const QString &query) +void MatchView::match(const TQString &query) { interface->match(query.utf8()); } -void MatchView::closeEvent ( QCloseEvent * e ) +void MatchView::closeEvent ( TQCloseEvent * e ) { e->accept(); // hides the widget emit(windowClosed()); @@ -215,22 +215,22 @@ void MatchView::enableGetButton() } -void MatchView::mouseButtonPressed(int button, QListViewItem *, const QPoint &, int) +void MatchView::mouseButtonPressed(int button, TQListViewItem *, const TQPoint &, int) { if (button == MidButton) emit(clipboardRequested()); } -void MatchView::returnPressed(QListViewItem *) +void MatchView::returnPressed(TQListViewItem *) { getSelected(); } -void MatchView::getOneItem(QListViewItem *i) +void MatchView::getOneItem(TQListViewItem *i) { - QStringList defines; + TQStringList defines; if ((!i->childCount())&&(i->parent())) defines.append(((MatchViewItem *)(i))->command); @@ -248,14 +248,14 @@ void MatchView::getOneItem(QListViewItem *i) void MatchView::getSelected() { - QStringList defines; + TQStringList defines; MatchViewItem *top = static_cast<MatchViewItem*>(w_list->firstChild()); MatchViewItem *sub; while (top) { if (top->isSelected()&&(!top->subEntrys.isEmpty())) { - QString command; - QStringList::iterator it; + TQString command; + TQStringList::iterator it; for (it = top->subEntrys.begin(); it != top->subEntrys.end(); ++it) { command = "define "; command += (*it); @@ -278,14 +278,14 @@ void MatchView::getSelected() void MatchView::getAll() { - QStringList defines; + TQStringList defines; MatchViewItem *top = static_cast<MatchViewItem*>(w_list->firstChild()); MatchViewItem *sub; while (top) { if (!top->subEntrys.isEmpty()) { - QString command; - QStringList::iterator it; + TQString command; + TQStringList::iterator it; for (it = top->subEntrys.begin(); it != top->subEntrys.end(); ++it) { command = "define "; command += (*it); @@ -305,7 +305,7 @@ void MatchView::getAll() } -void MatchView::doGet(QStringList &defines) +void MatchView::doGet(TQStringList &defines) { if (defines.count() > 0) { if (defines.count() > global->maxDefinitions) { @@ -319,7 +319,7 @@ void MatchView::doGet(QStringList &defines) } -void MatchView::newList(const QStringList &matches) +void MatchView::newList(const TQStringList &matches) { MatchViewItem *top=0; bool initialOpen = (matches.count()<200); @@ -342,9 +342,9 @@ void MatchView::newList(const QStringList &matches) w_list->setRootIsDecorated(true); w_getAll->setEnabled(true); getAllOn = true; - QString lastDb, db, match; + TQString lastDb, db, match; - QStringList::const_iterator it; + TQStringList::const_iterator it; for (it = matches.begin(); it != matches.end(); ++it) { db = (*it).section(' ', 0, 0); @@ -374,42 +374,42 @@ void MatchView::newList(const QStringList &matches) // construct the right-mouse-button-popup-menu on demand -void MatchView::buildPopupMenu(QListViewItem *i, const QPoint &_point, int) +void MatchView::buildPopupMenu(TQListViewItem *i, const TQPoint &_point, int) { rightBtnMenu->clear(); if ((i!=0L)&&(i->isExpandable()||i->parent())) { popupCurrent = (MatchViewItem *)(i); - rightBtnMenu->insertItem(i18n("&Get"),this,SLOT(popupGetCurrent())); + rightBtnMenu->insertItem(i18n("&Get"),this,TQT_SLOT(popupGetCurrent())); if (!i->isExpandable()) { // toplevel item -> only "get" - rightBtnMenu->insertItem(i18n("&Match"),this,SLOT(popupMatchCurrent())); - rightBtnMenu->insertItem(i18n("&Define"),this,SLOT(popupDefineCurrent())); + rightBtnMenu->insertItem(i18n("&Match"),this,TQT_SLOT(popupMatchCurrent())); + rightBtnMenu->insertItem(i18n("&Define"),this,TQT_SLOT(popupDefineCurrent())); } rightBtnMenu->insertSeparator(); } kapp->clipboard()->setSelectionMode(false); - QString text = kapp->clipboard()->text(); + TQString text = kapp->clipboard()->text(); if (text.isEmpty()) { kapp->clipboard()->setSelectionMode(true); text = kapp->clipboard()->text(); } if (!text.isEmpty()) { popupClip = kapp->clipboard()->text(); - rightBtnMenu->insertItem(i18n("Match &Clipboard Content"),this,SLOT(popupMatchClip())); - rightBtnMenu->insertItem(SmallIcon("define_clip"),i18n("D&efine Clipboard Content"),this,SLOT(popupDefineClip())); + rightBtnMenu->insertItem(i18n("Match &Clipboard Content"),this,TQT_SLOT(popupMatchClip())); + rightBtnMenu->insertItem(SmallIcon("define_clip"),i18n("D&efine Clipboard Content"),this,TQT_SLOT(popupDefineClip())); rightBtnMenu->insertSeparator(); } - int ID = rightBtnMenu->insertItem(i18n("Get &Selected"),this,SLOT(getSelected())); + int ID = rightBtnMenu->insertItem(i18n("Get &Selected"),this,TQT_SLOT(getSelected())); rightBtnMenu->setItemEnabled(ID,getOn); - ID = rightBtnMenu->insertItem(i18n("Get &All"),this,SLOT(getAll())); + ID = rightBtnMenu->insertItem(i18n("Get &All"),this,TQT_SLOT(getAll())); rightBtnMenu->setItemEnabled(ID,getAllOn); if (w_list->childCount()) { rightBtnMenu->insertSeparator(); - rightBtnMenu->insertItem(i18n("E&xpand List"),this,SLOT(expandList())); - rightBtnMenu->insertItem(i18n("C&ollapse List"),this,SLOT(collapseList())); + rightBtnMenu->insertItem(i18n("E&xpand List"),this,TQT_SLOT(expandList())); + rightBtnMenu->insertItem(i18n("C&ollapse List"),this,TQT_SLOT(collapseList())); } rightBtnMenu->popup(_point); @@ -448,7 +448,7 @@ void MatchView::popupMatchClip() void MatchView::expandList() { - QListViewItem *top = w_list->firstChild(); + TQListViewItem *top = w_list->firstChild(); while (top) { w_list->setOpen(top,true); @@ -460,7 +460,7 @@ void MatchView::expandList() void MatchView::collapseList() { w_list->setCurrentItem(w_list->firstChild()); - QListViewItem *top = w_list->firstChild(); + TQListViewItem *top = w_list->firstChild(); while (top) { w_list->setOpen(top,false); |