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

findwidget_p.cpp

Go to the documentation of this file.
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/categoryselect.h>
00024 #include <qpe/datebookmonth.h>
00025 
00026 #include <qcheckbox.h>
00027 #include <qlabel.h>
00028 #include <qlineedit.h>
00029 
00030 FindWidget::FindWidget( const QString &appName, QWidget *parent,
00031                         const char *name )
00032     : FindWidgetBase( parent, name ),
00033       mStrApp( appName ),
00034       mDate( QDate::currentDate() )
00035 {
00036     setMaximumSize( sizeHint() );
00037     QArray<int> vl(0);
00038     cmbCat->setCategories( vl, mStrApp );
00039     cmbCat->setRemoveCategoryEdit( TRUE );
00040     cmbCat->setAllCategories( TRUE );
00041     // hide junk for the moment...
00042     lblStartDate->hide();
00043     cmdStartDate->hide();
00044     QPopupMenu *m1 = new QPopupMenu( this );
00045     dtPicker = new DateBookMonth( m1, 0, TRUE );
00046     dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() );
00047     m1->insertItem( dtPicker );
00048     cmdStartDate->setPopup( m1 );
00049     cmdStartDate->setText( TimeString::shortDate(mDate) );
00050     QObject::connect( dtPicker, SIGNAL(dateClicked(int,int,int)),
00051                       this, SLOT(slotDateChanged(int,int,int)) );
00052 
00053     QObject::connect( cmdFind, SIGNAL(clicked()),
00054                       this, SLOT(slotFindClicked()) );
00055 }
00056 
00057 FindWidget::~FindWidget()
00058 {
00059 }
00060 
00061 QString FindWidget::findText() const
00062 {
00063     return txtFind->text();
00064 }
00065 
00066 void FindWidget::slotFindClicked()
00067 {
00068     lblStatus->setText( "" );
00069     if ( cmdStartDate->isVisible() )
00070         emit signalFindClicked( findText(),
00071                                 mDate,
00072                                 chkCase->isChecked(),
00073                                 chkBackwards->isChecked(),
00074                                 cmbCat->currentCategory() );
00075     else
00076         emit signalFindClicked( findText(), chkCase->isChecked(),
00077                                 chkBackwards->isChecked(),
00078                                 cmbCat->currentCategory() );
00079 }
00080 
00081 void FindWidget::setUseDate( bool show )
00082 {
00083     if ( show ) {
00084         lblStartDate->show();
00085         cmdStartDate->show();
00086     } else {
00087         lblStartDate->hide();
00088         cmdStartDate->hide();
00089     }
00090     chkBackwards->setDisabled( show );
00091 }
00092 
00093 void FindWidget::setDate( const QDate &dt )
00094 {
00095     slotDateChanged( dt.year(), dt.month(), dt.day() );
00096 }
00097 
00098 void FindWidget::slotNotFound()
00099 {
00100     lblStatus->setText( tr("String Not Found.") );
00101 }
00102 
00103 void FindWidget::slotWrapAround()
00104 {
00105     lblStatus->setText( tr("End reached, starting at %1", "Date using TimeString::shortDate")
00106                         .arg(TimeString::shortDate( mDate ) ) );
00107 }
00108 
00109 void FindWidget::slotDateChanged( int year, int month, int day )
00110 {
00111     mDate.setYMD( year, month, day );
00112     cmdStartDate->setText( TimeString::shortDate( mDate ) );
00113     dtPicker->setDate( year, month, day );
00114 }

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