]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSearchDialog.C
ws change
[lyx.git] / src / frontends / qt2 / QSearchDialog.C
1 /**
2  * \file QSearchDialog.C
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author Edwin Leuven
7  */
8
9 #include <config.h>
10
11 #include "ControlSearch.h"
12 #include "QSearchDialog.h"
13 #include "debug.h"
14
15 #include <qpushbutton.h>
16 #include <qcombobox.h>
17 #include <qcheckbox.h>
18 #include <qlabel.h>
19
20 QSearchDialog::QSearchDialog(QSearch * form)
21         : QSearchDialogBase(0, 0, false, 0),
22         form_(form)
23 {
24         connect(closePB, SIGNAL(clicked()),
25                 form_, SLOT(slotClose()));
26 }
27
28
29 void QSearchDialog::closeEvent(QCloseEvent * e)
30 {
31         form_->slotWMHide();
32         e->accept();
33 }
34
35
36 void QSearchDialog::findChanged()
37 {
38         if (findCO->currentText().isEmpty()) {
39                 findPB->setEnabled(false);
40                 replacePB->setEnabled(false);
41                 replaceallPB->setEnabled(false);
42         } else {
43                 findPB->setEnabled(true);
44                 replacePB->setEnabled(!form_->readOnly());
45                 replaceallPB->setEnabled(!form_->readOnly());
46         }
47 }
48
49
50 void QSearchDialog::findClicked()
51 {
52         string const find(findCO->currentText().latin1());
53         form_->find(find,
54                 caseCB->isChecked(),
55                 wordsCB->isChecked(),
56                 backwardsCB->isChecked());
57 }
58
59
60 void QSearchDialog::replaceClicked()
61 {
62         string const find(findCO->currentText().latin1());
63         string const replace(replaceCO->currentText().latin1());
64         form_->replace(find, replace,
65                 caseCB->isChecked(),
66                 wordsCB->isChecked(),
67                 false);
68 }
69
70
71 void QSearchDialog::replaceallClicked()
72 {
73         form_->replace(findCO->currentText().latin1(),
74                 replaceCO->currentText().latin1(),
75                 caseCB->isChecked(),
76                 wordsCB->isChecked(),
77                 true);
78 }