author | eilers <eilers> | 2002-11-27 15:21:06 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-27 15:21:06 (UTC) |
commit | 4b20972da142bbdea42c682025ab5303c35a5a92 (patch) (unidiff) | |
tree | 934acaec747a495188a7d3c1e125ecc0776b68c6 | |
parent | 4d7272423782dc2f9f7dbde36b848f55eb323c79 (diff) | |
download | opie-4b20972da142bbdea42c682025ab5303c35a5a92.zip opie-4b20972da142bbdea42c682025ab5303c35a5a92.tar.gz opie-4b20972da142bbdea42c682025ab5303c35a5a92.tar.bz2 |
Extremely improved table update
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 55 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 3 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 72 | ||||
-rw-r--r-- | core/pim/addressbook/abview.h | 3 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 46 |
5 files changed, 109 insertions, 70 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 | |||
125 | enablePainting( true ), | 125 | enablePainting( true ), |
126 | columnVisible( true ) | 126 | columnVisible( true ), |
127 | countNested( 0 ) | ||
127 | { | 128 | { |
@@ -164,3 +165,3 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) | |||
164 | setSorting( false ); | 165 | setSorting( false ); |
165 | setUpdatesEnabled( FALSE ); | 166 | setPaintingEnabled( FALSE ); |
166 | 167 | ||
@@ -172,4 +173,2 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) | |||
172 | 173 | ||
173 | setUpdatesEnabled( TRUE ); | ||
174 | |||
175 | setSorting( true ); | 174 | setSorting( true ); |
@@ -180,2 +179,4 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) | |||
180 | 179 | ||
180 | setPaintingEnabled( TRUE ); | ||
181 | |||
181 | } | 182 | } |
@@ -190,2 +191,3 @@ bool AbTable::selectContact( int UID ) | |||
190 | 191 | ||
192 | setPaintingEnabled( FALSE ); | ||
191 | for ( int r = 0; r < rows; ++r ) { | 193 | for ( int r = 0; r < rows; ++r ) { |
@@ -206,2 +208,4 @@ bool AbTable::selectContact( int UID ) | |||
206 | 208 | ||
209 | setPaintingEnabled( TRUE ); | ||
210 | |||
207 | return true; | 211 | return true; |
@@ -211,3 +215,3 @@ void AbTable::insertIntoTable( const OContact& cnt, int row ) | |||
211 | { | 215 | { |
212 | // qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); | 216 | qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); |
213 | QString strName, | 217 | QString strName, |
@@ -253,2 +257,3 @@ void AbTable::resort() | |||
253 | qWarning( "void AbTable::resort()" ); | 257 | qWarning( "void AbTable::resort()" ); |
258 | setPaintingEnabled( FALSE ); | ||
254 | if ( sorting() ) { | 259 | if ( sorting() ) { |
@@ -260,2 +265,3 @@ void AbTable::resort() | |||
260 | } | 265 | } |
266 | setPaintingEnabled( TRUE ); | ||
261 | } | 267 | } |
@@ -284,2 +290,4 @@ void AbTable::clear() | |||
284 | contactList.clear(); | 290 | contactList.clear(); |
291 | |||
292 | setPaintingEnabled( FALSE ); | ||
285 | for ( int r = 0; r < numRows(); ++r ) { | 293 | for ( int r = 0; r < numRows(); ++r ) { |
@@ -292,2 +300,3 @@ void AbTable::clear() | |||
292 | setNumRows( 0 ); | 300 | setNumRows( 0 ); |
301 | setPaintingEnabled( TRUE ); | ||
293 | } | 302 | } |
@@ -302,2 +311,3 @@ void AbTable::refresh() | |||
302 | 311 | ||
312 | setPaintingEnabled( FALSE ); | ||
303 | for ( int r = 0; r < rows; ++r ) { | 313 | for ( int r = 0; r < rows; ++r ) { |
@@ -308,2 +318,3 @@ void AbTable::refresh() | |||
308 | resort(); | 318 | resort(); |
319 | setPaintingEnabled( TRUE ); | ||
309 | } | 320 | } |
@@ -456,2 +467,4 @@ void AbTable::fitColumns() | |||
456 | // contentsWidth = 130; | 467 | // contentsWidth = 130; |
468 | |||
469 | setPaintingEnabled( FALSE ); | ||
457 | 470 | ||
@@ -468,2 +481,4 @@ void AbTable::fitColumns() | |||
468 | setColumnWidth( 1, contentsWidth ); | 481 | setColumnWidth( 1, contentsWidth ); |
482 | |||
483 | setPaintingEnabled( TRUE ); | ||
469 | } | 484 | } |
@@ -535,2 +550,4 @@ void AbTable::updateVisible() | |||
535 | { | 550 | { |
551 | qWarning("void AbTable::updateVisible()"); | ||
552 | |||
536 | int visible, | 553 | int visible, |
@@ -542,6 +559,6 @@ void AbTable::updateVisible() | |||
542 | 559 | ||
543 | realignTable(); | ||
544 | |||
545 | setPaintingEnabled( FALSE ); | 560 | setPaintingEnabled( FALSE ); |
546 | 561 | ||
562 | realignTable(); | ||
563 | |||
547 | totalRows = numRows(); | 564 | totalRows = numRows(); |
@@ -571,4 +588,9 @@ void AbTable::setPaintingEnabled( bool e ) | |||
571 | { | 588 | { |
572 | if ( e != enablePainting ) { | 589 | qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
573 | if ( !enablePainting ) { | 590 | |
591 | if ( e ) { | ||
592 | if ( countNested > 0 ) | ||
593 | --countNested; | ||
594 | if ( ! countNested ){ | ||
595 | setUpdatesEnabled( true ); | ||
574 | enablePainting = true; | 596 | enablePainting = true; |
@@ -576,8 +598,19 @@ void AbTable::setPaintingEnabled( bool e ) | |||
576 | viewport()->update(); | 598 | viewport()->update(); |
577 | } else { | ||
578 | enablePainting = false; | ||
579 | } | 599 | } |
600 | } else { | ||
601 | ++countNested; | ||
602 | enablePainting = false; | ||
603 | setUpdatesEnabled( false ); | ||
580 | } | 604 | } |
605 | qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | ||
581 | } | 606 | } |
582 | 607 | ||
608 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | ||
609 | qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | ||
610 | if ( enablePainting ) | ||
611 | QTable::viewportPaintEvent( e ); | ||
612 | } | ||
613 | |||
614 | |||
615 | |||
583 | void AbTable::rowHeightChanged( int row ) | 616 | 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: | |||
87 | void setPaintingEnabled( bool e ); | 87 | void setPaintingEnabled( bool e ); |
88 | void viewportPaintEvent( QPaintEvent* e); | ||
88 | 89 | ||
@@ -129,4 +130,4 @@ private: | |||
129 | bool enablePainting; | 130 | bool enablePainting; |
130 | |||
131 | bool columnVisible; | 131 | bool columnVisible; |
132 | int countNested; | ||
132 | 133 | ||
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 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | ||
3 | ** | ||
4 | ** This file is part of Qt Palmtop Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** | ||
15 | **********************************************************************/ | ||
16 | |||
1 | #include "abview.h" | 17 | #include "abview.h" |
@@ -139,5 +155,2 @@ void AbView::load() | |||
139 | 155 | ||
140 | // Feed all views with new lists | ||
141 | updateListinViews(); | ||
142 | |||
143 | qWarning ("Number of contacts: %d", m_list.count()); | 156 | qWarning ("Number of contacts: %d", m_list.count()); |
@@ -161,16 +174,5 @@ void AbView::clear() | |||
161 | 174 | ||
162 | void AbView::setShowByCategory( Views view, const QString& cat ) | 175 | void AbView::setShowByCategory( const QString& cat ) |
163 | { | 176 | { |
164 | qWarning("AbView::setShowCategory( Views view, const QString& cat )"); | 177 | qWarning("AbView::setShowCategory( const QString& cat )"); |
165 | |||
166 | // if ( view == PersonalView ){ | ||
167 | // if ( ! m_inPersonal ) | ||
168 | // showPersonal( true ); | ||
169 | |||
170 | // }else{ | ||
171 | // if ( m_inPersonal ) | ||
172 | // showPersonal( false ); | ||
173 | |||
174 | // m_curr_View = view; | ||
175 | // } | ||
176 | 178 | ||
@@ -184,14 +186,6 @@ void AbView::setShowByCategory( Views view, const QString& cat ) | |||
184 | 186 | ||
185 | // If we just change the view, we don't have to reload any data.. | 187 | // Just do anything if we really change the category |
186 | // This speeds up a lot of things ! | 188 | if ( intCat != m_curr_category ){ |
187 | if ( intCat == m_curr_category ){ | ||
188 | qWarning ("Just change the View (Category is: %d)", m_curr_category); | ||
189 | m_prev_View = m_curr_View; | ||
190 | m_curr_View = view; | ||
191 | |||
192 | updateView(); | ||
193 | }else{ | ||
194 | qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 189 | qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); |
195 | 190 | ||
196 | m_curr_View = view; | ||
197 | m_curr_category = intCat; | 191 | m_curr_category = intCat; |
@@ -203,2 +197,18 @@ void AbView::setShowByCategory( Views view, const QString& cat ) | |||
203 | } | 197 | } |
198 | |||
199 | void AbView::setShowToView( Views view ) | ||
200 | { | ||
201 | qWarning("void AbView::setShowToView( View %d )", view); | ||
202 | |||
203 | qWarning ("Change the View (Category is: %d)", m_curr_category); | ||
204 | |||
205 | if ( m_curr_View != view ){ | ||
206 | m_prev_View = m_curr_View; | ||
207 | m_curr_View = view; | ||
208 | |||
209 | updateView(); | ||
210 | } | ||
211 | |||
212 | } | ||
213 | |||
204 | void AbView::setShowByLetter( char c ) | 214 | void AbView::setShowByLetter( char c ) |
@@ -403,2 +413,5 @@ void AbView::updateView() | |||
403 | 413 | ||
414 | // Feed all views with new lists | ||
415 | updateListinViews(); | ||
416 | |||
404 | if ( m_viewStack -> visibleWidget() ){ | 417 | if ( m_viewStack -> visibleWidget() ){ |
@@ -417,3 +430,2 @@ void AbView::updateView() | |||
417 | } | 430 | } |
418 | emit signalViewSwitched ( (int) m_curr_View ); | ||
419 | }else | 431 | }else |
@@ -421,2 +433,6 @@ void AbView::updateView() | |||
421 | 433 | ||
434 | // Inform the world that the view is changed | ||
435 | if ( m_curr_View != m_prev_View ) | ||
436 | emit signalViewSwitched ( (int) m_curr_View ); | ||
437 | |||
422 | m_prev_View = m_curr_View; | 438 | m_prev_View = m_curr_View; |
@@ -427,3 +443,2 @@ void AbView::updateView() | |||
427 | m_abTable -> setChoiceSelection( m_orderedFields ); | 443 | m_abTable -> setChoiceSelection( m_orderedFields ); |
428 | m_abTable -> setContacts( m_list ); | ||
429 | if ( m_curr_Contact != 0 ) | 444 | if ( m_curr_Contact != 0 ) |
@@ -433,3 +448,2 @@ void AbView::updateView() | |||
433 | case CardView: | 448 | case CardView: |
434 | m_ablabel -> setContacts( m_list ); | ||
435 | if ( m_curr_Contact != 0 ) | 449 | 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: | |||
31 | void showPersonal( bool personal ); | 31 | void showPersonal( bool personal ); |
32 | void setShowByCategory( Views view, const QString& cat ); | 32 | void setShowByCategory( const QString& cat ); |
33 | void setShowToView( Views view ); | ||
33 | void setShowByLetter( char c ); | 34 | 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 ) | |||
823 | 823 | ||
824 | // Checkmark Book Menu Item Selected | 824 | // Switch view |
825 | if ( c < 3 ) | 825 | if ( c < 3 ) |
826 | for ( unsigned int i = 1; i < 3; i++ ) | 826 | for ( unsigned int i = 1; i < 3; i++ ){ |
827 | catMenu->setItemChecked( i, c == (int)i ); | 827 | if ( catMenu ) |
828 | // Checkmark Category Menu Item Selected | 828 | catMenu->setItemChecked( i, c == (int)i ); |
829 | } | ||
829 | else | 830 | else |
831 | // Checkmark Category Menu Item Selected | ||
830 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 832 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
@@ -832,2 +834,3 @@ void AddressbookWindow::slotSetCategory( int c ) | |||
832 | 834 | ||
835 | // Now switch to the selected category | ||
833 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 836 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
@@ -854,5 +857,7 @@ void AddressbookWindow::slotSetCategory( int c ) | |||
854 | 857 | ||
858 | // Switch to the selected View | ||
855 | slotViewSwitched( view ); | 859 | slotViewSwitched( view ); |
856 | 860 | ||
857 | m_abView -> setShowByCategory( view, cat ); | 861 | // Tell the view about the selected category |
862 | m_abView -> setShowByCategory( cat ); | ||
858 | 863 | ||
@@ -870,2 +875,4 @@ void AddressbookWindow::slotViewSwitched( int view ) | |||
870 | int menu = 0; | 875 | int menu = 0; |
876 | |||
877 | // Switch to selected view | ||
871 | switch ( view ){ | 878 | switch ( view ){ |
@@ -881,11 +888,2 @@ void AddressbookWindow::slotViewSwitched( int view ) | |||
881 | break; | 888 | break; |
882 | // case AbView::PersonalView: | ||
883 | // menu = 3; | ||
884 | // break; | ||
885 | // case AbView::CompanyBook: | ||
886 | // menu = 3; | ||
887 | // break; | ||
888 | // case AbView::EmailBook: | ||
889 | // menu = 4; | ||
890 | // break; | ||
891 | } | 889 | } |
@@ -895,2 +893,6 @@ void AddressbookWindow::slotViewSwitched( int view ) | |||
895 | } | 893 | } |
894 | |||
895 | // Tell the view about the selected view | ||
896 | m_abView -> setShowToView ( (AbView::Views) view ); | ||
897 | |||
896 | } | 898 | } |
@@ -900,3 +902,3 @@ void AddressbookWindow::slotListView() | |||
900 | { | 902 | { |
901 | emit slotSetCategory( AbView::TableView +1 ); | 903 | slotViewSwitched( AbView::TableView ); |
902 | } | 904 | } |
@@ -905,3 +907,3 @@ void AddressbookWindow::slotCardView() | |||
905 | { | 907 | { |
906 | emit slotSetCategory( AbView::CardView +1 ); | 908 | slotViewSwitched( AbView::CardView ); |
907 | } | 909 | } |
@@ -939,14 +941,2 @@ void AddressbookWindow::populateCategories() | |||
939 | 941 | ||
940 | // :SX | ||
941 | // if ( abList->showBook().isEmpty() ) { | ||
942 | // catMenu->setItemChecked( 1, true ); | ||
943 | // } else if ( abList->showBook() == "Phone" ) { | ||
944 | // catMenu->setItemChecked( 2, true ); | ||
945 | // } else if ( abList->showBook() == "Company" ) { | ||
946 | // catMenu->setItemChecked( 3, true ); | ||
947 | // } else if ( abList->showBook() == "Email" ) { | ||
948 | // catMenu->setItemChecked( 4, true ); | ||
949 | // } else if ( abList->showBook() == "Cards" ) { | ||
950 | // catMenu->setItemChecked( 5, true ); | ||
951 | // } | ||
952 | 942 | ||