summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abview.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 8a2db96..9f7f71f 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -37,16 +37,17 @@ QString addressbookPersonalVCardName()
37} 37}
38 38
39 39
40AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 40AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
41 QWidget(parent), 41 QWidget(parent),
42 mCat(0), 42 mCat(0),
43 m_inSearch( false ), 43 m_inSearch( false ),
44 m_inPersonal( false ), 44 m_inPersonal( false ),
45 m_sortOrder( true ),
45 m_curr_category( 0 ), 46 m_curr_category( 0 ),
46 m_curr_View( TableView ), 47 m_curr_View( TableView ),
47 m_prev_View( TableView ), 48 m_prev_View( TableView ),
48 m_curr_Contact ( 0 ), 49 m_curr_Contact ( 0 ),
49 m_contactdb ( 0l ), 50 m_contactdb ( 0l ),
50 m_storedDB ( 0l ), 51 m_storedDB ( 0l ),
51 m_viewStack( 0l ), 52 m_viewStack( 0l ),
52 m_abTable( 0l ), 53 m_abTable( 0l ),
@@ -75,16 +76,18 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
75 // Create CardView and add it to WidgetStack 76 // Create CardView and add it to WidgetStack
76 QVBox* cardBox = new QVBox( m_viewStack ); 77 QVBox* cardBox = new QVBox( m_viewStack );
77 m_ablabel = new AbLabel( cardBox, "CardView"); 78 m_ablabel = new AbLabel( cardBox, "CardView");
78 m_viewStack -> addWidget( cardBox , CardView ); 79 m_viewStack -> addWidget( cardBox , CardView );
79 80
80 // Connect views to me 81 // Connect views to me
81 connect ( m_abTable, SIGNAL( signalSwitch(void) ), 82 connect ( m_abTable, SIGNAL( signalSwitch(void) ),
82 this, SLOT( slotSwitch(void) ) ); 83 this, SLOT( slotSwitch(void) ) );
84 connect ( m_abTable, SIGNAL( signalSortOrderChanged( bool ) ),
85 this, SLOT( slotSetSortOrder( bool ) ) );
83 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), 86 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ),
84 this, SLOT( slotSwitch(void) ) ); 87 this, SLOT( slotSwitch(void) ) );
85 88
86 load(); 89 load();
87} 90}
88 91
89AbView::~AbView() 92AbView::~AbView()
90{ 93{
@@ -156,25 +159,25 @@ void AbView::load()
156 159
157 // Letter Search is stopped at this place 160 // Letter Search is stopped at this place
158 emit signalClearLetterPicker(); 161 emit signalClearLetterPicker();
159 162
160 odebug << "selected Category: " << m_curr_category << oendl; 163 odebug << "selected Category: " << m_curr_category << oendl;
161 164
162 if ( m_curr_category == -1 ) { 165 if ( m_curr_category == -1 ) {
163 // Show just unfiled contacts 166 // Show just unfiled contacts
164 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, 167 m_list = m_contactdb->sorted( m_sortOrder, Opie::OPimContactAccess::SortFileAsName,
165 Opie::OPimContactAccess::DoNotShowWithCategory, 0 ); 168 Opie::OPimContactAccess::DoNotShowWithCategory, 0 );
166 } elseif ( m_curr_category == 0 ){ 169 } elseif ( m_curr_category == 0 ){
167 // Just show all contacts 170 // Just show all contacts
168 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, 171 m_list = m_contactdb->sorted( m_sortOrder, Opie::OPimContactAccess::SortFileAsName,
169 Opie::OPimBase::FilterOff, 0 ); 172 Opie::OPimBase::FilterOff, 0 );
170 } else { 173 } else {
171 // Show contacts with given categories 174 // Show contacts with given categories
172 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, 175 m_list = m_contactdb->sorted( m_sortOrder, Opie::OPimContactAccess::SortFileAsName,
173 Opie::OPimBase::FilterCategory, m_curr_category ); 176 Opie::OPimBase::FilterCategory, m_curr_category );
174 } 177 }
175 178
176 odebug << "Number of contacts: " << m_list.count() << oendl; 179 odebug << "Number of contacts: " << m_list.count() << oendl;
177 180
178 updateView( true ); 181 updateView( true );
179 182
180} 183}
@@ -411,16 +414,21 @@ void AbView::slotSwitch(){
411 odebug << "Switching to TableView" << oendl; 414 odebug << "Switching to TableView" << oendl;
412 m_curr_View = TableView; 415 m_curr_View = TableView;
413 break; 416 break;
414 } 417 }
415 updateView(); 418 updateView();
416 419
417} 420}
418 421
422void AbView::slotSetSortOrder( bool order ){
423 m_sortOrder = order;
424 reload();
425}
426
419// END: Slots 427// END: Slots
420 428
421void AbView::clearForCategory() 429void AbView::clearForCategory()
422{ 430{
423 Opie::OPimContactAccess::List::Iterator it; 431 Opie::OPimContactAccess::List::Iterator it;
424 // Now remove all contacts with wrong category if any category selected 432 // Now remove all contacts with wrong category if any category selected
425 433
426 Opie::OPimContactAccess::List allList = m_list; 434 Opie::OPimContactAccess::List allList = m_list;