summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
Unidiff
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
@@ -15,145 +15,150 @@
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29/* 29/*
30 * ===================================================================== 30 * =====================================================================
31 * ToDo: XML-Backend: Automatic reload if something was changed... 31 * ToDo: XML-Backend: Automatic reload if something was changed...
32 * 32 *
33 * 33 *
34 */ 34 */
35 35
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>
42#include <qregexp.h> 52#include <qregexp.h>
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
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
87} 92}
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
97 102
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
132 137
133bool OPimContactAccess::wasChangedExternally()const 138bool OPimContactAccess::wasChangedExternally()const
134{ 139{
135 return ( m_backEnd->wasChangedExternally() ); 140 return ( m_backEnd->wasChangedExternally() );
136} 141}
137 142
138 143
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
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,64 +1,67 @@
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 .>+-=
8 _;:, .> :=|. This program is free software; you can 8 _;:, .> :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12 - . .-<_> .<> Foundation; either version 2 of the License, 12 - . .-<_> .<> Foundation; either version 2 of the License,
13 ._= =} : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14 .%`+i> _;_. 14 .%`+i> _;_.
15 .i_,=:_. -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17 : .. .:, . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= = ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++= -. .` .: details. 21++= -. .` .: details.
22 : = ...= . :.=- 22 : = ...= . :.=-
23 -. .:....=;==+<; You should have received a copy of the GNU 23 -. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
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
42namespace Opie { 45namespace Opie {
43 46
44class OPimAccessTemplatePrivate; 47class OPimAccessTemplatePrivate;
45/** 48/**
46 * Thats the frontend to our OPIE PIM 49 * Thats the frontend to our OPIE PIM
47 * Library. Either you want to use it's 50 * Library. Either you want to use it's
48 * interface or you want to implement 51 * interface or you want to implement
49 * your own Access lib 52 * your own Access lib
50 * Just create a OPimRecord and inherit from 53 * Just create a OPimRecord and inherit from
51 * the templates 54 * the templates
52 */ 55 */
53 56
54template <class T = OPimRecord > 57template <class T = OPimRecord >
55class OPimAccessTemplate : public OTemplateBase<T> { 58class OPimAccessTemplate : public OTemplateBase<T> {
56public: 59public:
57 enum Access { 60 enum Access {
58 Random = 0, 61 Random = 0,
59 SortedAccess 62 SortedAccess
60 }; 63 };
61 typedef OPimRecordList<T> List; 64 typedef OPimRecordList<T> List;
62 typedef OPimAccessBackend<T> BackEnd; 65 typedef OPimAccessBackend<T> BackEnd;
63 typedef OPimCache<T> Cache; 66 typedef OPimCache<T> Cache;
64 67
@@ -184,104 +187,104 @@ protected:
184 void invalidateCache(); 187 void invalidateCache();
185 188
186 void setBackEnd( BackEnd* end ); 189 void setBackEnd( BackEnd* end );
187 /** 190 /**
188 * returns the backend 191 * returns the backend
189 */ 192 */
190 BackEnd* backEnd(); 193 BackEnd* backEnd();
191 BackEnd* m_backEnd; 194 BackEnd* m_backEnd;
192 Cache m_cache; 195 Cache m_cache;
193 196
194private: 197private:
195 OPimAccessTemplatePrivate *d; 198 OPimAccessTemplatePrivate *d;
196 199
197}; 200};
198 201
199template <class T> 202template <class T>
200OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) 203OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
201 : OTemplateBase<T>(), m_backEnd( end ) 204 : OTemplateBase<T>(), m_backEnd( end )
202{ 205{
203 if (end ) 206 if (end )
204 end->setFrontend( this ); 207 end->setFrontend( this );
205} 208}
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}
211template <class T> 214template <class T>
212bool OPimAccessTemplate<T>::load() { 215bool OPimAccessTemplate<T>::load() {
213 invalidateCache(); 216 invalidateCache();
214 return m_backEnd->load(); 217 return m_backEnd->load();
215} 218}
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>
222bool OPimAccessTemplate<T>::save() { 225bool OPimAccessTemplate<T>::save() {
223 return m_backEnd->save(); 226 return m_backEnd->save();
224} 227}
225template <class T> 228template <class T>
226typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { 229typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
227 QArray<int> ints = m_backEnd->allRecords(); 230 QArray<int> ints = m_backEnd->allRecords();
228 List lis(ints, this ); 231 List lis(ints, this );
229 return lis; 232 return lis;
230} 233}
231template <class T> 234template <class T>
232typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { 235typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const {
233 QArray<int> ints = m_backEnd->matchRegexp( r ); 236 QArray<int> ints = m_backEnd->matchRegexp( r );
234 List lis(ints, this ); 237 List lis(ints, this );
235 return lis; 238 return lis;
236} 239}
237template <class T> 240template <class T>
238QArray<int> OPimAccessTemplate<T>::records()const { 241QArray<int> OPimAccessTemplate<T>::records()const {
239 return m_backEnd->allRecords(); 242 return m_backEnd->allRecords();
240} 243}
241template <class T> 244template <class T>
242typename OPimAccessTemplate<T>::List 245typename OPimAccessTemplate<T>::List
243OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { 246OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
244 QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); 247 QArray<int> ints = m_backEnd->queryByExample( t, settings, d );
245 248
246 List lis(ints, this ); 249 List lis(ints, this );
247 return lis; 250 return lis;
248} 251}
249template <class T> 252template <class T>
250T OPimAccessTemplate<T>::find( int uid ) const{ 253T OPimAccessTemplate<T>::find( int uid ) const{
251 T t = m_backEnd->find( uid ); 254 T t = m_backEnd->find( uid );
252 cache( t ); 255 cache( t );
253 return t; 256 return t;
254} 257}
255template <class T> 258template <class T>
256T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, 259T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar,
257 uint current, typename OTemplateBase<T>::CacheDirection dir )const { 260 uint current, typename OTemplateBase<T>::CacheDirection dir )const {
258 /* 261 /*
259 * better do T.isEmpty() 262 * better do T.isEmpty()
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 }
267 270
268 T t = m_backEnd->find( uid, ar, current, dir ); 271 T t = m_backEnd->find( uid, ar, current, dir );
269 cache( t ); 272 cache( t );
270 return t; 273 return t;
271} 274}
272template <class T> 275template <class T>
273void OPimAccessTemplate<T>::clear() { 276void OPimAccessTemplate<T>::clear() {
274 invalidateCache(); 277 invalidateCache();
275 m_backEnd->clear(); 278 m_backEnd->clear();
276} 279}
277template <class T> 280template <class T>
278bool OPimAccessTemplate<T>::add( const T& t ) { 281bool OPimAccessTemplate<T>::add( const T& t ) {
279 cache( t ); 282 cache( t );
280 return m_backEnd->add( t ); 283 return m_backEnd->add( t );
281} 284}
282 285
283template <class T> 286template <class T>
284bool OPimAccessTemplate<T>::add( const OPimRecord& rec) { 287bool OPimAccessTemplate<T>::add( const OPimRecord& rec) {
285 /* same type */ 288 /* same type */
286 T tempInstance; 289 T tempInstance;
287 if ( rec.rtti() == tempInstance.rtti() ) { 290 if ( rec.rtti() == tempInstance.rtti() ) {
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
@@ -1152,64 +1152,64 @@ void OPimContact::setBirthday( const QDate &v )
1152/*! \fn void OPimContact::setAnniversary( const QDate &date ) 1152/*! \fn void OPimContact::setAnniversary( const QDate &date )
1153 Sets the anniversary of the contact to \a date. If date is 1153 Sets the anniversary of the contact to \a date. If date is
1154 null, the current stored date will be removed. 1154 null, the current stored date will be removed.
1155*/ 1155*/
1156void OPimContact::setAnniversary( const QDate &v ) 1156void OPimContact::setAnniversary( const QDate &v )
1157{ 1157{
1158 if ( v.isNull() ) 1158 if ( v.isNull() )
1159 { 1159 {
1160 owarn << "Remove Anniversary" << oendl; 1160 owarn << "Remove Anniversary" << oendl;
1161 replace( Qtopia::Anniversary, QString::null ); 1161 replace( Qtopia::Anniversary, QString::null );
1162 return ; 1162 return ;
1163 } 1163 }
1164 1164
1165 if ( v.isValid() ) 1165 if ( v.isValid() )
1166 replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) ); 1166 replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) );
1167} 1167}
1168 1168
1169 1169
1170/*! \fn QDate OPimContact::birthday() const 1170/*! \fn QDate OPimContact::birthday() const
1171 Returns the birthday of the contact. 1171 Returns the birthday of the contact.
1172*/ 1172*/
1173QDate OPimContact::birthday() const 1173QDate 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
1180 return QDate(); 1180 return QDate();
1181} 1181}
1182 1182
1183 1183
1184/*! \fn QDate OPimContact::anniversary() const 1184/*! \fn QDate OPimContact::anniversary() const
1185 Returns the anniversary of the contact. 1185 Returns the anniversary of the contact.
1186*/ 1186*/
1187QDate OPimContact::anniversary() const 1187QDate 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
1195 return empty; 1195 return empty;
1196} 1196}
1197 1197
1198 1198
1199void OPimContact::insertEmail( const QString &v ) 1199void OPimContact::insertEmail( const QString &v )
1200{ 1200{
1201 //odebug << "insertEmail " << v << "" << oendl; 1201 //odebug << "insertEmail " << v << "" << oendl;
1202 QString e = v.simplifyWhiteSpace(); 1202 QString e = v.simplifyWhiteSpace();
1203 QString def = defaultEmail(); 1203 QString def = defaultEmail();
1204 1204
1205 // if no default, set it as the default email and don't insert 1205 // if no default, set it as the default email and don't insert
1206 if ( def.isEmpty() ) 1206 if ( def.isEmpty() )
1207 { 1207 {
1208 setDefaultEmail( e ); // will insert into the list for us 1208 setDefaultEmail( e ); // will insert into the list for us
1209 return ; 1209 return ;
1210 } 1210 }
1211 1211
1212 // otherwise, insert assuming doesn't already exist 1212 // otherwise, insert assuming doesn't already exist
1213 QString emailsStr = find( Qtopia::Emails ); 1213 QString emailsStr = find( Qtopia::Emails );
1214 if ( emailsStr.contains( e ) ) 1214 if ( emailsStr.contains( e ) )
1215 return ; 1215 return ;
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
@@ -206,45 +206,45 @@ QString OPimNotifyManager::remindersToString() const
206 206
207 OPimNotifyManager::Reminders reminders = m_rem; 207 OPimNotifyManager::Reminders reminders = m_rem;
208 if ( !reminders.isEmpty() ) 208 if ( !reminders.isEmpty() )
209 { 209 {
210 OPimNotifyManager::Reminders::Iterator it = reminders.begin(); 210 OPimNotifyManager::Reminders::Iterator it = reminders.begin();
211 QStringList records; 211 QStringList records;
212 for ( ; it != reminders.end(); ++it ) 212 for ( ; it != reminders.end(); ++it )
213 { 213 {
214 records << QString::number( ( *it ).recordUid() ); 214 records << QString::number( ( *it ).recordUid() );
215 } 215 }
216 str = records.join( ";" ); 216 str = records.join( ";" );
217 } 217 }
218 218
219 return str; 219 return str;
220} 220}
221 221
222 222
223void OPimNotifyManager::alarmsFromString( const QString& str ) 223void OPimNotifyManager::alarmsFromString( const QString& str )
224{ 224{
225 QStringList als = QStringList::split( ";", str ); 225 QStringList als = QStringList::split( ";", str );
226 for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) 226 for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it )
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 );
235 } 235 }
236} 236}
237 237
238 238
239void OPimNotifyManager::remindersFromString( const QString& str ) 239void OPimNotifyManager::remindersFromString( const QString& str )
240{ 240{
241 241
242 QStringList rems = QStringList::split( ";", str ); 242 QStringList rems = QStringList::split( ";", str );
243 for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) 243 for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it )
244 { 244 {
245 OPimReminder rem( ( *it ).toInt() ); 245 OPimReminder rem( ( *it ).toInt() );
246 add( rem ); 246 add( rem );
247 } 247 }
248 248
249} 249}
250} 250}
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
@@ -12,48 +12,49 @@
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ORECORDLIST_H 30#ifndef ORECORDLIST_H
31#define ORECORDLIST_H 31#define ORECORDLIST_H
32 32
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>
39 40
40namespace Opie 41namespace Opie
41{ 42{
42 43
43class OPimRecordListIteratorPrivate; 44class OPimRecordListIteratorPrivate;
44/** 45/**
45 * Our List Iterator 46 * Our List Iterator
46 * it behaves like STL or Qt 47 * it behaves like STL or Qt
47 * 48 *
48 * for(it = list.begin(); it != list.end(); ++it ) 49 * for(it = list.begin(); it != list.end(); ++it )
49 * doSomeCoolStuff( (*it) ); 50 * doSomeCoolStuff( (*it) );
50 */ 51 */
51template <class T> class OPimRecordList; 52template <class T> class OPimRecordList;
52template <class T = OPimRecord> 53template <class T = OPimRecord>
53class OPimRecordListIterator 54class OPimRecordListIterator
54{ 55{
55 friend class OPimRecordList<T>; 56 friend class OPimRecordList<T>;
56 57
57 public: 58 public:
58 typedef OTemplateBase<T> Base; 59 typedef OTemplateBase<T> Base;
59 60
@@ -168,75 +169,75 @@ class OPimRecordList
168 169
169/* ok now implement it */ 170/* ok now implement it */
170template <class T> 171template <class T>
171OPimRecordListIterator<T>::OPimRecordListIterator() 172OPimRecordListIterator<T>::OPimRecordListIterator()
172{ 173{
173 m_current = 0; 174 m_current = 0;
174 m_temp = 0l; 175 m_temp = 0l;
175 m_end = true; 176 m_end = true;
176 m_record = T(); 177 m_record = T();
177 /* forward */ 178 /* forward */
178 m_direction = TRUE; 179 m_direction = TRUE;
179} 180}
180 181
181 182
182template <class T> 183template <class T>
183OPimRecordListIterator<T>::~OPimRecordListIterator() 184OPimRecordListIterator<T>::~OPimRecordListIterator()
184{ 185{
185 /* nothing to delete */ 186 /* nothing to delete */
186} 187}
187 188
188 189
189template <class T> 190template <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;
195 m_temp = it.m_temp; 196 m_temp = it.m_temp;
196 m_end = it.m_end; 197 m_end = it.m_end;
197 m_record = it.m_record; 198 m_record = it.m_record;
198 m_direction = it.m_direction; 199 m_direction = it.m_direction;
199} 200}
200 201
201 202
202template <class T> 203template <class T>
203OPimRecordListIterator<T> &OPimRecordListIterator<T>::operator=( const OPimRecordListIterator<T>& it ) 204OPimRecordListIterator<T> &OPimRecordListIterator<T>::operator=( const OPimRecordListIterator<T>& it )
204{ 205{
205 m_uids = it.m_uids; 206 m_uids = it.m_uids;
206 m_current = it.m_current; 207 m_current = it.m_current;
207 m_temp = it.m_temp; 208 m_temp = it.m_temp;
208 m_end = it.m_end; 209 m_end = it.m_end;
209 m_record = it.m_record; 210 m_record = it.m_record;
210 211
211 return *this; 212 return *this;
212} 213}
213 214
214 215
215template <class T> 216template <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,
221 m_direction ? Base::Forward : 222 m_direction ? Base::Forward :
222 Base::Reverse ); 223 Base::Reverse );
223 else 224 else
224 m_record = T(); 225 m_record = T();
225 226
226 return m_record; 227 return m_record;
227} 228}
228 229
229 230
230template <class T> 231template <class T>
231OPimRecordListIterator<T> &OPimRecordListIterator<T>::operator++() 232OPimRecordListIterator<T> &OPimRecordListIterator<T>::operator++()
232{ 233{
233 m_direction = true; 234 m_direction = true;
234 if ( m_current < m_uids.count() ) 235 if ( m_current < m_uids.count() )
235 { 236 {
236 m_end = false; 237 m_end = false;
237 ++m_current; 238 ++m_current;
238 } 239 }
239 else 240 else
240 m_end = true; 241 m_end = true;
241 242
242 return *this; 243 return *this;