summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
authorar <ar>2004-06-01 21:38:07 (UTC)
committer ar <ar>2004-06-01 21:38:07 (UTC)
commitbaed1d5ab8589aef14440009bc4e7380bcc5a741 (patch) (side-by-side diff)
treec636e892c5eec0df2b36d16cb601a7da41a2ef0f /libopie2/opiepim/backend
parent4438393d8eef624565e840b798429071829adea8 (diff)
downloadopie-baed1d5ab8589aef14440009bc4e7380bcc5a741.zip
opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.gz
opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.bz2
- convert to odebug framework
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp64
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp18
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp32
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp43
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp42
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp48
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp10
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp65
8 files changed, 178 insertions, 144 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
index 14207be..dda23cc 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
@@ -32,13 +32,7 @@
#include "ocontactaccessbackend_sql.h"
-#include <qarray.h>
-#include <qdatetime.h>
-#include <qstringlist.h>
-
-#include <qpe/global.h>
-#include <qpe/recordfields.h>
-
+/* OPIE */
#include <opie2/opimcontact.h>
#include <opie2/opimcontactfields.h>
#include <opie2/opimdateconversion.h>
@@ -46,6 +40,16 @@
#include <opie2/osqlresult.h>
#include <opie2/osqlmanager.h>
#include <opie2/osqlquery.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+#include <qpe/recordfields.h>
+
+/* QT */
+#include <qarray.h>
+#include <qdatetime.h>
+#include <qstringlist.h>
+
using namespace Opie;
using namespace Opie::DB;
@@ -268,7 +272,7 @@ namespace {
+ "');";
}
// qu += "commit;";
- qDebug("add %s", qu.latin1() );
+ odebug << "add " << qu << "" << oendl;
return qu;
}
@@ -316,7 +320,7 @@ namespace {
QString qu = "select *";
qu += " from addressbook where uid = " + QString::number(m_uid);
- // qWarning("find query: %s", qu.latin1() );
+ // owarn << "find query: " << qu << "" << oendl;
return qu;
}
@@ -350,7 +354,7 @@ OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL ( const QString& /* a
const QString& filename ):
OPimContactAccessBackend(), m_changed(false), m_driver( NULL )
{
- qDebug("C'tor OPimContactAccessBackend_SQL starts");
+ odebug << "C'tor OPimContactAccessBackend_SQL starts" << oendl;
QTime t;
t.start();
@@ -367,7 +371,7 @@ OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL ( const QString& /* a
load();
- qDebug("C'tor OPimContactAccessBackend_SQL ends: %d ms", t.elapsed() );
+ odebug << "C'tor OPimContactAccessBackend_SQL ends: " << t.elapsed() << " ms" << oendl;
}
OPimContactAccessBackend_SQL::~OPimContactAccessBackend_SQL ()
@@ -430,7 +434,7 @@ QArray<int> OPimContactAccessBackend_SQL::allRecords() const
bool OPimContactAccessBackend_SQL::add ( const OPimContact &newcontact )
{
- qDebug("add in contact SQL-Backend");
+ odebug << "add in contact SQL-Backend" << oendl;
InsertQuery ins( newcontact );
OSQLResult res = m_driver->query( &ins );
@@ -469,14 +473,14 @@ bool OPimContactAccessBackend_SQL::replace ( const OPimContact &contact )
OPimContact OPimContactAccessBackend_SQL::find ( int uid ) const
{
- qDebug("OPimContactAccessBackend_SQL::find()");
+ odebug << "OPimContactAccessBackend_SQL::find()" << oendl;
QTime t;
t.start();
OPimContact retContact( requestNonCustom( uid ) );
retContact.setExtraMap( requestCustom( uid ) );
- qDebug("OPimContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() );
+ odebug << "OPimContactAccessBackend_SQL::find() needed: " << t.elapsed() << " ms" << oendl;
return retContact;
}
@@ -585,7 +589,7 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu
qu += searchQuery;
- qDebug( "queryByExample query: %s", qu.latin1() );
+ odebug << "queryByExample query: " << qu << "" << oendl;
// Execute query and return the received uid's
OSQLRawQuery raw( qu );
@@ -620,7 +624,7 @@ QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const
qu = qu + searchlist + ")";
- qDebug( "query: %s", qu.latin1() );
+ odebug << "query: " << qu << "" << oendl;
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
@@ -701,7 +705,7 @@ QArray<int> OPimContactAccessBackend_SQL::sorted( bool asc, int , int , int )
if ( !asc )
query += "DESC";
- // qDebug("sorted query is: %s", query.latin1() );
+ // odebug << "sorted query is: " << query << "" << oendl;
OSQLRawQuery raw( query );
OSQLResult res = m_driver->query( &raw );
@@ -712,14 +716,14 @@ QArray<int> OPimContactAccessBackend_SQL::sorted( bool asc, int , int , int )
QArray<int> list = extractUids( res );
- qDebug("sorted needed %d ms!", t.elapsed() );
+ odebug << "sorted needed " << t.elapsed() << " ms!" << oendl;
return list;
}
void OPimContactAccessBackend_SQL::update()
{
- qDebug("Update starts");
+ odebug << "Update starts" << oendl;
QTime t;
t.start();
@@ -735,25 +739,25 @@ void OPimContactAccessBackend_SQL::update()
m_changed = false;
- qDebug("Update ends %d ms", t.elapsed() );
+ odebug << "Update ends " << t.elapsed() << " ms" << oendl;
}
QArray<int> OPimContactAccessBackend_SQL::extractUids( OSQLResult& res ) const
{
- qDebug("extractUids");
+ odebug << "extractUids" << oendl;
QTime t;
t.start();
OSQLResultItem::ValueList list = res.results();
OSQLResultItem::ValueList::Iterator it;
QArray<int> ints(list.count() );
- qDebug(" count = %d", list.count() );
+ odebug << " count = " << list.count() << "" << oendl;
int i = 0;
for (it = list.begin(); it != list.end(); ++it ) {
ints[i] = (*it).data("uid").toInt();
i++;
}
- qDebug("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() );
+ odebug << "extractUids ready: count2 = " << i << " needs " << t.elapsed() << " ms" << oendl;
return ints;
@@ -788,7 +792,7 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co
int id = translate[*it];
QString value = resItem.data( (*it) );
- // qDebug("Reading %s... found: %s", (*it).latin1(), value.latin1() );
+ // odebug << "Reading " << (*it) << "... found: " << value << "" << oendl;
switch( id ){
case Qtopia::Birthday:
@@ -806,7 +810,7 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co
}
break;
case Qtopia::AddressCategory:
- qDebug("Category is: %s", value.latin1() );
+ odebug << "Category is: " << value << "" << oendl;
default:
nonCustomMap.insert( id, value );
}
@@ -816,9 +820,9 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co
nonCustomMap.insert( Qtopia::AddressUid, resItem.data( "uid" ) );
t3needed = t3.elapsed();
- // qDebug("Adding UID: %s", resItem.data( "uid" ).latin1() );
- qDebug("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms",
- t.elapsed(), t2needed, t3needed );
+ // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl;
+ odebug << "RequestNonCustom needed: insg.:" << t.elapsed() << " ms, query: " << t2needed
+ << " ms, mapping: " << t3needed << " ms" << oendl;
return nonCustomMap;
}
@@ -834,7 +838,7 @@ QMap<QString, QString> OPimContactAccessBackend_SQL::requestCustom( int uid ) c
OSQLResult res_custom = m_driver->query( &query );
if ( res_custom.state() == OSQLResult::Failure ) {
- qWarning("OSQLResult::Failure in find query !!");
+ owarn << "OSQLResult::Failure in find query !!" << oendl;
QMap<QString, QString> empty;
return empty;
}
@@ -845,7 +849,7 @@ QMap<QString, QString> OPimContactAccessBackend_SQL::requestCustom( int uid ) c
customMap.insert( (*it).data( "type" ), (*it).data( "value" ) );
}
- qDebug("RequestCustom needed: %d ms", t.elapsed() );
+ odebug << "RequestCustom needed: " << t.elapsed() << " ms" << oendl;
return customMap;
}
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index ffa6a7d..b6ea461 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -35,6 +35,8 @@
/* OPIE */
#include <opie2/ocontactaccessbackend_vcard.h>
+#include <opie2/odebug.h>
+
#include <qpe/timeconversion.h>
//FIXME: Hack to allow direct access to FILE* fh. Rewrite this!
@@ -64,7 +66,7 @@ bool OPimContactAccessBackend_VCard::load ()
if ( !obj )
return false;
}else{
- qWarning("File \"%s\" not found !", m_file.latin1() );
+ owarn << "File \"" << m_file << "\" not found !" << oendl;
return false;
}
@@ -77,7 +79,7 @@ bool OPimContactAccessBackend_VCard::load ()
*/
if ( con.uid() == 0 ){
con.setUid( 1 );
- qWarning("assigned new uid %d",con.uid() );
+ owarn << "assigned new uid " << con.uid() << "" << oendl;
}
m_map.insert( con.uid(), con );
@@ -316,7 +318,7 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj )
if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default
type |= VOICE;
- qWarning("value %s %d", value.data(), type );
+ owarn << "value " << value.data() << " " << type << "" << oendl;
if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) )
c.setHomePhone( value );
if ( ( type & (FAX|HOME) ) == (FAX|HOME) )
@@ -510,7 +512,7 @@ VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c )
// Exporting Birthday regarding RFC 2425 (5.8.4)
if ( c.birthday().isValid() ){
- qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() );
+ owarn << "Exporting birthday as: " << convDateToVCardDate( c.birthday() ) << "" << oendl;
safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) );
}
@@ -529,7 +531,7 @@ VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c )
safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() );
safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() );
if ( c.anniversary().isValid() ){
- qWarning("Exporting anniversary as: %s", convDateToVCardDate( c.anniversary() ).latin1() );
+ owarn << "Exporting anniversary as: " << convDateToVCardDate( c.anniversary() ) << "" << oendl;
safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) );
}
safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() );
@@ -558,13 +560,13 @@ QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datest
int dayPos = datestr.find('-', monthPos+1 );
int sep_ignore = 1;
if ( monthPos == -1 || dayPos == -1 ) {
- qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
+ odebug << "fromString didn't find - in str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl;
// Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD )
if ( datestr.length() == 8 ){
monthPos = 4;
dayPos = 6;
sep_ignore = 0;
- qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
+ odebug << "Try with follwing positions str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl;
} else {
return QDate();
}
@@ -572,7 +574,7 @@ QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datest
int y = datestr.left( monthPos ).toInt();
int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt();
int d = datestr.mid( dayPos + sep_ignore ).toInt();
- qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos);
+ odebug << "TimeConversion::fromString ymd = " << datestr << " => " << y << " " << m << " " << d << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl;
QDate date ( y,m,d );
return date;
}
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index 7b4d81f..5ffcb11 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -30,8 +30,17 @@
* XML Backend for the OPIE-Contact Database.
*/
+
+/* OPIE */
#include <opie2/ocontactaccessbackend_xml.h>
+#include <opie2/xmltree.h>
+#include <opie2/ocontactaccessbackend.h>
+#include <opie2/ocontactaccess.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+/* QT */
#include <qasciidict.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -39,12 +48,7 @@
#include <qarray.h>
#include <qmap.h>
-#include <qpe/global.h>
-
-#include <opie2/xmltree.h>
-#include <opie2/ocontactaccessbackend.h>
-#include <opie2/ocontactaccess.h>
-
+/* STD */
#include <stdlib.h>
#include <errno.h>
@@ -104,7 +108,7 @@ bool OPimContactAccessBackend_XML::save()
// Write all contacts
QListIterator<OPimContact> it( m_contactList );
for ( ; it.current(); ++it ) {
- // qWarning(" Uid %d at Offset: %x", (*it)->uid(), idx_offset );
+ // owarn << " Uid " << (*it)->uid() << " at Offset: " << idx_offset << "" << oendl;
out += "<Contact ";
(*it)->save( out );
out += "/>\n";
@@ -459,7 +463,7 @@ QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int )
bool OPimContactAccessBackend_XML::add ( const OPimContact &newcontact )
{
- //qWarning("odefaultbackend: ACTION::ADD");
+ //owarn << "odefaultbackend: ACTION::ADD" << oendl;
updateJournal (newcontact, ACTION_ADD);
addContact_p( newcontact );
@@ -483,7 +487,7 @@ bool OPimContactAccessBackend_XML::replace ( const OPimContact &contact )
m_uidToContact.remove( QString().setNum( contact.uid() ) );
m_uidToContact.insert( QString().setNum( newCont->uid() ), newCont );
- qWarning("Nur zur Sicherheit: %d == %d ?",contact.uid(), newCont->uid());
+ owarn << "Nur zur Sicherheit: " << contact.uid() << " == " << newCont->uid() << " ?" << oendl;
return true;
} else
@@ -589,7 +593,7 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
dict.insert( "action", new int(JOURNALACTION) );
dict.insert( "actionrow", new int(JOURNALROW) );
- //qWarning( "OPimContactDefaultBackEnd::loading %s", filename.latin1() );
+ //owarn << "OPimContactDefaultBackEnd::loading " << filename << "" << oendl;
XMLElement *root = XMLElement::load( filename );
if(root != 0l ){ // start parsing
@@ -597,7 +601,7 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
* Contact-Class
*/
XMLElement *element = root->firstChild();
- //qWarning("OPimContactAccess::load tagName(): %s", root->tagName().latin1() );
+ //owarn << "OPimContactAccess::load tagName(): " << root->tagName() << "" << oendl;
element = element->firstChild();
/* Search Tag "Contacts" which is the parent of all Contacts */
@@ -637,7 +641,7 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
int *find = dict[ it.key() ];
/* Unknown attributes will be stored as "Custom" elements */
if ( !find ) {
- // qWarning("Attribute %s not known.", it.key().latin1());
+ // owarn << "Attribute " << it.key() << " not known." << oendl;
//contact.setCustomField(it.key(), it.data());
customMap.insert( it.key(), it.data() );
continue;
@@ -704,10 +708,10 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
element = element->nextChild();
}
}else {
- qWarning("ODefBack::could not load");
+ owarn << "ODefBack::could not load" << oendl;
}
delete root;
- qWarning("returning from loading" );
+ owarn << "returning from loading" << oendl;
return true;
}
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index f4f3c94..105c106 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -31,20 +31,25 @@
*
*/
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <qarray.h>
-#include <qstringlist.h>
-
-#include <qpe/global.h>
-
+/* OPIE */
#include <opie2/osqldriver.h>
#include <opie2/osqlmanager.h>
#include <opie2/osqlquery.h>
#include <opie2/opimrecurrence.h>
#include <opie2/odatebookaccessbackend_sql.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+
+/* QT */
+#include <qarray.h>
+#include <qstringlist.h>
+
+/* STD */
+#include <stdio.h>
+#include <stdlib.h>
+
using namespace Opie::DB;
@@ -162,7 +167,7 @@ bool ODateBookAccessBackend_SQL::load()
qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), priority INTEGER, value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );";
- qWarning( "command: %s", qu.latin1() );
+ owarn << "command: " << qu << "" << oendl;
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
@@ -221,12 +226,12 @@ void ODateBookAccessBackend_SQL::clear()
OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{
- qDebug( "ODateBookAccessBackend_SQL::find( %d )", uid );
+ odebug << "ODateBookAccessBackend_SQL::find( " << uid << " )" << oendl;
QString qu = "select *";
qu += "from datebook where uid = " + QString::number(uid);
- qDebug( "Query: %s", qu.latin1() );
+ odebug << "Query: " << qu << "" << oendl;
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
@@ -247,7 +252,7 @@ OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{
OPimEvent retDate( dateEventMap );
retDate.setExtraMap( requestCustom( uid ) );
- qDebug( "ODateBookAccessBackend_SQL::find( %d ) end", uid );
+ odebug << "ODateBookAccessBackend_SQL::find( " << uid << " ) end" << oendl;
return retDate;
}
@@ -283,7 +288,7 @@ bool ODateBookAccessBackend_SQL::add( const OPimEvent& ev )
+ it.data() //.latin1()
+ "');";
}
- qWarning("add %s", qu.latin1() );
+ owarn << "add " << qu << "" << oendl;
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
@@ -390,7 +395,7 @@ QArray<int> ODateBookAccessBackend_SQL::matchRegexp( const QRegExp &r ) const
qu += " )";
- qDebug( "query: %s", qu.latin1() );
+ odebug << "query: " << qu << "" << oendl;
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
@@ -405,20 +410,20 @@ QArray<int> ODateBookAccessBackend_SQL::matchRegexp( const QRegExp &r ) const
QArray<int> ODateBookAccessBackend_SQL::extractUids( OSQLResult& res ) const
{
- qWarning("extractUids");
+ owarn << "extractUids" << oendl;
QTime t;
t.start();
OSQLResultItem::ValueList list = res.results();
OSQLResultItem::ValueList::Iterator it;
QArray<int> ints(list.count() );
- qWarning(" count = %d", list.count() );
+ owarn << " count = " << list.count() << "" << oendl;
int i = 0;
for (it = list.begin(); it != list.end(); ++it ) {
ints[i] = (*it).data("uid").toInt();
i++;
}
- qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() );
+ owarn << "extractUids ready: count2 = " << i << " needs " << t.elapsed() << " ms" << oendl;
return ints;
@@ -435,7 +440,7 @@ QMap<QString, QString> ODateBookAccessBackend_SQL::requestCustom( int uid ) cons
OSQLResult res_custom = m_driver->query( &query );
if ( res_custom.state() == OSQLResult::Failure ) {
- qWarning("OSQLResult::Failure in find query !!");
+ owarn << "OSQLResult::Failure in find query !!" << oendl;
QMap<QString, QString> empty;
return empty;
}
@@ -446,7 +451,7 @@ QMap<QString, QString> ODateBookAccessBackend_SQL::requestCustom( int uid ) cons
customMap.insert( (*it).data( "type" ), (*it).data( "value" ) );
}
- qDebug("RequestCustom needed: %d ms", t.elapsed() );
+ odebug << "RequestCustom needed: " << t.elapsed() << " ms" << oendl;
return customMap;
}
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
index 77c0253..2ff36e3 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
@@ -26,6 +26,23 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+
+/* OPIE */
+#include <opie2/opimnotifymanager.h>
+#include <opie2/opimrecurrence.h>
+#include <opie2/opimtimezone.h>
+#include <opie2/odatebookaccessbackend_xml.h>
+#include <opie2/odebug.h>
+
+#include <qtopia/global.h>
+#include <qtopia/stringutil.h>
+#include <qtopia/timeconversion.h>
+
+/* QT */
+#include <qasciidict.h>
+#include <qfile.h>
+
+/* STD */
#include <errno.h>
#include <fcntl.h>
@@ -38,17 +55,6 @@
#include <unistd.h>
-#include <qasciidict.h>
-#include <qfile.h>
-
-#include <qtopia/global.h>
-#include <qtopia/stringutil.h>
-#include <qtopia/timeconversion.h>
-
-#include <opie2/opimnotifymanager.h>
-#include <opie2/opimrecurrence.h>
-#include <opie2/opimtimezone.h>
-#include <opie2/odatebookaccessbackend_xml.h>
using namespace Opie;
@@ -116,7 +122,7 @@ namespace {
// FIXME: Use OPimEvent::toMap() here !! (eilers)
inline void save( const OPimEvent& ev, QString& buf ) {
- qWarning("Saving %d %s", ev.uid(), ev.description().latin1() );
+ owarn << "Saving " << ev.uid() << " " << ev.description() << "" << oendl;
buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\"";
if (!ev.location().isEmpty() )
buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\"";
@@ -490,10 +496,10 @@ void ODateBookAccessBackend_XML::finalizeRecord( OPimEvent& ev ) {
ev.setTimeZone( "UTC"); // make sure it is really utc
}else {
/* to current date time */
- // qWarning(" Start is %d", start );
+ // owarn << " Start is " << start << "" << oendl;
OPimTimeZone zone( ev.timeZone().isEmpty() ? OPimTimeZone::current() : ev.timeZone() );
QDateTime date = zone.toDateTime( start );
- qWarning(" Start is %s", date.toString().latin1() );
+ owarn << " Start is " << date.toString() << "" << oendl;
ev.setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) );
date = zone.toDateTime( end );
@@ -514,10 +520,10 @@ void ODateBookAccessBackend_XML::finalizeRecord( OPimEvent& ev ) {
ev.notifiers().add( al );
}
if ( m_raw.contains( ev.uid() ) || m_rep.contains( ev.uid() ) ) {
- qWarning("already contains assign uid");
+ owarn << "already contains assign uid" << oendl;
ev.setUid( 1 );
}
- qWarning("addind %d %s", ev.uid(), ev.description().latin1() );
+ owarn << "addind " << ev.uid() << " " << ev.description() << "" << oendl;
if ( ev.hasRecurrence() )
m_rep.insert( ev.uid(), ev );
else
@@ -525,7 +531,7 @@ void ODateBookAccessBackend_XML::finalizeRecord( OPimEvent& ev ) {
}
void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString& value) {
-// qWarning(" setting %s", value.latin1() );
+// owarn << " setting " << value << "" << oendl;
switch( id ) {
case FDescription:
e.setDescription( value );
@@ -610,7 +616,7 @@ void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString&
QStringList list = QStringList::split(' ', value );
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
QDate date( (*it).left(4).toInt(), (*it).mid(4, 2).toInt(), (*it).right(2).toInt() );
- qWarning("adding exception %s", date.toString().latin1() );
+ owarn << "adding exception " << date.toString() << "" << oendl;
recur()->exceptions().append( date );
}
}
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 132b5a6..6f65c48 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -28,12 +28,7 @@
Boston, MA 02111-1307, USA.
*/
-#include <qdatetime.h>
-#include <qmap.h>
-#include <qstring.h>
-
-#include <qpe/global.h>
-
+/* OPIE */
#include <opie2/osqldriver.h>
#include <opie2/osqlresult.h>
#include <opie2/osqlmanager.h>
@@ -43,6 +38,15 @@
#include <opie2/opimstate.h>
#include <opie2/opimnotifymanager.h>
#include <opie2/opimrecurrence.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+
+/* QT */
+#include <qdatetime.h>
+#include <qmap.h>
+#include <qstring.h>
+
using namespace Opie::DB;
@@ -291,7 +295,7 @@ namespace {
}
- qDebug("add %s", qu.latin1() );
+ odebug << "add " << qu << "" << oendl;
return qu;
}
@@ -456,7 +460,7 @@ OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{
OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
uint cur, Frontend::CacheDirection dir ) const{
uint CACHE = readAhead();
- qDebug("searching for %d", uid );
+ odebug << "searching for " << uid << "" << oendl;
QArray<int> search( CACHE );
uint size =0;
OPimTodo to;
@@ -466,7 +470,7 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
/* forward */
case 0: // FIXME: Not a good style to use magic numbers here (eilers)
for (uint i = cur; i < ints.count() && size < CACHE; i++ ) {
- qDebug("size %d %d", size, ints[i] );
+ odebug << "size " << size << " " << ints[i] << "" << oendl;
search[size] = ints[i];
size++;
}
@@ -541,7 +545,7 @@ QArray<int> OPimTodoAccessBackendSQL::effectiveToDos( const QDate& s,
*/
QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
int sortFilter, int cat ) {
- qDebug("sorted %d, %d", asc, sortOrder );
+ odebug << "sorted " << asc << ", " << sortOrder << "" << oendl;
QString query;
query = "select uid from todolist WHERE ";
@@ -600,11 +604,11 @@ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
}
if ( !asc ) {
- qDebug("not ascending!");
+ odebug << "not ascending!" << oendl;
query += " DESC";
}
- qDebug( query );
+ odebug << query << oendl;
OSQLRawQuery raw(query );
return uids( m_driver->query(&raw) );
}
@@ -629,19 +633,19 @@ OPimTodo OPimTodoAccessBackendSQL::todo( const OSQLResult& res ) const{
OSQLResultItem::ValueList list = res.results();
OSQLResultItem::ValueList::Iterator it = list.begin();
- qDebug("todo1");
+ odebug << "todo1" << oendl;
OPimTodo to = todo( (*it) );
cache( to );
++it;
for ( ; it != list.end(); ++it ) {
- qDebug("caching");
+ odebug << "caching" << oendl;
cache( todo( (*it) ) );
}
return to;
}
OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
- qDebug("todo(ResultItem)");
+ odebug << "todo(ResultItem)" << oendl;
// Request information from addressbook table and create the OPimTodo-object.
@@ -649,7 +653,7 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
hasDueDate = date( dueDate, item.data("DueDate") );
QStringList cats = QStringList::split(";", item.data("categories") );
- qDebug("Item is completed: %d", item.data("completed").toInt() );
+ odebug << "Item is completed: " << item.data("completed").toInt() << "" << oendl;
OPimTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(),
cats, item.data("summary"), item.data("description"),
@@ -750,7 +754,7 @@ QArray<int> OPimTodoAccessBackendSQL::uids( const OSQLResult& res) const{
OSQLResultItem::ValueList list = res.results();
OSQLResultItem::ValueList::Iterator it;
QArray<int> ints(list.count() );
- qDebug(" count = %d", list.count() );
+ odebug << " count = " << list.count() << "" << oendl;
int i = 0;
for (it = list.begin(); it != list.end(); ++it ) {
@@ -776,7 +780,7 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const
qu += ")";
- qDebug( "query: %s", qu.latin1() );
+ odebug << "query: " << qu << "" << oendl;
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
@@ -816,7 +820,7 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){
QArray<int> completed_uids = uids( res );
- qDebug( "Number of completed: %d", completed_uids.size() );
+ odebug << "Number of completed: " << completed_uids.size() << "" << oendl;
if ( completed_uids.size() == 0 )
return;
@@ -842,12 +846,12 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){
}
qu += query + " );";
- qDebug( "query: %s", qu.latin1() );
+ odebug << "query: " << qu << "" << oendl;
OSQLRawQuery raw2( qu );
res = m_driver->query( &raw2 );
if ( res.state() == OSQLResult::Failure ) {
- qWarning("OPimTodoAccessBackendSQL::removeAllCompleted():Failure in query: %s", qu.latin1() );
+ owarn << "OPimTodoAccessBackendSQL::removeAllCompleted():Failure in query: " << qu << "" << oendl;
}
}
@@ -860,7 +864,7 @@ QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const
OSQLResult res_custom = m_driver->query( &query );
if ( res_custom.state() == OSQLResult::Failure ) {
- qWarning("OSQLResult::Failure in find query !!");
+ owarn << "OSQLResult::Failure in find query !!" << oendl;
QMap<QString, QString> empty;
return empty;
}
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index 03d4479..14a325e 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -27,11 +27,15 @@
Boston, MA 02111-1307, USA.
*/
-/* OPIE */
#include "vobject_p.h"
-#include <qpe/timeconversion.h>
+
+/* OPIE */
#include <opie2/otodoaccessvcal.h>
+#include <opie2/odebug.h>
+
+#include <qpe/timeconversion.h>
+/* QT */
//FIXME: Hack to allow direct access to FILE* fh. Rewrite this!
#define protected public
#include <qfile.h>
@@ -88,7 +92,7 @@ namespace {
// categories
if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){
name = vObjectStringZValue( ob );
- qWarning("Categories:%s", name.data() );
+ owarn << "Categories:" << name.data() << "" << oendl;
}
event.setUid( 1 );
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index cce6111..3e06d88 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -26,6 +26,25 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+
+/* OPIE */
+#include <opie2/opimdateconversion.h>
+#include <opie2/opimstate.h>
+#include <opie2/opimtimezone.h>
+#include <opie2/opimnotifymanager.h>
+#include <opie2/opimrecurrence.h>
+#include <opie2/otodoaccessxml.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+#include <qpe/stringutil.h>
+#include <qpe/timeconversion.h>
+
+/* QT */
+#include <qfile.h>
+#include <qvector.h>
+
+/* STD */
#include <errno.h>
#include <fcntl.h>
@@ -36,20 +55,6 @@
#include <unistd.h>
-#include <qfile.h>
-#include <qvector.h>
-
-#include <qpe/global.h>
-#include <qpe/stringutil.h>
-#include <qpe/timeconversion.h>
-
-#include <opie2/opimdateconversion.h>
-#include <opie2/opimstate.h>
-#include <opie2/opimtimezone.h>
-#include <opie2/opimnotifymanager.h>
-#include <opie2/opimrecurrence.h>
-#include <opie2/otodoaccessxml.h>
-
using namespace Opie;
namespace {
@@ -177,7 +182,7 @@ bool OPimTodoAccessXML::load() {
while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) {
i = point -dt;
i+= strLen;
- qWarning("Found a start at %d %d", i, (point-dt) );
+ owarn << "Found a start at " << i << " " << (point-dt) << "" << oendl;
OPimTodo ev;
m_year = m_month = m_day = 0;
@@ -233,7 +238,7 @@ bool OPimTodoAccessXML::load() {
/*
* now add it
*/
- qWarning("End at %d", i );
+ owarn << "End at " << i << "" << oendl;
if (m_events.contains( ev.uid() ) || ev.uid() == 0) {
ev.setUid( 1 );
m_changed = true;
@@ -256,7 +261,7 @@ bool OPimTodoAccessXML::load() {
munmap(map_addr, attribut.st_size );
- qWarning("counts %d records loaded!", m_events.count() );
+ owarn << "counts " << m_events.count() << " records loaded!" << oendl;
return true;
}
bool OPimTodoAccessXML::reload() {
@@ -264,9 +269,9 @@ bool OPimTodoAccessXML::reload() {
return load();
}
bool OPimTodoAccessXML::save() {
-// qWarning("saving");
+// owarn << "saving" << oendl;
if (!m_opened || !m_changed ) {
-// qWarning("not saving");
+// owarn << "not saving" << oendl;
return true;
}
QString strNewFile = m_file + ".new";
@@ -307,7 +312,7 @@ bool OPimTodoAccessXML::save() {
f.close();
if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) {
-// qWarning("error renaming");
+// owarn << "error renaming" << oendl;
QFile::remove( strNewFile );
}
@@ -345,7 +350,7 @@ void OPimTodoAccessXML::clear() {
m_events.clear();
}
bool OPimTodoAccessXML::add( const OPimTodo& todo ) {
-// qWarning("add");
+// owarn << "add" << oendl;
m_changed = true;
m_events.insert( todo.uid(), todo );
@@ -404,13 +409,13 @@ QArray<int> OPimTodoAccessXML::overDue() {
/* private */
void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
const QCString& attr, const QString& val) {
-// qWarning("parse to do from XMLElement" );
+// owarn << "parse to do from XMLElement" << oendl;
int *find=0;
find = (*dict)[ attr.data() ];
if (!find ) {
-// qWarning("Unknown option" + it.key() );
+// owarn << "Unknown option" + it.key() << oendl;
ev.setCustomField( attr, val );
return;
}
@@ -463,8 +468,8 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
QStringList als = QStringList::split(";", val );
for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
- qWarning("alarm: %s", alarm.join("___").latin1() );
- qWarning("alarm[0]: %s %s", alarm[0].latin1(), OPimDateConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
+ owarn << "alarm: " << alarm.join("___") << "" << oendl;
+ owarn << "alarm[0]: " << alarm[0] << " " << OPimDateConversion::dateTimeFromString( alarm[0] ).toString() << "" << oendl;
OPimAlarm al( alarm[2].toInt(), OPimDateConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
manager.add( al );
}
@@ -537,11 +542,11 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
namespace {
QString customToXml(const QMap<QString, QString>& customMap )
{
- //qWarning(QString("writing custom %1").arg(customMap.count()));
+ //owarn << QString("writing custom %1").arg(customMap.count()) << oendl;
QString buf(" ");
for ( QMap<QString, QString>::ConstIterator cit = customMap.begin();
cit != customMap.end(); ++cit) {
-// qWarning(".ITEM.");
+// owarn << ".ITEM." << oendl;
buf += cit.key();
buf += "=\"";
buf += Qtopia::escapeString(cit.data());
@@ -570,7 +575,7 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
}
-// qWarning( "Uid %d", ev.uid() );
+// owarn << "Uid " << ev.uid() << "" << oendl;
str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
// append the extra options
@@ -617,7 +622,7 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
}
}
// now write the list
- qWarning("als: %s", als.join("____________").latin1() );
+ owarn << "als: " << als.join("____________") << "" << oendl;
str += "Alarms=\""+als.join(";") +"\" ";
}
@@ -838,7 +843,7 @@ QArray<int> OPimTodoAccessXML::sorted( bool asc, int sortOrder,
}
/* isOverdue but we should not show overdue - why?*/
/* if ( (*it).isOverdue() && !bOnly ) {
- qWarning("item is overdue but !bOnly");
+ owarn << "item is overdue but !bOnly" << oendl;
continue;
}
*/