Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 18113c2..5df7253 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | |||
@@ -108,7 +108,6 @@ bool OPimContactAccessBackend_XML::save() | |||
108 | // Write all contacts | 108 | // Write all contacts |
109 | QListIterator<OPimContact> it( m_contactList ); | 109 | QListIterator<OPimContact> it( m_contactList ); |
110 | for ( ; it.current(); ++it ) { | 110 | for ( ; it.current(); ++it ) { |
111 | // owarn << " Uid " << (*it)->uid() << " at Offset: " << idx_offset << "" << oendl; | ||
112 | out += "<Contact "; | 111 | out += "<Contact "; |
113 | (*it)->save( out ); | 112 | (*it)->save( out ); |
114 | out += "/>\n"; | 113 | out += "/>\n"; |
@@ -137,8 +136,6 @@ bool OPimContactAccessBackend_XML::save() | |||
137 | // move the file over, I'm just going to use the system call | 136 | // move the file over, I'm just going to use the system call |
138 | // because, I don't feel like using QDir. | 137 | // because, I don't feel like using QDir. |
139 | if ( ::rename( strNewFile.latin1(), m_fileName.latin1() ) < 0 ) { | 138 | if ( ::rename( strNewFile.latin1(), m_fileName.latin1() ) < 0 ) { |
140 | owarn << "problem renaming file " << strNewFile << " to " << m_journalName | ||
141 | << ", errno: " << errno << oendl; | ||
142 | // remove the tmp file... | 139 | // remove the tmp file... |
143 | QFile::remove( strNewFile ); | 140 | QFile::remove( strNewFile ); |
144 | } | 141 | } |
@@ -213,9 +210,8 @@ OPimContact OPimContactAccessBackend_XML::find ( int uid ) const | |||
213 | } | 210 | } |
214 | 211 | ||
215 | QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &query, int settings, | 212 | QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &query, int settings, |
216 | const QDateTime& d ) | 213 | const QDateTime& d )const |
217 | { | 214 | { |
218 | |||
219 | QArray<int> m_currentQuery( m_contactList.count() ); | 215 | QArray<int> m_currentQuery( m_contactList.count() ); |
220 | QListIterator<OPimContact> it( m_contactList ); | 216 | QListIterator<OPimContact> it( m_contactList ); |
221 | uint arraycounter = 0; | 217 | uint arraycounter = 0; |
@@ -278,13 +274,10 @@ QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &qu | |||
278 | // Check whether the birthday/anniversary date is between | 274 | // Check whether the birthday/anniversary date is between |
279 | // the current/given date and the maximum date | 275 | // the current/given date and the maximum date |
280 | // ( maximum time range ) ! | 276 | // ( maximum time range ) ! |
281 | owarn << "Checking if " << checkDate->toString() << " is between " << current.toString() | ||
282 | << " and " << queryDate->toString() << " ! " << oendl; | ||
283 | if ( current.daysTo( *queryDate ) >= 0 ){ | 277 | if ( current.daysTo( *queryDate ) >= 0 ){ |
284 | if ( !( ( *checkDate >= current ) && | 278 | if ( !( ( *checkDate >= current ) && |
285 | ( *checkDate <= *queryDate ) ) ){ | 279 | ( *checkDate <= *queryDate ) ) ){ |
286 | allcorrect = false; | 280 | allcorrect = false; |
287 | owarn << " Nope!.." << oendl; | ||
288 | } | 281 | } |
289 | } | 282 | } |
290 | } | 283 | } |
@@ -430,6 +423,7 @@ bool OPimContactAccessBackend_XML::hasQuerySettings (uint querySettings) const | |||
430 | } | 423 | } |
431 | } | 424 | } |
432 | 425 | ||
426 | #if 0 | ||
433 | // Currently only asc implemented.. | 427 | // Currently only asc implemented.. |
434 | QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int ) | 428 | QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int ) |
435 | { | 429 | { |
@@ -458,10 +452,11 @@ QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int ) | |||
458 | return m_currentQuery; | 452 | return m_currentQuery; |
459 | 453 | ||
460 | } | 454 | } |
455 | #endif | ||
456 | |||
461 | 457 | ||
462 | bool OPimContactAccessBackend_XML::add ( const OPimContact &newcontact ) | 458 | bool OPimContactAccessBackend_XML::add ( const OPimContact &newcontact ) |
463 | { | 459 | { |
464 | //owarn << "odefaultbackend: ACTION::ADD" << oendl; | ||
465 | updateJournal (newcontact, ACTION_ADD); | 460 | updateJournal (newcontact, ACTION_ADD); |
466 | addContact_p( newcontact ); | 461 | addContact_p( newcontact ); |
467 | 462 | ||
@@ -485,8 +480,6 @@ bool OPimContactAccessBackend_XML::replace ( const OPimContact &contact ) | |||
485 | m_uidToContact.remove( QString().setNum( contact.uid() ) ); | 480 | m_uidToContact.remove( QString().setNum( contact.uid() ) ); |
486 | m_uidToContact.insert( QString().setNum( newCont->uid() ), newCont ); | 481 | m_uidToContact.insert( QString().setNum( newCont->uid() ), newCont ); |
487 | 482 | ||
488 | owarn << "Nur zur Sicherheit: " << contact.uid() << " == " << newCont->uid() << " ?" << oendl; | ||
489 | |||
490 | return true; | 483 | return true; |
491 | } else | 484 | } else |
492 | return false; | 485 | return false; |
@@ -591,22 +584,17 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal | |||
591 | dict.insert( "action", new int(JOURNALACTION) ); | 584 | dict.insert( "action", new int(JOURNALACTION) ); |
592 | dict.insert( "actionrow", new int(JOURNALROW) ); | 585 | dict.insert( "actionrow", new int(JOURNALROW) ); |
593 | 586 | ||
594 | //owarn << "OPimContactDefaultBackEnd::loading " << filename << "" << oendl; | ||
595 | |||
596 | XMLElement *root = XMLElement::load( filename ); | 587 | XMLElement *root = XMLElement::load( filename ); |
597 | if(root != 0l ){ // start parsing | 588 | if(root != 0l ){ // start parsing |
598 | /* Parse all XML-Elements and put the data into the | 589 | /* Parse all XML-Elements and put the data into the |
599 | * Contact-Class | 590 | * Contact-Class |
600 | */ | 591 | */ |
601 | XMLElement *element = root->firstChild(); | 592 | XMLElement *element = root->firstChild(); |
602 | //owarn << "OPimContactAccess::load tagName(): " << root->tagName() << "" << oendl; | ||
603 | element = element ? element->firstChild() : 0; | 593 | element = element ? element->firstChild() : 0; |
604 | 594 | ||
605 | /* Search Tag "Contacts" which is the parent of all Contacts */ | 595 | /* Search Tag "Contacts" which is the parent of all Contacts */ |
606 | while( element && !isJournal ){ | 596 | while( element && !isJournal ){ |
607 | if( element->tagName() != QString::fromLatin1("Contacts") ){ | 597 | if( element->tagName() != QString::fromLatin1("Contacts") ){ |
608 | //owarn << "OPimContactDefBack::Searching for Tag \"Contacts\"! Found: " | ||
609 | // << element->tagName() << oendl; | ||
610 | element = element->nextChild(); | 598 | element = element->nextChild(); |
611 | } else { | 599 | } else { |
612 | element = element->firstChild(); | 600 | element = element->firstChild(); |
@@ -616,16 +604,12 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal | |||
616 | /* Parse all Contacts and ignore unknown tags */ | 604 | /* Parse all Contacts and ignore unknown tags */ |
617 | while( element ){ | 605 | while( element ){ |
618 | if( element->tagName() != QString::fromLatin1("Contact") ){ | 606 | if( element->tagName() != QString::fromLatin1("Contact") ){ |
619 | //owarn << "OPimContactDefBack::Searching for Tag \"Contact\"! Found: " | ||
620 | // << element->tagName() << oendl; | ||
621 | element = element->nextChild(); | 607 | element = element->nextChild(); |
622 | continue; | 608 | continue; |
623 | } | 609 | } |
624 | /* Found alement with tagname "contact", now parse and store all | 610 | /* Found alement with tagname "contact", now parse and store all |
625 | * attributes contained | 611 | * attributes contained |
626 | */ | 612 | */ |
627 | //owarn << "OPimContactDefBack::load element tagName() : " | ||
628 | // << element->tagName() << oendl; | ||
629 | QString dummy; | 613 | QString dummy; |
630 | foundAction = false; | 614 | foundAction = false; |
631 | 615 | ||
@@ -634,12 +618,9 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal | |||
634 | contactMap.clear(); | 618 | contactMap.clear(); |
635 | customMap.clear(); | 619 | customMap.clear(); |
636 | for( it = aMap.begin(); it != aMap.end(); ++it ){ | 620 | for( it = aMap.begin(); it != aMap.end(); ++it ){ |
637 | // owarn << "Read Attribute: " << it.key() << "=" << it.data() << oendl; | ||
638 | |||
639 | int *find = dict[ it.key() ]; | 621 | int *find = dict[ it.key() ]; |
640 | /* Unknown attributes will be stored as "Custom" elements */ | 622 | /* Unknown attributes will be stored as "Custom" elements */ |
641 | if ( !find ) { | 623 | if ( !find ) { |
642 | // owarn << "Attribute " << it.key() << " not known." << oendl; | ||
643 | //contact.setCustomField(it.key(), it.data()); | 624 | //contact.setCustomField(it.key(), it.data()); |
644 | customMap.insert( it.key(), it.data() ); | 625 | customMap.insert( it.key(), it.data() ); |
645 | continue; | 626 | continue; |
@@ -704,10 +685,8 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal | |||
704 | element = element->nextChild(); | 685 | element = element->nextChild(); |
705 | } | 686 | } |
706 | }else { | 687 | }else { |
707 | owarn << "ODefBack::could not load" << oendl; | ||
708 | } | 688 | } |
709 | delete root; | 689 | delete root; |
710 | owarn << "returning from loading" << oendl; | ||
711 | return true; | 690 | return true; |
712 | } | 691 | } |
713 | 692 | ||