-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 314de10..7577079 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -78,97 +78,99 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 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() { emit doSearch( mSearchText->text() ); // qDebug("emit dosreach "); } void IncSearchWidget::announceFieldChanged() { emit fieldChanged(); } void IncSearchWidget::setSize() { if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { mFieldCombo->setMaximumWidth( 40 ); mSearchText->setMaximumWidth( 30 ); } else { QFontMetrics fm ( mFieldCombo->font() ); int wid = fm.width(i18n( "All Fields" ) ); - int max = wid; +#ifdef DESKTOP_VERSION + wid = wid * 2; +#endif mFieldCombo->setMaximumWidth( wid+60 ); mSearchText->setMaximumWidth( 1024 ); } } void IncSearchWidget::setFields( const KABC::Field::List &list ) { mFieldCombo->clear(); mFieldCombo->insertItem( i18n( "All Fields" ) ); KABC::Field::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { mFieldCombo->insertItem( (*it)->label() ); } mFieldList = list; announceDoSearch(); announceFieldChanged(); setSize(); } 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 ]; } void IncSearchWidget::setCurrentItem( int pos ) { mFieldCombo->setCurrentItem( pos ); announceFieldChanged(); } int IncSearchWidget::currentItem() const { return mFieldCombo->currentItem(); } #ifndef KAB_EMBEDDED #include "incsearchwidget.moc" |