Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

finddlg.cpp

Go to the documentation of this file.
00001 /*
00002                =.            This file is part of the Opie Project
00003              .=l.            Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
00004            .>+-=
00005  _;:,     .>    :=|.         This program is free software; you can
00006 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00007 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00008 .="- .-=="i,     .._         License as published by the Free Software
00009  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00010      ._= =}       :          or (at your option) any later version.
00011     .%`+i>       _;_.
00012     .i_,=:_.      -<s.       This program is distributed in the hope that
00013      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00014     : ..    .:,     . . .    without even the implied warranty of
00015     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00016   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00017 ..}^=.=       =       ;      Library General Public License for more
00018 ++=   -.     .`     .:       details.
00019  :     =  ...= . :.=-
00020  -.   .:....=;==+<;          You should have received a copy of the GNU
00021   -_. . .   )=.  =           Library General Public License along with
00022     --        :-=`           this library; see the file COPYING.LIB.
00023                              If not, write to the Free Software Foundation,
00024                              Inc., 59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 /*
00030  * Opie Sheet (formerly Sheet/Qt)
00031  * by Serdar Ozler <sozler@sitebest.com>
00032  */
00033 
00034 #include "finddlg.h"
00035 
00036 /* QT */
00037 #include <qlabel.h>
00038 #include <qradiobutton.h>
00039 
00040 FindDialog::FindDialog(QWidget *parent)
00041         :QDialog(parent, 0, TRUE)
00042 {
00043     // Main widget
00044     tabs=new QTabWidget(this);
00045     widgetFind=new QWidget(tabs);
00046     widgetOptions=new QWidget(tabs);
00047     tabs->addTab(widgetFind, tr("&Find && Replace"));
00048     tabs->addTab(widgetOptions, tr("&Options"));
00049 
00050     // Find tab
00051     QLabel *label=new QLabel(tr("&Search for:"), widgetFind);
00052     label->setGeometry(10, 10, 215, 20);
00053     editFind=new QLineEdit(widgetFind);
00054     editFind->setGeometry(10, 40, 215, 20);
00055     label->setBuddy(editFind);
00056 
00057     label=new QLabel(tr("&Replace with:"), widgetFind);
00058     label->setGeometry(10, 80, 215, 20);
00059     editReplace=new QLineEdit(widgetFind);
00060     editReplace->setGeometry(10, 110, 215, 20);
00061     editReplace->setEnabled(FALSE);
00062     label->setBuddy(editReplace);
00063 
00064     groupType=new QVButtonGroup(tr("&Type"), widgetFind);
00065     groupType->setGeometry(10, 150, 215, 90);
00066     QRadioButton *radio=new QRadioButton(tr("&Find"), groupType);
00067     radio=new QRadioButton(tr("&Replace"), groupType);
00068     radio=new QRadioButton(tr("Replace &all"), groupType);
00069     groupType->setButton(0);
00070     connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int)));
00071 
00072     // Options tab
00073     checkCase=new QCheckBox(tr("Match &case"), widgetOptions);
00074     checkCase->setGeometry(10, 10, 215, 20);
00075     checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions);
00076     checkSelection->setGeometry(10, 40, 215, 20);
00077     checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions);
00078     checkEntire->setGeometry(10, 70, 215, 20);
00079 
00080     // Main widget
00081     box=new QVBoxLayout(this);
00082     box->addWidget(tabs);
00083 
00084     setCaption(tr("Find & Replace"));
00085 }
00086 
00087 FindDialog::~FindDialog()
00088 {}
00089 
00090 void FindDialog::typeChanged(int id)
00091 {
00092     editReplace->setEnabled(id>0);
00093 }
00094 
00095 int FindDialog::exec(Sheet *s)
00096 {
00097     if (QDialog::exec()==QDialog::Accepted)
00098     {
00099         int id=groupType->id(groupType->selected());
00100         s->dataFindReplace(editFind->text(), editReplace->text(), checkCase->isChecked(), !checkSelection->isChecked(), checkEntire->isChecked(), id>0, id>1);
00101         return QDialog::Accepted;
00102     }
00103     return QDialog::Rejected;
00104 }

Generated on Sat Nov 5 16:17:00 2005 for OPIE by  doxygen 1.4.2