Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index e333b17..00335ae 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -122,9 +122,10 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name lastSortCol( -1 ), asc( TRUE ), intFields( order ), enablePainting( true ), - columnVisible( true ) + columnVisible( true ), + countNested( 0 ) { qWarning("C'tor start"); setSelectionMode( NoSelection ); @@ -161,24 +162,24 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) clear(); m_viewList = viewList; setSorting( false ); - setUpdatesEnabled( FALSE ); + setPaintingEnabled( FALSE ); OContactAccess::List::Iterator it; setNumRows( m_viewList.count() ); int row = 0; for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) insertIntoTable( *it, row++ ); - setUpdatesEnabled( TRUE ); - setSorting( true ); resort(); updateVisible(); + setPaintingEnabled( TRUE ); + } bool AbTable::selectContact( int UID ) { @@ -187,8 +188,9 @@ bool AbTable::selectContact( int UID ) AbTableItem *abi; OContact* foundContact = 0l; bool found = false; + setPaintingEnabled( FALSE ); for ( int r = 0; r < rows; ++r ) { abi = static_cast<AbTableItem*>( item(r, 0) ); foundContact = &contactList[abi]; if ( foundContact -> uid() == UID ){ @@ -203,14 +205,16 @@ bool AbTable::selectContact( int UID ) ensureCellVisible( 0,0 ); setCurrentCell( 0, 0 ); } + setPaintingEnabled( TRUE ); + return true; } 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, strContact; strName = findContactName( cnt ); @@ -250,15 +254,17 @@ void AbTable::columnClicked( int col ) void AbTable::resort() { qWarning( "void AbTable::resort()" ); + setPaintingEnabled( FALSE ); if ( sorting() ) { if ( lastSortCol == -1 ) lastSortCol = 0; sortColumn( lastSortCol, asc, TRUE ); //QMessageBox::information( this, "resort", "resort" ); updateVisible(); } + setPaintingEnabled( TRUE ); } OContact AbTable::currentEntry() { @@ -281,16 +287,19 @@ int AbTable::currentEntry_UID() void AbTable::clear() { qWarning( "void AbTable::clear()" ); contactList.clear(); + + setPaintingEnabled( FALSE ); for ( int r = 0; r < numRows(); ++r ) { for ( int c = 0; c < numCols(); ++c ) { if ( cellWidget( r, c ) ) clearCellWidget( r, c ); clearCell( r, c ); } } setNumRows( 0 ); + setPaintingEnabled( TRUE ); } // Refresh updates column 2 if the contactsettings changed void AbTable::refresh() @@ -299,14 +308,16 @@ void AbTable::refresh() int rows = numRows(); QString value; AbTableItem *abi; + setPaintingEnabled( FALSE ); for ( int r = 0; r < rows; ++r ) { abi = static_cast<AbTableItem*>( item(r, 0) ); value = findContactContact( contactList[abi], r ); static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() ); } resort(); + setPaintingEnabled( TRUE ); } void AbTable::keyPressEvent( QKeyEvent *e ) { @@ -453,8 +464,10 @@ void AbTable::fitColumns() qWarning( "void AbTable::fitColumns()" ); int contentsWidth = visibleWidth() / 2; // :SX Why too low // Fix to better value // contentsWidth = 130; + + setPaintingEnabled( FALSE ); if ( columnVisible == false ){ showColumn(0); columnVisible = true; @@ -465,8 +478,10 @@ void AbTable::fitColumns() setColumnWidth( 0, contentsWidth ); adjustColumn(1); if ( columnWidth(1) < contentsWidth ) setColumnWidth( 1, contentsWidth ); + + setPaintingEnabled( TRUE ); } void AbTable::show() { @@ -532,19 +547,21 @@ QStringList AbTable::choiceSelection(int /*index*/) const void AbTable::updateVisible() { + qWarning("void AbTable::updateVisible()"); + int visible, totalRows, row, selectedRow = 0; visible = 0; - realignTable(); - setPaintingEnabled( FALSE ); + realignTable(); + totalRows = numRows(); for ( row = 0; row < totalRows; row++ ) { if ( rowHeight(row) == 0 ) { showRow( row ); @@ -568,19 +585,35 @@ void AbTable::updateVisible() void AbTable::setPaintingEnabled( bool e ) { - if ( e != enablePainting ) { - if ( !enablePainting ) { + 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 { - enablePainting = false; } + } 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::rowHeightChanged( int row ) { if ( enablePainting ) QTable::rowHeightChanged( row ); |