summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp117
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h17
-rw-r--r--libopie2/opiepim/core/opimcontact.cpp4
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp4
-rw-r--r--libopie2/opiepim/core/opimrecordlist.h5
5 files changed, 78 insertions, 69 deletions
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 <opie2/ocontactaccessbackend_xml.h>
+#include <opie2/opimresolver.h>
+#include <opie2/opimglobal.h>
+#include <opie2/odebug.h>
+
+//#include <qpe/qcopenvelope_qws.h>
+#include <qpe/global.h>
+
+/* QT */
#include <qasciidict.h>
#include <qdatetime.h>
#include <qfile.h>
@@ -43,117 +53,112 @@
#include <qlist.h>
#include <qcopchannel_qws.h>
-//#include <qpe/qcopenvelope_qws.h>
-#include <qpe/global.h>
-
+/* STD */
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
-#include <opie2/ocontactaccessbackend_xml.h>
-#include <opie2/opimresolver.h>
-#include <opie2/opimglobal.h>
namespace Opie {
OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
- OPimContactAccessBackend* end, bool autosync ):
- OPimAccessTemplate<OPimContact>( end )
+ OPimContactAccessBackend* end, bool autosync ):
+ OPimAccessTemplate<OPimContact>( 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<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname );
+ owarn << "Using BackendFactory !" << oendl;
+ end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname );
}
- // Set backend locally and in template
+ // Set backend locally and in template
m_backEnd = end;
- OPimAccessTemplate<OPimContact>::setBackEnd (end);
+ OPimAccessTemplate<OPimContact>::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<OPimContact>::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<OPimContact>::wasChangedExternally() )
+ reload();
- bool status = OPimAccessTemplate<OPimContact>::save();
- if ( !status ) return false;
+ bool status = OPimAccessTemplate<OPimContact>::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<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
{
- QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
- return ( OPimRecordList<OPimContact>(matchingContacts, this) );
+ QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
+ return ( OPimRecordList<OPimContact>(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 <zecke@handhelds.org>
- Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
+ Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
@@ -30,14 +30,17 @@
#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
#define OPIE_PIM_ACCESS_TEMPLATE_H
-#include <qarray.h>
-
+/* OPIE */
#include <opie2/opimrecord.h>
#include <opie2/opimaccessbackend.h>
#include <opie2/opimrecordlist.h>
#include <opie2/opimcache.h>
#include <opie2/opimtemplatebase.h>
+#include <opie2/odebug.h>
+
+/* QT */
+#include <qarray.h>
namespace Opie {
@@ -205,7 +208,7 @@ OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
}
template <class T>
OPimAccessTemplate<T>::~OPimAccessTemplate() {
- qWarning("~OPimAccessTemplate<T>");
+ owarn << "~OPimAccessTemplate<T>" << oendl;
delete m_backEnd;
}
template <class T>
@@ -215,8 +218,8 @@ bool OPimAccessTemplate<T>::load() {
}
template <class T>
bool OPimAccessTemplate<T>::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 <class T>
bool OPimAccessTemplate<T>::save() {
@@ -260,7 +263,7 @@ T OPimAccessTemplate<T>::find( int uid, const QArray<int>& 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 <opie2/opimtemplatebase.h>
#include <opie2/opimrecord.h>
+//#include <opie2/odebug.h>
/* QT */
#include <qarray.h>
@@ -189,7 +190,7 @@ OPimRecordListIterator<T>::~OPimRecordListIterator()
template <class T>
OPimRecordListIterator<T>::OPimRecordListIterator( const OPimRecordListIterator<T>& 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<T> &OPimRecordListIterator<T>::operator=( const OPimRecor
template <class T>
T OPimRecordListIterator<T>::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 :