author | zautrix <zautrix> | 2005-03-29 13:52:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 13:52:41 (UTC) |
commit | 7046b36fb5dd14598ece00b575554eba2956ef84 (patch) (side-by-side diff) | |
tree | 934579f9f61f09563dfcbfef207d314d510d57ea /kaddressbook/incsearchwidget.cpp | |
parent | 894717798a8d129f4b991a2fe856d2f1e8e9624a (diff) | |
download | kdepimpi-7046b36fb5dd14598ece00b575554eba2956ef84.zip kdepimpi-7046b36fb5dd14598ece00b575554eba2956ef84.tar.gz kdepimpi-7046b36fb5dd14598ece00b575554eba2956ef84.tar.bz2 |
kapi fixes
Diffstat (limited to 'kaddressbook/incsearchwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index dd2121a..cd198c4 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -105,47 +105,53 @@ void IncSearchWidget::announceDoSearch2() 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; + mFieldCombo->setMaximumWidth( wid+60 ); + mSearchText->setMaximumWidth( 1024 ); + } +} 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 ); + 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 |