-rw-r--r-- | kaddressbook/kaddressbookview.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 |
5 files changed, 9 insertions, 7 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 8062354..424d52a 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp | |||
@@ -99,64 +99,68 @@ QString KAddressBookView::selectedEmails() | |||
99 | } | 99 | } |
100 | 100 | ||
101 | return emailAddrs; | 101 | return emailAddrs; |
102 | } | 102 | } |
103 | 103 | ||
104 | KABC::Addressee::List KAddressBookView::addressees() | 104 | KABC::Addressee::List KAddressBookView::addressees() |
105 | { | 105 | { |
106 | KABC::Addressee::List addresseeList; | 106 | KABC::Addressee::List addresseeList; |
107 | 107 | ||
108 | KABC::AddressBook::Iterator it; | 108 | KABC::AddressBook::Iterator it; |
109 | for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 109 | for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
110 | if ( mFilter.filterAddressee( *it ) ) | 110 | if ( mFilter.filterAddressee( *it ) ) |
111 | addresseeList.append( *it ); | 111 | addresseeList.append( *it ); |
112 | } | 112 | } |
113 | 113 | ||
114 | return addresseeList; | 114 | return addresseeList; |
115 | } | 115 | } |
116 | 116 | ||
117 | void KAddressBookView::initGUI() | 117 | void KAddressBookView::initGUI() |
118 | { | 118 | { |
119 | // Create the layout | 119 | // Create the layout |
120 | QVBoxLayout *layout = new QVBoxLayout( this ); | 120 | QVBoxLayout *layout = new QVBoxLayout( this ); |
121 | 121 | ||
122 | // Add the view widget | 122 | // Add the view widget |
123 | mViewWidget = new QWidget( this ); | 123 | mViewWidget = new QWidget( this ); |
124 | layout->addWidget( mViewWidget ); | 124 | layout->addWidget( mViewWidget ); |
125 | } | 125 | } |
126 | 126 | ||
127 | KABC::Field::List KAddressBookView::fields() const | 127 | KABC::Field::List KAddressBookView::fields() const |
128 | { | 128 | { |
129 | return mFieldList; | 129 | return mFieldList; |
130 | } | 130 | } |
131 | KABC::Field::List KAddressBookView::allFields() const | ||
132 | { | ||
133 | return KABC::Field::allFields(); | ||
134 | } | ||
131 | 135 | ||
132 | void KAddressBookView::setFilter( const Filter &filter ) | 136 | void KAddressBookView::setFilter( const Filter &filter ) |
133 | { | 137 | { |
134 | mFilter = filter; | 138 | mFilter = filter; |
135 | } | 139 | } |
136 | 140 | ||
137 | KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const | 141 | KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const |
138 | { | 142 | { |
139 | return mDefaultFilterType; | 143 | return mDefaultFilterType; |
140 | } | 144 | } |
141 | 145 | ||
142 | const QString &KAddressBookView::defaultFilterName() const | 146 | const QString &KAddressBookView::defaultFilterName() const |
143 | { | 147 | { |
144 | return mDefaultFilterName; | 148 | return mDefaultFilterName; |
145 | } | 149 | } |
146 | 150 | ||
147 | KABC::AddressBook *KAddressBookView::addressBook() const | 151 | KABC::AddressBook *KAddressBookView::addressBook() const |
148 | { | 152 | { |
149 | return mAddressBook; | 153 | return mAddressBook; |
150 | } | 154 | } |
151 | 155 | ||
152 | QWidget *KAddressBookView::viewWidget() | 156 | QWidget *KAddressBookView::viewWidget() |
153 | { | 157 | { |
154 | return mViewWidget; | 158 | return mViewWidget; |
155 | } | 159 | } |
156 | 160 | ||
157 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, | 161 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, |
158 | QWidget *parent, | 162 | QWidget *parent, |
159 | const char *name ) | 163 | const char *name ) |
160 | { | 164 | { |
161 | return new ViewConfigureWidget( ab, parent, name ); | 165 | return new ViewConfigureWidget( ab, parent, name ); |
162 | } | 166 | } |
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 2e91cbc..8646136 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -93,64 +93,66 @@ class KAddressBookView : public QWidget | |||
93 | If overloaded in the subclass, do not forget to call the super class's | 93 | If overloaded in the subclass, do not forget to call the super class's |
94 | method. | 94 | method. |
95 | 95 | ||
96 | @param config The KConfig object to read from. The group will already | 96 | @param config The KConfig object to read from. The group will already |
97 | be set, so do not change the group. | 97 | be set, so do not change the group. |
98 | */ | 98 | */ |
99 | virtual void writeConfig( KConfig *config ); | 99 | virtual void writeConfig( KConfig *config ); |
100 | 100 | ||
101 | /** | 101 | /** |
102 | Returns a QString with all the selected email addresses concatenated | 102 | Returns a QString with all the selected email addresses concatenated |
103 | together with a ',' seperator. | 103 | together with a ',' seperator. |
104 | */ | 104 | */ |
105 | virtual QString selectedEmails(); | 105 | virtual QString selectedEmails(); |
106 | 106 | ||
107 | /** | 107 | /** |
108 | Return the type of the view: Icon, Table, etc. Please make sure that | 108 | Return the type of the view: Icon, Table, etc. Please make sure that |
109 | this is the same value that ViewWrapper::type() will return for your | 109 | this is the same value that ViewWrapper::type() will return for your |
110 | view. | 110 | view. |
111 | */ | 111 | */ |
112 | virtual QString type() const = 0; | 112 | virtual QString type() const = 0; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | Returns a list of the fields that should be displayed. The list | 115 | Returns a list of the fields that should be displayed. The list |
116 | is composed of the fields proper names (ie: Home Address), so | 116 | is composed of the fields proper names (ie: Home Address), so |
117 | the view may need to translate them in order to get the | 117 | the view may need to translate them in order to get the |
118 | value from the addressee. | 118 | value from the addressee. |
119 | 119 | ||
120 | This list is generated from the config file, so it is advisable to call | 120 | This list is generated from the config file, so it is advisable to call |
121 | this method whenever a readConfig() is called in order to get the newest | 121 | this method whenever a readConfig() is called in order to get the newest |
122 | list of fields. | 122 | list of fields. |
123 | */ | 123 | */ |
124 | KABC::Field::List fields() const; | 124 | KABC::Field::List fields() const; |
125 | |||
126 | KABC::Field::List allFields() const; | ||
125 | 127 | ||
126 | /** | 128 | /** |
127 | Sets the active filter. This filter will be used for filtering | 129 | Sets the active filter. This filter will be used for filtering |
128 | the list of addressees to display. The view will <b>not</b> | 130 | the list of addressees to display. The view will <b>not</b> |
129 | automatically refresh itself, so in most cases you will want to call | 131 | automatically refresh itself, so in most cases you will want to call |
130 | KAddressBookView::refresh() after this method. | 132 | KAddressBookView::refresh() after this method. |
131 | */ | 133 | */ |
132 | void setFilter( const Filter& ); | 134 | void setFilter( const Filter& ); |
133 | 135 | ||
134 | /** | 136 | /** |
135 | @return The default filter type selection. If the selection | 137 | @return The default filter type selection. If the selection |
136 | is SpecificFilter, the name of the filter can be retrieved with | 138 | is SpecificFilter, the name of the filter can be retrieved with |
137 | defaultFilterName() | 139 | defaultFilterName() |
138 | */ | 140 | */ |
139 | DefaultFilterType defaultFilterType() const; | 141 | DefaultFilterType defaultFilterType() const; |
140 | 142 | ||
141 | /** | 143 | /** |
142 | @return The name of the default filter. This string is | 144 | @return The name of the default filter. This string is |
143 | only valid if defaultFilterType() is returning SpecificFilter. | 145 | only valid if defaultFilterType() is returning SpecificFilter. |
144 | */ | 146 | */ |
145 | const QString &defaultFilterName() const; | 147 | const QString &defaultFilterName() const; |
146 | 148 | ||
147 | /** | 149 | /** |
148 | @return The address book. | 150 | @return The address book. |
149 | */ | 151 | */ |
150 | KABC::AddressBook *addressBook() const; | 152 | KABC::AddressBook *addressBook() const; |
151 | 153 | ||
152 | public slots: | 154 | public slots: |
153 | /** | 155 | /** |
154 | Must be overloaded in subclasses to refresh the view. | 156 | Must be overloaded in subclasses to refresh the view. |
155 | Refreshing includes updating the view to ensure that only items | 157 | Refreshing includes updating the view to ensure that only items |
156 | in the document are visible. If <i>uid</i> is valid, only the | 158 | in the document are visible. If <i>uid</i> is valid, only the |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 2c9b162..2d7ed08 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -266,65 +266,65 @@ void KAddressBookCardView::writeConfig( KConfig *config ) | |||
266 | } | 266 | } |
267 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | 267 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) |
268 | { | 268 | { |
269 | mCardView->clear(); | 269 | mCardView->clear(); |
270 | if ( s.isEmpty() || s == "*" ) { | 270 | if ( s.isEmpty() || s == "*" ) { |
271 | refresh(); | 271 | refresh(); |
272 | return; | 272 | return; |
273 | } | 273 | } |
274 | QString pattern = s.lower()+"*"; | 274 | QString pattern = s.lower()+"*"; |
275 | QRegExp re; | 275 | QRegExp re; |
276 | re.setWildcard(true); // most people understand these better. | 276 | re.setWildcard(true); // most people understand these better. |
277 | re.setCaseSensitive(false); | 277 | re.setCaseSensitive(false); |
278 | re.setPattern( pattern ); | 278 | re.setPattern( pattern ); |
279 | if (!re.isValid()) | 279 | if (!re.isValid()) |
280 | return; | 280 | return; |
281 | mCardView->viewport()->setUpdatesEnabled( false ); | 281 | mCardView->viewport()->setUpdatesEnabled( false ); |
282 | KABC::Addressee::List addresseeList = addressees(); | 282 | KABC::Addressee::List addresseeList = addressees(); |
283 | KABC::Addressee::List::Iterator it; | 283 | KABC::Addressee::List::Iterator it; |
284 | if ( field ) { | 284 | if ( field ) { |
285 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 285 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
286 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 286 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
287 | continue; | 287 | continue; |
288 | #if QT_VERSION >= 300 | 288 | #if QT_VERSION >= 300 |
289 | if (re.search(field->value( *it ).lower()) != -1) | 289 | if (re.search(field->value( *it ).lower()) != -1) |
290 | #else | 290 | #else |
291 | if (re.match(field->value( *it ).lower()) != -1) | 291 | if (re.match(field->value( *it ).lower()) != -1) |
292 | #endif | 292 | #endif |
293 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 293 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
294 | addressBook(), *it, mCardView); | 294 | addressBook(), *it, mCardView); |
295 | 295 | ||
296 | } | 296 | } |
297 | } else { | 297 | } else { |
298 | KABC::Field::List fieldList = fields(); | 298 | KABC::Field::List fieldList = allFields(); |
299 | KABC::Field::List::ConstIterator fieldIt; | 299 | KABC::Field::List::ConstIterator fieldIt; |
300 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 300 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
301 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 301 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
302 | continue; | 302 | continue; |
303 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 303 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
304 | #if QT_VERSION >= 300 | 304 | #if QT_VERSION >= 300 |
305 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 305 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
306 | #else | 306 | #else |
307 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 307 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
308 | #endif | 308 | #endif |
309 | { | 309 | { |
310 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 310 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
311 | addressBook(), *it, mCardView); | 311 | addressBook(), *it, mCardView); |
312 | continue; | 312 | continue; |
313 | } | 313 | } |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } | 316 | } |
317 | mCardView->viewport()->setUpdatesEnabled( true ); | 317 | mCardView->viewport()->setUpdatesEnabled( true ); |
318 | mCardView->viewport()->update(); | 318 | mCardView->viewport()->update(); |
319 | if ( mCardView->firstItem() ) { | 319 | if ( mCardView->firstItem() ) { |
320 | mCardView->setCurrentItem ( mCardView->firstItem() ); | 320 | mCardView->setCurrentItem ( mCardView->firstItem() ); |
321 | mCardView->setSelected ( mCardView->firstItem() , true ); | 321 | mCardView->setSelected ( mCardView->firstItem() , true ); |
322 | } | 322 | } |
323 | else | 323 | else |
324 | emit selected(QString::null); | 324 | emit selected(QString::null); |
325 | } | 325 | } |
326 | QStringList KAddressBookCardView::selectedUids() | 326 | QStringList KAddressBookCardView::selectedUids() |
327 | { | 327 | { |
328 | QStringList uidList; | 328 | QStringList uidList; |
329 | CardViewItem *item; | 329 | CardViewItem *item; |
330 | AddresseeCardViewItem *aItem; | 330 | AddresseeCardViewItem *aItem; |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index 0ce56c8..faeda06 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -253,65 +253,65 @@ void KAddressBookIconView::readConfig(KConfig *config) | |||
253 | } | 253 | } |
254 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 254 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
255 | { | 255 | { |
256 | mIconView->clear(); | 256 | mIconView->clear(); |
257 | mIconList.clear(); | 257 | mIconList.clear(); |
258 | if ( s.isEmpty() || s == "*" ) { | 258 | if ( s.isEmpty() || s == "*" ) { |
259 | refresh(); | 259 | refresh(); |
260 | return; | 260 | return; |
261 | } | 261 | } |
262 | QString pattern = s.lower()+"*"; | 262 | QString pattern = s.lower()+"*"; |
263 | QRegExp re; | 263 | QRegExp re; |
264 | re.setWildcard(true); // most people understand these better. | 264 | re.setWildcard(true); // most people understand these better. |
265 | re.setCaseSensitive(false); | 265 | re.setCaseSensitive(false); |
266 | re.setPattern( pattern ); | 266 | re.setPattern( pattern ); |
267 | if (!re.isValid()) | 267 | if (!re.isValid()) |
268 | return; | 268 | return; |
269 | KABC::Addressee::List addresseeList = addressees(); | 269 | KABC::Addressee::List addresseeList = addressees(); |
270 | KABC::Addressee::List::Iterator it; | 270 | KABC::Addressee::List::Iterator it; |
271 | if ( field ) { | 271 | if ( field ) { |
272 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 272 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
273 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 273 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
274 | continue; | 274 | continue; |
275 | #if QT_VERSION >= 300 | 275 | #if QT_VERSION >= 300 |
276 | if (re.search(field->value( *it ).lower()) != -1) | 276 | if (re.search(field->value( *it ).lower()) != -1) |
277 | #else | 277 | #else |
278 | if (re.match(field->value( *it ).lower()) != -1) | 278 | if (re.match(field->value( *it ).lower()) != -1) |
279 | #endif | 279 | #endif |
280 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 280 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
281 | 281 | ||
282 | 282 | ||
283 | } | 283 | } |
284 | } else { | 284 | } else { |
285 | KABC::Field::List fieldList = fields(); | 285 | KABC::Field::List fieldList = allFields(); |
286 | KABC::Field::List::ConstIterator fieldIt; | 286 | KABC::Field::List::ConstIterator fieldIt; |
287 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 287 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
288 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 288 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
289 | continue; | 289 | continue; |
290 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 290 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
291 | #if QT_VERSION >= 300 | 291 | #if QT_VERSION >= 300 |
292 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 292 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
293 | #else | 293 | #else |
294 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 294 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
295 | #endif | 295 | #endif |
296 | { | 296 | { |
297 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 297 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
298 | continue; | 298 | continue; |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | mIconView->arrangeItemsInGrid( true ); | 303 | mIconView->arrangeItemsInGrid( true ); |
304 | if ( mIconView->firstItem() ) { | 304 | if ( mIconView->firstItem() ) { |
305 | mIconView->setCurrentItem ( mIconView->firstItem() ); | 305 | mIconView->setCurrentItem ( mIconView->firstItem() ); |
306 | mIconView->setSelected ( mIconView->firstItem() , true ); | 306 | mIconView->setSelected ( mIconView->firstItem() , true ); |
307 | } | 307 | } |
308 | else | 308 | else |
309 | emit selected(QString::null); | 309 | emit selected(QString::null); |
310 | } | 310 | } |
311 | QStringList KAddressBookIconView::selectedUids() | 311 | QStringList KAddressBookIconView::selectedUids() |
312 | { | 312 | { |
313 | QStringList uidList; | 313 | QStringList uidList; |
314 | QIconViewItem *item; | 314 | QIconViewItem *item; |
315 | AddresseeIconViewItem *aItem; | 315 | AddresseeIconViewItem *aItem; |
316 | 316 | ||
317 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 317 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 89053c2..61703ee 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -134,65 +134,65 @@ void KAddressBookTableView::reconstructListView() | |||
134 | mListView->show(); | 134 | mListView->show(); |
135 | } | 135 | } |
136 | 136 | ||
137 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 137 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
138 | { | 138 | { |
139 | mListView->clear(); | 139 | mListView->clear(); |
140 | if ( s.isEmpty() || s == "*" ) { | 140 | if ( s.isEmpty() || s == "*" ) { |
141 | refresh(); | 141 | refresh(); |
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | QString pattern = s.lower()+"*"; | 144 | QString pattern = s.lower()+"*"; |
145 | QRegExp re; | 145 | QRegExp re; |
146 | re.setWildcard(true); // most people understand these better. | 146 | re.setWildcard(true); // most people understand these better. |
147 | re.setCaseSensitive(false); | 147 | re.setCaseSensitive(false); |
148 | re.setPattern( pattern ); | 148 | re.setPattern( pattern ); |
149 | if (!re.isValid()) | 149 | if (!re.isValid()) |
150 | return; | 150 | return; |
151 | KABC::Addressee::List addresseeList = addressees(); | 151 | KABC::Addressee::List addresseeList = addressees(); |
152 | KABC::Addressee::List::Iterator it; | 152 | KABC::Addressee::List::Iterator it; |
153 | if ( field ) { | 153 | if ( field ) { |
154 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 154 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
155 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 155 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
156 | continue; | 156 | continue; |
157 | #if QT_VERSION >= 300 | 157 | #if QT_VERSION >= 300 |
158 | if (re.search(field->value( *it ).lower()) != -1) | 158 | if (re.search(field->value( *it ).lower()) != -1) |
159 | #else | 159 | #else |
160 | if (re.match(field->value( *it ).lower()) != -1) | 160 | if (re.match(field->value( *it ).lower()) != -1) |
161 | #endif | 161 | #endif |
162 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 162 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
163 | 163 | ||
164 | } | 164 | } |
165 | } else { | 165 | } else { |
166 | KABC::Field::List fieldList = fields(); | 166 | KABC::Field::List fieldList = allFields(); |
167 | KABC::Field::List::ConstIterator fieldIt; | 167 | KABC::Field::List::ConstIterator fieldIt; |
168 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 168 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
169 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 169 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
170 | continue; | 170 | continue; |
171 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 171 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
172 | #if QT_VERSION >= 300 | 172 | #if QT_VERSION >= 300 |
173 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 173 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
174 | #else | 174 | #else |
175 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 175 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
176 | #endif | 176 | #endif |
177 | { | 177 | { |
178 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 178 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
179 | break; | 179 | break; |
180 | } | 180 | } |
181 | } | 181 | } |
182 | } | 182 | } |
183 | } | 183 | } |
184 | // Sometimes the background pixmap gets messed up when we add lots | 184 | // Sometimes the background pixmap gets messed up when we add lots |
185 | // of items. | 185 | // of items. |
186 | mListView->repaint(); | 186 | mListView->repaint(); |
187 | if ( mListView->firstChild() ) { | 187 | if ( mListView->firstChild() ) { |
188 | mListView->setCurrentItem ( mListView->firstChild() ); | 188 | mListView->setCurrentItem ( mListView->firstChild() ); |
189 | mListView->setSelected ( mListView->firstChild(), true ); | 189 | mListView->setSelected ( mListView->firstChild(), true ); |
190 | } | 190 | } |
191 | else | 191 | else |
192 | emit selected(QString::null); | 192 | emit selected(QString::null); |
193 | 193 | ||
194 | } | 194 | } |
195 | void KAddressBookTableView::writeConfig(KConfig *config) | 195 | void KAddressBookTableView::writeConfig(KConfig *config) |
196 | { | 196 | { |
197 | KAddressBookView::writeConfig(config); | 197 | KAddressBookView::writeConfig(config); |
198 | 198 | ||
@@ -229,68 +229,64 @@ void KAddressBookTableView::readConfig(KConfig *config) | |||
229 | #endif //KAB_EMBEDDED | 229 | #endif //KAB_EMBEDDED |
230 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); | 230 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); |
231 | mListView->setAlternateColor(c); | 231 | mListView->setAlternateColor(c); |
232 | 232 | ||
233 | 233 | ||
234 | //US mListView->viewport()->setPalette( p ); | 234 | //US mListView->viewport()->setPalette( p ); |
235 | mListView->setPalette( p ); | 235 | mListView->setPalette( p ); |
236 | } | 236 | } |
237 | else | 237 | else |
238 | { | 238 | { |
239 | // needed if turned off during a session. | 239 | // needed if turned off during a session. |
240 | //US mListView->viewport()->setPalette( mListView->palette() ); | 240 | //US mListView->viewport()->setPalette( mListView->palette() ); |
241 | mListView->setPalette( mListView->palette() ); | 241 | mListView->setPalette( mListView->palette() ); |
242 | } | 242 | } |
243 | 243 | ||
244 | //custom fonts? | 244 | //custom fonts? |
245 | QFont f( font() ); | 245 | QFont f( font() ); |
246 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 246 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
247 | { | 247 | { |
248 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); | 248 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); |
249 | f.setBold( true ); | 249 | f.setBold( true ); |
250 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 250 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
251 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); | 251 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); |
252 | } | 252 | } |
253 | else | 253 | else |
254 | { | 254 | { |
255 | mListView->setFont( f ); | 255 | mListView->setFont( f ); |
256 | f.setBold( true ); | 256 | f.setBold( true ); |
257 | //US mListView->setHeaderFont( f ); | 257 | //US mListView->setHeaderFont( f ); |
258 | mListView->header()->setFont( f ); | 258 | mListView->header()->setFont( f ); |
259 | } | 259 | } |
260 | 260 | ||
261 | |||
262 | |||
263 | |||
264 | |||
265 | // Set the list view options | 261 | // Set the list view options |
266 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", | 262 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |
267 | true)); | 263 | true)); |
268 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); | 264 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); |
269 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); | 265 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); |
270 | 266 | ||
271 | if (config->readBoolEntry("Background", false)) | 267 | if (config->readBoolEntry("Background", false)) |
272 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); | 268 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); |
273 | 269 | ||
274 | // Restore the layout of the listview | 270 | // Restore the layout of the listview |
275 | mListView->restoreLayout(config, config->group()); | 271 | mListView->restoreLayout(config, config->group()); |
276 | } | 272 | } |
277 | 273 | ||
278 | void KAddressBookTableView::refresh(QString uid) | 274 | void KAddressBookTableView::refresh(QString uid) |
279 | { | 275 | { |
280 | // For now just repopulate. In reality this method should | 276 | // For now just repopulate. In reality this method should |
281 | // check the value of uid, and if valid iterate through | 277 | // check the value of uid, and if valid iterate through |
282 | // the listview to find the entry, then tell it to refresh. | 278 | // the listview to find the entry, then tell it to refresh. |
283 | 279 | ||
284 | if (uid.isNull()) { | 280 | if (uid.isNull()) { |
285 | // Clear the list view | 281 | // Clear the list view |
286 | QString currentUID, nextUID; | 282 | QString currentUID, nextUID; |
287 | #ifndef KAB_EMBEDDED | 283 | #ifndef KAB_EMBEDDED |
288 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 284 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |
289 | #else //KAB_EMBEDDED | 285 | #else //KAB_EMBEDDED |
290 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); | 286 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); |
291 | #endif //KAB_EMBEDDED | 287 | #endif //KAB_EMBEDDED |
292 | 288 | ||
293 | if ( currentItem ) { | 289 | if ( currentItem ) { |
294 | #ifndef KAB_EMBEDDED | 290 | #ifndef KAB_EMBEDDED |
295 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); | 291 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); |
296 | #else //KAB_EMBEDDED | 292 | #else //KAB_EMBEDDED |