author | eilers <eilers> | 2003-03-06 08:15:23 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-06 08:15:23 (UTC) |
commit | de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a (patch) (side-by-side diff) | |
tree | a1be481f2d4281f7221f538f95bfe996ff5e2dfc | |
parent | caecd32d28df2c0de6982bf84c599c5b25880661 (diff) | |
download | opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.zip opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.gz opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.bz2 |
New table appearance by Dan Williams ! It looks like todolist, now ! Thanks
a lot !
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 36 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 1 |
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 @@ -565,81 +565,113 @@ void AbTable::updateVisible() visible = 0; setPaintingEnabled( FALSE ); realignTable(); totalRows = numRows(); for ( row = 0; row < totalRows; row++ ) { if ( rowHeight(row) == 0 ) { showRow( row ); adjustRow( row ); if ( isSelected( row,0 ) || isSelected( row,1 ) ) selectedRow = row; } visible++; } if ( selectedRow ) setCurrentCell( selectedRow, 0 ); if ( !visible ) setCurrentCell( -1, 0 ); setPaintingEnabled( TRUE ); - - } void AbTable::setPaintingEnabled( bool e ) { // qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); if ( e ) { if ( countNested > 0 ) --countNested; if ( ! countNested ){ setUpdatesEnabled( true ); enablePainting = true; rowHeightChanged( 0 ); viewport()->update(); } } else { ++countNested; enablePainting = false; setUpdatesEnabled( false ); } // qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); } void AbTable::viewportPaintEvent( QPaintEvent* e ) { // qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); if ( enablePainting ) QTable::viewportPaintEvent( e ); } +void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { + const QColorGroup &cg = colorGroup(); + + p->save(); + + // Paint alternating background bars + if ( (row % 2 ) == 0 ) { + p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); + p->setPen( QPen( cg.text() ) ); + } + else { + p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); + p->setPen( QPen( cg.buttonText() ) ); + } + + QFont f = p->font(); + QFontMetrics fm(f); + + int marg = 2; + int x = 0; + int y = ( cr.height() - 14 ) / 2; + QPixmap pic = pixmap( row, col ); + if ( !pic.isNull() ) + { + p->drawPixmap( x + marg, y, pixmap( row, col ) ); + p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) ); + } + else + { + p->drawText( x + marg,2 + fm.ascent(), text( row, col ) ); + } + + p->restore(); +} void AbTable::rowHeightChanged( int row ) { if ( enablePainting ) QTable::rowHeightChanged( row ); } ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) { ContactItem item; item.value = ""; for ( QValueList<int>::ConstIterator it = intFields.begin(); it != intFields.end(); ++it ) { switch ( *it ) { default: break; case Qtopia::Title: item.value = entry.title(); break; case Qtopia::Suffix: item.value = entry.suffix(); break; 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 @@ -75,48 +75,49 @@ class AbTable : public QTable public: AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); ~AbTable(); // Set the contacts shown in the table void setContacts( const OContactAccess::List& viewList ); // Selects a contact of a specific UID bool selectContact( int UID ); // Get the current selected entry OContact currentEntry(); // Get the UID of the current selected Entry int currentEntry_UID(); QString findContactName( const OContact &entry ); void init(); void clear(); void refresh(); void show(); void setPaintingEnabled( bool e ); void viewportPaintEvent( QPaintEvent* e); + void paintCell(QPainter* p, int row, int col, const QRect&, bool ); // addresspicker mode (What's that ? se) void setChoiceNames( const QStringList& list); QStringList choiceNames() const; void setChoiceSelection( const QValueList<int>& list ); QStringList choiceSelection(int index) const; signals: void signalSwitch(); void signalEditor(); void signalKeyDown(); void signalKeyUp(); protected: virtual void keyPressEvent( QKeyEvent *e ); // int rowHeight( int ) const; // int rowPos( int row ) const; // virtual int rowAt( int pos ) const; protected slots: void moveTo( char ); virtual void columnClicked( int col ); |