summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 9297d6a..97f4a8f 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -128,7 +128,7 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam
128 lastSortCol( -1 ), 128 lastSortCol( -1 ),
129 asc( TRUE ), 129 asc( TRUE ),
130 intFields( order ), 130 intFields( order ),
131 currFindRow( -2 ), 131 currFindRow( -1 ),
132 mCat( 0 ), 132 mCat( 0 ),
133 m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. ! 133 m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. !
134{ 134{
@@ -638,15 +638,19 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
638 bool backwards, QString cat /* int category */ ) 638 bool backwards, QString cat /* int category */ )
639{ 639{
640 int category = 0; 640 int category = 0;
641
642 // Use the current Category if nothing else selected
641 if ( cat.isEmpty() ) 643 if ( cat.isEmpty() )
642 category = -2; // mCat.id("Contacts", "All"); 644 category = mCat.id( "Contacts", showCat );
643 else 645 else{
644 category = mCat.id("Contacts", cat ); 646 category = mCat.id("Contacts", cat );
647 }
645 648
646 qWarning ("Found in Category %d", category); 649 qWarning ("Found in Category %d", category);
647 650
648 if ( currFindRow < -1 ) 651 if ( currFindRow < -1 )
649 currFindRow = currentRow() - 1; 652 currFindRow = - 1;
653
650 clearSelection( TRUE ); 654 clearSelection( TRUE );
651 int rows, row; 655 int rows, row;
652 AbTableItem *ati; 656 AbTableItem *ati;
@@ -659,14 +663,12 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
659 for ( row = currFindRow + 1; row < rows; row++ ) { 663 for ( row = currFindRow + 1; row < rows; row++ ) {
660 ati = static_cast<AbTableItem*>( item(row, 0) ); 664 ati = static_cast<AbTableItem*>( item(row, 0) );
661 if ( contactCompare( contactList[ati], r, category ) ) 665 if ( contactCompare( contactList[ati], r, category ) )
662 //if ( contactCompare( contactList[row], r, category ) )
663 break; 666 break;
664 } 667 }
665 } else { 668 } else {
666 for ( row = currFindRow - 1; row > -1; row-- ) { 669 for ( row = currFindRow - 1; row > -1; row-- ) {
667 ati = static_cast<AbTableItem*>( item(row, 0) ); 670 ati = static_cast<AbTableItem*>( item(row, 0) );
668 if ( contactCompare( contactList[ati], r, category ) ) 671 if ( contactCompare( contactList[ati], r, category ) )
669 //if ( contactCompare( contactList[row], r, category ) )
670 break; 672 break;
671 } 673 }
672 } 674 }
@@ -688,7 +690,7 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
688 foundSelection.init( currFindRow, 0 ); 690 foundSelection.init( currFindRow, 0 );
689 foundSelection.expandTo( currFindRow, numCols() - 1 ); 691 foundSelection.expandTo( currFindRow, numCols() - 1 );
690 addSelection( foundSelection ); 692 addSelection( foundSelection );
691 setCurrentCell( currFindRow, numCols() - 1 ); 693 setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
692 wrapAround = true; 694 wrapAround = true;
693 } 695 }
694} 696}
@@ -700,7 +702,7 @@ static bool contactCompare( const OContact &cnt, const QRegExp &r, int category
700 cats = cnt.categories(); 702 cats = cnt.categories();
701 703
702 returnMe = false; 704 returnMe = false;
703 if ( (category == -1 && cats.count() == 0) || category == -2 ) 705 if ( (cats.count() == 0) || (category == 0) )
704 returnMe = cnt.match( r ); 706 returnMe = cnt.match( r );
705 else { 707 else {
706 int i; 708 int i;