KexiFindDialog::KexiFindDialog(QWidget* parent) : QDialog(parent, Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::Tool) , d(new Private()) { setObjectName("KexiFindDialog"); setupUi(this); m_search->setCurrentIndex( (int)KexiSearchAndReplaceViewInterface::Options::SearchDown); layout()->setMargin(KDialog::marginHint()); layout()->setSpacing(KDialog::spacingHint()); KAction *a = KStandardAction::findNext(0, 0, 0); m_btnFind->setText(a->text()); m_btnFind->setIcon(KIcon(a->icon())); delete a; m_btnClose->setText(KStandardGuiItem::close().text()); m_btnClose->setIcon(KStandardGuiItem::close().icon()); connect(m_btnFind, SIGNAL(clicked()), this, SIGNAL(findNext())); connect(m_btnClose, SIGNAL(clicked()), this, SLOT(slotCloseClicked())); connect(m_btnReplace, SIGNAL(clicked()), this, SIGNAL(replaceNext())); connect(m_btnReplaceAll, SIGNAL(clicked()), this, SIGNAL(replaceAll())); // clear message after the text is changed connect(m_textToFind, SIGNAL(editTextChanged(const QString&)), this, SLOT(updateMessage(const QString&))); connect(m_textToReplace, SIGNAL(editTextChanged(const QString&)), this, SLOT(updateMessage(const QString&))); d->replaceMode = true; //to force updating by setReplaceMode() setReplaceMode(false); setLookInColumnList(QStringList(), QStringList()); }
void KexiFindDialog::setActions(KAction *findnext, KAction *findprev, KAction *replace, KAction *replaceall) { d->findnextAction = findnext; d->findprevAction = findprev; d->replaceAction = replace; d->replaceallAction = replaceall; qDeleteAll(d->shortcuts); d->setActionAndShortcut(d->findnextAction, this, SIGNAL(findNext())); d->setActionAndShortcut(d->findprevAction, this, SIGNAL(findPrevious())); d->setActionAndShortcut(d->replaceAction, this, SIGNAL(replaceNext())); d->setActionAndShortcut(d->replaceallAction, this, SIGNAL(replaceAll())); }
void QFESPIMB040ScriptedAcquisition::replaceFirst() { if (ui->edtScript->getEditor()->hasSelection()) replaceDlg->setPhrase(ui->edtScript->getEditor()->getSelection()); if (replaceDlg->exec()==QDialog::Accepted) { // enable "Find next" action findNextAct->setEnabled(true); findNextAct->setIcon(QIcon(":/spimb040/script_find_replace_next.png")); findNextAct->setText(tr("Replace &next")); findNextAct->setStatusTip(tr("Replace the next occurence ")); disconnect(findNextAct, SIGNAL(triggered()), this, 0); connect(findNextAct, SIGNAL(triggered()), this, SLOT(replaceNext())); if (!ui->edtScript->getEditor()->replaceFirst(replaceDlg->getPhrase(), replaceDlg->getReplace(), replaceDlg->getSearchFromStart(), replaceDlg->getMatchCase(), replaceDlg->getWholeWords(), replaceDlg->getReplaceAll(), replaceDlg->getAskBeforeReplace())) { QMessageBox::information(this, tr("Find & Replace..."), tr("Did not find '%1' ...") .arg(ui->edtScript->getEditor()->getPhrase())); } } }
connect( ui->actionSaveAs , SIGNAL(triggered()) , this , SLOT(saveAs()) ); connect( ui->tabWidget , SIGNAL(currentChanged(int)) , this , SLOT(configureGui(int)) ); connect( ui->tabWidget , SIGNAL(tabCloseRequested(int)) , this , SLOT(closeTab(int)) ); connect( ui->actionNew , SIGNAL(triggered()) , this , SLOT(newTab()) ); connect( ui->actionClose , SIGNAL(triggered()) , this , SLOT(closeTabFromMenu()) ); connect( ui->actionQuit , SIGNAL(triggered()) , this , SLOT(quitFromMenu()) ); //find connect( ui->actionFind , SIGNAL(triggered()) , this , SLOT(toggleFindWidget()) ); connect( ui->findClose , SIGNAL(clicked()) , this , SLOT(toggleFindWidget()) ); connect( ui->findEdit , SIGNAL(textChanged(QString)) , this , SLOT(findFirst(QString)) ); connect( ui->findNext , SIGNAL(clicked()) , this , SLOT(findNext()) ); connect( ui->findPrev , SIGNAL(clicked()) , this , SLOT(findPrev()) ); connect( ui->actionFind_Next , SIGNAL(triggered()) , this , SLOT(findNext()) ); connect( ui->actionFind_Previous , SIGNAL(triggered()) , this , SLOT(findPrev()) ); connect( ui->replaceNext , SIGNAL(clicked()) , this , SLOT(replaceNext()) ); connect( ui->replacePrev , SIGNAL(clicked()) , this , SLOT(replacePrevious()) ); connect( ui->replaceAll , SIGNAL(clicked()) , this , SLOT(replaceAll()) ); //gotoLine connect( ui->gotoLineClose , SIGNAL(clicked()) , this , SLOT(toggleGotoLine()) ); connect( ui->actionGo_To_Line , SIGNAL(triggered()) , this , SLOT(toggleGotoLine()) ); connect( ui->gotoLineSpin , SIGNAL(valueChanged(int)) , this , SLOT(gotoLine(int)) ); //select connect( ui->actionSelectAll , SIGNAL(triggered()) , this , SLOT(selectAll()) ); connect( ui->actionDeselect , SIGNAL(triggered()) , this , SLOT(deselect()) ); //copy-paste connect( ui->actionCopy , SIGNAL(triggered()) , this , SLOT(copy()) ); connect( ui->actionCut , SIGNAL(triggered()) , this , SLOT(cut()) );