From d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce Mon Sep 17 00:00:00 2001 From: ar Date: Tue, 01 Jun 2004 22:21:23 +0000 Subject: - convert to odebug framework --- (limited to 'libopie2/opiepim/core') diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp index a372267..7a3d7cb 100644 --- a/libopie2/opiepim/core/ocontactaccess.cpp +++ b/libopie2/opiepim/core/ocontactaccess.cpp @@ -36,6 +36,16 @@ #include "ocontactaccess.h" #include "obackendfactory.h" +/* OPIE */ +#include +#include +#include +#include + +//#include +#include + +/* QT */ #include #include #include @@ -43,117 +53,112 @@ #include #include -//#include -#include - +/* STD */ #include #include #include #include -#include -#include -#include namespace Opie { OPimContactAccess::OPimContactAccess ( const QString appname, const QString , - OPimContactAccessBackend* end, bool autosync ): - OPimAccessTemplate( end ) + OPimContactAccessBackend* end, bool autosync ): + OPimAccessTemplate( end ) { /* take care of the backend. If there is no one defined, we - * will use the XML-Backend as default (until we have a cute SQL-Backend..). - */ + * will use the XML-Backend as default (until we have a cute SQL-Backend..). + */ if( end == 0 ) { - qWarning ("Using BackendFactory !"); - end = OBackendFactory::defaultBackend( OPimGlobal::CONTACTLIST, appname ); + owarn << "Using BackendFactory !" << oendl; + end = OBackendFactory::defaultBackend( OPimGlobal::CONTACTLIST, appname ); } - // Set backend locally and in template + // Set backend locally and in template m_backEnd = end; - OPimAccessTemplate::setBackEnd (end); + OPimAccessTemplate::setBackEnd (end); - /* Connect signal of external db change to function */ - QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); - connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), + /* Connect signal of external db change to function */ + QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); + connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(copMessage(const QCString&,const QByteArray&)) ); - if ( autosync ){ - QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); - connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), - this, SLOT(copMessage(const QCString&,const QByteArray&)) ); - } + if ( autosync ){ + QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); + connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(copMessage(const QCString&,const QByteArray&)) ); + } } OPimContactAccess::~OPimContactAccess () { - /* The user may forget to save the changed database, therefore try to - * do it for him.. - */ - save(); - // delete m_backEnd; is done by template.. + /* The user may forget to save the changed database, therefore try to + * do it for him.. + */ + save(); + // delete m_backEnd; is done by template.. } bool OPimContactAccess::save () { - /* If the database was changed externally, we could not save the - * Data. This will remove added items which is unacceptable ! - * Therefore: Reload database and merge the data... - */ - if ( OPimAccessTemplate::wasChangedExternally() ) - reload(); + /* If the database was changed externally, we could not save the + * Data. This will remove added items which is unacceptable ! + * Therefore: Reload database and merge the data... + */ + if ( OPimAccessTemplate::wasChangedExternally() ) + reload(); - bool status = OPimAccessTemplate::save(); - if ( !status ) return false; + bool status = OPimAccessTemplate::save(); + if ( !status ) return false; - /* Now tell everyone that new data is available. - */ - QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); + /* Now tell everyone that new data is available. + */ + QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); - return true; + return true; } const uint OPimContactAccess::querySettings() { - return ( m_backEnd->querySettings() ); + return ( m_backEnd->querySettings() ); } bool OPimContactAccess::hasQuerySettings ( int querySettings ) const { - return ( m_backEnd->hasQuerySettings ( querySettings ) ); + return ( m_backEnd->hasQuerySettings ( querySettings ) ); } OPimRecordList OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const { - QArray matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); - return ( OPimRecordList(matchingContacts, this) ); + QArray matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); + return ( OPimRecordList(matchingContacts, this) ); } bool OPimContactAccess::wasChangedExternally()const { - return ( m_backEnd->wasChangedExternally() ); + return ( m_backEnd->wasChangedExternally() ); } void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) { - if ( msg == "addressbookUpdated()" ){ - qWarning ("OPimContactAccess: Received addressbokUpdated()"); - emit signalChanged ( this ); - } else if ( msg == "flush()" ) { - qWarning ("OPimContactAccess: Received flush()"); - save (); - } else if ( msg == "reload()" ) { - qWarning ("OPimContactAccess: Received reload()"); - reload (); - emit signalChanged ( this ); - } + if ( msg == "addressbookUpdated()" ){ + owarn << "OPimContactAccess: Received addressbokUpdated()" << oendl; + emit signalChanged ( this ); + } else if ( msg == "flush()" ) { + owarn << "OPimContactAccess: Received flush()" << oendl; + save (); + } else if ( msg == "reload()" ) { + owarn << "OPimContactAccess: Received reload()" << oendl; + reload (); + emit signalChanged ( this ); + } } int OPimContactAccess::rtti() const { - return OPimResolver::AddressBook; + return OPimResolver::AddressBook; } } diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index e438980..55d600a 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h @@ -1,7 +1,7 @@ /* This file is part of the Opie Project Copyright (C) Holger Freyther - Copyright (C) Stefan Eilers + Copyright (C) Stefan Eilers =. Copyright (C) The Opie Team .=l. .>+-= @@ -30,14 +30,17 @@ #ifndef OPIE_PIM_ACCESS_TEMPLATE_H #define OPIE_PIM_ACCESS_TEMPLATE_H -#include - +/* OPIE */ #include #include #include #include #include +#include + +/* QT */ +#include namespace Opie { @@ -205,7 +208,7 @@ OPimAccessTemplate::OPimAccessTemplate( BackEnd* end ) } template OPimAccessTemplate::~OPimAccessTemplate() { - qWarning("~OPimAccessTemplate"); + owarn << "~OPimAccessTemplate" << oendl; delete m_backEnd; } template @@ -215,8 +218,8 @@ bool OPimAccessTemplate::load() { } template bool OPimAccessTemplate::reload() { - invalidateCache(); // zecke: I think this should be added (se) - return m_backEnd->reload(); + invalidateCache(); // zecke: I think this should be added (se) + return m_backEnd->reload(); } template bool OPimAccessTemplate::save() { @@ -260,7 +263,7 @@ T OPimAccessTemplate::find( int uid, const QArray& ar, * after a find this way we would * avoid two finds in QCache... */ - // qWarning("find it now %d", uid ); + // owarn << "find it now " << uid << oendl; if (m_cache.contains( uid ) ) { return m_cache.find( uid ); } diff --git a/libopie2/opiepim/core/opimcontact.cpp b/libopie2/opiepim/core/opimcontact.cpp index 48a74d0..36e9a93 100644 --- a/libopie2/opiepim/core/opimcontact.cpp +++ b/libopie2/opiepim/core/opimcontact.cpp @@ -1173,7 +1173,7 @@ void OPimContact::setAnniversary( const QDate &v ) QDate OPimContact::birthday() const { QString str = find( Qtopia::Birthday ); - // qWarning ("Birthday %s", str.latin1() ); + // owarn << "Birthday " << str << oendl; if ( !str.isEmpty() ) return OPimDateConversion::dateFromString ( str ); else @@ -1188,7 +1188,7 @@ QDate OPimContact::anniversary() const { QDate empty; QString str = find( Qtopia::Anniversary ); - // qWarning ("Anniversary %s", str.latin1() ); + // owarn << "Anniversary " << str << oendl; if ( !str.isEmpty() ) return OPimDateConversion::dateFromString ( str ); else diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 0f863aa..516dc79 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp @@ -227,8 +227,8 @@ void OPimNotifyManager::alarmsFromString( const QString& str ) { QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty owarn << "alarm: " << alarm.join( "___" ) << "" << oendl; - qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(), - OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() ); + owarn << "alarm[0]: " << alarm[ 0 ] << " " + << OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString() << oendl; OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ), alarm[ 1 ].toInt() ); add( al ); diff --git a/libopie2/opiepim/core/opimrecordlist.h b/libopie2/opiepim/core/opimrecordlist.h index b23138d..1d5027f 100644 --- a/libopie2/opiepim/core/opimrecordlist.h +++ b/libopie2/opiepim/core/opimrecordlist.h @@ -33,6 +33,7 @@ /* OPIE */ #include #include +//#include /* QT */ #include @@ -189,7 +190,7 @@ OPimRecordListIterator::~OPimRecordListIterator() template OPimRecordListIterator::OPimRecordListIterator( const OPimRecordListIterator& it ) { - // qWarning("OPimRecordListIterator copy c'tor"); + //owarn << "OPimRecordListIterator copy c'tor" << oendl; m_uids = it.m_uids; m_current = it.m_current; m_temp = it.m_temp; @@ -215,7 +216,7 @@ OPimRecordListIterator &OPimRecordListIterator::operator=( const OPimRecor template T OPimRecordListIterator::operator*() { - //qWarning("operator* %d %d", m_current, m_uids[m_current] ); + //owarn << "operator* " << m_current << " " << m_uids[m_current] << oendl; if ( !m_end ) m_record = m_temp->find( m_uids[ m_current ], m_uids, m_current, m_direction ? Base::Forward : -- cgit v0.9.0.2