summaryrefslogtreecommitdiffabout
path: root/kaddressbook/incsearchwidget.cpp
authorzautrix <zautrix>2004-10-10 23:26:49 (UTC)
committer zautrix <zautrix>2004-10-10 23:26:49 (UTC)
commitea40295e233db219dc2431960e18fb4398ddb75c (patch) (side-by-side diff)
tree1d654ae51d7f65f4375787105951a8f4f9fc359e /kaddressbook/incsearchwidget.cpp
parent640874bb21ea348edb33a54690ad225e0efdd1e4 (diff)
downloadkdepimpi-ea40295e233db219dc2431960e18fb4398ddb75c.zip
kdepimpi-ea40295e233db219dc2431960e18fb4398ddb75c.tar.gz
kdepimpi-ea40295e233db219dc2431960e18fb4398ddb75c.tar.bz2
added better searching in kapi
Diffstat (limited to 'kaddressbook/incsearchwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 3533427..78eaf65 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -36,112 +36,118 @@
#include "incsearchwidget.h"
IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
#ifndef KAB_EMBEDDED
//US setCaption( i18n( "Incremental Search" ) );
#endif //KAB_EMBEDDED
QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
#ifdef DESKTOP_VERSION
QLabel *label = new QLabel( i18n( "Search:" ), this );
label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
layout->addWidget( label );
#endif //KAB_EMBEDDED
mSearchText = new KLineEdit( this );
layout->addWidget( mSearchText );
// #ifdef KAB_EMBEDDED
// if (KGlobal::getOrientation() == KGlobal::Portrait)
// mSearchText->setMaximumWidth(30);
// #endif //KAB_EMBEDDED
mFieldCombo = new QComboBox( false, this );
layout->addWidget( mFieldCombo );
mFieldCombo->setMaximumHeight( 34 );
QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
// #ifndef KAB_EMBEDDED
// resize( QSize(420, 50).expandedTo( sizeHint() ) );
// #else //KAB_EMBEDDED
// resize( QSize(30, 10).expandedTo( sizeHint() ) );
// #endif //KAB_EMBEDDED
// for performance reasons, we do a search on the pda only after return is pressed
connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
SLOT( announceDoSearch2() ) );
connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
SLOT( announceDoSearch2() ) );
connect( mSearchText, SIGNAL( returnPressed() ),
SLOT( announceDoSearch() ) );
connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
SLOT( announceFieldChanged() ) );
+
+
+ connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() ));
+ connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() ));
+
+
setFocusProxy( mSearchText );
}
IncSearchWidget::~IncSearchWidget()
{
}
void IncSearchWidget::announceDoSearch2()
{
if ( KABPrefs::instance()->mSearchWithReturn )
return;
emit doSearch( mSearchText->text() );
//qDebug("emit dosreach ");
}
-void IncSearchWidget::announceDoSearch()
+void IncSearchWidget::announceDoSearch()
{
emit doSearch( mSearchText->text() );
// qDebug("emit dosreach ");
}
void IncSearchWidget::announceFieldChanged()
{
emit fieldChanged();
}
void IncSearchWidget::setFields( const KABC::Field::List &list )
{
mFieldCombo->clear();
mFieldCombo->insertItem( i18n( "All Fields" ) );
QFontMetrics fm ( mFieldCombo->font() );
int wid = fm.width(i18n( "All Fields" ) );
int max = wid;
KABC::Field::List::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
mFieldCombo->insertItem( (*it)->label() );
// wid = fm.width((*it)->label() );
//if ( wid > max )
// max = wid;
}
mFieldList = list;
announceDoSearch();
announceFieldChanged();
mFieldCombo->setMaximumWidth( wid+60 );
}
KABC::Field::List IncSearchWidget::fields() const
{
return mFieldList;
}
KABC::Field *IncSearchWidget::currentField()const
{
if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
return 0; // for error or 'use all fields'
else
return mFieldList[ mFieldCombo->currentItem() - 1 ];
}