summaryrefslogtreecommitdiffabout
path: root/kaddressbook/incsearchwidget.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/incsearchwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index dd2121a..cd198c4 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -116,3 +116,15 @@ void IncSearchWidget::announceFieldChanged()
}
-
+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 )
@@ -122,5 +134,2 @@ void IncSearchWidget::setFields( const KABC::Field::List &list )
mFieldCombo->insertItem( i18n( "All Fields" ) );
- QFontMetrics fm ( mFieldCombo->font() );
- int wid = fm.width(i18n( "All Fields" ) );
- int max = wid;
@@ -129,5 +138,2 @@ void IncSearchWidget::setFields( const KABC::Field::List &list )
mFieldCombo->insertItem( (*it)->label() );
- // wid = fm.width((*it)->label() );
- //if ( wid > max )
- // max = wid;
}
@@ -138,3 +144,3 @@ void IncSearchWidget::setFields( const KABC::Field::List &list )
announceFieldChanged();
- mFieldCombo->setMaximumWidth( wid+60 );
+ setSize();
}