summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -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 );