summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
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/core
parentbaed1d5ab8589aef14440009bc4e7380bcc5a741 (diff)
downloadopie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.zip
opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.tar.gz
opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.tar.bz2
- convert to odebug framework
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
@@ -37,4 +37,14 @@
37#include "obackendfactory.h" 37#include "obackendfactory.h"
38 38
39/* OPIE */
40#include <opie2/ocontactaccessbackend_xml.h>
41#include <opie2/opimresolver.h>
42#include <opie2/opimglobal.h>
43#include <opie2/odebug.h>
44
45//#include <qpe/qcopenvelope_qws.h>
46#include <qpe/global.h>
47
48/* QT */
39#include <qasciidict.h> 49#include <qasciidict.h>
40#include <qdatetime.h> 50#include <qdatetime.h>
@@ -44,7 +54,5 @@
44#include <qcopchannel_qws.h> 54#include <qcopchannel_qws.h>
45 55
46//#include <qpe/qcopenvelope_qws.h> 56/* STD */
47#include <qpe/global.h>
48
49#include <errno.h> 57#include <errno.h>
50#include <fcntl.h> 58#include <fcntl.h>
@@ -52,35 +60,32 @@
52#include <stdlib.h> 60#include <stdlib.h>
53 61
54#include <opie2/ocontactaccessbackend_xml.h>
55#include <opie2/opimresolver.h>
56#include <opie2/opimglobal.h>
57 62
58namespace Opie { 63namespace Opie {
59 64
60OPimContactAccess::OPimContactAccess ( const QString appname, const QString , 65OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
61 OPimContactAccessBackend* end, bool autosync ): 66 OPimContactAccessBackend* end, bool autosync ):
62 OPimAccessTemplate<OPimContact>( end ) 67 OPimAccessTemplate<OPimContact>( end )
63{ 68{
64 /* take care of the backend. If there is no one defined, we 69 /* take care of the backend. If there is no one defined, we
65 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 70 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
66 */ 71 */
67 if( end == 0 ) { 72 if( end == 0 ) {
68 qWarning ("Using BackendFactory !"); 73 owarn << "Using BackendFactory !" << oendl;
69 end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname ); 74 end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname );
70 } 75 }
71 // Set backend locally and in template 76 // Set backend locally and in template
72 m_backEnd = end; 77 m_backEnd = end;
73 OPimAccessTemplate<OPimContact>::setBackEnd (end); 78 OPimAccessTemplate<OPimContact>::setBackEnd (end);
74 79
75 80
76 /* Connect signal of external db change to function */ 81 /* Connect signal of external db change to function */
77 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 82 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
78 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), 83 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
79 this, SLOT(copMessage(const QCString&,const QByteArray&)) ); 84 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
80 if ( autosync ){ 85 if ( autosync ){
81 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); 86 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
82 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), 87 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
83 this, SLOT(copMessage(const QCString&,const QByteArray&)) ); 88 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
84 } 89 }
85 90
86 91
@@ -88,9 +93,9 @@ OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
88OPimContactAccess::~OPimContactAccess () 93OPimContactAccess::~OPimContactAccess ()
89{ 94{
90 /* The user may forget to save the changed database, therefore try to 95 /* The user may forget to save the changed database, therefore try to
91 * do it for him.. 96 * do it for him..
92 */ 97 */
93 save(); 98 save();
94 // delete m_backEnd; is done by template.. 99 // delete m_backEnd; is done by template..
95} 100}
96 101
@@ -98,34 +103,34 @@ OPimContactAccess::~OPimContactAccess ()
98bool OPimContactAccess::save () 103bool OPimContactAccess::save ()
99{ 104{
100 /* If the database was changed externally, we could not save the 105 /* If the database was changed externally, we could not save the
101 * Data. This will remove added items which is unacceptable ! 106 * Data. This will remove added items which is unacceptable !
102 * Therefore: Reload database and merge the data... 107 * Therefore: Reload database and merge the data...
103 */ 108 */
104 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) 109 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() )
105 reload(); 110 reload();
106 111
107 bool status = OPimAccessTemplate<OPimContact>::save(); 112 bool status = OPimAccessTemplate<OPimContact>::save();
108 if ( !status ) return false; 113 if ( !status ) return false;
109 114
110 /* Now tell everyone that new data is available. 115 /* Now tell everyone that new data is available.
111 */ 116 */
112 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 117 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
113 118
114 return true; 119 return true;
115} 120}
116 121
117const uint OPimContactAccess::querySettings() 122const uint OPimContactAccess::querySettings()
118{ 123{
119 return ( m_backEnd->querySettings() ); 124 return ( m_backEnd->querySettings() );
120} 125}
121 126
122bool OPimContactAccess::hasQuerySettings ( int querySettings ) const 127bool OPimContactAccess::hasQuerySettings ( int querySettings ) const
123{ 128{
124 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 129 return ( m_backEnd->hasQuerySettings ( querySettings ) );
125} 130}
126OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const 131OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
127{ 132{
128 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); 133 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
129 return ( OPimRecordList<OPimContact>(matchingContacts, this) ); 134 return ( OPimRecordList<OPimContact>(matchingContacts, this) );
130} 135}
131 136
@@ -133,5 +138,5 @@ OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortO
133bool OPimContactAccess::wasChangedExternally()const 138bool OPimContactAccess::wasChangedExternally()const
134{ 139{
135 return ( m_backEnd->wasChangedExternally() ); 140 return ( m_backEnd->wasChangedExternally() );
136} 141}
137 142
@@ -139,20 +144,20 @@ bool OPimContactAccess::wasChangedExternally()const
139void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) 144void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & )
140{ 145{
141 if ( msg == "addressbookUpdated()" ){ 146 if ( msg == "addressbookUpdated()" ){
142 qWarning ("OPimContactAccess: Received addressbokUpdated()"); 147 owarn << "OPimContactAccess: Received addressbokUpdated()" << oendl;
143 emit signalChanged ( this ); 148 emit signalChanged ( this );
144 } else if ( msg == "flush()" ) { 149 } else if ( msg == "flush()" ) {
145 qWarning ("OPimContactAccess: Received flush()"); 150 owarn << "OPimContactAccess: Received flush()" << oendl;
146 save (); 151 save ();
147 } else if ( msg == "reload()" ) { 152 } else if ( msg == "reload()" ) {
148 qWarning ("OPimContactAccess: Received reload()"); 153 owarn << "OPimContactAccess: Received reload()" << oendl;
149 reload (); 154 reload ();
150 emit signalChanged ( this ); 155 emit signalChanged ( this );
151 } 156 }
152} 157}
153 158
154int OPimContactAccess::rtti() const 159int OPimContactAccess::rtti() const
155{ 160{
156 return OPimResolver::AddressBook; 161 return OPimResolver::AddressBook;
157} 162}
158 163
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
@@ -2,5 +2,5 @@
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Holger Freyther <zecke@handhelds.org> 3 Copyright (C) Holger Freyther <zecke@handhelds.org>
4 Copyright (C) Stefan Eilers <eilers.stefan@epost.de> 4 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
5 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 5 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
6 .=l. 6 .=l.
@@ -31,6 +31,5 @@
31#define OPIE_PIM_ACCESS_TEMPLATE_H 31#define OPIE_PIM_ACCESS_TEMPLATE_H
32 32
33#include <qarray.h> 33/* OPIE */
34
35#include <opie2/opimrecord.h> 34#include <opie2/opimrecord.h>
36#include <opie2/opimaccessbackend.h> 35#include <opie2/opimaccessbackend.h>
@@ -39,4 +38,8 @@
39#include <opie2/opimcache.h> 38#include <opie2/opimcache.h>
40#include <opie2/opimtemplatebase.h> 39#include <opie2/opimtemplatebase.h>
40#include <opie2/odebug.h>
41
42/* QT */
43#include <qarray.h>
41 44
42namespace Opie { 45namespace Opie {
@@ -206,5 +209,5 @@ OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
206template <class T> 209template <class T>
207OPimAccessTemplate<T>::~OPimAccessTemplate() { 210OPimAccessTemplate<T>::~OPimAccessTemplate() {
208 qWarning("~OPimAccessTemplate<T>"); 211 owarn << "~OPimAccessTemplate<T>" << oendl;
209 delete m_backEnd; 212 delete m_backEnd;
210} 213}
@@ -216,6 +219,6 @@ bool OPimAccessTemplate<T>::load() {
216template <class T> 219template <class T>
217bool OPimAccessTemplate<T>::reload() { 220bool OPimAccessTemplate<T>::reload() {
218 invalidateCache(); // zecke: I think this should be added (se) 221 invalidateCache(); // zecke: I think this should be added (se)
219 return m_backEnd->reload(); 222 return m_backEnd->reload();
220} 223}
221template <class T> 224template <class T>
@@ -261,5 +264,5 @@ T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar,
261 * avoid two finds in QCache... 264 * avoid two finds in QCache...
262 */ 265 */
263 // qWarning("find it now %d", uid ); 266 // owarn << "find it now " << uid << oendl;
264 if (m_cache.contains( uid ) ) { 267 if (m_cache.contains( uid ) ) {
265 return m_cache.find( uid ); 268 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
@@ -1174,5 +1174,5 @@ QDate OPimContact::birthday() const
1174{ 1174{
1175 QString str = find( Qtopia::Birthday ); 1175 QString str = find( Qtopia::Birthday );
1176 // qWarning ("Birthday %s", str.latin1() ); 1176 // owarn << "Birthday " << str << oendl;
1177 if ( !str.isEmpty() ) 1177 if ( !str.isEmpty() )
1178 return OPimDateConversion::dateFromString ( str ); 1178 return OPimDateConversion::dateFromString ( str );
@@ -1189,5 +1189,5 @@ QDate OPimContact::anniversary() const
1189 QDate empty; 1189 QDate empty;
1190 QString str = find( Qtopia::Anniversary ); 1190 QString str = find( Qtopia::Anniversary );
1191 // qWarning ("Anniversary %s", str.latin1() ); 1191 // owarn << "Anniversary " << str << oendl;
1192 if ( !str.isEmpty() ) 1192 if ( !str.isEmpty() )
1193 return OPimDateConversion::dateFromString ( str ); 1193 return OPimDateConversion::dateFromString ( str );
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
@@ -228,6 +228,6 @@ void OPimNotifyManager::alarmsFromString( const QString& str )
228 QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty 228 QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty
229 owarn << "alarm: " << alarm.join( "___" ) << "" << oendl; 229 owarn << "alarm: " << alarm.join( "___" ) << "" << oendl;
230 qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(), 230 owarn << "alarm[0]: " << alarm[ 0 ] << " "
231 OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() ); 231 << OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString() << oendl;
232 OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ), 232 OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ),
233 alarm[ 1 ].toInt() ); 233 alarm[ 1 ].toInt() );
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
@@ -34,4 +34,5 @@
34#include <opie2/opimtemplatebase.h> 34#include <opie2/opimtemplatebase.h>
35#include <opie2/opimrecord.h> 35#include <opie2/opimrecord.h>
36//#include <opie2/odebug.h>
36 37
37/* QT */ 38/* QT */
@@ -190,5 +191,5 @@ template <class T>
190OPimRecordListIterator<T>::OPimRecordListIterator( const OPimRecordListIterator<T>& it ) 191OPimRecordListIterator<T>::OPimRecordListIterator( const OPimRecordListIterator<T>& it )
191{ 192{
192 // qWarning("OPimRecordListIterator copy c'tor"); 193 //owarn << "OPimRecordListIterator copy c'tor" << oendl;
193 m_uids = it.m_uids; 194 m_uids = it.m_uids;
194 m_current = it.m_current; 195 m_current = it.m_current;
@@ -216,5 +217,5 @@ template <class T>
216T OPimRecordListIterator<T>::operator*() 217T OPimRecordListIterator<T>::operator*()
217{ 218{
218 //qWarning("operator* %d %d", m_current, m_uids[m_current] ); 219 //owarn << "operator* " << m_current << " " << m_uids[m_current] << oendl;
219 if ( !m_end ) 220 if ( !m_end )
220 m_record = m_temp->find( m_uids[ m_current ], m_uids, m_current, 221 m_record = m_temp->find( m_uids[ m_current ], m_uids, m_current,