summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
authoreilers <eilers>2002-10-18 15:42:57 (UTC)
committer eilers <eilers>2002-10-18 15:42:57 (UTC)
commit47e60a8dc20f46dd00b9405f7fde122792018627 (patch) (unidiff)
treeb109ca9e9c200e7e47c0e61e8f2e86ba6bf4a37f /core/pim/addressbook/abtable.cpp
parentc16dcab3fe45ae7193cbdfb2f62bf7e5482d449b (diff)
downloadopie-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.cpp10
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 )
590 AbTableItem *ati; 590 AbTableItem *ati;
591 ati = static_cast<AbTableItem*>(item(row, 0)); 591 ati = static_cast<AbTableItem*>(item(row, 0));
592 if ( !ati ) 592 if ( !ati )
593 return; 593 return;
594 594
595 // :SX db access -> remove 595 // :SX db access -> remove
596 qWarning ("Remove Contact from DB ! UID: %d",contactList[ati].uid() ); 596 qWarning ("Remove Contact from DB ! UID: %d",contactList[ati].uid() );
597 m_contactdb.remove( contactList[ati].uid() ); 597 m_contactdb.remove( contactList[ati].uid() );
598 598
599 contactList.remove( ati ); 599 contactList.remove( ati );
600 600
601 realignTable( row ); 601 realignTable( row );
602 602
603} 603}
604 604
605#if QT_VERSION <= 230 605#if QT_VERSION <= 230
606#ifndef SINGLE_APP 606#ifndef SINGLE_APP
607void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) 607void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
608{ 608{
609 // Region of the rect we should draw 609 // Region of the rect we should draw
610 QRegion reg( QRect( cx, cy, cw, ch ) ); 610 QRegion reg( QRect( cx, cy, cw, ch ) );
611 // Subtract the table from it 611 // Subtract the table from it
612 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); 612 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) );
613 // And draw the rectangles (transformed as needed) 613 // And draw the rectangles (transformed as needed)
614 QArray<QRect> r = reg.rects(); 614 QArray<QRect> r = reg.rects();
615 for (unsigned int i=0; i<r.count(); i++) 615 for (unsigned int i=0; i<r.count(); i++)
616 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); 616 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) );
617} 617}
618#endif 618#endif
619#endif 619#endif
620 620
621 621
622// int AbTable::rowHeight( int ) const 622// int AbTable::rowHeight( int ) const
623// { 623// {
624// return 18; 624// return 18;
625// } 625// }
626 626
627// int AbTable::rowPos( int row ) const 627// int AbTable::rowPos( int row ) const
628// { 628// {
629// return 18*row; 629// return 18*row;
630// } 630// }
631 631
632// int AbTable::rowAt( int pos ) const 632// int AbTable::rowAt( int pos ) const
633// { 633// {
634// return QMIN( pos/18, numRows()-1 ); 634// return QMIN( pos/18, numRows()-1 );
635// } 635// }
636 636
637void AbTable::slotDoFind( const QString &findString, bool caseSensitive, 637void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
638 bool backwards, int category ) 638 bool backwards, QString cat /* int category */ )
639{ 639{
640 int category = 0;
641 if ( cat.isEmpty() )
642 category = -2; // mCat.id("Contacts", "All");
643 else
644 category = mCat.id("Contacts", cat );
645
646 qWarning ("Found in Category %d", category);
647
640 if ( currFindRow < -1 ) 648 if ( currFindRow < -1 )
641 currFindRow = currentRow() - 1; 649 currFindRow = currentRow() - 1;
642 clearSelection( TRUE ); 650 clearSelection( TRUE );
643 int rows, row; 651 int rows, row;
644 AbTableItem *ati; 652 AbTableItem *ati;
645 QRegExp r( findString ); 653 QRegExp r( findString );
646 r.setCaseSensitive( caseSensitive ); 654 r.setCaseSensitive( caseSensitive );
647 rows = numRows(); 655 rows = numRows();
648 static bool wrapAround = true; 656 static bool wrapAround = true;
649 657
650 if ( !backwards ) { 658 if ( !backwards ) {
651 for ( row = currFindRow + 1; row < rows; row++ ) { 659 for ( row = currFindRow + 1; row < rows; row++ ) {
652 ati = static_cast<AbTableItem*>( item(row, 0) ); 660 ati = static_cast<AbTableItem*>( item(row, 0) );
653 if ( contactCompare( contactList[ati], r, category ) ) 661 if ( contactCompare( contactList[ati], r, category ) )
654 //if ( contactCompare( contactList[row], r, category ) ) 662 //if ( contactCompare( contactList[row], r, category ) )
655 break; 663 break;
656 } 664 }
657 } else { 665 } else {
658 for ( row = currFindRow - 1; row > -1; row-- ) { 666 for ( row = currFindRow - 1; row > -1; row-- ) {
659 ati = static_cast<AbTableItem*>( item(row, 0) ); 667 ati = static_cast<AbTableItem*>( item(row, 0) );
660 if ( contactCompare( contactList[ati], r, category ) ) 668 if ( contactCompare( contactList[ati], r, category ) )
661 //if ( contactCompare( contactList[row], r, category ) ) 669 //if ( contactCompare( contactList[row], r, category ) )
662 break; 670 break;
663 } 671 }
664 } 672 }
665 if ( row >= rows || row < 0 ) { 673 if ( row >= rows || row < 0 ) {
666 if ( row < 0 ) 674 if ( row < 0 )
667 currFindRow = rows; 675 currFindRow = rows;
668 else 676 else
669 currFindRow = -1; 677 currFindRow = -1;
670 678
671 if ( wrapAround ) 679 if ( wrapAround )
672 emit signalWrapAround(); 680 emit signalWrapAround();
673 else 681 else
674 emit signalNotFound(); 682 emit signalNotFound();
675 683
676 wrapAround = !wrapAround; 684 wrapAround = !wrapAround;
677 } else { 685 } else {
678 currFindRow = row; 686 currFindRow = row;
679 QTableSelection foundSelection; 687 QTableSelection foundSelection;
680 foundSelection.init( currFindRow, 0 ); 688 foundSelection.init( currFindRow, 0 );
681 foundSelection.expandTo( currFindRow, numCols() - 1 ); 689 foundSelection.expandTo( currFindRow, numCols() - 1 );
682 addSelection( foundSelection ); 690 addSelection( foundSelection );
683 setCurrentCell( currFindRow, numCols() - 1 ); 691 setCurrentCell( currFindRow, numCols() - 1 );
684 wrapAround = true; 692 wrapAround = true;
685 } 693 }
686} 694}
687 695