summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
Side-by-side diff
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
@@ -125,13 +125,13 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam
// #else
: QTable( parent, name ),
// #endif
lastSortCol( -1 ),
asc( TRUE ),
intFields( order ),
- currFindRow( -2 ),
+ currFindRow( -1 ),
mCat( 0 ),
m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. !
{
mCat.load( categoryFileName() );
setSelectionMode( NoSelection );
init();
@@ -635,41 +635,43 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
// }
void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
bool backwards, QString cat /* int category */ )
{
int category = 0;
+
+ // Use the current Category if nothing else selected
if ( cat.isEmpty() )
- category = -2; // mCat.id("Contacts", "All");
- else
+ category = mCat.id( "Contacts", showCat );
+ else{
category = mCat.id("Contacts", cat );
+ }
qWarning ("Found in Category %d", category);
if ( currFindRow < -1 )
- currFindRow = currentRow() - 1;
+ currFindRow = - 1;
+
clearSelection( TRUE );
int rows, row;
AbTableItem *ati;
QRegExp r( findString );
r.setCaseSensitive( caseSensitive );
rows = numRows();
static bool wrapAround = true;
if ( !backwards ) {
for ( row = currFindRow + 1; row < rows; row++ ) {
ati = static_cast<AbTableItem*>( item(row, 0) );
if ( contactCompare( contactList[ati], r, category ) )
- //if ( contactCompare( contactList[row], r, category ) )
break;
}
} else {
for ( row = currFindRow - 1; row > -1; row-- ) {
ati = static_cast<AbTableItem*>( item(row, 0) );
if ( contactCompare( contactList[ati], r, category ) )
- //if ( contactCompare( contactList[row], r, category ) )
break;
}
}
if ( row >= rows || row < 0 ) {
if ( row < 0 )
currFindRow = rows;
@@ -685,25 +687,25 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
} else {
currFindRow = row;
QTableSelection foundSelection;
foundSelection.init( currFindRow, 0 );
foundSelection.expandTo( currFindRow, numCols() - 1 );
addSelection( foundSelection );
- setCurrentCell( currFindRow, numCols() - 1 );
+ setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
wrapAround = true;
}
}
static bool contactCompare( const OContact &cnt, const QRegExp &r, int category )
{
bool returnMe;
QArray<int> cats;
cats = cnt.categories();
returnMe = false;
- if ( (category == -1 && cats.count() == 0) || category == -2 )
+ if ( (cats.count() == 0) || (category == 0) )
returnMe = cnt.match( r );
else {
int i;
for ( i = 0; i < int(cats.count()); i++ ) {
if ( cats[i] == category ) {
returnMe = cnt.match( r );