-rw-r--r-- | core/pim/addressbook/abtable.cpp | 1 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 44 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 7 |
3 files changed, 25 insertions, 27 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 0be7d1a..49e66ad 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -161,3 +161,2 @@ void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) | |||
161 | 161 | ||
162 | Opie::OPimContactAccess::List::Iterator it; | ||
163 | setNumRows( m_viewList.count() ); | 162 | setNumRows( m_viewList.count() ); |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 6be19f8..34035fd 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -44,3 +44,3 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | |||
44 | m_inPersonal( false ), | 44 | m_inPersonal( false ), |
45 | m_curr_category( -1 ), | 45 | m_curr_category( 0 ), |
46 | m_curr_View( TableView ), | 46 | m_curr_View( TableView ), |
@@ -159,16 +159,5 @@ void AbView::load() | |||
159 | 159 | ||
160 | if ( m_curr_category == 0 ) { | 160 | m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, |
161 | // Show unfiled | 161 | Opie::OPimContactAccess::FilterCategory, m_curr_category ); |
162 | m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, | 162 | |
163 | Opie::OPimContactAccess::DoNotShowWithCategory, 0 ); | ||
164 | } elseif ( m_curr_category != -1 ){ | ||
165 | // Just show selected category | ||
166 | m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, | ||
167 | Opie::OPimBase::FilterCategory, m_curr_category ); | ||
168 | } else { | ||
169 | // Show all categories | ||
170 | m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, | ||
171 | Opie::OPimBase::FilterOff, 0 ); | ||
172 | } | ||
173 | |||
174 | // if ( m_curr_category != -1 ) | 163 | // if ( m_curr_category != -1 ) |
@@ -201,5 +190,7 @@ void AbView::setShowByCategory( const QString& cat ) | |||
201 | 190 | ||
202 | // All (cat == NULL) will be stored as -1 | 191 | // Unfiled will be stored as -1 |
203 | if ( cat.isNull() ) | 192 | if ( cat == tr( "Unfiled" ) ) |
204 | intCat = -1; | 193 | intCat = -1; |
194 | else if ( cat.isNull() ) | ||
195 | intCat = 0; | ||
205 | else | 196 | else |
@@ -214,5 +205,5 @@ void AbView::setShowByCategory( const QString& cat ) | |||
214 | emit signalClearLetterPicker(); | 205 | emit signalClearLetterPicker(); |
215 | |||
216 | load(); | 206 | load(); |
217 | } | 207 | } |
208 | m_curr_category = intCat; | ||
218 | 209 | ||
@@ -247,3 +238,3 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | |||
247 | // ignore the request .. | 238 | // ignore the request .. |
248 | if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | | 239 | if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | |
249 | Opie::OPimContactAccess::IgnoreCase ) ){ | 240 | Opie::OPimContactAccess::IgnoreCase ) ){ |
@@ -267,4 +258,9 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | |||
267 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); | 258 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); |
268 | if ( m_curr_category != -1 ) | 259 | |
260 | if ( m_curr_category != 0 ) | ||
269 | clearForCategory(); | 261 | clearForCategory(); |
262 | |||
263 | // Sort filtered results | ||
264 | m_list = m_contactdb->sorted( m_list, true, Opie::OPimContactAccess::SortFileAsName, | ||
265 | Opie::OPimContactAccess::FilterCategory, m_curr_category ); | ||
270 | m_curr_Contact = 0; | 266 | m_curr_Contact = 0; |
@@ -380,3 +376,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
380 | // we will not have a lot of matching entries.. | 376 | // we will not have a lot of matching entries.. |
381 | if ( m_curr_category != -1 ) | 377 | if ( m_curr_category != 0 ) |
382 | clearForCategory(); | 378 | clearForCategory(); |
@@ -420,3 +416,3 @@ void AbView::clearForCategory() | |||
420 | Opie::OPimContactAccess::List allList = m_list; | 416 | Opie::OPimContactAccess::List allList = m_list; |
421 | if ( m_curr_category != -1 ){ | 417 | if ( m_curr_category != 0 ){ |
422 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 418 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
@@ -443,3 +439,3 @@ bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) | |||
443 | returnMe = false; | 439 | returnMe = false; |
444 | if ( cats.count() == 0 && category == 0 ) | 440 | if ( cats.count() == 0 && category == -1 ) |
445 | // Contacts with no category will just shown on "All" and "Unfiled" | 441 | // Contacts with no category will just shown on "All" and "Unfiled" |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 6984501..faae0a9 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -856,4 +856,7 @@ void AddressbookWindow::slotSetCategory( const QString &category ) | |||
856 | // Tell the view about the selected category | 856 | // Tell the view about the selected category |
857 | m_config.setCategory( category ); | 857 | QString cat = category; |
858 | m_abView -> setShowByCategory( category ); | 858 | if ( cat == tr( "All" ) ) |
859 | cat = QString::null; | ||
860 | m_config.setCategory( cat ); | ||
861 | m_abView -> setShowByCategory( cat ); | ||
859 | } | 862 | } |