summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp36
-rw-r--r--core/pim/addressbook/abtable.h1
2 files changed, 35 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 55b1ba1..a829dc2 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -577,26 +577,24 @@ void AbTable::updateVisible()
577 selectedRow = row; 577 selectedRow = row;
578 } 578 }
579 visible++; 579 visible++;
580 } 580 }
581 581
582 if ( selectedRow ) 582 if ( selectedRow )
583 setCurrentCell( selectedRow, 0 ); 583 setCurrentCell( selectedRow, 0 );
584 584
585 if ( !visible ) 585 if ( !visible )
586 setCurrentCell( -1, 0 ); 586 setCurrentCell( -1, 0 );
587 587
588 setPaintingEnabled( TRUE ); 588 setPaintingEnabled( TRUE );
589
590
591} 589}
592 590
593 591
594void AbTable::setPaintingEnabled( bool e ) 592void AbTable::setPaintingEnabled( bool e )
595{ 593{
596 //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); 594 //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
597 595
598 if ( e ) { 596 if ( e ) {
599 if ( countNested > 0 ) 597 if ( countNested > 0 )
600 --countNested; 598 --countNested;
601 if ( ! countNested ){ 599 if ( ! countNested ){
602 setUpdatesEnabled( true ); 600 setUpdatesEnabled( true );
@@ -609,25 +607,59 @@ void AbTable::setPaintingEnabled( bool e )
609 enablePainting = false; 607 enablePainting = false;
610 setUpdatesEnabled( false ); 608 setUpdatesEnabled( false );
611 } 609 }
612 //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); 610 //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
613} 611}
614 612
615void AbTable::viewportPaintEvent( QPaintEvent* e ) { 613void AbTable::viewportPaintEvent( QPaintEvent* e ) {
616 //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); 614 //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting);
617 if ( enablePainting ) 615 if ( enablePainting )
618 QTable::viewportPaintEvent( e ); 616 QTable::viewportPaintEvent( e );
619} 617}
620 618
619void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
620 const QColorGroup &cg = colorGroup();
621
622 p->save();
623
624 // Paint alternating background bars
625 if ( (row % 2 ) == 0 ) {
626 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
627 p->setPen( QPen( cg.text() ) );
628 }
629 else {
630 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
631 p->setPen( QPen( cg.buttonText() ) );
632 }
621 633
634 QFont f = p->font();
635 QFontMetrics fm(f);
636
637 int marg = 2;
638 int x = 0;
639 int y = ( cr.height() - 14 ) / 2;
640
641 QPixmap pic = pixmap( row, col );
642 if ( !pic.isNull() )
643 {
644 p->drawPixmap( x + marg, y, pixmap( row, col ) );
645 p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) );
646 }
647 else
648 {
649 p->drawText( x + marg,2 + fm.ascent(), text( row, col ) );
650 }
651
652 p->restore();
653}
622 654
623void AbTable::rowHeightChanged( int row ) 655void AbTable::rowHeightChanged( int row )
624{ 656{
625 if ( enablePainting ) 657 if ( enablePainting )
626 QTable::rowHeightChanged( row ); 658 QTable::rowHeightChanged( row );
627} 659}
628ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) 660ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ )
629{ 661{
630 662
631 ContactItem item; 663 ContactItem item;
632 664
633 item.value = ""; 665 item.value = "";
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 092e86f..4e6b294 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -87,24 +87,25 @@ public:
87 // Get the UID of the current selected Entry 87 // Get the UID of the current selected Entry
88 int currentEntry_UID(); 88 int currentEntry_UID();
89 89
90 QString findContactName( const OContact &entry ); 90 QString findContactName( const OContact &entry );
91 91
92 void init(); 92 void init();
93 void clear(); 93 void clear();
94 void refresh(); 94 void refresh();
95 95
96 void show(); 96 void show();
97 void setPaintingEnabled( bool e ); 97 void setPaintingEnabled( bool e );
98 void viewportPaintEvent( QPaintEvent* e); 98 void viewportPaintEvent( QPaintEvent* e);
99 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
99 100
100 // addresspicker mode (What's that ? se) 101 // addresspicker mode (What's that ? se)
101 void setChoiceNames( const QStringList& list); 102 void setChoiceNames( const QStringList& list);
102 QStringList choiceNames() const; 103 QStringList choiceNames() const;
103 void setChoiceSelection( const QValueList<int>& list ); 104 void setChoiceSelection( const QValueList<int>& list );
104 QStringList choiceSelection(int index) const; 105 QStringList choiceSelection(int index) const;
105 106
106signals: 107signals:
107 void signalSwitch(); 108 void signalSwitch();
108 void signalEditor(); 109 void signalEditor();
109 void signalKeyDown(); 110 void signalKeyDown();
110 void signalKeyUp(); 111 void signalKeyUp();