summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abview.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp72
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,3 +1,19 @@
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>
@@ -137,9 +153,6 @@ void AbView::load()
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();
@@ -159,20 +172,9 @@ void AbView::clear()
159 // :SX 172 // :SX
160} 173}
161 174
162void AbView::setShowByCategory( Views view, const QString& cat ) 175void 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
@@ -182,18 +184,10 @@ void AbView::setShowByCategory( Views view, const QString& cat )
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
@@ -201,6 +195,22 @@ void AbView::setShowByCategory( Views view, const QString& cat )
201 } 195 }
202 196
203} 197}
198
199void 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
204void AbView::setShowByLetter( char c ) 214void AbView::setShowByLetter( char c )
205{ 215{
206 qWarning("void AbView::setShowByLetter( %c )", c ); 216 qWarning("void AbView::setShowByLetter( %c )", c );
@@ -401,6 +411,9 @@ 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 }
@@ -415,23 +428,24 @@ void AbView::updateView()
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();