Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index d3ca783..664bd3f 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -19,12 +19,14 @@ | |||
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | 20 | ||
21 | #include <qpe/global.h> | 21 | #include <qpe/global.h> |
22 | 22 | ||
23 | #include <opie/ocontactaccessbackend_vcard.h> | 23 | #include <opie/ocontactaccessbackend_vcard.h> |
24 | 24 | ||
25 | #include <assert.h> | ||
26 | |||
25 | 27 | ||
26 | // Is defined in LibQPE | 28 | // Is defined in LibQPE |
27 | extern QString categoryFileName(); | 29 | extern QString categoryFileName(); |
28 | 30 | ||
29 | QString addressbookPersonalVCardName() | 31 | QString addressbookPersonalVCardName() |
30 | { | 32 | { |
@@ -157,13 +159,13 @@ void AbView::load() | |||
157 | m_list = m_contactdb->allRecords(); | 159 | m_list = m_contactdb->allRecords(); |
158 | else{ | 160 | else{ |
159 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 161 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
160 | clearForCategory(); | 162 | clearForCategory(); |
161 | } | 163 | } |
162 | 164 | ||
163 | //qWarning ("Number of contacts: %d", m_list.count()); | 165 | qWarning ("Number of contacts: %d", m_list.count()); |
164 | 166 | ||
165 | updateView( true ); | 167 | updateView( true ); |
166 | 168 | ||
167 | } | 169 | } |
168 | 170 | ||
169 | void AbView::reload() | 171 | void AbView::reload() |
@@ -215,27 +217,41 @@ void AbView::setShowToView( Views view ) | |||
215 | 217 | ||
216 | updateView(); | 218 | updateView(); |
217 | } | 219 | } |
218 | 220 | ||
219 | } | 221 | } |
220 | 222 | ||
221 | void AbView::setShowByLetter( char c ) | 223 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) |
222 | { | 224 | { |
223 | //qWarning("void AbView::setShowByLetter( %c )", c ); | 225 | qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); |
226 | |||
227 | assert( mode < AbConfig::LASTELEMENT ); | ||
228 | |||
224 | OContact query; | 229 | OContact query; |
225 | if ( c == 0 ){ | 230 | if ( c == 0 ){ |
226 | load(); | 231 | load(); |
227 | return; | 232 | return; |
228 | }else{ | 233 | }else{ |
229 | // If the current Backend is unable to solve the query, we will | 234 | // If the current Backend is unable to solve the query, we will |
230 | // ignore the request .. | 235 | // ignore the request .. |
231 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ | 236 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ |
232 | return; | 237 | return; |
233 | } | 238 | } |
234 | 239 | ||
240 | switch( mode ){ | ||
241 | case AbConfig::LastName: | ||
235 | query.setLastName( QString("%1*").arg(c) ); | 242 | query.setLastName( QString("%1*").arg(c) ); |
243 | break; | ||
244 | case AbConfig::FullName: | ||
245 | query.setFileAs( QString("%1*").arg(c) ); | ||
246 | break; | ||
247 | default: | ||
248 | qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); | ||
249 | qWarning( "I will ignore it.." ); | ||
250 | return; | ||
251 | } | ||
236 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); | 252 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); |
237 | clearForCategory(); | 253 | clearForCategory(); |
238 | m_curr_Contact = 0; | 254 | m_curr_Contact = 0; |
239 | } | 255 | } |
240 | updateView( true ); | 256 | updateView( true ); |
241 | } | 257 | } |