Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 72 |
1 files changed, 43 insertions, 29 deletions
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,6 +1,22 @@ | |||
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" |
2 | 18 | ||
3 | #include <qlayout.h> | 19 | #include <qlayout.h> |
4 | 20 | ||
5 | #include <qpe/global.h> | 21 | #include <qpe/global.h> |
6 | 22 | ||
@@ -134,15 +150,12 @@ void AbView::load() | |||
134 | m_list = m_contactdb->allRecords(); | 150 | m_list = m_contactdb->allRecords(); |
135 | else | 151 | else |
136 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 152 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
137 | 153 | ||
138 | clearForCategory(); | 154 | clearForCategory(); |
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()); |
144 | 157 | ||
145 | updateView(); | 158 | updateView(); |
146 | 159 | ||
147 | } | 160 | } |
148 | 161 | ||
@@ -156,54 +169,51 @@ void AbView::reload() | |||
156 | 169 | ||
157 | void AbView::clear() | 170 | void AbView::clear() |
158 | { | 171 | { |
159 | // :SX | 172 | // :SX |
160 | } | 173 | } |
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 | ||
177 | int intCat = 0; | 179 | int intCat = 0; |
178 | 180 | ||
179 | // All (cat == NULL) will be stored as -1 | 181 | // All (cat == NULL) will be stored as -1 |
180 | if ( cat.isNull() ) | 182 | if ( cat.isNull() ) |
181 | intCat = -1; | 183 | intCat = -1; |
182 | else | 184 | else |
183 | intCat = mCat.id("Contacts", cat ); | 185 | intCat = mCat.id("Contacts", 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; |
198 | emit signalClearLetterPicker(); | 192 | emit signalClearLetterPicker(); |
199 | 193 | ||
200 | load(); | 194 | load(); |
201 | } | 195 | } |
202 | 196 | ||
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 ) |
205 | { | 215 | { |
206 | qWarning("void AbView::setShowByLetter( %c )", c ); | 216 | qWarning("void AbView::setShowByLetter( %c )", c ); |
207 | OContact query; | 217 | OContact query; |
208 | if ( c == 0 ){ | 218 | if ( c == 0 ){ |
209 | load(); | 219 | load(); |
@@ -398,12 +408,15 @@ void AbView::updateListinViews() | |||
398 | } | 408 | } |
399 | 409 | ||
400 | void AbView::updateView() | 410 | void AbView::updateView() |
401 | { | 411 | { |
402 | qWarning("AbView::updateView()"); | 412 | qWarning("AbView::updateView()"); |
403 | 413 | ||
414 | // Feed all views with new lists | ||
415 | updateListinViews(); | ||
416 | |||
404 | if ( m_viewStack -> visibleWidget() ){ | 417 | if ( m_viewStack -> visibleWidget() ){ |
405 | m_viewStack -> visibleWidget() -> clearFocus(); | 418 | m_viewStack -> visibleWidget() -> clearFocus(); |
406 | } | 419 | } |
407 | 420 | ||
408 | // If we switching the view, we have to store some information | 421 | // If we switching the view, we have to store some information |
409 | if ( m_list.count() ){ | 422 | if ( m_list.count() ){ |
@@ -412,29 +425,30 @@ void AbView::updateView() | |||
412 | m_curr_Contact = m_abTable -> currentEntry_UID(); | 425 | m_curr_Contact = m_abTable -> currentEntry_UID(); |
413 | break; | 426 | break; |
414 | case CardView: | 427 | case CardView: |
415 | m_curr_Contact = m_ablabel -> currentEntry_UID(); | 428 | m_curr_Contact = m_ablabel -> currentEntry_UID(); |
416 | break; | 429 | break; |
417 | } | 430 | } |
418 | emit signalViewSwitched ( (int) m_curr_View ); | ||
419 | }else | 431 | }else |
420 | m_curr_Contact = 0; | 432 | m_curr_Contact = 0; |
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; |
423 | 439 | ||
424 | // Switch to new View | 440 | // Switch to new View |
425 | switch ( (int) m_curr_View ) { | 441 | switch ( (int) m_curr_View ) { |
426 | case TableView: | 442 | case TableView: |
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 ) |
430 | m_abTable -> selectContact ( m_curr_Contact ); | 445 | m_abTable -> selectContact ( m_curr_Contact ); |
431 | m_abTable -> setFocus(); | 446 | m_abTable -> setFocus(); |
432 | break; | 447 | break; |
433 | case CardView: | 448 | case CardView: |
434 | m_ablabel -> setContacts( m_list ); | ||
435 | if ( m_curr_Contact != 0 ) | 449 | if ( m_curr_Contact != 0 ) |
436 | m_ablabel -> selectContact( m_curr_Contact ); | 450 | m_ablabel -> selectContact( m_curr_Contact ); |
437 | m_ablabel -> setFocus(); | 451 | m_ablabel -> setFocus(); |
438 | break; | 452 | break; |
439 | } | 453 | } |
440 | 454 | ||