author | zautrix <zautrix> | 2005-03-29 13:52:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 13:52:41 (UTC) |
commit | 7046b36fb5dd14598ece00b575554eba2956ef84 (patch) (unidiff) | |
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() | |||
105 | 105 | ||
106 | void IncSearchWidget::announceDoSearch() | 106 | void IncSearchWidget::announceDoSearch() |
107 | { | 107 | { |
108 | 108 | ||
109 | emit doSearch( mSearchText->text() ); | 109 | emit doSearch( mSearchText->text() ); |
110 | // qDebug("emit dosreach "); | 110 | // qDebug("emit dosreach "); |
111 | } | 111 | } |
112 | 112 | ||
113 | void IncSearchWidget::announceFieldChanged() | 113 | void IncSearchWidget::announceFieldChanged() |
114 | { | 114 | { |
115 | emit fieldChanged(); | 115 | emit fieldChanged(); |
116 | } | 116 | } |
117 | 117 | void IncSearchWidget::setSize() | |
118 | { | ||
119 | if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { | ||
120 | mFieldCombo->setMaximumWidth( 40 ); | ||
121 | mSearchText->setMaximumWidth( 30 ); | ||
122 | } else { | ||
123 | QFontMetrics fm ( mFieldCombo->font() ); | ||
124 | int wid = fm.width(i18n( "All Fields" ) ); | ||
125 | int max = wid; | ||
126 | mFieldCombo->setMaximumWidth( wid+60 ); | ||
127 | mSearchText->setMaximumWidth( 1024 ); | ||
128 | } | ||
129 | } | ||
118 | void IncSearchWidget::setFields( const KABC::Field::List &list ) | 130 | void IncSearchWidget::setFields( const KABC::Field::List &list ) |
119 | { | 131 | { |
120 | 132 | ||
121 | mFieldCombo->clear(); | 133 | mFieldCombo->clear(); |
122 | mFieldCombo->insertItem( i18n( "All Fields" ) ); | 134 | mFieldCombo->insertItem( i18n( "All Fields" ) ); |
123 | QFontMetrics fm ( mFieldCombo->font() ); | 135 | |
124 | int wid = fm.width(i18n( "All Fields" ) ); | ||
125 | int max = wid; | ||
126 | |||
127 | KABC::Field::List::ConstIterator it; | 136 | KABC::Field::List::ConstIterator it; |
128 | for ( it = list.begin(); it != list.end(); ++it ) { | 137 | for ( it = list.begin(); it != list.end(); ++it ) { |
129 | mFieldCombo->insertItem( (*it)->label() ); | 138 | mFieldCombo->insertItem( (*it)->label() ); |
130 | // wid = fm.width((*it)->label() ); | ||
131 | //if ( wid > max ) | ||
132 | // max = wid; | ||
133 | } | 139 | } |
134 | 140 | ||
135 | mFieldList = list; | 141 | mFieldList = list; |
136 | 142 | ||
137 | announceDoSearch(); | 143 | announceDoSearch(); |
138 | announceFieldChanged(); | 144 | announceFieldChanged(); |
139 | mFieldCombo->setMaximumWidth( wid+60 ); | 145 | setSize(); |
140 | } | 146 | } |
141 | 147 | ||
142 | KABC::Field::List IncSearchWidget::fields() const | 148 | KABC::Field::List IncSearchWidget::fields() const |
143 | { | 149 | { |
144 | return mFieldList; | 150 | return mFieldList; |
145 | } | 151 | } |
146 | 152 | ||
147 | KABC::Field *IncSearchWidget::currentField()const | 153 | KABC::Field *IncSearchWidget::currentField()const |
148 | { | 154 | { |
149 | if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) | 155 | if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) |
150 | return 0; // for error or 'use all fields' | 156 | return 0; // for error or 'use all fields' |
151 | else | 157 | else |