author | ar <ar> | 2004-06-01 22:21:23 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-01 22:21:23 (UTC) |
commit | d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce (patch) (unidiff) | |
tree | 4bab082304716df1ec924ef040161e3cf9c10366 /libopie2/opiepim/core | |
parent | baed1d5ab8589aef14440009bc4e7380bcc5a741 (diff) | |
download | opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.zip opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.tar.gz opie-d4fe7d53ddf8f3e7ae046a511f0dc061f30d45ce.tar.bz2 |
- convert to odebug framework
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.cpp | 117 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 17 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimcontact.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecordlist.h | 5 |
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 @@ | |||
36 | #include "ocontactaccess.h" | 36 | #include "ocontactaccess.h" |
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> |
41 | #include <qfile.h> | 51 | #include <qfile.h> |
@@ -43,117 +53,112 @@ | |||
43 | #include <qlist.h> | 53 | #include <qlist.h> |
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> |
51 | #include <unistd.h> | 59 | #include <unistd.h> |
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 | ||
58 | namespace Opie { | 63 | namespace Opie { |
59 | 64 | ||
60 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , | 65 | OPimContactAccess::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 | ||
87 | } | 92 | } |
88 | OPimContactAccess::~OPimContactAccess () | 93 | OPimContactAccess::~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 | ||
97 | 102 | ||
98 | bool OPimContactAccess::save () | 103 | bool 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 | ||
117 | const uint OPimContactAccess::querySettings() | 122 | const uint OPimContactAccess::querySettings() |
118 | { | 123 | { |
119 | return ( m_backEnd->querySettings() ); | 124 | return ( m_backEnd->querySettings() ); |
120 | } | 125 | } |
121 | 126 | ||
122 | bool OPimContactAccess::hasQuerySettings ( int querySettings ) const | 127 | bool OPimContactAccess::hasQuerySettings ( int querySettings ) const |
123 | { | 128 | { |
124 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); | 129 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); |
125 | } | 130 | } |
126 | OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const | 131 | OPimRecordList<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 | ||
132 | 137 | ||
133 | bool OPimContactAccess::wasChangedExternally()const | 138 | bool OPimContactAccess::wasChangedExternally()const |
134 | { | 139 | { |
135 | return ( m_backEnd->wasChangedExternally() ); | 140 | return ( m_backEnd->wasChangedExternally() ); |
136 | } | 141 | } |
137 | 142 | ||
138 | 143 | ||
139 | void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) | 144 | void 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 | ||
154 | int OPimContactAccess::rtti() const | 159 | int OPimContactAccess::rtti() const |
155 | { | 160 | { |
156 | return OPimResolver::AddressBook; | 161 | return OPimResolver::AddressBook; |
157 | } | 162 | } |
158 | 163 | ||
159 | } | 164 | } |
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 @@ | |||
1 | /* | 1 | /* |
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. |
7 | .>+-= | 7 | .>+-= |
@@ -30,14 +30,17 @@ | |||
30 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H | 30 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H |
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> |
37 | #include <opie2/opimrecordlist.h> | 36 | #include <opie2/opimrecordlist.h> |
38 | 37 | ||
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 | ||
42 | namespace Opie { | 45 | namespace Opie { |
43 | 46 | ||
@@ -205,7 +208,7 @@ OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) | |||
205 | } | 208 | } |
206 | template <class T> | 209 | template <class T> |
207 | OPimAccessTemplate<T>::~OPimAccessTemplate() { | 210 | OPimAccessTemplate<T>::~OPimAccessTemplate() { |
208 | qWarning("~OPimAccessTemplate<T>"); | 211 | owarn << "~OPimAccessTemplate<T>" << oendl; |
209 | delete m_backEnd; | 212 | delete m_backEnd; |
210 | } | 213 | } |
211 | template <class T> | 214 | template <class T> |
@@ -215,8 +218,8 @@ bool OPimAccessTemplate<T>::load() { | |||
215 | } | 218 | } |
216 | template <class T> | 219 | template <class T> |
217 | bool OPimAccessTemplate<T>::reload() { | 220 | bool 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 | } |
221 | template <class T> | 224 | template <class T> |
222 | bool OPimAccessTemplate<T>::save() { | 225 | bool OPimAccessTemplate<T>::save() { |
@@ -260,7 +263,7 @@ T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, | |||
260 | * after a find this way we would | 263 | * after a find this way we would |
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 ); |
266 | } | 269 | } |
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 ) | |||
1173 | QDate OPimContact::birthday() const | 1173 | 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 ); |
1179 | else | 1179 | else |
@@ -1188,7 +1188,7 @@ QDate OPimContact::anniversary() const | |||
1188 | { | 1188 | { |
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 ); |
1194 | else | 1194 | 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 ) | |||
227 | { | 227 | { |
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() ); |
234 | add( al ); | 234 | 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 @@ | |||
33 | /* OPIE */ | 33 | /* OPIE */ |
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 */ |
38 | #include <qarray.h> | 39 | #include <qarray.h> |
@@ -189,7 +190,7 @@ OPimRecordListIterator<T>::~OPimRecordListIterator() | |||
189 | template <class T> | 190 | template <class T> |
190 | OPimRecordListIterator<T>::OPimRecordListIterator( const OPimRecordListIterator<T>& it ) | 191 | OPimRecordListIterator<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; |
195 | m_temp = it.m_temp; | 196 | m_temp = it.m_temp; |
@@ -215,7 +216,7 @@ OPimRecordListIterator<T> &OPimRecordListIterator<T>::operator=( const OPimRecor | |||
215 | template <class T> | 216 | template <class T> |
216 | T OPimRecordListIterator<T>::operator*() | 217 | T 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, |
221 | m_direction ? Base::Forward : | 222 | m_direction ? Base::Forward : |