summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/finddlg.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-sheet/finddlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/finddlg.cpp132
1 files changed, 76 insertions, 56 deletions
diff --git a/noncore/apps/opie-sheet/finddlg.cpp b/noncore/apps/opie-sheet/finddlg.cpp
index e4c6ec8..c724159 100644
--- a/noncore/apps/opie-sheet/finddlg.cpp
+++ b/noncore/apps/opie-sheet/finddlg.cpp
@@ -1,84 +1,104 @@
1/*************************************************************************** 1/*
2 * * 2 =. This file is part of the Opie Project
3 * This program is free software; you can redistribute it and/or modify * 3 .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
4 * it under the terms of the GNU General Public License as published by * 4 .>+-=
5 * the Free Software Foundation; either version 2 of the License, or * 5 _;:, .> :=|. This program is free software; you can
6 * (at your option) any later version. * 6.> <`_, > . <= redistribute it and/or modify it under
7 * * 7:`=1 )Y*s>-.-- : the terms of the GNU General Public
8 ***************************************************************************/ 8.="- .-=="i, .._ License as published by the Free Software
9 - . .-<_> .<> Foundation; either version 2 of the License,
10 ._= =} : or (at your option) any later version.
11 .%`+i> _;_.
12 .i_,=:_. -<s. This program is distributed in the hope that
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14 : .. .:, . . . without even the implied warranty of
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.= = ; Library General Public License for more
18++= -. .` .: details.
19 : = ...= . :.=-
20 -. .:....=;==+<; You should have received a copy of the GNU
21 -_. . . )=. = Library General Public License along with
22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
9 28
10/* 29/*
11 * Opie Sheet (formerly Sheet/Qt) 30 * Opie Sheet (formerly Sheet/Qt)
12 * by Serdar Ozler <sozler@sitebest.com> 31 * by Serdar Ozler <sozler@sitebest.com>
13 */ 32 */
14 33
34#include "finddlg.h"
35
36/* QT */
15#include <qlabel.h> 37#include <qlabel.h>
16#include <qradiobutton.h> 38#include <qradiobutton.h>
17#include "finddlg.h"
18 39
19FindDialog::FindDialog(QWidget *parent) 40FindDialog::FindDialog(QWidget *parent)
20 :QDialog(parent, 0, TRUE) 41 :QDialog(parent, 0, TRUE)
21{ 42{
22 // Main widget 43 // Main widget
23 tabs=new QTabWidget(this); 44 tabs=new QTabWidget(this);
24 widgetFind=new QWidget(tabs); 45 widgetFind=new QWidget(tabs);
25 widgetOptions=new QWidget(tabs); 46 widgetOptions=new QWidget(tabs);
26 tabs->addTab(widgetFind, tr("&Find && Replace")); 47 tabs->addTab(widgetFind, tr("&Find && Replace"));
27 tabs->addTab(widgetOptions, tr("&Options")); 48 tabs->addTab(widgetOptions, tr("&Options"));
28 49
29 // Find tab 50 // Find tab
30 QLabel *label=new QLabel(tr("&Search for:"), widgetFind); 51 QLabel *label=new QLabel(tr("&Search for:"), widgetFind);
31 label->setGeometry(10, 10, 215, 20); 52 label->setGeometry(10, 10, 215, 20);
32 editFind=new QLineEdit(widgetFind); 53 editFind=new QLineEdit(widgetFind);
33 editFind->setGeometry(10, 40, 215, 20); 54 editFind->setGeometry(10, 40, 215, 20);
34 label->setBuddy(editFind); 55 label->setBuddy(editFind);
35 56
36 label=new QLabel(tr("&Replace with:"), widgetFind); 57 label=new QLabel(tr("&Replace with:"), widgetFind);
37 label->setGeometry(10, 80, 215, 20); 58 label->setGeometry(10, 80, 215, 20);
38 editReplace=new QLineEdit(widgetFind); 59 editReplace=new QLineEdit(widgetFind);
39 editReplace->setGeometry(10, 110, 215, 20); 60 editReplace->setGeometry(10, 110, 215, 20);
40 editReplace->setEnabled(FALSE); 61 editReplace->setEnabled(FALSE);
41 label->setBuddy(editReplace); 62 label->setBuddy(editReplace);
42 63
43 groupType=new QVButtonGroup(tr("&Type"), widgetFind); 64 groupType=new QVButtonGroup(tr("&Type"), widgetFind);
44 groupType->setGeometry(10, 150, 215, 90); 65 groupType->setGeometry(10, 150, 215, 90);
45 QRadioButton *radio=new QRadioButton(tr("&Find"), groupType); 66 QRadioButton *radio=new QRadioButton(tr("&Find"), groupType);
46 radio=new QRadioButton(tr("&Replace"), groupType); 67 radio=new QRadioButton(tr("&Replace"), groupType);
47 radio=new QRadioButton(tr("Replace &all"), groupType); 68 radio=new QRadioButton(tr("Replace &all"), groupType);
48 groupType->setButton(0); 69 groupType->setButton(0);
49 connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); 70 connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int)));
50 71
51 // Options tab 72 // Options tab
52 checkCase=new QCheckBox(tr("Match &case"), widgetOptions); 73 checkCase=new QCheckBox(tr("Match &case"), widgetOptions);
53 checkCase->setGeometry(10, 10, 215, 20); 74 checkCase->setGeometry(10, 10, 215, 20);
54 checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions); 75 checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions);
55 checkSelection->setGeometry(10, 40, 215, 20); 76 checkSelection->setGeometry(10, 40, 215, 20);
56 checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions); 77 checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions);
57 checkEntire->setGeometry(10, 70, 215, 20); 78 checkEntire->setGeometry(10, 70, 215, 20);
58 79
59 // Main widget 80 // Main widget
60 box=new QVBoxLayout(this); 81 box=new QVBoxLayout(this);
61 box->addWidget(tabs); 82 box->addWidget(tabs);
62 83
63 setCaption(tr("Find & Replace")); 84 setCaption(tr("Find & Replace"));
64} 85}
65 86
66FindDialog::~FindDialog() 87FindDialog::~FindDialog()
67{ 88{}
68}
69 89
70void FindDialog::typeChanged(int id) 90void FindDialog::typeChanged(int id)
71{ 91{
72 editReplace->setEnabled(id>0); 92 editReplace->setEnabled(id>0);
73} 93}
74 94
75int FindDialog::exec(Sheet *s) 95int FindDialog::exec(Sheet *s)
76{ 96{
77 if (QDialog::exec()==QDialog::Accepted) 97 if (QDialog::exec()==QDialog::Accepted)
78 { 98 {
79 int id=groupType->id(groupType->selected()); 99 int id=groupType->id(groupType->selected());
80 s->dataFindReplace(editFind->text(), editReplace->text(), checkCase->isChecked(), !checkSelection->isChecked(), checkEntire->isChecked(), id>0, id>1); 100 s->dataFindReplace(editFind->text(), editReplace->text(), checkCase->isChecked(), !checkSelection->isChecked(), checkEntire->isChecked(), id>0, id>1);
81 return QDialog::Accepted; 101 return QDialog::Accepted;
82 } 102 }
83 return QDialog::Rejected; 103 return QDialog::Rejected;
84} 104}