summaryrefslogtreecommitdiff
authoreilers <eilers>2002-11-27 15:21:06 (UTC)
committer eilers <eilers>2002-11-27 15:21:06 (UTC)
commit4b20972da142bbdea42c682025ab5303c35a5a92 (patch) (side-by-side diff)
tree934acaec747a495188a7d3c1e125ecc0776b68c6
parent4d7272423782dc2f9f7dbde36b848f55eb323c79 (diff)
downloadopie-4b20972da142bbdea42c682025ab5303c35a5a92.zip
opie-4b20972da142bbdea42c682025ab5303c35a5a92.tar.gz
opie-4b20972da142bbdea42c682025ab5303c35a5a92.tar.bz2
Extremely improved table update
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp51
-rw-r--r--core/pim/addressbook/abtable.h3
-rw-r--r--core/pim/addressbook/abview.cpp72
-rw-r--r--core/pim/addressbook/abview.h3
-rw-r--r--core/pim/addressbook/addressbook.cpp44
5 files changed, 106 insertions, 67 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
@@ -125,3 +125,4 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name
enablePainting( true ),
- columnVisible( true )
+ columnVisible( true ),
+ countNested( 0 )
{
@@ -164,3 +165,3 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
setSorting( false );
- setUpdatesEnabled( FALSE );
+ setPaintingEnabled( FALSE );
@@ -172,4 +173,2 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
- setUpdatesEnabled( TRUE );
-
setSorting( true );
@@ -180,2 +179,4 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
+ setPaintingEnabled( TRUE );
+
}
@@ -190,2 +191,3 @@ bool AbTable::selectContact( int UID )
+ setPaintingEnabled( FALSE );
for ( int r = 0; r < rows; ++r ) {
@@ -206,2 +208,4 @@ bool AbTable::selectContact( int UID )
+ setPaintingEnabled( TRUE );
+
return true;
@@ -211,3 +215,3 @@ 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,
@@ -253,2 +257,3 @@ void AbTable::resort()
qWarning( "void AbTable::resort()" );
+ setPaintingEnabled( FALSE );
if ( sorting() ) {
@@ -260,2 +265,3 @@ void AbTable::resort()
}
+ setPaintingEnabled( TRUE );
}
@@ -284,2 +290,4 @@ void AbTable::clear()
contactList.clear();
+
+ setPaintingEnabled( FALSE );
for ( int r = 0; r < numRows(); ++r ) {
@@ -292,2 +300,3 @@ void AbTable::clear()
setNumRows( 0 );
+ setPaintingEnabled( TRUE );
}
@@ -302,2 +311,3 @@ void AbTable::refresh()
+ setPaintingEnabled( FALSE );
for ( int r = 0; r < rows; ++r ) {
@@ -308,2 +318,3 @@ void AbTable::refresh()
resort();
+ setPaintingEnabled( TRUE );
}
@@ -457,2 +468,4 @@ void AbTable::fitColumns()
+ setPaintingEnabled( FALSE );
+
if ( columnVisible == false ){
@@ -468,2 +481,4 @@ void AbTable::fitColumns()
setColumnWidth( 1, contentsWidth );
+
+ setPaintingEnabled( TRUE );
}
@@ -535,2 +550,4 @@ void AbTable::updateVisible()
{
+ qWarning("void AbTable::updateVisible()");
+
int visible,
@@ -542,6 +559,6 @@ void AbTable::updateVisible()
- realignTable();
-
setPaintingEnabled( FALSE );
+ realignTable();
+
totalRows = numRows();
@@ -571,4 +588,9 @@ 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;
@@ -576,8 +598,19 @@ void AbTable::setPaintingEnabled( bool e )
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::rowHeightChanged( int row )
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 83bd5a7..9825665 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -87,2 +87,3 @@ public:
void setPaintingEnabled( bool e );
+ void viewportPaintEvent( QPaintEvent* e);
@@ -129,4 +130,4 @@ private:
bool enablePainting;
-
bool columnVisible;
+ int countNested;
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 8d22129..3af7663 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -1 +1,17 @@
+/**********************************************************************
+** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
+**
+** This file is part of Qt Palmtop Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+**********************************************************************/
+
#include "abview.h"
@@ -139,5 +155,2 @@ void AbView::load()
- // Feed all views with new lists
- updateListinViews();
-
qWarning ("Number of contacts: %d", m_list.count());
@@ -161,16 +174,5 @@ void AbView::clear()
-void AbView::setShowByCategory( Views view, const QString& cat )
+void AbView::setShowByCategory( const QString& cat )
{
- qWarning("AbView::setShowCategory( Views view, const QString& cat )");
-
-// if ( view == PersonalView ){
-// if ( ! m_inPersonal )
-// showPersonal( true );
-
-// }else{
-// if ( m_inPersonal )
-// showPersonal( false );
-
-// m_curr_View = view;
-// }
+ qWarning("AbView::setShowCategory( const QString& cat )");
@@ -184,14 +186,6 @@ void AbView::setShowByCategory( Views view, const QString& cat )
- // If we just change the view, we don't have to reload any data..
- // This speeds up a lot of things !
- if ( intCat == m_curr_category ){
- qWarning ("Just change the View (Category is: %d)", m_curr_category);
- m_prev_View = m_curr_View;
- m_curr_View = view;
-
- updateView();
- }else{
+ // Just do anything if we really change the category
+ if ( intCat != m_curr_category ){
qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
- m_curr_View = view;
m_curr_category = intCat;
@@ -203,2 +197,18 @@ void AbView::setShowByCategory( Views view, const QString& cat )
}
+
+void AbView::setShowToView( Views view )
+{
+ qWarning("void AbView::setShowToView( View %d )", view);
+
+ qWarning ("Change the View (Category is: %d)", m_curr_category);
+
+ if ( m_curr_View != view ){
+ m_prev_View = m_curr_View;
+ m_curr_View = view;
+
+ updateView();
+ }
+
+}
+
void AbView::setShowByLetter( char c )
@@ -403,2 +413,5 @@ void AbView::updateView()
+ // Feed all views with new lists
+ updateListinViews();
+
if ( m_viewStack -> visibleWidget() ){
@@ -417,3 +430,2 @@ void AbView::updateView()
}
- emit signalViewSwitched ( (int) m_curr_View );
}else
@@ -421,2 +433,6 @@ void AbView::updateView()
+ // Inform the world that the view is changed
+ if ( m_curr_View != m_prev_View )
+ emit signalViewSwitched ( (int) m_curr_View );
+
m_prev_View = m_curr_View;
@@ -427,3 +443,2 @@ void AbView::updateView()
m_abTable -> setChoiceSelection( m_orderedFields );
- m_abTable -> setContacts( m_list );
if ( m_curr_Contact != 0 )
@@ -433,3 +448,2 @@ void AbView::updateView()
case CardView:
- m_ablabel -> setContacts( m_list );
if ( m_curr_Contact != 0 )
diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h
index 201b521..2c10cfa 100644
--- a/core/pim/addressbook/abview.h
+++ b/core/pim/addressbook/abview.h
@@ -31,3 +31,4 @@ public:
void showPersonal( bool personal );
- void setShowByCategory( Views view, const QString& cat );
+ void setShowByCategory( const QString& cat );
+ void setShowToView( Views view );
void setShowByLetter( char c );
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 3b2e4b8..5d588da 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -823,8 +823,10 @@ void AddressbookWindow::slotSetCategory( int c )
- // Checkmark Book Menu Item Selected
+ // Switch view
if ( c < 3 )
- for ( unsigned int i = 1; i < 3; i++ )
+ for ( unsigned int i = 1; i < 3; i++ ){
+ if ( catMenu )
catMenu->setItemChecked( i, c == (int)i );
- // Checkmark Category Menu Item Selected
+ }
else
+ // Checkmark Category Menu Item Selected
for ( unsigned int i = 3; i < catMenu->count(); i++ )
@@ -832,2 +834,3 @@ void AddressbookWindow::slotSetCategory( int c )
+ // Now switch to the selected category
for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
@@ -854,5 +857,7 @@ void AddressbookWindow::slotSetCategory( int c )
+ // Switch to the selected View
slotViewSwitched( view );
- m_abView -> setShowByCategory( view, cat );
+ // Tell the view about the selected category
+ m_abView -> setShowByCategory( cat );
@@ -870,2 +875,4 @@ void AddressbookWindow::slotViewSwitched( int view )
int menu = 0;
+
+ // Switch to selected view
switch ( view ){
@@ -881,11 +888,2 @@ void AddressbookWindow::slotViewSwitched( int view )
break;
-// case AbView::PersonalView:
-// menu = 3;
-// break;
-// case AbView::CompanyBook:
-// menu = 3;
-// break;
-// case AbView::EmailBook:
-// menu = 4;
-// break;
}
@@ -895,2 +893,6 @@ void AddressbookWindow::slotViewSwitched( int view )
}
+
+ // Tell the view about the selected view
+ m_abView -> setShowToView ( (AbView::Views) view );
+
}
@@ -900,3 +902,3 @@ void AddressbookWindow::slotListView()
{
- emit slotSetCategory( AbView::TableView +1 );
+ slotViewSwitched( AbView::TableView );
}
@@ -905,3 +907,3 @@ void AddressbookWindow::slotCardView()
{
- emit slotSetCategory( AbView::CardView +1 );
+ slotViewSwitched( AbView::CardView );
}
@@ -939,14 +941,2 @@ void AddressbookWindow::populateCategories()
- // :SX
-// if ( abList->showBook().isEmpty() ) {
-// catMenu->setItemChecked( 1, true );
-// } else if ( abList->showBook() == "Phone" ) {
-// catMenu->setItemChecked( 2, true );
-// } else if ( abList->showBook() == "Company" ) {
-// catMenu->setItemChecked( 3, true );
-// } else if ( abList->showBook() == "Email" ) {
-// catMenu->setItemChecked( 4, true );
-// } else if ( abList->showBook() == "Cards" ) {
-// catMenu->setItemChecked( 5, true );
-// }