summaryrefslogtreecommitdiff
authoreilers <eilers>2002-11-28 11:50:57 (UTC)
committer eilers <eilers>2002-11-28 11:50:57 (UTC)
commitadc6c4f994dc38ff287cb03a73933816108ba47b (patch) (unidiff)
tree7a07bb017ec7a0db0888c48b3092904ffc39ba9b
parent0d508bf39ad43aa06c9cd395dd382d8e00dfbf3a (diff)
downloadopie-adc6c4f994dc38ff287cb03a73933816108ba47b.zip
opie-adc6c4f994dc38ff287cb03a73933816108ba47b.tar.gz
opie-adc6c4f994dc38ff287cb03a73933816108ba47b.tar.bz2
Change of view caused jump to the first line of table->fixed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 3af7663..0f4bd5f 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -318,142 +318,142 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
318 emit signalNotFound(); 318 emit signalNotFound();
319 return; 319 return;
320 } 320 }
321 321
322 // Now remove all contacts with wrong category (if any selected) 322 // Now remove all contacts with wrong category (if any selected)
323 // This algorithm is a litte bit ineffective, but 323 // This algorithm is a litte bit ineffective, but
324 // we will not have a lot of matching entries.. 324 // we will not have a lot of matching entries..
325 clearForCategory(); 325 clearForCategory();
326 326
327 // Now show all found entries 327 // Now show all found entries
328 updateView(); 328 updateView();
329} 329}
330 330
331void AbView::offSearch() 331void AbView::offSearch()
332{ 332{
333 m_inSearch = false; 333 m_inSearch = false;
334 334
335 load(); 335 load();
336} 336}
337 337
338void AbView::slotSwitch(){ 338void AbView::slotSwitch(){
339 qWarning("AbView::slotSwitch()"); 339 qWarning("AbView::slotSwitch()");
340 340
341 m_prev_View = m_curr_View; 341 m_prev_View = m_curr_View;
342 switch ( (int) m_curr_View ){ 342 switch ( (int) m_curr_View ){
343 case TableView: 343 case TableView:
344 qWarning("Switching to CardView"); 344 qWarning("Switching to CardView");
345 m_curr_View = CardView; 345 m_curr_View = CardView;
346 break; 346 break;
347 case CardView: 347 case CardView:
348 qWarning("Switching to TableView"); 348 qWarning("Switching to TableView");
349 m_curr_View = TableView; 349 m_curr_View = TableView;
350 break; 350 break;
351 } 351 }
352 updateView(); 352 updateView();
353 353
354} 354}
355 355
356// END: Slots 356// END: Slots
357 357
358void AbView::clearForCategory() 358void AbView::clearForCategory()
359{ 359{
360 OContactAccess::List::Iterator it; 360 OContactAccess::List::Iterator it;
361 // Now remove all contacts with wrong category if any category selected 361 // Now remove all contacts with wrong category if any category selected
362 362
363 OContactAccess::List allList = m_list; 363 OContactAccess::List allList = m_list;
364 if ( m_curr_category != -1 ){ 364 if ( m_curr_category != -1 ){
365 for ( it = allList.begin(); it != allList.end(); ++it ){ 365 for ( it = allList.begin(); it != allList.end(); ++it ){
366 if ( !contactCompare( *it, m_curr_category ) ){ 366 if ( !contactCompare( *it, m_curr_category ) ){
367 qWarning("Removing %d", (*it).uid()); 367 qWarning("Removing %d", (*it).uid());
368 m_list.remove( (*it).uid() ); 368 m_list.remove( (*it).uid() );
369 } 369 }
370 } 370 }
371 } 371 }
372 372
373} 373}
374 374
375bool AbView::contactCompare( const OContact &cnt, int category ) 375bool AbView::contactCompare( const OContact &cnt, int category )
376{ 376{
377 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 377 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category);
378 378
379 bool returnMe; 379 bool returnMe;
380 QArray<int> cats; 380 QArray<int> cats;
381 cats = cnt.categories(); 381 cats = cnt.categories();
382 382
383 qWarning ("Number of categories: %d", cats.count() ); 383 qWarning ("Number of categories: %d", cats.count() );
384 384
385 returnMe = false; 385 returnMe = false;
386 if ( cats.count() == 0 && category == 0 ) 386 if ( cats.count() == 0 && category == 0 )
387 // Contacts with no category will just shown on "All" and "Unfiled" 387 // Contacts with no category will just shown on "All" and "Unfiled"
388 returnMe = true; 388 returnMe = true;
389 else { 389 else {
390 int i; 390 int i;
391 for ( i = 0; i < int(cats.count()); i++ ) { 391 for ( i = 0; i < int(cats.count()); i++ ) {
392 qWarning("Comparing %d with %d",cats[i],category ); 392 qWarning("Comparing %d with %d",cats[i],category );
393 if ( cats[i] == category ) { 393 if ( cats[i] == category ) {
394 returnMe = true; 394 returnMe = true;
395 break; 395 break;
396 } 396 }
397 } 397 }
398 } 398 }
399 qWarning ("Return: %d", returnMe); 399 qWarning ("Return: %d", returnMe);
400 return returnMe; 400 return returnMe;
401} 401}
402 402
403// In Some rare cases we have to update all lists.. 403// In Some rare cases we have to update all lists..
404void AbView::updateListinViews() 404void AbView::updateListinViews()
405{ 405{
406 m_abTable -> setContacts( m_list ); 406 m_abTable -> setContacts( m_list );
407 m_ablabel -> setContacts( m_list ); 407 m_ablabel -> setContacts( m_list );
408} 408}
409 409
410void AbView::updateView() 410void AbView::updateView()
411{ 411{
412 qWarning("AbView::updateView()"); 412 qWarning("AbView::updateView()");
413 413
414 // Feed all views with new lists
415 updateListinViews();
416
417 if ( m_viewStack -> visibleWidget() ){ 414 if ( m_viewStack -> visibleWidget() ){
418 m_viewStack -> visibleWidget() -> clearFocus(); 415 m_viewStack -> visibleWidget() -> clearFocus();
419 } 416 }
420 417
421 // If we switching the view, we have to store some information 418 // If we switching the view, we have to store some information
422 if ( m_list.count() ){ 419 if ( m_list.count() ){
423 switch ( (int) m_prev_View ) { 420 switch ( (int) m_prev_View ) {
424 case TableView: 421 case TableView:
425 m_curr_Contact = m_abTable -> currentEntry_UID(); 422 m_curr_Contact = m_abTable -> currentEntry_UID();
426 break; 423 break;
427 case CardView: 424 case CardView:
428 m_curr_Contact = m_ablabel -> currentEntry_UID(); 425 m_curr_Contact = m_ablabel -> currentEntry_UID();
429 break; 426 break;
430 } 427 }
431 }else 428 }else
432 m_curr_Contact = 0; 429 m_curr_Contact = 0;
433 430
431 // Feed all views with new lists
432 updateListinViews();
433
434 // Inform the world that the view is changed 434 // Inform the world that the view is changed
435 if ( m_curr_View != m_prev_View ) 435 if ( m_curr_View != m_prev_View )
436 emit signalViewSwitched ( (int) m_curr_View ); 436 emit signalViewSwitched ( (int) m_curr_View );
437 437
438 m_prev_View = m_curr_View; 438 m_prev_View = m_curr_View;
439 439
440 // Switch to new View 440 // Switch to new View
441 switch ( (int) m_curr_View ) { 441 switch ( (int) m_curr_View ) {
442 case TableView: 442 case TableView:
443 m_abTable -> setChoiceSelection( m_orderedFields ); 443 m_abTable -> setChoiceSelection( m_orderedFields );
444 if ( m_curr_Contact != 0 ) 444 if ( m_curr_Contact != 0 )
445 m_abTable -> selectContact ( m_curr_Contact ); 445 m_abTable -> selectContact ( m_curr_Contact );
446 m_abTable -> setFocus(); 446 m_abTable -> setFocus();
447 break; 447 break;
448 case CardView: 448 case CardView:
449 if ( m_curr_Contact != 0 ) 449 if ( m_curr_Contact != 0 )
450 m_ablabel -> selectContact( m_curr_Contact ); 450 m_ablabel -> selectContact( m_curr_Contact );
451 m_ablabel -> setFocus(); 451 m_ablabel -> setFocus();
452 break; 452 break;
453 } 453 }
454 454
455 // Raise the current View 455 // Raise the current View
456 m_viewStack -> raiseWidget( m_curr_View ); 456 m_viewStack -> raiseWidget( m_curr_View );
457} 457}
458 458
459 459