summaryrefslogtreecommitdiff
authoreilers <eilers>2003-03-06 08:15:23 (UTC)
committer eilers <eilers>2003-03-06 08:15:23 (UTC)
commitde5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a (patch) (unidiff)
treea1be481f2d4281f7221f538f95bfe996ff5e2dfc
parentcaecd32d28df2c0de6982bf84c599c5b25880661 (diff)
downloadopie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.zip
opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.gz
opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.bz2
New table appearance by Dan Williams ! It looks like todolist, now ! Thanks
a lot !
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
@@ -583,14 +583,12 @@ void AbTable::updateVisible()
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 );
@@ -615,13 +613,47 @@ void AbTable::setPaintingEnabled( bool e )
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}
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
@@ -93,12 +93,13 @@ public:
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;