author | zautrix <zautrix> | 2004-10-07 22:37:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 22:37:40 (UTC) |
commit | 21ec296f7f2832920dac336bb9f9476c80d746f5 (patch) (unidiff) | |
tree | 69b2897665d70ad45da249b1cf374a01d3be6dc4 /kaddressbook/views | |
parent | 4a01915314201cbe2461ce68cdf9c556c687d727 (diff) | |
download | kdepimpi-21ec296f7f2832920dac336bb9f9476c80d746f5.zip kdepimpi-21ec296f7f2832920dac336bb9f9476c80d746f5.tar.gz kdepimpi-21ec296f7f2832920dac336bb9f9476c80d746f5.tar.bz2 |
ab view fixes
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 8d0fca1..4babf67 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -302,64 +302,66 @@ QStringList KAddressBookCardView::selectedUids() | |||
302 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 302 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
303 | { | 303 | { |
304 | if (item->isSelected()) | 304 | if (item->isSelected()) |
305 | { | 305 | { |
306 | #ifndef KAB_EMBEDDED | 306 | #ifndef KAB_EMBEDDED |
307 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 307 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
308 | #else //KAB_EMBEDDED | 308 | #else //KAB_EMBEDDED |
309 | aItem = (AddresseeCardViewItem*)(item); | 309 | aItem = (AddresseeCardViewItem*)(item); |
310 | #endif //KAB_EMBEDDED | 310 | #endif //KAB_EMBEDDED |
311 | if (aItem) | 311 | if (aItem) |
312 | uidList << aItem->addressee().uid(); | 312 | uidList << aItem->addressee().uid(); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | return uidList; | 316 | return uidList; |
317 | } | 317 | } |
318 | 318 | ||
319 | void KAddressBookCardView::refresh(QString uid) | 319 | void KAddressBookCardView::refresh(QString uid) |
320 | { | 320 | { |
321 | CardViewItem *item; | 321 | CardViewItem *item; |
322 | AddresseeCardViewItem *aItem; | 322 | AddresseeCardViewItem *aItem; |
323 | 323 | ||
324 | if (uid.isNull()) | 324 | if (uid.isNull()) |
325 | { | 325 | { |
326 | // Rebuild the view | 326 | // Rebuild the view |
327 | mCardView->viewport()->setUpdatesEnabled( false ); | 327 | mCardView->viewport()->setUpdatesEnabled( false ); |
328 | mCardView->clear(); | 328 | mCardView->clear(); |
329 | 329 | ||
330 | KABC::Addressee::List addresseeList = addressees(); | 330 | KABC::Addressee::List addresseeList = addressees(); |
331 | KABC::Addressee::List::Iterator iter; | 331 | KABC::Addressee::List::Iterator iter; |
332 | for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) | 332 | for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) |
333 | { | 333 | { |
334 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) | ||
335 | continue; | ||
334 | aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, | 336 | aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, |
335 | addressBook(), *iter, mCardView); | 337 | addressBook(), *iter, mCardView); |
336 | } | 338 | } |
337 | mCardView->viewport()->setUpdatesEnabled( true ); | 339 | mCardView->viewport()->setUpdatesEnabled( true ); |
338 | mCardView->viewport()->update(); | 340 | mCardView->viewport()->update(); |
339 | 341 | ||
340 | // by default nothing is selected | 342 | // by default nothing is selected |
341 | emit selected(QString::null); | 343 | emit selected(QString::null); |
342 | } | 344 | } |
343 | else | 345 | else |
344 | { | 346 | { |
345 | // Try to find the one to refresh | 347 | // Try to find the one to refresh |
346 | bool found = false; | 348 | bool found = false; |
347 | for (item = mCardView->firstItem(); item && !found; | 349 | for (item = mCardView->firstItem(); item && !found; |
348 | item = item->nextItem()) | 350 | item = item->nextItem()) |
349 | { | 351 | { |
350 | #ifndef KAB_EMBEDDED | 352 | #ifndef KAB_EMBEDDED |
351 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 353 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
352 | #else //KAB_EMBEDDED | 354 | #else //KAB_EMBEDDED |
353 | aItem = (AddresseeCardViewItem*)(item); | 355 | aItem = (AddresseeCardViewItem*)(item); |
354 | #endif //KAB_EMBEDDED | 356 | #endif //KAB_EMBEDDED |
355 | 357 | ||
356 | if ((aItem) && (aItem->addressee().uid() == uid)) | 358 | if ((aItem) && (aItem->addressee().uid() == uid)) |
357 | { | 359 | { |
358 | aItem->refresh(); | 360 | aItem->refresh(); |
359 | found = true; | 361 | found = true; |
360 | } | 362 | } |
361 | } | 363 | } |
362 | } | 364 | } |
363 | } | 365 | } |
364 | 366 | ||
365 | void KAddressBookCardView::setSelected(QString uid, bool selected) | 367 | void KAddressBookCardView::setSelected(QString uid, bool selected) |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index 0ffc674..fdc0db9 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -287,66 +287,69 @@ QStringList KAddressBookIconView::selectedUids() | |||
287 | QIconViewItem *item; | 287 | QIconViewItem *item; |
288 | AddresseeIconViewItem *aItem; | 288 | AddresseeIconViewItem *aItem; |
289 | 289 | ||
290 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 290 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
291 | { | 291 | { |
292 | if (item->isSelected()) | 292 | if (item->isSelected()) |
293 | { | 293 | { |
294 | #ifndef KAB_EMBEDDED | 294 | #ifndef KAB_EMBEDDED |
295 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 295 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
296 | #else //KAB_EMBEDDED | 296 | #else //KAB_EMBEDDED |
297 | aItem = (AddresseeIconViewItem*)(item); | 297 | aItem = (AddresseeIconViewItem*)(item); |
298 | #endif //KAB_EMBEDDED | 298 | #endif //KAB_EMBEDDED |
299 | if (aItem) | 299 | if (aItem) |
300 | uidList << aItem->addressee().uid(); | 300 | uidList << aItem->addressee().uid(); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | return uidList; | 304 | return uidList; |
305 | } | 305 | } |
306 | 306 | ||
307 | void KAddressBookIconView::refresh(QString uid) | 307 | void KAddressBookIconView::refresh(QString uid) |
308 | { | 308 | { |
309 | QIconViewItem *item; | 309 | QIconViewItem *item; |
310 | AddresseeIconViewItem *aItem; | 310 | AddresseeIconViewItem *aItem; |
311 | 311 | ||
312 | if ( uid.isNull() ) { | 312 | if ( uid.isNull() ) { |
313 | // Rebuild the view | 313 | // Rebuild the view |
314 | mIconView->clear(); | 314 | mIconView->clear(); |
315 | mIconList.clear(); | 315 | mIconList.clear(); |
316 | 316 | ||
317 | KABC::Addressee::List addresseeList = addressees(); | 317 | KABC::Addressee::List addresseeList = addressees(); |
318 | KABC::Addressee::List::Iterator iter; | 318 | KABC::Addressee::List::Iterator iter; |
319 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) | 319 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { |
320 | aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); | 320 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) |
321 | continue; | ||
322 | aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); | ||
323 | } | ||
321 | 324 | ||
322 | mIconView->arrangeItemsInGrid( true ); | 325 | mIconView->arrangeItemsInGrid( true ); |
323 | 326 | ||
324 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) | 327 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) |
325 | { | 328 | { |
326 | #ifndef KAB_EMBEDDED | 329 | #ifndef KAB_EMBEDDED |
327 | AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); | 330 | AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); |
328 | #else //KAB_EMBEDDED | 331 | #else //KAB_EMBEDDED |
329 | AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); | 332 | AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); |
330 | #endif //KAB_EMBEDDED | 333 | #endif //KAB_EMBEDDED |
331 | mIconList.append( aivi ); | 334 | mIconList.append( aivi ); |
332 | } | 335 | } |
333 | 336 | ||
334 | } else { | 337 | } else { |
335 | // Try to find the one to refresh | 338 | // Try to find the one to refresh |
336 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { | 339 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { |
337 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
338 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 341 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
339 | #else //KAB_EMBEDDED | 342 | #else //KAB_EMBEDDED |
340 | aItem = (AddresseeIconViewItem*)(item); | 343 | aItem = (AddresseeIconViewItem*)(item); |
341 | #endif //KAB_EMBEDDED | 344 | #endif //KAB_EMBEDDED |
342 | if ((aItem) && (aItem->addressee().uid() == uid)) { | 345 | if ((aItem) && (aItem->addressee().uid() == uid)) { |
343 | aItem->refresh(); | 346 | aItem->refresh(); |
344 | mIconView->arrangeItemsInGrid( true ); | 347 | mIconView->arrangeItemsInGrid( true ); |
345 | return; | 348 | return; |
346 | } | 349 | } |
347 | } | 350 | } |
348 | refresh( QString::null ); | 351 | refresh( QString::null ); |
349 | } | 352 | } |
350 | } | 353 | } |
351 | 354 | ||
352 | void KAddressBookIconView::setSelected(QString uid, bool selected) | 355 | void KAddressBookIconView::setSelected(QString uid, bool selected) |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 1dc9198..fbfddba 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -248,64 +248,66 @@ void KAddressBookTableView::readConfig(KConfig *config) | |||
248 | void KAddressBookTableView::refresh(QString uid) | 248 | void KAddressBookTableView::refresh(QString uid) |
249 | { | 249 | { |
250 | // For now just repopulate. In reality this method should | 250 | // For now just repopulate. In reality this method should |
251 | // check the value of uid, and if valid iterate through | 251 | // check the value of uid, and if valid iterate through |
252 | // the listview to find the entry, then tell it to refresh. | 252 | // the listview to find the entry, then tell it to refresh. |
253 | 253 | ||
254 | if (uid.isNull()) { | 254 | if (uid.isNull()) { |
255 | // Clear the list view | 255 | // Clear the list view |
256 | QString currentUID, nextUID; | 256 | QString currentUID, nextUID; |
257 | #ifndef KAB_EMBEDDED | 257 | #ifndef KAB_EMBEDDED |
258 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 258 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |
259 | #else //KAB_EMBEDDED | 259 | #else //KAB_EMBEDDED |
260 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); | 260 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); |
261 | #endif //KAB_EMBEDDED | 261 | #endif //KAB_EMBEDDED |
262 | 262 | ||
263 | if ( currentItem ) { | 263 | if ( currentItem ) { |
264 | #ifndef KAB_EMBEDDED | 264 | #ifndef KAB_EMBEDDED |
265 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); | 265 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); |
266 | #else //KAB_EMBEDDED | 266 | #else //KAB_EMBEDDED |
267 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); | 267 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); |
268 | #endif //KAB_EMBEDDED | 268 | #endif //KAB_EMBEDDED |
269 | if ( nextItem ) | 269 | if ( nextItem ) |
270 | nextUID = nextItem->addressee().uid(); | 270 | nextUID = nextItem->addressee().uid(); |
271 | currentUID = currentItem->addressee().uid(); | 271 | currentUID = currentItem->addressee().uid(); |
272 | } | 272 | } |
273 | 273 | ||
274 | mListView->clear(); | 274 | mListView->clear(); |
275 | 275 | ||
276 | currentItem = 0; | 276 | currentItem = 0; |
277 | KABC::Addressee::List addresseeList = addressees(); | 277 | KABC::Addressee::List addresseeList = addressees(); |
278 | KABC::Addressee::List::Iterator it; | 278 | KABC::Addressee::List::Iterator it; |
279 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 279 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
280 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | ||
281 | continue; | ||
280 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 282 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
281 | if ( (*it).uid() == currentUID ) | 283 | if ( (*it).uid() == currentUID ) |
282 | currentItem = item; | 284 | currentItem = item; |
283 | else if ( (*it).uid() == nextUID && !currentItem ) | 285 | else if ( (*it).uid() == nextUID && !currentItem ) |
284 | currentItem = item; | 286 | currentItem = item; |
285 | } | 287 | } |
286 | 288 | ||
287 | // Sometimes the background pixmap gets messed up when we add lots | 289 | // Sometimes the background pixmap gets messed up when we add lots |
288 | // of items. | 290 | // of items. |
289 | mListView->repaint(); | 291 | mListView->repaint(); |
290 | 292 | ||
291 | if ( currentItem ) { | 293 | if ( currentItem ) { |
292 | mListView->setCurrentItem( currentItem ); | 294 | mListView->setCurrentItem( currentItem ); |
293 | mListView->ensureItemVisible( currentItem ); | 295 | mListView->ensureItemVisible( currentItem ); |
294 | } | 296 | } |
295 | } else { | 297 | } else { |
296 | // Only need to update on entry. Iterate through and try to find it | 298 | // Only need to update on entry. Iterate through and try to find it |
297 | ContactListViewItem *ceItem; | 299 | ContactListViewItem *ceItem; |
298 | QListViewItemIterator it( mListView ); | 300 | QListViewItemIterator it( mListView ); |
299 | while ( it.current() ) { | 301 | while ( it.current() ) { |
300 | #ifndef KAB_EMBEDDED | 302 | #ifndef KAB_EMBEDDED |
301 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 303 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
302 | #else //KAB_EMBEDDED | 304 | #else //KAB_EMBEDDED |
303 | ceItem = (ContactListViewItem*)( it.current() ); | 305 | ceItem = (ContactListViewItem*)( it.current() ); |
304 | #endif //KAB_EMBEDDED | 306 | #endif //KAB_EMBEDDED |
305 | 307 | ||
306 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 308 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
307 | ceItem->refresh(); | 309 | ceItem->refresh(); |
308 | return; | 310 | return; |
309 | } | 311 | } |
310 | ++it; | 312 | ++it; |
311 | } | 313 | } |