summaryrefslogtreecommitdiff
path: root/library/findwidget_p.cpp
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /library/findwidget_p.cpp
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
Diffstat (limited to 'library/findwidget_p.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/findwidget_p.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/library/findwidget_p.cpp b/library/findwidget_p.cpp
new file mode 100644
index 0000000..7ed8bca
--- a/dev/null
+++ b/library/findwidget_p.cpp
@@ -0,0 +1,119 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "findwidget_p.h"
22
23#include <qpe/categories.h>
24#include <qpe/categoryselect.h>
25#include <qpe/datebookmonth.h>
26#include <qpe/timestring.h>
27
28#include <qcheckbox.h>
29#include <qlabel.h>
30#include <qlineedit.h>
31#include <qmessagebox.h>
32#include <qpushbutton.h>
33#include <qpopupmenu.h>
34#include <qtoolbutton.h>
35
36FindWidget::FindWidget( const QString &appName, QWidget *parent,
37 const char *name )
38 : FindWidgetBase( parent, name ),
39 mStrApp( appName ),
40 mDate( QDate::currentDate() )
41{
42 setMaximumSize( sizeHint() );
43 QArray<int> vl(0);
44 cmbCat->setCategories( vl, mStrApp );
45 cmbCat->setRemoveCategoryEdit( TRUE );
46 cmbCat->setAllCategories( TRUE );
47 // hide junk for the moment...
48 lblStartDate->hide();
49 cmdStartDate->hide();
50 QPopupMenu *m1 = new QPopupMenu( this );
51 dtPicker = new DateBookMonth( m1, 0, TRUE );
52 dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() );
53 m1->insertItem( dtPicker );
54 cmdStartDate->setPopup( m1 );
55 cmdStartDate->setText( TimeString::shortDate(mDate) );
56 QObject::connect( dtPicker, SIGNAL(dateClicked(int, int, int)),
57 this, SLOT(slotDateChanged(int, int, int)) );
58
59 QObject::connect( cmdFind, SIGNAL(clicked()),
60 this, SLOT(slotFindClicked()) );
61}
62
63FindWidget::~FindWidget()
64{
65}
66
67QString FindWidget::findText() const
68{
69 return txtFind->text();
70}
71
72void FindWidget::slotFindClicked()
73{
74 lblStatus->setText( "" );
75 if ( cmdStartDate->isVisible() )
76 emit signalFindClicked( findText(),
77 mDate,
78 chkCase->isChecked(),
79 chkBackwards->isChecked(),
80 cmbCat->currentCategory() );
81 else
82 emit signalFindClicked( findText(), chkCase->isChecked(),
83 chkBackwards->isChecked(),
84 cmbCat->currentCategory() );
85}
86
87void FindWidget::setUseDate( bool show )
88{
89 if ( show ) {
90 lblStartDate->show();
91 cmdStartDate->show();
92 } else {
93 lblStartDate->hide();
94 cmdStartDate->hide();
95 }
96 chkBackwards->setDisabled( show );
97}
98
99void FindWidget::setDate( const QDate &dt )
100{
101 slotDateChanged( dt.year(), dt.month(), dt.day() );
102}
103
104void FindWidget::slotNotFound()
105{
106 lblStatus->setText( tr("String Not Found.") );
107}
108
109void FindWidget::slotWrapAround()
110{
111 lblStatus->setText( tr("End reached, starting at beginning") );
112}
113
114void FindWidget::slotDateChanged( int year, int month, int day )
115{
116 mDate.setYMD( year, month, day );
117 cmdStartDate->setText( TimeString::shortDate( mDate ) );
118 dtPicker->setDate( year, month, day );
119}