]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/searchdlgimpl.C
John's FormExternal patch, Edwin's Qt2 patch and Baruch's gnome patch.
[lyx.git] / src / frontends / qt2 / searchdlgimpl.C
1 /** 
2  * \file searchdlgimpl.h
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  * 
6  * \author Edwin Leuven
7  */
8
9 #include "searchdlgimpl.h"
10
11 #include <qpushbutton.h>
12 #include <qcombobox.h>
13 #include <qcheckbox.h>
14 #include <qlabel.h>
15
16
17 SearchDlgImpl::SearchDlgImpl(FormSearch* form, QWidget* parent,  const char* name, bool modal, WFlags fl )
18     : SearchDlg( parent, name, modal, fl ), form_(form)
19 {
20    setCaption(name);
21 }
22
23 SearchDlgImpl::~SearchDlgImpl()
24 {
25 }
26
27 void SearchDlgImpl::closeEvent(QCloseEvent * e)
28 {
29    form_->close();
30    e->accept();
31 }
32
33 void SearchDlgImpl::setReadOnly(bool readonly)
34 {
35    replace->setEnabled(!readonly);
36    replaceLabel->setEnabled(!readonly);
37    replacePB->setEnabled(!readonly);
38    replaceAllPB->setEnabled(!readonly);
39 }
40
41 void SearchDlgImpl::Find()
42 {
43    form_->find(tostr(find->currentText()).c_str(),
44                caseSensitive->isChecked(),
45                matchWord->isChecked(),
46                !searchBack->isChecked());
47 }
48
49 void SearchDlgImpl::Replace(bool replaceall = false)
50 {
51    form_->replace(tostr(find->currentText()).c_str(),
52                   tostr(replace->currentText()).c_str(),
53                   caseSensitive->isChecked(),
54                   matchWord->isChecked(),
55                   !searchBack->isChecked(),
56                   replaceall);
57 }
58
59