summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp29
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
@@ -109,5 +109,4 @@ bool OPimContactAccessBackend_XML::save()
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 );
@@ -138,6 +137,4 @@ bool OPimContactAccessBackend_XML::save()
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 );
@@ -214,7 +211,6 @@ OPimContact OPimContactAccessBackend_XML::find ( int uid ) const
214 211
215QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &query, int settings, 212QArray<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 );
@@ -279,11 +275,8 @@ QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &qu
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 }
@@ -431,4 +424,5 @@ bool OPimContactAccessBackend_XML::hasQuerySettings (uint querySettings) const
431} 424}
432 425
426#if 0
433// Currently only asc implemented.. 427// Currently only asc implemented..
434QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int ) 428QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int )
@@ -459,8 +453,9 @@ QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int )
459 453
460} 454}
455#endif
456
461 457
462bool OPimContactAccessBackend_XML::add ( const OPimContact &newcontact ) 458bool 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 );
@@ -486,6 +481,4 @@ bool OPimContactAccessBackend_XML::replace ( const OPimContact &contact )
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
@@ -592,6 +585,4 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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
@@ -600,5 +591,4 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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
@@ -606,6 +596,4 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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 {
@@ -617,6 +605,4 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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;
@@ -625,6 +611,4 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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;
@@ -635,10 +619,7 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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() );
@@ -705,8 +686,6 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
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}