author | eilers <eilers> | 2002-10-18 15:42:57 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-18 15:42:57 (UTC) |
commit | 47e60a8dc20f46dd00b9405f7fde122792018627 (patch) (side-by-side diff) | |
tree | b109ca9e9c200e7e47c0e61e8f2e86ba6bf4a37f /core/pim/addressbook/abtable.cpp | |
parent | c16dcab3fe45ae7193cbdfb2f62bf7e5482d449b (diff) | |
download | opie-47e60a8dc20f46dd00b9405f7fde122792018627.zip opie-47e60a8dc20f46dd00b9405f7fde122792018627.tar.gz opie-47e60a8dc20f46dd00b9405f7fde122792018627.tar.bz2 |
First attempt of new find entry field.. It still needs some finetuning !
Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 91a7171..9297d6a 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -590,98 +590,106 @@ void AbTable::journalFreeRemove( int row ) AbTableItem *ati; ati = static_cast<AbTableItem*>(item(row, 0)); if ( !ati ) return; // :SX db access -> remove qWarning ("Remove Contact from DB ! UID: %d",contactList[ati].uid() ); m_contactdb.remove( contactList[ati].uid() ); contactList.remove( ati ); realignTable( row ); } #if QT_VERSION <= 230 #ifndef SINGLE_APP void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) { // Region of the rect we should draw QRegion reg( QRect( cx, cy, cw, ch ) ); // Subtract the table from it reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); // And draw the rectangles (transformed as needed) QArray<QRect> r = reg.rects(); for (unsigned int i=0; i<r.count(); i++) p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); } #endif #endif // int AbTable::rowHeight( int ) const // { // return 18; // } // int AbTable::rowPos( int row ) const // { // return 18*row; // } // int AbTable::rowAt( int pos ) const // { // return QMIN( pos/18, numRows()-1 ); // } void AbTable::slotDoFind( const QString &findString, bool caseSensitive, - bool backwards, int category ) + bool backwards, QString cat /* int category */ ) { + int category = 0; + if ( cat.isEmpty() ) + category = -2; // mCat.id("Contacts", "All"); + else + category = mCat.id("Contacts", cat ); + + qWarning ("Found in Category %d", category); + if ( currFindRow < -1 ) currFindRow = currentRow() - 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; 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, numCols() - 1 ); wrapAround = true; } } |