Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 07ad29a..0adba68 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | |||
@@ -56,3 +56,3 @@ using namespace Opie; | |||
56 | namespace Opie { | 56 | namespace Opie { |
57 | OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, const QString& filename ): | 57 | OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ): |
58 | m_changed( false ) | 58 | m_changed( false ) |
@@ -80,3 +80,3 @@ OContactAccessBackend_XML::OContactAccessBackend_XML ( const QString& appname, c | |||
80 | 80 | ||
81 | bool OContactAccessBackend_XML::save() | 81 | bool OPimContactAccessBackend_XML::save() |
82 | { | 82 | { |
@@ -106,3 +106,3 @@ bool OContactAccessBackend_XML::save() | |||
106 | // Write all contacts | 106 | // Write all contacts |
107 | QListIterator<OContact> it( m_contactList ); | 107 | QListIterator<OPimContact> it( m_contactList ); |
108 | for ( ; it.current(); ++it ) { | 108 | for ( ; it.current(); ++it ) { |
@@ -150,3 +150,3 @@ bool OContactAccessBackend_XML::save() | |||
150 | 150 | ||
151 | bool OContactAccessBackend_XML::load () | 151 | bool OPimContactAccessBackend_XML::load () |
152 | { | 152 | { |
@@ -169,3 +169,3 @@ bool OContactAccessBackend_XML::load () | |||
169 | 169 | ||
170 | void OContactAccessBackend_XML::clear () | 170 | void OPimContactAccessBackend_XML::clear () |
171 | { | 171 | { |
@@ -177,3 +177,3 @@ void OContactAccessBackend_XML::clear () | |||
177 | 177 | ||
178 | bool OContactAccessBackend_XML::wasChangedExternally() | 178 | bool OPimContactAccessBackend_XML::wasChangedExternally() |
179 | { | 179 | { |
@@ -186,3 +186,3 @@ bool OContactAccessBackend_XML::wasChangedExternally() | |||
186 | 186 | ||
187 | QArray<int> OContactAccessBackend_XML::allRecords() const | 187 | QArray<int> OPimContactAccessBackend_XML::allRecords() const |
188 | { | 188 | { |
@@ -191,3 +191,3 @@ QArray<int> OContactAccessBackend_XML::allRecords() const | |||
191 | uint counter = 0; | 191 | uint counter = 0; |
192 | QListIterator<OContact> it( m_contactList ); | 192 | QListIterator<OPimContact> it( m_contactList ); |
193 | for( ; it.current(); ++it ){ | 193 | for( ; it.current(); ++it ){ |
@@ -199,7 +199,7 @@ QArray<int> OContactAccessBackend_XML::allRecords() const | |||
199 | 199 | ||
200 | OContact OContactAccessBackend_XML::find ( int uid ) const | 200 | OPimContact OPimContactAccessBackend_XML::find ( int uid ) const |
201 | { | 201 | { |
202 | OContact foundContact; //Create empty contact | 202 | OPimContact foundContact; //Create empty contact |
203 | 203 | ||
204 | OContact* found = m_uidToContact.find( QString().setNum( uid ) ); | 204 | OPimContact* found = m_uidToContact.find( QString().setNum( uid ) ); |
205 | 205 | ||
@@ -212,3 +212,3 @@ OContact OContactAccessBackend_XML::find ( int uid ) const | |||
212 | 212 | ||
213 | QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, int settings, | 213 | QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &query, int settings, |
214 | const QDateTime& d ) | 214 | const QDateTime& d ) |
@@ -217,3 +217,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
217 | QArray<int> m_currentQuery( m_contactList.count() ); | 217 | QArray<int> m_currentQuery( m_contactList.count() ); |
218 | QListIterator<OContact> it( m_contactList ); | 218 | QListIterator<OPimContact> it( m_contactList ); |
219 | uint arraycounter = 0; | 219 | uint arraycounter = 0; |
@@ -242,3 +242,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
242 | if( checkDate->isValid() ){ | 242 | if( checkDate->isValid() ){ |
243 | if ( settings & OContactAccess::DateYear ){ | 243 | if ( settings & OPimContactAccess::DateYear ){ |
244 | if ( queryDate->year() != checkDate->year() ) | 244 | if ( queryDate->year() != checkDate->year() ) |
@@ -246,3 +246,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
246 | } | 246 | } |
247 | if ( settings & OContactAccess::DateMonth ){ | 247 | if ( settings & OPimContactAccess::DateMonth ){ |
248 | if ( queryDate->month() != checkDate->month() ) | 248 | if ( queryDate->month() != checkDate->month() ) |
@@ -250,3 +250,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
250 | } | 250 | } |
251 | if ( settings & OContactAccess::DateDay ){ | 251 | if ( settings & OPimContactAccess::DateDay ){ |
252 | if ( queryDate->day() != checkDate->day() ) | 252 | if ( queryDate->day() != checkDate->day() ) |
@@ -254,3 +254,3 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
254 | } | 254 | } |
255 | if ( settings & OContactAccess::DateDiff ) { | 255 | if ( settings & OPimContactAccess::DateDiff ) { |
256 | QDate current; | 256 | QDate current; |
@@ -303,13 +303,13 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
303 | if ( !query.field(i).isEmpty() ){ | 303 | if ( !query.field(i).isEmpty() ){ |
304 | switch ( settings & ~( OContactAccess::IgnoreCase | 304 | switch ( settings & ~( OPimContactAccess::IgnoreCase |
305 | | OContactAccess::DateDiff | 305 | | OPimContactAccess::DateDiff |
306 | | OContactAccess::DateYear | 306 | | OPimContactAccess::DateYear |
307 | | OContactAccess::DateMonth | 307 | | OPimContactAccess::DateMonth |
308 | | OContactAccess::DateDay | 308 | | OPimContactAccess::DateDay |
309 | | OContactAccess::MatchOne | 309 | | OPimContactAccess::MatchOne |
310 | ) ){ | 310 | ) ){ |
311 | 311 | ||
312 | case OContactAccess::RegExp:{ | 312 | case OPimContactAccess::RegExp:{ |
313 | QRegExp expr ( query.field(i), | 313 | QRegExp expr ( query.field(i), |
314 | !(settings & OContactAccess::IgnoreCase), | 314 | !(settings & OPimContactAccess::IgnoreCase), |
315 | false ); | 315 | false ); |
@@ -319,5 +319,5 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
319 | break; | 319 | break; |
320 | case OContactAccess::WildCards:{ | 320 | case OPimContactAccess::WildCards:{ |
321 | QRegExp expr ( query.field(i), | 321 | QRegExp expr ( query.field(i), |
322 | !(settings & OContactAccess::IgnoreCase), | 322 | !(settings & OPimContactAccess::IgnoreCase), |
323 | true ); | 323 | true ); |
@@ -327,4 +327,4 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
327 | break; | 327 | break; |
328 | case OContactAccess::ExactMatch:{ | 328 | case OPimContactAccess::ExactMatch:{ |
329 | if (settings & OContactAccess::IgnoreCase){ | 329 | if (settings & OPimContactAccess::IgnoreCase){ |
330 | if ( query.field(i).upper() != | 330 | if ( query.field(i).upper() != |
@@ -353,6 +353,6 @@ QArray<int> OContactAccessBackend_XML::queryByExample ( const OContact &query, i | |||
353 | 353 | ||
354 | QArray<int> OContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const | 354 | QArray<int> OPimContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const |
355 | { | 355 | { |
356 | QArray<int> m_currentQuery( m_contactList.count() ); | 356 | QArray<int> m_currentQuery( m_contactList.count() ); |
357 | QListIterator<OContact> it( m_contactList ); | 357 | QListIterator<OPimContact> it( m_contactList ); |
358 | uint arraycounter = 0; | 358 | uint arraycounter = 0; |
@@ -371,12 +371,12 @@ QArray<int> OContactAccessBackend_XML::matchRegexp( const QRegExp &r ) const | |||
371 | 371 | ||
372 | const uint OContactAccessBackend_XML::querySettings() | 372 | const uint OPimContactAccessBackend_XML::querySettings() |
373 | { | 373 | { |
374 | return ( OContactAccess::WildCards | 374 | return ( OPimContactAccess::WildCards |
375 | | OContactAccess::IgnoreCase | 375 | | OPimContactAccess::IgnoreCase |
376 | | OContactAccess::RegExp | 376 | | OPimContactAccess::RegExp |
377 | | OContactAccess::ExactMatch | 377 | | OPimContactAccess::ExactMatch |
378 | | OContactAccess::DateDiff | 378 | | OPimContactAccess::DateDiff |
379 | | OContactAccess::DateYear | 379 | | OPimContactAccess::DateYear |
380 | | OContactAccess::DateMonth | 380 | | OPimContactAccess::DateMonth |
381 | | OContactAccess::DateDay | 381 | | OPimContactAccess::DateDay |
382 | ); | 382 | ); |
@@ -384,5 +384,5 @@ const uint OContactAccessBackend_XML::querySettings() | |||
384 | 384 | ||
385 | bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const | 385 | bool OPimContactAccessBackend_XML::hasQuerySettings (uint querySettings) const |
386 | { | 386 | { |
387 | /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay | 387 | /* OPimContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay |
388 | * may be added with any of the other settings. IgnoreCase should never used alone. | 388 | * may be added with any of the other settings. IgnoreCase should never used alone. |
@@ -393,10 +393,10 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const | |||
393 | if ( ( querySettings & ( | 393 | if ( ( querySettings & ( |
394 | OContactAccess::IgnoreCase | 394 | OPimContactAccess::IgnoreCase |
395 | | OContactAccess::WildCards | 395 | | OPimContactAccess::WildCards |
396 | | OContactAccess::DateDiff | 396 | | OPimContactAccess::DateDiff |
397 | | OContactAccess::DateYear | 397 | | OPimContactAccess::DateYear |
398 | | OContactAccess::DateMonth | 398 | | OPimContactAccess::DateMonth |
399 | | OContactAccess::DateDay | 399 | | OPimContactAccess::DateDay |
400 | | OContactAccess::RegExp | 400 | | OPimContactAccess::RegExp |
401 | | OContactAccess::ExactMatch | 401 | | OPimContactAccess::ExactMatch |
402 | ) ) != querySettings ) | 402 | ) ) != querySettings ) |
@@ -407,3 +407,3 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const | |||
407 | // IngoreCase alone is invalid | 407 | // IngoreCase alone is invalid |
408 | if ( querySettings == OContactAccess::IgnoreCase ) | 408 | if ( querySettings == OPimContactAccess::IgnoreCase ) |
409 | return false; | 409 | return false; |
@@ -411,14 +411,14 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const | |||
411 | // WildCards, RegExp and ExactMatch should never used at the same time | 411 | // WildCards, RegExp and ExactMatch should never used at the same time |
412 | switch ( querySettings & ~( OContactAccess::IgnoreCase | 412 | switch ( querySettings & ~( OPimContactAccess::IgnoreCase |
413 | | OContactAccess::DateDiff | 413 | | OPimContactAccess::DateDiff |
414 | | OContactAccess::DateYear | 414 | | OPimContactAccess::DateYear |
415 | | OContactAccess::DateMonth | 415 | | OPimContactAccess::DateMonth |
416 | | OContactAccess::DateDay | 416 | | OPimContactAccess::DateDay |
417 | ) | 417 | ) |
418 | ){ | 418 | ){ |
419 | case OContactAccess::RegExp: | 419 | case OPimContactAccess::RegExp: |
420 | return ( true ); | 420 | return ( true ); |
421 | case OContactAccess::WildCards: | 421 | case OPimContactAccess::WildCards: |
422 | return ( true ); | 422 | return ( true ); |
423 | case OContactAccess::ExactMatch: | 423 | case OPimContactAccess::ExactMatch: |
424 | return ( true ); | 424 | return ( true ); |
@@ -432,3 +432,3 @@ bool OContactAccessBackend_XML::hasQuerySettings (uint querySettings) const | |||
432 | // Currently only asc implemented.. | 432 | // Currently only asc implemented.. |
433 | QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int ) | 433 | QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int ) |
434 | { | 434 | { |
@@ -440,3 +440,3 @@ QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int ) | |||
440 | // Afterwards sort namelist and use map to fill array to return.. | 440 | // Afterwards sort namelist and use map to fill array to return.. |
441 | QListIterator<OContact> it( m_contactList ); | 441 | QListIterator<OPimContact> it( m_contactList ); |
442 | for( ; it.current(); ++it ){ | 442 | for( ; it.current(); ++it ){ |
@@ -460,3 +460,3 @@ QArray<int> OContactAccessBackend_XML::sorted( bool asc, int , int , int ) | |||
460 | 460 | ||
461 | bool OContactAccessBackend_XML::add ( const OContact &newcontact ) | 461 | bool OPimContactAccessBackend_XML::add ( const OPimContact &newcontact ) |
462 | { | 462 | { |
@@ -471,3 +471,3 @@ bool OContactAccessBackend_XML::add ( const OContact &newcontact ) | |||
471 | 471 | ||
472 | bool OContactAccessBackend_XML::replace ( const OContact &contact ) | 472 | bool OPimContactAccessBackend_XML::replace ( const OPimContact &contact ) |
473 | { | 473 | { |
@@ -475,6 +475,6 @@ bool OContactAccessBackend_XML::replace ( const OContact &contact ) | |||
475 | 475 | ||
476 | OContact* found = m_uidToContact.find ( QString().setNum( contact.uid() ) ); | 476 | OPimContact* found = m_uidToContact.find ( QString().setNum( contact.uid() ) ); |
477 | 477 | ||
478 | if ( found ) { | 478 | if ( found ) { |
479 | OContact* newCont = new OContact( contact ); | 479 | OPimContact* newCont = new OPimContact( contact ); |
480 | 480 | ||
@@ -493,3 +493,3 @@ bool OContactAccessBackend_XML::replace ( const OContact &contact ) | |||
493 | 493 | ||
494 | bool OContactAccessBackend_XML::remove ( int uid ) | 494 | bool OPimContactAccessBackend_XML::remove ( int uid ) |
495 | { | 495 | { |
@@ -497,3 +497,3 @@ bool OContactAccessBackend_XML::remove ( int uid ) | |||
497 | 497 | ||
498 | OContact* found = m_uidToContact.find ( QString().setNum( uid ) ); | 498 | OPimContact* found = m_uidToContact.find ( QString().setNum( uid ) ); |
499 | 499 | ||
@@ -509,3 +509,3 @@ bool OContactAccessBackend_XML::remove ( int uid ) | |||
509 | 509 | ||
510 | bool OContactAccessBackend_XML::reload(){ | 510 | bool OPimContactAccessBackend_XML::reload(){ |
511 | /* Reload is the same as load in this implementation */ | 511 | /* Reload is the same as load in this implementation */ |
@@ -514,5 +514,5 @@ bool OContactAccessBackend_XML::reload(){ | |||
514 | 514 | ||
515 | void OContactAccessBackend_XML::addContact_p( const OContact &newcontact ) | 515 | void OPimContactAccessBackend_XML::addContact_p( const OPimContact &newcontact ) |
516 | { | 516 | { |
517 | OContact* contRef = new OContact( newcontact ); | 517 | OPimContact* contRef = new OPimContact( newcontact ); |
518 | 518 | ||
@@ -523,3 +523,3 @@ void OContactAccessBackend_XML::addContact_p( const OContact &newcontact ) | |||
523 | /* This function loads the xml-database and the journalfile */ | 523 | /* This function loads the xml-database and the journalfile */ |
524 | bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | 524 | bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal ) |
525 | { | 525 | { |
@@ -592,3 +592,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
592 | 592 | ||
593 | //qWarning( "OContactDefaultBackEnd::loading %s", filename.latin1() ); | 593 | //qWarning( "OPimContactDefaultBackEnd::loading %s", filename.latin1() ); |
594 | 594 | ||
@@ -600,3 +600,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
600 | XMLElement *element = root->firstChild(); | 600 | XMLElement *element = root->firstChild(); |
601 | //qWarning("OContactAccess::load tagName(): %s", root->tagName().latin1() ); | 601 | //qWarning("OPimContactAccess::load tagName(): %s", root->tagName().latin1() ); |
602 | element = element->firstChild(); | 602 | element = element->firstChild(); |
@@ -606,3 +606,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
606 | if( element->tagName() != QString::fromLatin1("Contacts") ){ | 606 | if( element->tagName() != QString::fromLatin1("Contacts") ){ |
607 | //qWarning ("OContactDefBack::Searching for Tag \"Contacts\"! Found: %s", | 607 | //qWarning ("OPimContactDefBack::Searching for Tag \"Contacts\"! Found: %s", |
608 | // element->tagName().latin1()); | 608 | // element->tagName().latin1()); |
@@ -617,3 +617,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
617 | if( element->tagName() != QString::fromLatin1("Contact") ){ | 617 | if( element->tagName() != QString::fromLatin1("Contact") ){ |
618 | //qWarning ("OContactDefBack::Searching for Tag \"Contact\"! Found: %s", | 618 | //qWarning ("OPimContactDefBack::Searching for Tag \"Contact\"! Found: %s", |
619 | // element->tagName().latin1()); | 619 | // element->tagName().latin1()); |
@@ -625,3 +625,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
625 | */ | 625 | */ |
626 | //qWarning("OContactDefBack::load element tagName() : %s", | 626 | //qWarning("OPimContactDefBack::load element tagName() : %s", |
627 | // element->tagName().latin1() ); | 627 | // element->tagName().latin1() ); |
@@ -672,3 +672,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
672 | /* now generate the Contact contact */ | 672 | /* now generate the Contact contact */ |
673 | OContact contact( contactMap ); | 673 | OPimContact contact( contactMap ); |
674 | 674 | ||
@@ -715,3 +715,3 @@ bool OContactAccessBackend_XML::load( const QString filename, bool isJournal ) | |||
715 | 715 | ||
716 | void OContactAccessBackend_XML::updateJournal( const OContact& cnt, | 716 | void OPimContactAccessBackend_XML::updateJournal( const OPimContact& cnt, |
717 | journal_action action ) | 717 | journal_action action ) |
@@ -743,3 +743,3 @@ void OContactAccessBackend_XML::updateJournal( const OContact& cnt, | |||
743 | 743 | ||
744 | void OContactAccessBackend_XML::removeJournal() | 744 | void OPimContactAccessBackend_XML::removeJournal() |
745 | { | 745 | { |