Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index aa242b7..52e5f59 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "abview.h" | 17 | #include "abview.h" |
18 | 18 | ||
19 | #include <opie2/ocontactaccessbackend_vcard.h> | 19 | #include <opie2/ocontactaccessbackend_vcard.h> |
20 | #include <opie2/odebug.h> | ||
20 | 21 | ||
21 | #include <qpe/global.h> | 22 | #include <qpe/global.h> |
22 | 23 | ||
@@ -51,7 +52,7 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | |||
51 | m_abTable( 0l ), | 52 | m_abTable( 0l ), |
52 | m_orderedFields( ordered ) | 53 | m_orderedFields( ordered ) |
53 | { | 54 | { |
54 | qWarning("AbView::c'tor"); | 55 | Opie::Core::owarn << "AbView::c'tor" << oendl; |
55 | // Load default database and handle syncing myself.. ! | 56 | // Load default database and handle syncing myself.. ! |
56 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); | 57 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); |
57 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available | 58 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available |
@@ -99,28 +100,28 @@ AbView::~AbView() | |||
99 | 100 | ||
100 | void AbView::setView( Views view ) | 101 | void AbView::setView( Views view ) |
101 | { | 102 | { |
102 | qWarning("AbView::setView( Views view )"); | 103 | Opie::Core::owarn << "AbView::setView( Views view )" << oendl; |
103 | m_curr_View = view; | 104 | m_curr_View = view; |
104 | load(); | 105 | load(); |
105 | } | 106 | } |
106 | 107 | ||
107 | void AbView::addEntry( const Opie::OPimContact &newContact ) | 108 | void AbView::addEntry( const Opie::OPimContact &newContact ) |
108 | { | 109 | { |
109 | qWarning("abview:AddContact"); | 110 | Opie::Core::owarn << "AbView::AddContact" << oendl; |
110 | m_contactdb->add ( newContact ); | 111 | m_contactdb->add ( newContact ); |
111 | load(); | 112 | load(); |
112 | 113 | ||
113 | } | 114 | } |
114 | void AbView::removeEntry( const int UID ) | 115 | void AbView::removeEntry( const int UID ) |
115 | { | 116 | { |
116 | qWarning("abview:RemoveContact"); | 117 | Opie::Core::owarn << "AbView;:RemoveContact" << oendl; |
117 | m_contactdb->remove( UID ); | 118 | m_contactdb->remove( UID ); |
118 | load(); | 119 | load(); |
119 | } | 120 | } |
120 | 121 | ||
121 | void AbView::replaceEntry( const Opie::OPimContact &contact ) | 122 | void AbView::replaceEntry( const Opie::OPimContact &contact ) |
122 | { | 123 | { |
123 | qWarning("abview:ReplaceContact"); | 124 | Opie::Core::owarn << "AbView::ReplaceContact" << oendl; |
124 | m_contactdb->replace( contact ); | 125 | m_contactdb->replace( contact ); |
125 | load(); | 126 | load(); |
126 | 127 | ||
@@ -144,14 +145,14 @@ Opie::OPimContact AbView::currentEntry() | |||
144 | 145 | ||
145 | bool AbView::save() | 146 | bool AbView::save() |
146 | { | 147 | { |
147 | //qWarning("abView:Save data"); | 148 | //Opie::Core::owarn << "AbView::Save data" << oendl; |
148 | 149 | ||
149 | return m_contactdb->save(); | 150 | return m_contactdb->save(); |
150 | } | 151 | } |
151 | 152 | ||
152 | void AbView::load() | 153 | void AbView::load() |
153 | { | 154 | { |
154 | qWarning("abView:Load data"); | 155 | Opie::Core::owarn << "AbView::Load data" << oendl; |
155 | 156 | ||
156 | // Letter Search is stopped at this place | 157 | // Letter Search is stopped at this place |
157 | emit signalClearLetterPicker(); | 158 | emit signalClearLetterPicker(); |
@@ -165,7 +166,7 @@ void AbView::load() | |||
165 | clearForCategory(); | 166 | clearForCategory(); |
166 | } | 167 | } |
167 | 168 | ||
168 | qWarning ("Number of contacts: %d", m_list.count()); | 169 | Opie::Core::owarn << "Number of contacts: " << m_list.count() << oendl; |
169 | 170 | ||
170 | updateView( true ); | 171 | updateView( true ); |
171 | 172 | ||
@@ -173,7 +174,7 @@ void AbView::load() | |||
173 | 174 | ||
174 | void AbView::reload() | 175 | void AbView::reload() |
175 | { | 176 | { |
176 | qWarning( "void AbView::reload()" ); | 177 | Opie::Core::owarn << "AbView::::reload()" << oendl; |
177 | 178 | ||
178 | m_contactdb->reload(); | 179 | m_contactdb->reload(); |
179 | load(); | 180 | load(); |
@@ -186,7 +187,7 @@ void AbView::clear() | |||
186 | 187 | ||
187 | void AbView::setShowByCategory( const QString& cat ) | 188 | void AbView::setShowByCategory( const QString& cat ) |
188 | { | 189 | { |
189 | qWarning("AbView::setShowCategory( const QString& cat )"); | 190 | Opie::Core::owarn << "AbView::setShowCategory( const QString& cat )" << oendl; |
190 | 191 | ||
191 | int intCat = 0; | 192 | int intCat = 0; |
192 | 193 | ||
@@ -198,7 +199,8 @@ void AbView::setShowByCategory( const QString& cat ) | |||
198 | 199 | ||
199 | // Just do anything if we really change the category | 200 | // Just do anything if we really change the category |
200 | if ( intCat != m_curr_category ){ | 201 | if ( intCat != m_curr_category ){ |
201 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 202 | // Opie::Core::owarn << "Categories: Selected " << cat << ".. Number: " |
203 | // << m_curr_category << oendl; | ||
202 | 204 | ||
203 | m_curr_category = intCat; | 205 | m_curr_category = intCat; |
204 | emit signalClearLetterPicker(); | 206 | emit signalClearLetterPicker(); |
@@ -210,10 +212,10 @@ void AbView::setShowByCategory( const QString& cat ) | |||
210 | 212 | ||
211 | void AbView::setShowToView( Views view ) | 213 | void AbView::setShowToView( Views view ) |
212 | { | 214 | { |
213 | qWarning("void AbView::setShowToView( View %d )", view); | 215 | Opie::Core::owarn << "void AbView::setShowToView( View " << view << " )" << oendl; |
214 | 216 | ||
215 | if ( m_curr_View != view ){ | 217 | if ( m_curr_View != view ){ |
216 | qWarning ("Change the View (Category is: %d)", m_curr_category); | 218 | Opie::Core::owarn << "Change the View (Category is: " << m_curr_category << ")" << oendl; |
217 | m_prev_View = m_curr_View; | 219 | m_prev_View = m_curr_View; |
218 | m_curr_View = view; | 220 | m_curr_View = view; |
219 | 221 | ||
@@ -224,7 +226,7 @@ void AbView::setShowToView( Views view ) | |||
224 | 226 | ||
225 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | 227 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) |
226 | { | 228 | { |
227 | qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); | 229 | Opie::Core::owarn << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; |
228 | 230 | ||
229 | assert( mode < AbConfig::LASTELEMENT ); | 231 | assert( mode < AbConfig::LASTELEMENT ); |
230 | 232 | ||
@@ -247,8 +249,8 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | |||
247 | query.setFileAs( QString("%1*").arg(c) ); | 249 | query.setFileAs( QString("%1*").arg(c) ); |
248 | break; | 250 | break; |
249 | default: | 251 | default: |
250 | qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); | 252 | Opie::Core::owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl |
251 | qWarning( "I will ignore it.." ); | 253 | << "I will ignore it.." << oendl; |
252 | return; | 254 | return; |
253 | } | 255 | } |
254 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); | 256 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); |
@@ -277,7 +279,7 @@ QString AbView::showCategory() const | |||
277 | 279 | ||
278 | void AbView::showPersonal( bool personal ) | 280 | void AbView::showPersonal( bool personal ) |
279 | { | 281 | { |
280 | qWarning ("void AbView::showPersonal( %d )", personal); | 282 | Opie::Core::owarn << "void AbView::showPersonal( " << personal << " )" << oendl; |
281 | 283 | ||
282 | if ( personal ){ | 284 | if ( personal ){ |
283 | 285 | ||
@@ -333,7 +335,7 @@ QStringList AbView::categories() | |||
333 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 335 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
334 | bool , QString cat ) | 336 | bool , QString cat ) |
335 | { | 337 | { |
336 | //qWarning( "void AbView::slotDoFind" ); | 338 | //Opie::Core::owarn << "void AbView::slotDoFind" << oendl; |
337 | 339 | ||
338 | // We reloading the data: Deselect Letterpicker | 340 | // We reloading the data: Deselect Letterpicker |
339 | emit signalClearLetterPicker(); | 341 | emit signalClearLetterPicker(); |
@@ -347,7 +349,7 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
347 | category = mCat.id("Contacts", cat ); | 349 | category = mCat.id("Contacts", cat ); |
348 | } | 350 | } |
349 | 351 | ||
350 | //qWarning ("Find in Category %d", category); | 352 | //Opie::Core::owarn << "Find in Category " << category << oendl; |
351 | 353 | ||
352 | QRegExp r( str ); | 354 | QRegExp r( str ); |
353 | r.setCaseSensitive( caseSensitive ); | 355 | r.setCaseSensitive( caseSensitive ); |
@@ -356,7 +358,7 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
356 | // Get all matching entries out of the database | 358 | // Get all matching entries out of the database |
357 | m_list = m_contactdb->matchRegexp( r ); | 359 | m_list = m_contactdb->matchRegexp( r ); |
358 | 360 | ||
359 | //qWarning( "found: %d", m_list.count() ); | 361 | //Opie::Core::owarn << "Found: " << m_list.count() << oendl; |
360 | if ( m_list.count() == 0 ){ | 362 | if ( m_list.count() == 0 ){ |
361 | emit signalNotFound(); | 363 | emit signalNotFound(); |
362 | return; | 364 | return; |
@@ -380,16 +382,16 @@ void AbView::offSearch() | |||
380 | } | 382 | } |
381 | 383 | ||
382 | void AbView::slotSwitch(){ | 384 | void AbView::slotSwitch(){ |
383 | //qWarning("AbView::slotSwitch()"); | 385 | //Opie::Core::owarn << "AbView::slotSwitch()" << oendl; |
384 | 386 | ||
385 | m_prev_View = m_curr_View; | 387 | m_prev_View = m_curr_View; |
386 | switch ( (int) m_curr_View ){ | 388 | switch ( (int) m_curr_View ){ |
387 | case TableView: | 389 | case TableView: |
388 | qWarning("Switching to CardView"); | 390 | Opie::Core::owarn << "Switching to CardView" << oendl; |
389 | m_curr_View = CardView; | 391 | m_curr_View = CardView; |
390 | break; | 392 | break; |
391 | case CardView: | 393 | case CardView: |
392 | qWarning("Switching to TableView"); | 394 | Opie::Core::owarn << "Switching to TableView" << oendl; |
393 | m_curr_View = TableView; | 395 | m_curr_View = TableView; |
394 | break; | 396 | break; |
395 | } | 397 | } |
@@ -408,7 +410,7 @@ void AbView::clearForCategory() | |||
408 | if ( m_curr_category != -1 ){ | 410 | if ( m_curr_category != -1 ){ |
409 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 411 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
410 | if ( !contactCompare( *it, m_curr_category ) ){ | 412 | if ( !contactCompare( *it, m_curr_category ) ){ |
411 | // qWarning("Removing %d", (*it).uid()); | 413 | //Opie::Core::owarn << "Removing " << (*it).uid() << oendl; |
412 | m_list.remove( (*it).uid() ); | 414 | m_list.remove( (*it).uid() ); |
413 | } | 415 | } |
414 | } | 416 | } |
@@ -418,13 +420,14 @@ void AbView::clearForCategory() | |||
418 | 420 | ||
419 | bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) | 421 | bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) |
420 | { | 422 | { |
421 | //qWarning ("bool AbView::contactCompare( const Opie::OPimContact &cnt, %d )", category); | 423 | //Opie::Core::owarn << "bool AbView::contactCompare( const Opie::OPimContact &cnt, " |
424 | // << category << " )" << oendl; | ||
422 | 425 | ||
423 | bool returnMe; | 426 | bool returnMe; |
424 | QArray<int> cats; | 427 | QArray<int> cats; |
425 | cats = cnt.categories(); | 428 | cats = cnt.categories(); |
426 | 429 | ||
427 | //qWarning ("Number of categories: %d", cats.count() ); | 430 | //Opie::Core::owarn << "Number of categories: " << cats.count() << oendl; |
428 | 431 | ||
429 | returnMe = false; | 432 | returnMe = false; |
430 | if ( cats.count() == 0 && category == 0 ) | 433 | if ( cats.count() == 0 && category == 0 ) |
@@ -433,14 +436,14 @@ bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) | |||
433 | else { | 436 | else { |
434 | int i; | 437 | int i; |
435 | for ( i = 0; i < int(cats.count()); i++ ) { | 438 | for ( i = 0; i < int(cats.count()); i++ ) { |
436 | // qWarning("Comparing %d with %d",cats[i],category ); | 439 | //Opie::Core::owarn << "Comparing " << cats[i] << " with " << category << oendl; |
437 | if ( cats[i] == category ) { | 440 | if ( cats[i] == category ) { |
438 | returnMe = true; | 441 | returnMe = true; |
439 | break; | 442 | break; |
440 | } | 443 | } |
441 | } | 444 | } |
442 | } | 445 | } |
443 | //qWarning ("Return: %d", returnMe); | 446 | //Opie::Core::owarn << "Return: " << returnMe << oendl; |
444 | return returnMe; | 447 | return returnMe; |
445 | } | 448 | } |
446 | 449 | ||
@@ -453,7 +456,7 @@ void AbView::updateListinViews() | |||
453 | 456 | ||
454 | void AbView::updateView( bool newdata ) | 457 | void AbView::updateView( bool newdata ) |
455 | { | 458 | { |
456 | //qWarning("AbView::updateView()"); | 459 | //Opie::Core::owarn << "AbView::updateView()" << oendl; |
457 | 460 | ||
458 | if ( m_viewStack -> visibleWidget() ){ | 461 | if ( m_viewStack -> visibleWidget() ){ |
459 | m_viewStack -> visibleWidget() -> clearFocus(); | 462 | m_viewStack -> visibleWidget() -> clearFocus(); |