2001-03-26 19:34:45 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QSearchDialog.C
|
2001-03-06 14:23:02 +00:00
|
|
|
* Copyright 2001 The LyX Team.
|
|
|
|
* See the file COPYING.
|
2001-03-26 19:34:45 +00:00
|
|
|
*
|
2001-03-06 14:23:02 +00:00
|
|
|
* \author Edwin Leuven
|
|
|
|
*/
|
|
|
|
|
2001-03-26 19:34:45 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
#include "ControlSearch.h"
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QSearchDialog.h"
|
2001-08-31 02:34:10 +00:00
|
|
|
#include "debug.h"
|
2001-03-06 14:23:02 +00:00
|
|
|
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
QSearchDialog::QSearchDialog(QSearch * form)
|
|
|
|
: QSearchDialogBase(0, 0, false, 0),
|
2001-08-19 13:25:15 +00:00
|
|
|
form_(form)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotClose()));
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearchDialog::closeEvent(QCloseEvent * e)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearchDialog::findChanged()
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
if (findCO->currentText().isEmpty()) {
|
|
|
|
findPB->setEnabled(false);
|
|
|
|
replacePB->setEnabled(false);
|
|
|
|
replaceallPB->setEnabled(false);
|
|
|
|
} else {
|
|
|
|
findPB->setEnabled(true);
|
|
|
|
replacePB->setEnabled(!form_->readOnly());
|
|
|
|
replaceallPB->setEnabled(!form_->readOnly());
|
|
|
|
}
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
|
|
|
|
void QSearchDialog::findClicked()
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
string const find(findCO->currentText().latin1());
|
|
|
|
form_->find(find,
|
|
|
|
caseCB->isChecked(),
|
|
|
|
wordsCB->isChecked(),
|
|
|
|
backwardsCB->isChecked());
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearchDialog::replaceClicked()
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
string const find(findCO->currentText().latin1());
|
|
|
|
string const replace(replaceCO->currentText().latin1());
|
|
|
|
form_->replace(find, replace,
|
|
|
|
caseCB->isChecked(),
|
|
|
|
wordsCB->isChecked(),
|
|
|
|
false);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
2001-08-31 02:34:10 +00:00
|
|
|
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearchDialog::replaceallClicked()
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
form_->replace(findCO->currentText().latin1(),
|
|
|
|
replaceCO->currentText().latin1(),
|
|
|
|
caseCB->isChecked(),
|
|
|
|
wordsCB->isChecked(),
|
|
|
|
true);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|