Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 113 |
1 files changed, 70 insertions, 43 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index a2617fa..4705c78 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -46,2 +46,4 @@ +#if 0 + /*! @@ -114,2 +116,4 @@ void AbPickItem::setContentFromEditor( QWidget *w ) +#endif + /*! @@ -137,3 +141,3 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name - contactList.clear(); + // contactList.clear(); // qWarning("C'tor end"); @@ -160,3 +164,3 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) { - // qWarning("AbTable::setContacts()"); + qWarning("AbTable::setContacts()"); @@ -170,9 +174,9 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) setNumRows( m_viewList.count() ); - int row = 0; - for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) - insertIntoTable( *it, row++ ); +// int row = 0; +// for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) +// insertIntoTable( *it, row++ ); - setSorting( true ); +// setSorting( true ); - resort(); +// resort(); @@ -192,5 +196,4 @@ bool AbTable::selectContact( int UID ) { - // qWarning( "AbTable::selectContact( %d )", UID ); + qWarning( "AbTable::selectContact( %d )", UID ); int rows = numRows(); - AbTableItem *abi; OContact* foundContact = 0l; @@ -199,6 +202,5 @@ bool AbTable::selectContact( int UID ) setPaintingEnabled( FALSE ); + qWarning( "search start" ); for ( int r = 0; r < rows; ++r ) { - abi = static_cast<AbTableItem*>( item(r, 0) ); - foundContact = &contactList[abi]; - if ( foundContact -> uid() == UID ){ + if ( m_viewList.uidAt( r ) == UID ){ ensureCellVisible( r, 0 ); @@ -209,2 +211,3 @@ bool AbTable::selectContact( int UID ) } + qWarning( "search end" ); @@ -220,5 +223,6 @@ bool AbTable::selectContact( int UID ) +#if 0 void AbTable::insertIntoTable( const OContact& cnt, int row ) { - // qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); + qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); QString strName; @@ -242,3 +246,3 @@ void AbTable::insertIntoTable( const OContact& cnt, int row ) } - +#endif @@ -265,3 +269,4 @@ void AbTable::resort() { - // qWarning( "void AbTable::resort()" ); + qWarning( "void AbTable::resort() NOT POSSIBLE !!" ); +#if 0 setPaintingEnabled( FALSE ); @@ -275,2 +280,3 @@ void AbTable::resort() setPaintingEnabled( TRUE ); +#endif } @@ -278,12 +284,4 @@ void AbTable::resort() OContact AbTable::currentEntry() -{ - // qWarning( "OContact AbTable::currentEntry()" ); - OContact cnt; - AbTableItem *abItem; - abItem = static_cast<AbTableItem*>(item( currentRow(), 0 )); - if ( abItem ) { - cnt = contactList[abItem]; - //cnt = contactList[currentRow()]; - } - return cnt; +{ + return m_viewList[currentRow()]; } @@ -297,4 +295,4 @@ void AbTable::clear() { - // qWarning( "void AbTable::clear()" ); - contactList.clear(); + qWarning( "void AbTable::clear()" ); + // contactList.clear(); @@ -315,3 +313,5 @@ void AbTable::refresh() { - // qWarning( "void AbTable::refresh()" ); + qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" ); + +#if 0 int rows = numRows(); @@ -335,2 +335,4 @@ void AbTable::refresh() setPaintingEnabled( TRUE ); + +#endif } @@ -367,4 +369,5 @@ void AbTable::moveTo( char c ) { - qWarning( "void AbTable::moveTo( char c )" ); + qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" ); +#if 0 int rows = numRows(); @@ -396,5 +399,8 @@ void AbTable::moveTo( char c ) setCurrentCell( r, currentColumn() ); -} +#endif +} +#if 0 +// Useless.. Nobody uses it .. (se) QString AbTable::findContactName( const OContact &entry ) @@ -412,3 +418,3 @@ QString AbTable::findContactName( const OContact &entry ) } - +#endif @@ -508,2 +514,3 @@ void AbTable::show() +#if 0 void AbTable::setChoiceNames( const QStringList& list) @@ -522,2 +529,3 @@ void AbTable::setChoiceNames( const QStringList& list) } +#endif @@ -534,2 +542,3 @@ void AbTable::itemClicked(int,int col) +#if 0 QStringList AbTable::choiceNames() const @@ -539,2 +548,3 @@ QStringList AbTable::choiceNames() const +#endif void AbTable::setChoiceSelection( const QValueList<int>& list ) @@ -562,4 +572,2 @@ QStringList AbTable::choiceSelection(int /*index*/) const - - void AbTable::updateVisible() @@ -632,2 +640,6 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) + //qWarning( "Paint row: %d", row ); + + OContact act_contact = m_viewList[row]; + // Paint alternating background bars @@ -649,13 +661,28 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) - 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 ) ); - } + QString nameText = act_contact.fileAs(); + + switch( col ){ + case 0: + p->drawText( x + marg,2 + fm.ascent(), nameText ); + break; + case 1:{ + + ContactItem contactItem = findContactContact( act_contact, 0 ); + QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ + QString contactText = contactItem.value; + + if ( !contactPic.isNull() ) + { + p->drawPixmap( x + marg, y, contactPic ); + p->drawText( x + marg + contactPic.width() + + 4,2 + fm.ascent(), contactText ); + } + else + { + p->drawText( x + marg,2 + fm.ascent(), contactText ); + } + } + break; + } p->restore(); |