Diffstat (limited to 'noncore/apps/opie-sheet/finddlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/finddlg.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/noncore/apps/opie-sheet/finddlg.cpp b/noncore/apps/opie-sheet/finddlg.cpp new file mode 100644 index 0000000..cfe2f82 --- a/dev/null +++ b/noncore/apps/opie-sheet/finddlg.cpp | |||
@@ -0,0 +1,70 @@ | |||
1 | #include <qlabel.h> | ||
2 | #include <qradiobutton.h> | ||
3 | #include "finddlg.h" | ||
4 | |||
5 | FindDialog::FindDialog(QWidget *parent=0) | ||
6 | :QDialog(parent, 0, TRUE) | ||
7 | { | ||
8 | // Main widget | ||
9 | tabs=new QTabWidget(this); | ||
10 | widgetFind=new QWidget(tabs); | ||
11 | widgetOptions=new QWidget(tabs); | ||
12 | tabs->addTab(widgetFind, tr("&Find && Replace")); | ||
13 | tabs->addTab(widgetOptions, tr("&Options")); | ||
14 | |||
15 | // Find tab | ||
16 | QLabel *label=new QLabel(tr("&Search for:"), widgetFind); | ||
17 | label->setGeometry(10, 10, 215, 20); | ||
18 | editFind=new QLineEdit(widgetFind); | ||
19 | editFind->setGeometry(10, 40, 215, 20); | ||
20 | label->setBuddy(editFind); | ||
21 | |||
22 | label=new QLabel(tr("&Replace with:"), widgetFind); | ||
23 | label->setGeometry(10, 80, 215, 20); | ||
24 | editReplace=new QLineEdit(widgetFind); | ||
25 | editReplace->setGeometry(10, 110, 215, 20); | ||
26 | editReplace->setEnabled(FALSE); | ||
27 | label->setBuddy(editReplace); | ||
28 | |||
29 | groupType=new QVButtonGroup(tr("&Type"), widgetFind); | ||
30 | groupType->setGeometry(10, 150, 215, 90); | ||
31 | QRadioButton *radio=new QRadioButton(tr("&Find"), groupType); | ||
32 | radio=new QRadioButton(tr("&Replace"), groupType); | ||
33 | radio=new QRadioButton(tr("Replace &all"), groupType); | ||
34 | groupType->setButton(0); | ||
35 | connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); | ||
36 | |||
37 | // Options tab | ||
38 | checkCase=new QCheckBox(tr("Match &case"), widgetOptions); | ||
39 | checkCase->setGeometry(10, 10, 215, 20); | ||
40 | checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions); | ||
41 | checkSelection->setGeometry(10, 40, 215, 20); | ||
42 | checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions); | ||
43 | checkEntire->setGeometry(10, 70, 215, 20); | ||
44 | |||
45 | // Main widget | ||
46 | box=new QVBoxLayout(this); | ||
47 | box->addWidget(tabs); | ||
48 | |||
49 | setCaption(tr("Find & Replace")); | ||
50 | } | ||
51 | |||
52 | FindDialog::~FindDialog() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | void FindDialog::typeChanged(int id) | ||
57 | { | ||
58 | editReplace->setEnabled(id>0); | ||
59 | } | ||
60 | |||
61 | int FindDialog::exec(Sheet *s) | ||
62 | { | ||
63 | if (QDialog::exec()==QDialog::Accepted) | ||
64 | { | ||
65 | int id=groupType->id(groupType->selected()); | ||
66 | s->dataFindReplace(editFind->text(), editReplace->text(), checkCase->isChecked(), !checkSelection->isChecked(), checkEntire->isChecked(), id>0, id>1); | ||
67 | return QDialog::Accepted; | ||
68 | } | ||
69 | return QDialog::Rejected; | ||
70 | } | ||