summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
authorar <ar>2004-06-01 22:21:23 (UTC)
committer ar <ar>2004-06-01 22:21:23 (UTC)
commitd4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce (patch) (unidiff)
tree4bab082304716df1ec924ef040161e3cf9c10366 /libopie2/opiepim/backend
parentbaed1d5ab8589aef14440009bc4e7380bcc5a741 (diff)
downloadopie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.zip
opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.tar.gz
opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.tar.bz2
- convert to odebug framework
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h24
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp36
2 files changed, 31 insertions, 29 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 6f46652..3680ded 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -34,10 +34,7 @@
34#ifndef OPIE_BACKENDFACTORY_H_ 34#ifndef OPIE_BACKENDFACTORY_H_
35#define OPIE_BACKENDFACTORY_H_ 35#define OPIE_BACKENDFACTORY_H_
36 36
37#include <qstring.h> 37/* OPIE */
38#include <qasciidict.h>
39#include <qpe/config.h>
40
41#include <opie2/opimaccessbackend.h> 38#include <opie2/opimaccessbackend.h>
42#include <opie2/opimglobal.h> 39#include <opie2/opimglobal.h>
43#include <opie2/otodoaccessxml.h> 40#include <opie2/otodoaccessxml.h>
@@ -45,6 +42,7 @@
45#include <opie2/ocontactaccessbackend_xml.h> 42#include <opie2/ocontactaccessbackend_xml.h>
46#include <opie2/ocontactaccessbackend_vcard.h> 43#include <opie2/ocontactaccessbackend_vcard.h>
47#include <opie2/odatebookaccessbackend_xml.h> 44#include <opie2/odatebookaccessbackend_xml.h>
45#include <opie2/odebug.h>
48 46
49#ifdef __USE_SQL 47#ifdef __USE_SQL
50#include <opie2/otodoaccesssql.h> 48#include <opie2/otodoaccesssql.h>
@@ -52,6 +50,14 @@
52#include <opie2/odatebookaccessbackend_sql.h> 50#include <opie2/odatebookaccessbackend_sql.h>
53#endif 51#endif
54 52
53#include <qpe/config.h>
54
55/* QT */
56#include <qstring.h>
57#include <qasciidict.h>
58
59
60
55using namespace Opie; 61using namespace Opie;
56using namespace Opie::Pim; 62using namespace Opie::Pim;
57 63
@@ -90,7 +96,7 @@ class OBackendFactory
90 */ 96 */
91 static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle database, 97 static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle database,
92 const QString& appName, const QString& filename = QString::null ){ 98 const QString& appName, const QString& filename = QString::null ){
93 qWarning("Selected backend for %d is: %d", type, database ); 99 owarn << "Selected backend for " << type << " is: " << database << oendl;
94 // If we should use the dafult database style, we have to request it 100 // If we should use the dafult database style, we have to request it
95 OPimGlobal::DatabaseStyle use_database = database; 101 OPimGlobal::DatabaseStyle use_database = database;
96 if ( use_database == OPimGlobal::DEFAULT ){ 102 if ( use_database == OPimGlobal::DEFAULT ){
@@ -108,7 +114,7 @@ class OBackendFactory
108 return (T*) new OPimTodoAccessBackendSQL( filename ); 114 return (T*) new OPimTodoAccessBackendSQL( filename );
109 break; 115 break;
110#else 116#else
111 qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!"); 117 owarn << "OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!" << oendl;
112 // Fall through !! 118 // Fall through !!
113#endif 119#endif
114 case OPimGlobal::XML: 120 case OPimGlobal::XML:
@@ -127,7 +133,7 @@ class OBackendFactory
127 return (T*) new OPimContactAccessBackend_SQL( appName, filename ); 133 return (T*) new OPimContactAccessBackend_SQL( appName, filename );
128 break; 134 break;
129#else 135#else
130 qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!"); 136 owarn << "OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!" << oendl;
131 // Fall through !! 137 // Fall through !!
132#endif 138#endif
133 case OPimGlobal::XML: 139 case OPimGlobal::XML:
@@ -146,14 +152,14 @@ class OBackendFactory
146 return (T*) new ODateBookAccessBackend_SQL( appName, filename ); 152 return (T*) new ODateBookAccessBackend_SQL( appName, filename );
147 break; 153 break;
148#else 154#else
149 qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); 155 owarn << "OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!" << oendl;
150 // Fall through !! 156 // Fall through !!
151#endif 157#endif
152 case OPimGlobal::XML: 158 case OPimGlobal::XML:
153 return (T*) new ODateBookAccessBackend_XML( appName, filename ); 159 return (T*) new ODateBookAccessBackend_XML( appName, filename );
154 break; 160 break;
155 case OPimGlobal::VCARD: 161 case OPimGlobal::VCARD:
156 qWarning("OBackendFactory:: VCal Backend for DATEBOOK not implemented!"); 162 owarn << "OBackendFactory:: VCal Backend for DATEBOOK not implemented!" << oendl;
157 return (T*) NULL; 163 return (T*) NULL;
158 break; 164 break;
159 } 165 }
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index 5ffcb11..00d62ee 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -137,8 +137,8 @@ bool OPimContactAccessBackend_XML::save()
137 // move the file over, I'm just going to use the system call 137 // move the file over, I'm just going to use the system call
138 // because, I don't feel like using QDir. 138 // because, I don't feel like using QDir.
139 if ( ::rename( strNewFile.latin1(), m_fileName.latin1() ) < 0 ) { 139 if ( ::rename( strNewFile.latin1(), m_fileName.latin1() ) < 0 ) {
140 qWarning( "problem renaming file %s to %s, errno: %d", 140 owarn << "problem renaming file " << strNewFile << " to " << m_journalName
141 strNewFile.latin1(), m_journalName.latin1(), errno ); 141 << ", errno: " << errno << oendl;
142 // remove the tmp file... 142 // remove the tmp file...
143 QFile::remove( strNewFile ); 143 QFile::remove( strNewFile );
144 } 144 }
@@ -278,15 +278,13 @@ QArray<int> OPimContactAccessBackend_XML::queryByExample ( const OPimContact &qu
278 // Check whether the birthday/anniversary date is between 278 // Check whether the birthday/anniversary date is between
279 // the current/given date and the maximum date 279 // the current/given date and the maximum date
280 // ( maximum time range ) ! 280 // ( maximum time range ) !
281 qWarning("Checking if %s is between %s and %s ! ", 281 owarn << "Checking if " << checkDate->toString() << " is between " << current.toString()
282 checkDate->toString().latin1(), 282 << " and " << queryDate->toString() << " ! " << oendl;
283 current.toString().latin1(),
284 queryDate->toString().latin1() );
285 if ( current.daysTo( *queryDate ) >= 0 ){ 283 if ( current.daysTo( *queryDate ) >= 0 ){
286 if ( !( ( *checkDate >= current ) && 284 if ( !( ( *checkDate >= current ) &&
287 ( *checkDate <= *queryDate ) ) ){ 285 ( *checkDate <= *queryDate ) ) ){
288 allcorrect = false; 286 allcorrect = false;
289 qWarning (" Nope!.."); 287 owarn << " Nope!.." << oendl;
290 } 288 }
291 } 289 }
292 } 290 }
@@ -607,8 +605,8 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
607 /* Search Tag "Contacts" which is the parent of all Contacts */ 605 /* Search Tag "Contacts" which is the parent of all Contacts */
608 while( element && !isJournal ){ 606 while( element && !isJournal ){
609 if( element->tagName() != QString::fromLatin1("Contacts") ){ 607 if( element->tagName() != QString::fromLatin1("Contacts") ){
610 //qWarning ("OPimContactDefBack::Searching for Tag \"Contacts\"! Found: %s", 608 //owarn << "OPimContactDefBack::Searching for Tag \"Contacts\"! Found: "
611 // element->tagName().latin1()); 609 // << element->tagName() << oendl;
612 element = element->nextChild(); 610 element = element->nextChild();
613 } else { 611 } else {
614 element = element->firstChild(); 612 element = element->firstChild();
@@ -618,16 +616,16 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
618 /* Parse all Contacts and ignore unknown tags */ 616 /* Parse all Contacts and ignore unknown tags */
619 while( element ){ 617 while( element ){
620 if( element->tagName() != QString::fromLatin1("Contact") ){ 618 if( element->tagName() != QString::fromLatin1("Contact") ){
621 //qWarning ("OPimContactDefBack::Searching for Tag \"Contact\"! Found: %s", 619 //owarn << "OPimContactDefBack::Searching for Tag \"Contact\"! Found: "
622 // element->tagName().latin1()); 620 // << element->tagName() << oendl;
623 element = element->nextChild(); 621 element = element->nextChild();
624 continue; 622 continue;
625 } 623 }
626 /* Found alement with tagname "contact", now parse and store all 624 /* Found alement with tagname "contact", now parse and store all
627 * attributes contained 625 * attributes contained
628 */ 626 */
629 //qWarning("OPimContactDefBack::load element tagName() : %s", 627 //owarn << "OPimContactDefBack::load element tagName() : "
630 // element->tagName().latin1() ); 628 // << element->tagName() << oendl;
631 QString dummy; 629 QString dummy;
632 foundAction = false; 630 foundAction = false;
633 631
@@ -636,7 +634,7 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
636 contactMap.clear(); 634 contactMap.clear();
637 customMap.clear(); 635 customMap.clear();
638 for( it = aMap.begin(); it != aMap.end(); ++it ){ 636 for( it = aMap.begin(); it != aMap.end(); ++it ){
639 // qWarning ("Read Attribute: %s=%s", it.key().latin1(),it.data().latin1()); 637 // owarn << "Read Attribute: " << it.key() << "=" << it.data() << oendl;
640 638
641 int *find = dict[ it.key() ]; 639 int *find = dict[ it.key() ];
642 /* Unknown attributes will be stored as "Custom" elements */ 640 /* Unknown attributes will be stored as "Custom" elements */
@@ -662,7 +660,7 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
662 case JOURNALACTION: 660 case JOURNALACTION:
663 action = journal_action(it.data().toInt()); 661 action = journal_action(it.data().toInt());
664 foundAction = true; 662 foundAction = true;
665 qWarning ("ODefBack(journal)::ACTION found: %d", action); 663 owarn << "ODefBack(journal)::ACTION found: " << action << oendl;
666 break; 664 break;
667 case JOURNALROW: 665 case JOURNALROW:
668 journalKey = it.data().toInt(); 666 journalKey = it.data().toInt();
@@ -687,16 +685,14 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
687 break; 685 break;
688 case ACTION_REMOVE: 686 case ACTION_REMOVE:
689 if ( !remove (contact.uid()) ) 687 if ( !remove (contact.uid()) )
690 qWarning ("ODefBack(journal)::Unable to remove uid: %d", 688 owarn << "ODefBack(journal)::Unable to remove uid: " << contact.uid() << oendl;
691 contact.uid() );
692 break; 689 break;
693 case ACTION_REPLACE: 690 case ACTION_REPLACE:
694 if ( !replace ( contact ) ) 691 if ( !replace ( contact ) )
695 qWarning ("ODefBack(journal)::Unable to replace uid: %d", 692 owarn << "ODefBack(journal)::Unable to replace uid: " << contact.uid() << oendl;
696 contact.uid() );
697 break; 693 break;
698 default: 694 default:
699 qWarning ("Unknown action: ignored !"); 695 owarn << "Unknown action: ignored !" << oendl;
700 break; 696 break;
701 } 697 }
702 }else{ 698 }else{