From 78152b3adbe3ae4626c8f53e3edd0babcaf6fb72 Mon Sep 17 00:00:00 2001 From: eilers Date: Tue, 22 Oct 2002 12:34:54 +0000 Subject: Find bugfix. Tried to make the letterpicker more visible due to undelign does not work on my Z.. :( Added use of alternative mail-application (opie-mail instead of QT-Mail) --- (limited to 'core/pim/addressbook/abtable.cpp') diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 97b26db..4feadeb 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -686,41 +686,53 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive, bool us r.setWildcard( !useRegExp ); rows = numRows(); static bool wrapAround = true; + bool try_again = false; - if ( !backwards ) { - for ( row = currFindRow + 1; row < rows; row++ ) { - ati = static_cast( item(row, 0) ); - if ( contactCompare( contactList[ati], r, category ) ) - break; + // We will loop until we found an entry or found nothing. + do { + if ( !backwards ) { + for ( row = currFindRow + 1; row < rows; row++ ) { + ati = static_cast( item(row, 0) ); + if ( contactCompare( contactList[ati], r, category ) ){ + try_again = false; + break; + } + } + } else { + for ( row = currFindRow - 1; row > -1; row-- ) { + ati = static_cast( item(row, 0) ); + if ( contactCompare( contactList[ati], r, category ) ){ + try_again = false; + break; + } + } } - } else { - for ( row = currFindRow - 1; row > -1; row-- ) { - ati = static_cast( item(row, 0) ); - if ( contactCompare( contactList[ati], r, category ) ) - break; + if ( row >= rows || row < 0 ) { + if ( row < 0 ) + currFindRow = rows; + else + currFindRow = -1; + + if ( wrapAround ){ + emit signalWrapAround(); + try_again = true; + }else{ + emit signalNotFound(); + try_again = false; + } + + wrapAround = !wrapAround; + } else { + currFindRow = row; + QTableSelection foundSelection; + foundSelection.init( currFindRow, 0 ); + foundSelection.expandTo( currFindRow, numCols() - 1 ); + addSelection( foundSelection ); + setCurrentCell( currFindRow, 0 /* numCols() - 1 */ ); + wrapAround = true; + try_again = false; } - } - if ( row >= rows || row < 0 ) { - if ( row < 0 ) - currFindRow = rows; - else - currFindRow = -1; - - if ( wrapAround ) - emit signalWrapAround(); - else - emit signalNotFound(); - - wrapAround = !wrapAround; - } else { - currFindRow = row; - QTableSelection foundSelection; - foundSelection.init( currFindRow, 0 ); - foundSelection.expandTo( currFindRow, numCols() - 1 ); - addSelection( foundSelection ); - setCurrentCell( currFindRow, 0 /* numCols() - 1 */ ); - wrapAround = true; - } + } while ( try_again ); } static bool contactCompare( const OContact &cnt, const QRegExp &r, int category ) -- cgit v0.9.0.2