Qtopia library API Documentation

findwidget_p.cpp

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #include "findwidget_p.h"
00022 
00023 #include <qpe/categories.h>
00024 #include <qpe/categoryselect.h>
00025 #include <qpe/datebookmonth.h>
00026 #include <qpe/timestring.h>
00027 
00028 #include <qcheckbox.h>
00029 #include <qlabel.h>
00030 #include <qlineedit.h>
00031 #include <qmessagebox.h>
00032 #include <qpushbutton.h>
00033 #include <qpopupmenu.h>
00034 #include <qtoolbutton.h>
00035 
00036 FindWidget::FindWidget( const QString &appName, QWidget *parent,
00037             const char *name )
00038     : FindWidgetBase( parent, name ),
00039       mStrApp( appName ),
00040       mDate( QDate::currentDate() )
00041 {
00042     setMaximumSize( sizeHint() );
00043     QArray<int> vl(0);
00044     cmbCat->setCategories( vl, mStrApp );
00045     cmbCat->setRemoveCategoryEdit( TRUE );
00046     cmbCat->setAllCategories( TRUE );
00047     // hide junk for the moment...
00048     lblStartDate->hide();
00049     cmdStartDate->hide();
00050     QPopupMenu *m1 = new QPopupMenu( this );
00051     dtPicker = new DateBookMonth( m1, 0, TRUE );
00052     dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() );
00053     m1->insertItem( dtPicker );
00054     cmdStartDate->setPopup( m1 );
00055     cmdStartDate->setText( TimeString::shortDate(mDate) );
00056     QObject::connect( dtPicker, SIGNAL(dateClicked(int, int, int)),
00057               this, SLOT(slotDateChanged(int, int, int)) );
00058 
00059     QObject::connect( cmdFind, SIGNAL(clicked()),
00060               this, SLOT(slotFindClicked()) );
00061 }
00062 
00063 FindWidget::~FindWidget()
00064 {
00065 }
00066 
00067 QString FindWidget::findText() const
00068 {
00069     return txtFind->text();
00070 }
00071 
00072 void FindWidget::slotFindClicked()
00073 {
00074     lblStatus->setText( "" );
00075     if ( cmdStartDate->isVisible() )
00076     emit signalFindClicked( findText(),
00077                 mDate,
00078                 chkCase->isChecked(),
00079                 chkBackwards->isChecked(),
00080                 cmbCat->currentCategory() );
00081     else
00082     emit signalFindClicked( findText(), chkCase->isChecked(),
00083                 chkBackwards->isChecked(),
00084                 cmbCat->currentCategory() );
00085 }
00086 
00087 void FindWidget::setUseDate( bool show )
00088 {
00089     if ( show ) {
00090     lblStartDate->show();
00091     cmdStartDate->show();
00092     } else {
00093     lblStartDate->hide();
00094     cmdStartDate->hide();
00095     }
00096     chkBackwards->setDisabled( show );
00097 }
00098 
00099 void FindWidget::setDate( const QDate &dt )
00100 {
00101     slotDateChanged( dt.year(), dt.month(), dt.day() );
00102 }
00103 
00104 void FindWidget::slotNotFound()
00105 {
00106     lblStatus->setText( tr("String Not Found.") );
00107 }
00108 
00109 void FindWidget::slotWrapAround()
00110 {
00111     lblStatus->setText( tr("End reached, starting at beginning") );
00112 }
00113 
00114 void FindWidget::slotDateChanged( int year, int month, int day )
00115 {
00116     mDate.setYMD( year, month, day );
00117     cmdStartDate->setText( TimeString::shortDate( mDate ) );
00118     dtPicker->setDate( year, month, day );
00119 }
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:05 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001