Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 24 |
1 files changed, 20 insertions, 4 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 | |||
@@ -13,24 +13,26 @@ | |||
13 | ** | 13 | ** |
14 | ** | 14 | ** |
15 | **********************************************************************/ | 15 | **********************************************************************/ |
16 | 16 | ||
17 | #include "abview.h" | 17 | #include "abview.h" |
18 | 18 | ||
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 | { |
31 | QString filename = Global::applicationFileName("addressbook", | 33 | QString filename = Global::applicationFileName("addressbook", |
32 | "businesscard.vcf"); | 34 | "businesscard.vcf"); |
33 | return filename; | 35 | return filename; |
34 | } | 36 | } |
35 | 37 | ||
36 | 38 | ||
@@ -151,25 +153,25 @@ void AbView::load() | |||
151 | 153 | ||
152 | // Letter Search is stopped at this place | 154 | // Letter Search is stopped at this place |
153 | emit signalClearLetterPicker(); | 155 | emit signalClearLetterPicker(); |
154 | 156 | ||
155 | if ( m_inPersonal ) | 157 | if ( m_inPersonal ) |
156 | // VCard Backend does not sort.. | 158 | // VCard Backend does not sort.. |
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() |
170 | { | 172 | { |
171 | //qWarning( "void AbView::reload()" ); | 173 | //qWarning( "void AbView::reload()" ); |
172 | 174 | ||
173 | m_contactdb->reload(); | 175 | m_contactdb->reload(); |
174 | load(); | 176 | load(); |
175 | } | 177 | } |
@@ -209,39 +211,53 @@ void AbView::setShowToView( Views view ) | |||
209 | 211 | ||
210 | //qWarning ("Change the View (Category is: %d)", m_curr_category); | 212 | //qWarning ("Change the View (Category is: %d)", m_curr_category); |
211 | 213 | ||
212 | if ( m_curr_View != view ){ | 214 | if ( m_curr_View != view ){ |
213 | m_prev_View = m_curr_View; | 215 | m_prev_View = m_curr_View; |
214 | m_curr_View = view; | 216 | m_curr_View = 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 | ||
235 | query.setLastName( QString("%1*").arg(c) ); | 240 | switch( mode ){ |
241 | case AbConfig::LastName: | ||
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 | } |
242 | 258 | ||
243 | void AbView::setListOrder( const QValueList<int>& ordered ) | 259 | void AbView::setListOrder( const QValueList<int>& ordered ) |
244 | { | 260 | { |
245 | m_orderedFields = ordered; | 261 | m_orderedFields = ordered; |
246 | if ( m_abTable ){ | 262 | if ( m_abTable ){ |
247 | m_abTable->setOrderedList( ordered ); | 263 | m_abTable->setOrderedList( ordered ); |