-rw-r--r-- | libopie2/opiepim/core/opimnotify.cpp | 219 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotify.h | 21 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 120 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.h | 18 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 117 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.h | 28 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 235 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.h | 11 | ||||
-rw-r--r-- | libopie2/opiepim/ocontactfields.cpp | 40 | ||||
-rw-r--r-- | libopie2/opiepim/ocontactfields.h | 16 | ||||
-rw-r--r-- | libopie2/opiepim/oevent.cpp | 534 | ||||
-rw-r--r-- | libopie2/opiepim/oevent.h | 33 | ||||
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 142 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 294 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.h | 27 |
15 files changed, 1349 insertions, 506 deletions
diff --git a/libopie2/opiepim/core/opimnotify.cpp b/libopie2/opiepim/core/opimnotify.cpp index c61f9da..43858f0 100644 --- a/libopie2/opiepim/core/opimnotify.cpp +++ b/libopie2/opiepim/core/opimnotify.cpp | |||
@@ -28,11 +28,15 @@ | |||
28 | */ | 28 | */ |
29 | #include <qshared.h> | ||
30 | 29 | ||
31 | #include <opie2/opimnotify.h> | 30 | #include "opimnotify.h" |
32 | 31 | ||
33 | namespace Opie { | 32 | /* QT */ |
33 | #include <qshared.h> | ||
34 | 34 | ||
35 | struct OPimNotify::Data : public QShared { | 35 | namespace Opie |
36 | Data() : QShared(),dur(-1),parent(0) { | 36 | { |
37 | 37 | ||
38 | struct OPimNotify::Data : public QShared | ||
39 | { | ||
40 | Data() : QShared(), dur( -1 ), parent( 0 ) | ||
41 | { | ||
38 | } | 42 | } |
@@ -44,3 +48,4 @@ struct OPimNotify::Data : public QShared { | |||
44 | 48 | ||
45 | OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { | 49 | OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) |
50 | { | ||
46 | data = new Data; | 51 | data = new Data; |
@@ -50,2 +55,4 @@ OPimNotify::OPimNotify( const QDateTime& start, int duration, int parent ) { | |||
50 | } | 55 | } |
56 | |||
57 | |||
51 | OPimNotify::OPimNotify( const OPimNotify& noti) | 58 | OPimNotify::OPimNotify( const OPimNotify& noti) |
@@ -55,4 +62,8 @@ OPimNotify::OPimNotify( const OPimNotify& noti) | |||
55 | } | 62 | } |
56 | OPimNotify::~OPimNotify() { | 63 | |
57 | if ( data->deref() ) { | 64 | |
65 | OPimNotify::~OPimNotify() | ||
66 | { | ||
67 | if ( data->deref() ) | ||
68 | { | ||
58 | delete data; | 69 | delete data; |
@@ -62,3 +73,5 @@ OPimNotify::~OPimNotify() { | |||
62 | 73 | ||
63 | OPimNotify &OPimNotify::operator=( const OPimNotify& noti) { | 74 | |
75 | OPimNotify &OPimNotify::operator=( const OPimNotify& noti ) | ||
76 | { | ||
64 | noti.data->ref(); | 77 | noti.data->ref(); |
@@ -69,3 +82,6 @@ OPimNotify &OPimNotify::operator=( const OPimNotify& noti) { | |||
69 | } | 82 | } |
70 | bool OPimNotify::operator==( const OPimNotify& noti ) { | 83 | |
84 | |||
85 | bool OPimNotify::operator==( const OPimNotify& noti ) | ||
86 | { | ||
71 | if ( data == noti.data ) return true; | 87 | if ( data == noti.data ) return true; |
@@ -78,18 +94,36 @@ bool OPimNotify::operator==( const OPimNotify& noti ) { | |||
78 | } | 94 | } |
79 | QDateTime OPimNotify::dateTime()const { | 95 | |
96 | |||
97 | QDateTime OPimNotify::dateTime() const | ||
98 | { | ||
80 | return data->start; | 99 | return data->start; |
81 | } | 100 | } |
82 | QString OPimNotify::service()const { | 101 | |
102 | |||
103 | QString OPimNotify::service() const | ||
104 | { | ||
83 | return data->application; | 105 | return data->application; |
84 | } | 106 | } |
85 | int OPimNotify::parent()const { | 107 | |
108 | |||
109 | int OPimNotify::parent() const | ||
110 | { | ||
86 | return data->parent; | 111 | return data->parent; |
87 | } | 112 | } |
88 | int OPimNotify::duration()const { | 113 | |
114 | |||
115 | int OPimNotify::duration() const | ||
116 | { | ||
89 | return data->dur; | 117 | return data->dur; |
90 | } | 118 | } |
91 | QDateTime OPimNotify::endTime()const { | 119 | |
120 | |||
121 | QDateTime OPimNotify::endTime() const | ||
122 | { | ||
92 | return QDateTime( data->start.date(), data->start.time().addSecs( data->dur) ); | 123 | return QDateTime( data->start.date(), data->start.time().addSecs( data->dur) ); |
93 | } | 124 | } |
94 | void OPimNotify::setDateTime( const QDateTime& time ) { | 125 | |
126 | |||
127 | void OPimNotify::setDateTime( const QDateTime& time ) | ||
128 | { | ||
95 | copyIntern(); | 129 | copyIntern(); |
@@ -97,3 +131,6 @@ void OPimNotify::setDateTime( const QDateTime& time ) { | |||
97 | } | 131 | } |
98 | void OPimNotify::setDuration( int dur ) { | 132 | |
133 | |||
134 | void OPimNotify::setDuration( int dur ) | ||
135 | { | ||
99 | copyIntern(); | 136 | copyIntern(); |
@@ -101,3 +138,6 @@ void OPimNotify::setDuration( int dur ) { | |||
101 | } | 138 | } |
102 | void OPimNotify::setParent( int uid ) { | 139 | |
140 | |||
141 | void OPimNotify::setParent( int uid ) | ||
142 | { | ||
103 | copyIntern(); | 143 | copyIntern(); |
@@ -105,3 +145,6 @@ void OPimNotify::setParent( int uid ) { | |||
105 | } | 145 | } |
106 | void OPimNotify::setService( const QString& str ) { | 146 | |
147 | |||
148 | void OPimNotify::setService( const QString& str ) | ||
149 | { | ||
107 | copyIntern(); | 150 | copyIntern(); |
@@ -109,4 +152,8 @@ void OPimNotify::setService( const QString& str ) { | |||
109 | } | 152 | } |
110 | void OPimNotify::copyIntern() { | 153 | |
111 | if ( data->count != 1 ) { | 154 | |
155 | void OPimNotify::copyIntern() | ||
156 | { | ||
157 | if ( data->count != 1 ) | ||
158 | { | ||
112 | data->deref(); | 159 | data->deref(); |
@@ -120,4 +167,8 @@ void OPimNotify::copyIntern() { | |||
120 | } | 167 | } |
121 | void OPimNotify::deref() { | 168 | |
122 | if ( data->deref() ) { | 169 | |
170 | void OPimNotify::deref() | ||
171 | { | ||
172 | if ( data->deref() ) | ||
173 | { | ||
123 | delete data; | 174 | delete data; |
@@ -127,5 +178,8 @@ void OPimNotify::deref() { | |||
127 | 178 | ||
179 | |||
128 | /***********************************************************/ | 180 | /***********************************************************/ |
129 | struct OPimAlarm::Data : public QShared { | 181 | struct OPimAlarm::Data : public QShared |
130 | Data() : QShared() { | 182 | { |
183 | Data() : QShared() | ||
184 | { | ||
131 | sound = 1; | 185 | sound = 1; |
@@ -135,2 +189,4 @@ struct OPimAlarm::Data : public QShared { | |||
135 | }; | 189 | }; |
190 | |||
191 | |||
136 | OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent ) | 192 | OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int parent ) |
@@ -141,2 +197,4 @@ OPimAlarm::OPimAlarm( int sound, const QDateTime& start, int duration, int paren | |||
141 | } | 197 | } |
198 | |||
199 | |||
142 | OPimAlarm::OPimAlarm( const OPimAlarm& al) | 200 | OPimAlarm::OPimAlarm( const OPimAlarm& al) |
@@ -146,4 +204,8 @@ OPimAlarm::OPimAlarm( const OPimAlarm& al) | |||
146 | } | 204 | } |
147 | OPimAlarm::~OPimAlarm() { | 205 | |
148 | if ( data->deref() ) { | 206 | |
207 | OPimAlarm::~OPimAlarm() | ||
208 | { | ||
209 | if ( data->deref() ) | ||
210 | { | ||
149 | delete data; | 211 | delete data; |
@@ -152,2 +214,4 @@ OPimAlarm::~OPimAlarm() { | |||
152 | } | 214 | } |
215 | |||
216 | |||
153 | OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al) | 217 | OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al) |
@@ -163,3 +227,6 @@ OPimAlarm &OPimAlarm::operator=( const OPimAlarm& al) | |||
163 | } | 227 | } |
164 | bool OPimAlarm::operator==( const OPimAlarm& al) { | 228 | |
229 | |||
230 | bool OPimAlarm::operator==( const OPimAlarm& al ) | ||
231 | { | ||
165 | if ( data->sound != al.data->sound ) return false; | 232 | if ( data->sound != al.data->sound ) return false; |
@@ -170,12 +237,24 @@ bool OPimAlarm::operator==( const OPimAlarm& al) { | |||
170 | } | 237 | } |
171 | QString OPimAlarm::type()const { | 238 | |
239 | |||
240 | QString OPimAlarm::type() const | ||
241 | { | ||
172 | return QString::fromLatin1("OPimAlarm"); | 242 | return QString::fromLatin1("OPimAlarm"); |
173 | } | 243 | } |
174 | int OPimAlarm::sound()const { | 244 | |
245 | |||
246 | int OPimAlarm::sound() const | ||
247 | { | ||
175 | return data->sound; | 248 | return data->sound; |
176 | } | 249 | } |
177 | QString OPimAlarm::file()const { | 250 | |
251 | |||
252 | QString OPimAlarm::file() const | ||
253 | { | ||
178 | return data->file; | 254 | return data->file; |
179 | } | 255 | } |
180 | void OPimAlarm::setSound( int snd) { | 256 | |
257 | |||
258 | void OPimAlarm::setSound( int snd ) | ||
259 | { | ||
181 | copyIntern(); | 260 | copyIntern(); |
@@ -183,3 +262,6 @@ void OPimAlarm::setSound( int snd) { | |||
183 | } | 262 | } |
184 | void OPimAlarm::setFile( const QString& sound ) { | 263 | |
264 | |||
265 | void OPimAlarm::setFile( const QString& sound ) | ||
266 | { | ||
185 | copyIntern(); | 267 | copyIntern(); |
@@ -187,4 +269,8 @@ void OPimAlarm::setFile( const QString& sound ) { | |||
187 | } | 269 | } |
188 | void OPimAlarm::deref() { | 270 | |
189 | if ( data->deref() ) { | 271 | |
272 | void OPimAlarm::deref() | ||
273 | { | ||
274 | if ( data->deref() ) | ||
275 | { | ||
190 | delete data; | 276 | delete data; |
@@ -193,4 +279,8 @@ void OPimAlarm::deref() { | |||
193 | } | 279 | } |
194 | void OPimAlarm::copyIntern() { | 280 | |
195 | if ( data->count != 1 ) { | 281 | |
282 | void OPimAlarm::copyIntern() | ||
283 | { | ||
284 | if ( data->count != 1 ) | ||
285 | { | ||
196 | data->deref(); | 286 | data->deref(); |
@@ -202,6 +292,9 @@ void OPimAlarm::copyIntern() { | |||
202 | } | 292 | } |
293 | |||
294 | |||
203 | /************************/ | 295 | /************************/ |
204 | struct OPimReminder::Data : public QShared { | 296 | struct OPimReminder::Data : public QShared |
205 | Data() : QShared(), record( 0) { | 297 | { |
206 | } | 298 | Data() : QShared(), record( 0 ) |
299 | {} | ||
207 | int record; | 300 | int record; |
@@ -209,2 +302,4 @@ struct OPimReminder::Data : public QShared { | |||
209 | }; | 302 | }; |
303 | |||
304 | |||
210 | OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent ) | 305 | OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int parent ) |
@@ -215,2 +310,4 @@ OPimReminder::OPimReminder( int uid, const QDateTime& start, int dur, int paren | |||
215 | } | 310 | } |
311 | |||
312 | |||
216 | OPimReminder::OPimReminder( const OPimReminder& rem ) | 313 | OPimReminder::OPimReminder( const OPimReminder& rem ) |
@@ -220,3 +317,6 @@ OPimReminder::OPimReminder( const OPimReminder& rem ) | |||
220 | } | 317 | } |
221 | OPimReminder& OPimReminder::operator=( const OPimReminder& rem) { | 318 | |
319 | |||
320 | OPimReminder& OPimReminder::operator=( const OPimReminder& rem ) | ||
321 | { | ||
222 | OPimNotify::operator=(rem ); | 322 | OPimNotify::operator=(rem ); |
@@ -229,3 +329,6 @@ OPimReminder& OPimReminder::operator=( const OPimReminder& rem) { | |||
229 | } | 329 | } |
230 | bool OPimReminder::operator==( const OPimReminder& rem) { | 330 | |
331 | |||
332 | bool OPimReminder::operator==( const OPimReminder& rem ) | ||
333 | { | ||
231 | if ( data->record != rem.data->record ) return false; | 334 | if ( data->record != rem.data->record ) return false; |
@@ -234,9 +337,18 @@ bool OPimReminder::operator==( const OPimReminder& rem) { | |||
234 | } | 337 | } |
235 | QString OPimReminder::type()const { | 338 | |
339 | |||
340 | QString OPimReminder::type() const | ||
341 | { | ||
236 | return QString::fromLatin1("OPimReminder"); | 342 | return QString::fromLatin1("OPimReminder"); |
237 | } | 343 | } |
238 | int OPimReminder::recordUid()const { | 344 | |
345 | |||
346 | int OPimReminder::recordUid() const | ||
347 | { | ||
239 | return data->record; | 348 | return data->record; |
240 | } | 349 | } |
241 | void OPimReminder::setRecordUid( int uid ) { | 350 | |
351 | |||
352 | void OPimReminder::setRecordUid( int uid ) | ||
353 | { | ||
242 | copyIntern(); | 354 | copyIntern(); |
@@ -244,4 +356,8 @@ void OPimReminder::setRecordUid( int uid ) { | |||
244 | } | 356 | } |
245 | void OPimReminder::deref() { | 357 | |
246 | if ( data->deref() ) { | 358 | |
359 | void OPimReminder::deref() | ||
360 | { | ||
361 | if ( data->deref() ) | ||
362 | { | ||
247 | delete data; | 363 | delete data; |
@@ -250,4 +366,8 @@ void OPimReminder::deref() { | |||
250 | } | 366 | } |
251 | void OPimReminder::copyIntern() { | 367 | |
252 | if ( data->count != 1 ) { | 368 | |
369 | void OPimReminder::copyIntern() | ||
370 | { | ||
371 | if ( data->count != 1 ) | ||
372 | { | ||
253 | Data* da = new Data; | 373 | Data* da = new Data; |
@@ -257,2 +377,3 @@ void OPimReminder::copyIntern() { | |||
257 | } | 377 | } |
378 | |||
258 | } | 379 | } |
diff --git a/libopie2/opiepim/core/opimnotify.h b/libopie2/opiepim/core/opimnotify.h index fed3970..d0e40ca 100644 --- a/libopie2/opiepim/core/opimnotify.h +++ b/libopie2/opiepim/core/opimnotify.h | |||
@@ -28,5 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | #ifndef OPIE_PIM_NOTIFY_H | ||
30 | #define OPIE_PIM_NOTIFY_H | ||
31 | 29 | ||
30 | #ifndef OPIMNOTIFY_H | ||
31 | #define OPIMNOTIFY_H | ||
32 | |||
33 | /* QT */ | ||
32 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
@@ -34,4 +36,4 @@ | |||
34 | 36 | ||
35 | 37 | namespace Opie | |
36 | namespace Opie { | 38 | { |
37 | /** | 39 | /** |
@@ -49,3 +51,5 @@ namespace Opie { | |||
49 | */ | 51 | */ |
50 | class OPimNotify { | 52 | class OPimNotify |
53 | { | ||
54 | |||
51 | public: | 55 | public: |
@@ -102,3 +106,4 @@ private: | |||
102 | */ | 106 | */ |
103 | class OPimAlarm : public OPimNotify { | 107 | class OPimAlarm : public OPimNotify |
108 | { | ||
104 | public: | 109 | public: |
@@ -137,5 +142,5 @@ private: | |||
137 | */ | 142 | */ |
138 | class OPimReminder : public OPimNotify { | 143 | class OPimReminder : public OPimNotify |
144 | { | ||
139 | public: | 145 | public: |
140 | |||
141 | /** | 146 | /** |
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 1771fad..a54d597 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp | |||
@@ -28,9 +28,13 @@ | |||
28 | */ | 28 | */ |
29 | #include <opie2/opimnotifymanager.h> | ||
30 | 29 | ||
30 | #include "opimnotifymanager.h" | ||
31 | |||
32 | /* OPIE */ | ||
31 | #include <opie2/oconversion.h> | 33 | #include <opie2/oconversion.h> |
32 | 34 | ||
35 | /* QT */ | ||
33 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
34 | 37 | ||
35 | namespace Opie { | 38 | namespace Opie |
39 | { | ||
36 | 40 | ||
@@ -39,10 +43,18 @@ OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al) | |||
39 | {} | 43 | {} |
40 | OPimNotifyManager::~OPimNotifyManager() { | 44 | |
41 | } | 45 | |
46 | OPimNotifyManager::~OPimNotifyManager() | ||
47 | {} | ||
48 | |||
49 | |||
42 | /* use static_cast and type instead of dynamic... */ | 50 | /* use static_cast and type instead of dynamic... */ |
43 | void OPimNotifyManager::add( const OPimNotify& noti) { | 51 | void OPimNotifyManager::add( const OPimNotify& noti ) |
44 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 52 | { |
53 | if ( noti.type() == QString::fromLatin1( "OPimReminder" ) ) | ||
54 | { | ||
45 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 55 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
46 | m_rem.append( rem ); | 56 | m_rem.append( rem ); |
47 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 57 | } |
58 | else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) ) | ||
59 | { | ||
48 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 60 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
@@ -51,7 +63,13 @@ void OPimNotifyManager::add( const OPimNotify& noti) { | |||
51 | } | 63 | } |
52 | void OPimNotifyManager::remove( const OPimNotify& noti) { | 64 | |
53 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 65 | |
66 | void OPimNotifyManager::remove( const OPimNotify& noti ) | ||
67 | { | ||
68 | if ( noti.type() == QString::fromLatin1( "OPimReminder" ) ) | ||
69 | { | ||
54 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 70 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
55 | m_rem.remove( rem ); | 71 | m_rem.remove( rem ); |
56 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 72 | } |
73 | else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) ) | ||
74 | { | ||
57 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 75 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
@@ -60,4 +78,8 @@ void OPimNotifyManager::remove( const OPimNotify& noti) { | |||
60 | } | 78 | } |
61 | void OPimNotifyManager::replace( const OPimNotify& noti) { | 79 | |
62 | if ( noti.type() == QString::fromLatin1("OPimReminder") ) { | 80 | |
81 | void OPimNotifyManager::replace( const OPimNotify& noti ) | ||
82 | { | ||
83 | if ( noti.type() == QString::fromLatin1( "OPimReminder" ) ) | ||
84 | { | ||
63 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); | 85 | const OPimReminder& rem = static_cast<const OPimReminder&>(noti); |
@@ -65,3 +87,5 @@ void OPimNotifyManager::replace( const OPimNotify& noti) { | |||
65 | m_rem.append( rem ); | 87 | m_rem.append( rem ); |
66 | }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { | 88 | } |
89 | else if ( noti.type() == QString::fromLatin1( "OPimAlarm" ) ) | ||
90 | { | ||
67 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); | 91 | const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); |
@@ -71,9 +95,18 @@ void OPimNotifyManager::replace( const OPimNotify& noti) { | |||
71 | } | 95 | } |
72 | OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { | 96 | |
97 | |||
98 | OPimNotifyManager::Reminders OPimNotifyManager::reminders() const | ||
99 | { | ||
73 | return m_rem; | 100 | return m_rem; |
74 | } | 101 | } |
75 | OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { | 102 | |
103 | |||
104 | OPimNotifyManager::Alarms OPimNotifyManager::alarms() const | ||
105 | { | ||
76 | return m_al; | 106 | return m_al; |
77 | } | 107 | } |
78 | OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const { | 108 | |
109 | |||
110 | OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found ) const | ||
111 | { | ||
79 | Alarms::ConstIterator it; | 112 | Alarms::ConstIterator it; |
@@ -81,3 +114,4 @@ OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found | |||
81 | 114 | ||
82 | for ( it = m_al.begin(); it != m_al.end(); ++it ){ | 115 | for ( it = m_al.begin(); it != m_al.end(); ++it ) |
116 | { | ||
83 | if ( (*it).dateTime() == when ) | 117 | if ( (*it).dateTime() == when ) |
@@ -93,8 +127,14 @@ OPimAlarm OPimNotifyManager::alarmAtDateTime( const QDateTime& when, bool& found | |||
93 | 127 | ||
94 | void OPimNotifyManager::setAlarms( const Alarms& al) { | 128 | void OPimNotifyManager::setAlarms( const Alarms& al ) |
129 | { | ||
95 | m_al = al; | 130 | m_al = al; |
96 | } | 131 | } |
97 | void OPimNotifyManager::setReminders( const Reminders& rem) { | 132 | |
133 | |||
134 | void OPimNotifyManager::setReminders( const Reminders& rem ) | ||
135 | { | ||
98 | m_rem = rem; | 136 | m_rem = rem; |
99 | } | 137 | } |
138 | |||
139 | |||
100 | /* FIXME!!! */ | 140 | /* FIXME!!! */ |
@@ -107,5 +147,7 @@ void OPimNotifyManager::setReminders( const Reminders& rem) { | |||
107 | */ | 147 | */ |
108 | void OPimNotifyManager::registerNotify( const OPimNotify& ) { | 148 | void OPimNotifyManager::registerNotify( const OPimNotify& ) |
109 | 149 | { | |
110 | } | 150 | } |
151 | |||
152 | |||
111 | /* FIXME!!! */ | 153 | /* FIXME!!! */ |
@@ -116,7 +158,9 @@ void OPimNotifyManager::registerNotify( const OPimNotify& ) { | |||
116 | */ | 158 | */ |
117 | void OPimNotifyManager::deregister( const OPimNotify& ) { | 159 | void OPimNotifyManager::deregister( const OPimNotify& ) |
118 | 160 | { | |
119 | } | 161 | } |
120 | 162 | ||
121 | bool OPimNotifyManager::isEmpty()const { | 163 | |
164 | bool OPimNotifyManager::isEmpty() const | ||
165 | { | ||
122 | qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); | 166 | qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); |
@@ -126,3 +170,4 @@ bool OPimNotifyManager::isEmpty()const { | |||
126 | 170 | ||
127 | // Taken from otodoaccessxml.. | 171 | |
172 | // Taken from otodoaccessxml.. code duplication bad. any alternative? | ||
128 | QString OPimNotifyManager::alarmsToString() const | 173 | QString OPimNotifyManager::alarmsToString() const |
@@ -132,8 +177,11 @@ QString OPimNotifyManager::alarmsToString() const | |||
132 | OPimNotifyManager::Alarms alarms = m_al; | 177 | OPimNotifyManager::Alarms alarms = m_al; |
133 | if ( !alarms.isEmpty() ) { | 178 | if ( !alarms.isEmpty() ) |
179 | { | ||
134 | QStringList als; | 180 | QStringList als; |
135 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); | 181 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); |
136 | for ( ; it != alarms.end(); ++it ) { | 182 | for ( ; it != alarms.end(); ++it ) |
183 | { | ||
137 | /* only if time is valid */ | 184 | /* only if time is valid */ |
138 | if ( (*it).dateTime().isValid() ) { | 185 | if ( ( *it ).dateTime().isValid() ) |
186 | { | ||
139 | als << OConversion::dateTimeToString( (*it).dateTime() ) | 187 | als << OConversion::dateTimeToString( (*it).dateTime() ) |
@@ -151,2 +199,4 @@ QString OPimNotifyManager::alarmsToString() const | |||
151 | } | 199 | } |
200 | |||
201 | |||
152 | QString OPimNotifyManager::remindersToString() const | 202 | QString OPimNotifyManager::remindersToString() const |
@@ -156,6 +206,8 @@ QString OPimNotifyManager::remindersToString() const | |||
156 | OPimNotifyManager::Reminders reminders = m_rem; | 206 | OPimNotifyManager::Reminders reminders = m_rem; |
157 | if (!reminders.isEmpty() ) { | 207 | if ( !reminders.isEmpty() ) |
208 | { | ||
158 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); | 209 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); |
159 | QStringList records; | 210 | QStringList records; |
160 | for ( ; it != reminders.end(); ++it ) { | 211 | for ( ; it != reminders.end(); ++it ) |
212 | { | ||
161 | records << QString::number( (*it).recordUid() ); | 213 | records << QString::number( (*it).recordUid() ); |
@@ -168,2 +220,3 @@ QString OPimNotifyManager::remindersToString() const | |||
168 | 220 | ||
221 | |||
169 | void OPimNotifyManager::alarmsFromString( const QString& str ) | 222 | void OPimNotifyManager::alarmsFromString( const QString& str ) |
@@ -171,3 +224,4 @@ void OPimNotifyManager::alarmsFromString( const QString& str ) | |||
171 | QStringList als = QStringList::split(";", str ); | 224 | QStringList als = QStringList::split(";", str ); |
172 | for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { | 225 | for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) |
226 | { | ||
173 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty | 227 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty |
@@ -182,2 +236,3 @@ void OPimNotifyManager::alarmsFromString( const QString& str ) | |||
182 | 236 | ||
237 | |||
183 | void OPimNotifyManager::remindersFromString( const QString& str ) | 238 | void OPimNotifyManager::remindersFromString( const QString& str ) |
@@ -186,3 +241,4 @@ void OPimNotifyManager::remindersFromString( const QString& str ) | |||
186 | QStringList rems = QStringList::split(";", str ); | 241 | QStringList rems = QStringList::split(";", str ); |
187 | for (QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) { | 242 | for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) |
243 | { | ||
188 | OPimReminder rem( (*it).toInt() ); | 244 | OPimReminder rem( (*it).toInt() ); |
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h index 0272e5d..9241ea2 100644 --- a/libopie2/opiepim/core/opimnotifymanager.h +++ b/libopie2/opiepim/core/opimnotifymanager.h | |||
@@ -28,10 +28,13 @@ | |||
28 | */ | 28 | */ |
29 | #ifndef OPIE_PIM_NOTIFY_MANAGER_H | 29 | #ifndef OPIMNOTIFYMANAGER_H |
30 | #define OPIE_PIM_NOTIFY_MANAGER_H | 30 | #define OPIMNOTIFYMANAGER_H |
31 | |||
32 | #include <qvaluelist.h> | ||
33 | 31 | ||
32 | /* OPIE */ | ||
34 | #include <opie2/opimnotify.h> | 33 | #include <opie2/opimnotify.h> |
35 | 34 | ||
36 | namespace Opie { | 35 | /* QT */ |
36 | #include <qvaluelist.h> | ||
37 | |||
38 | namespace Opie | ||
39 | { | ||
37 | /** | 40 | /** |
@@ -39,3 +42,4 @@ namespace Opie { | |||
39 | */ | 42 | */ |
40 | class OPimNotifyManager { | 43 | class OPimNotifyManager |
44 | { | ||
41 | public: | 45 | public: |
@@ -108,4 +112,2 @@ public: | |||
108 | 112 | ||
109 | |||
110 | |||
111 | private: | 113 | private: |
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index 72bb372..c603f44 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp | |||
@@ -28,4 +28,6 @@ | |||
28 | */ | 28 | */ |
29 | #include <qarray.h> | ||
30 | 29 | ||
30 | #include "opimrecord.h" | ||
31 | |||
32 | /* OPIE */ | ||
31 | #include <qpe/categories.h> | 33 | #include <qpe/categories.h> |
@@ -33,5 +35,7 @@ | |||
33 | 35 | ||
34 | #include <opie2/opimrecord.h> | 36 | /* QT */ |
37 | #include <qarray.h> | ||
35 | 38 | ||
36 | namespace Opie { | 39 | namespace Opie |
40 | { | ||
37 | Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); | 41 | Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); |
@@ -40,3 +44,4 @@ Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); | |||
40 | OPimRecord::OPimRecord( int uid ) | 44 | OPimRecord::OPimRecord( int uid ) |
41 | : Qtopia::Record() { | 45 | : Qtopia::Record() |
46 | { | ||
42 | 47 | ||
@@ -45,4 +50,8 @@ OPimRecord::OPimRecord( int uid ) | |||
45 | } | 50 | } |
46 | OPimRecord::~OPimRecord() { | 51 | |
47 | } | 52 | |
53 | OPimRecord::~OPimRecord() | ||
54 | {} | ||
55 | |||
56 | |||
48 | OPimRecord::OPimRecord( const OPimRecord& rec ) | 57 | OPimRecord::OPimRecord( const OPimRecord& rec ) |
@@ -53,3 +62,5 @@ OPimRecord::OPimRecord( const OPimRecord& rec ) | |||
53 | 62 | ||
54 | OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { | 63 | |
64 | OPimRecord &OPimRecord::operator=( const OPimRecord& rec ) | ||
65 | { | ||
55 | if ( this == &rec ) return *this; | 66 | if ( this == &rec ) return *this; |
@@ -62,2 +73,4 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { | |||
62 | } | 73 | } |
74 | |||
75 | |||
63 | /* | 76 | /* |
@@ -65,3 +78,4 @@ OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { | |||
65 | */ | 78 | */ |
66 | QStringList OPimRecord::categoryNames( const QString& appname ) const { | 79 | QStringList OPimRecord::categoryNames( const QString& appname ) const |
80 | { | ||
67 | QStringList list; | 81 | QStringList list; |
@@ -71,3 +85,4 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const { | |||
71 | 85 | ||
72 | for (uint i = 0; i < cats.count(); i++ ) { | 86 | for ( uint i = 0; i < cats.count(); i++ ) |
87 | { | ||
73 | list << catDB.label( appname, cats[i] ); | 88 | list << catDB.label( appname, cats[i] ); |
@@ -77,6 +92,11 @@ QStringList OPimRecord::categoryNames( const QString& appname ) const { | |||
77 | } | 92 | } |
78 | void OPimRecord::setCategoryNames( const QStringList& ) { | ||
79 | 93 | ||
94 | |||
95 | void OPimRecord::setCategoryNames( const QStringList& ) | ||
96 | { | ||
80 | } | 97 | } |
81 | void OPimRecord::addCategoryName( const QString& ) { | 98 | |
99 | |||
100 | void OPimRecord::addCategoryName( const QString& ) | ||
101 | { | ||
82 | Categories catDB; | 102 | Categories catDB; |
@@ -86,5 +106,10 @@ void OPimRecord::addCategoryName( const QString& ) { | |||
86 | } | 106 | } |
87 | bool OPimRecord::isEmpty()const { | 107 | |
108 | |||
109 | bool OPimRecord::isEmpty() const | ||
110 | { | ||
88 | return ( uid() == 0 ); | 111 | return ( uid() == 0 ); |
89 | } | 112 | } |
113 | |||
114 | |||
90 | /*QString OPimRecord::crossToString()const { | 115 | /*QString OPimRecord::crossToString()const { |
@@ -104,3 +129,4 @@ bool OPimRecord::isEmpty()const { | |||
104 | /* if uid = 1 assign a new one */ | 129 | /* if uid = 1 assign a new one */ |
105 | void OPimRecord::setUid( int uid ) { | 130 | void OPimRecord::setUid( int uid ) |
131 | { | ||
106 | if ( uid == 1) | 132 | if ( uid == 1) |
@@ -110,9 +136,18 @@ void OPimRecord::setUid( int uid ) { | |||
110 | }; | 136 | }; |
111 | Qtopia::UidGen &OPimRecord::uidGen() { | 137 | |
138 | |||
139 | Qtopia::UidGen &OPimRecord::uidGen() | ||
140 | { | ||
112 | return m_uidGen; | 141 | return m_uidGen; |
113 | } | 142 | } |
114 | OPimXRefManager &OPimRecord::xrefmanager() { | 143 | |
144 | |||
145 | OPimXRefManager &OPimRecord::xrefmanager() | ||
146 | { | ||
115 | return m_xrefman; | 147 | return m_xrefman; |
116 | } | 148 | } |
117 | int OPimRecord::rtti(){ | 149 | |
150 | |||
151 | int OPimRecord::rtti() | ||
152 | { | ||
118 | return 0; | 153 | return 0; |
@@ -128,3 +163,4 @@ int OPimRecord::rtti(){ | |||
128 | */ | 163 | */ |
129 | bool OPimRecord::loadFromStream( QDataStream& stream ) { | 164 | bool OPimRecord::loadFromStream( QDataStream& stream ) |
165 | { | ||
130 | int Int; | 166 | int Int; |
@@ -137,3 +173,4 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { | |||
137 | QArray<int> array(UInt); | 173 | QArray<int> array(UInt); |
138 | for (uint i = 0; i < UInt; i++ ) { | 174 | for ( uint i = 0; i < UInt; i++ ) |
175 | { | ||
139 | stream >> array[i]; | 176 | stream >> array[i]; |
@@ -147,3 +184,4 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { | |||
147 | stream >> UInt; | 184 | stream >> UInt; |
148 | for ( uint i = 0; i < UInt; i++ ) { | 185 | for ( uint i = 0; i < UInt; i++ ) |
186 | { | ||
149 | xref.setPartner( OPimXRef::One, partner( stream ) ); | 187 | xref.setPartner( OPimXRef::One, partner( stream ) ); |
@@ -155,3 +193,6 @@ bool OPimRecord::loadFromStream( QDataStream& stream ) { | |||
155 | } | 193 | } |
156 | bool OPimRecord::saveToStream( QDataStream& stream )const { | 194 | |
195 | |||
196 | bool OPimRecord::saveToStream( QDataStream& stream ) const | ||
197 | { | ||
157 | /** UIDs */ | 198 | /** UIDs */ |
@@ -162,3 +203,4 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { | |||
162 | stream << categories().count(); | 203 | stream << categories().count(); |
163 | for ( uint i = 0; i < categories().count(); i++ ) { | 204 | for ( uint i = 0; i < categories().count(); i++ ) |
205 | { | ||
164 | stream << categories()[i]; | 206 | stream << categories()[i]; |
@@ -172,3 +214,4 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { | |||
172 | for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin(); | 214 | for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin(); |
173 | it != m_xrefman.list().end(); ++it ) { | 215 | it != m_xrefman.list().end(); ++it ) |
216 | { | ||
174 | flush( (*it).partner( OPimXRef::One), stream ); | 217 | flush( (*it).partner( OPimXRef::One), stream ); |
@@ -178,3 +221,6 @@ bool OPimRecord::saveToStream( QDataStream& stream )const { | |||
178 | } | 221 | } |
179 | void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{ | 222 | |
223 | |||
224 | void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const | ||
225 | { | ||
180 | str << par.service(); | 226 | str << par.service(); |
@@ -183,3 +229,6 @@ void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{ | |||
183 | } | 229 | } |
184 | OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { | 230 | |
231 | |||
232 | OPimXRefPartner OPimRecord::partner( QDataStream& stream ) | ||
233 | { | ||
185 | OPimXRefPartner par; | 234 | OPimXRefPartner par; |
@@ -199,12 +248,24 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) { | |||
199 | } | 248 | } |
200 | void OPimRecord::setLastHitField( int lastHit )const { | 249 | |
250 | |||
251 | void OPimRecord::setLastHitField( int lastHit ) const | ||
252 | { | ||
201 | m_lastHit = lastHit; | 253 | m_lastHit = lastHit; |
202 | } | 254 | } |
203 | int OPimRecord::lastHitField()const{ | 255 | |
256 | |||
257 | int OPimRecord::lastHitField() const | ||
258 | { | ||
204 | return m_lastHit; | 259 | return m_lastHit; |
205 | } | 260 | } |
206 | QMap<QString, QString> OPimRecord::toExtraMap()const { | 261 | |
262 | |||
263 | QMap<QString, QString> OPimRecord::toExtraMap() const | ||
264 | { | ||
207 | return customMap; | 265 | return customMap; |
208 | } | 266 | } |
209 | void OPimRecord::setExtraMap( const QMap<QString, QString>& map) { | 267 | |
268 | |||
269 | void OPimRecord::setExtraMap( const QMap<QString, QString>& map ) | ||
270 | { | ||
210 | customMap = map; | 271 | customMap = map; |
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h index 63a3a98..4981a41 100644 --- a/libopie2/opiepim/core/opimrecord.h +++ b/libopie2/opiepim/core/opimrecord.h | |||
@@ -28,10 +28,8 @@ | |||
28 | */ | 28 | */ |
29 | #ifndef OPIE_PIM_RECORD_H | ||
30 | #define OPIE_PIM_RECORD_H | ||
31 | 29 | ||
32 | #include <qdatastream.h> | 30 | #ifndef OPIMRECORD_H |
33 | #include <qmap.h> | 31 | #define OPIMRECORD_H |
34 | #include <qstring.h> | ||
35 | #include <qstringlist.h> | ||
36 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/opimxrefmanager.h> | ||
37 | /* | 35 | /* |
@@ -43,5 +41,10 @@ | |||
43 | 41 | ||
44 | #include <opie2/opimxrefmanager.h> | 42 | /* QT */ |
43 | #include <qdatastream.h> | ||
44 | #include <qmap.h> | ||
45 | #include <qstring.h> | ||
46 | #include <qstringlist.h> | ||
45 | 47 | ||
46 | namespace Opie { | 48 | namespace Opie |
49 | { | ||
47 | /** | 50 | /** |
@@ -51,3 +54,4 @@ namespace Opie { | |||
51 | */ | 54 | */ |
52 | class OPimRecord : public Qtopia::Record { | 55 | class OPimRecord : public Qtopia::Record |
56 | { | ||
53 | public: | 57 | public: |
@@ -112,4 +116,6 @@ public: | |||
112 | virtual bool match( const QString ®exp ) const | 116 | virtual bool match( const QString ®exp ) const |
113 | {setLastHitField( -1 ); | 117 | { |
114 | return Qtopia::Record::match(QRegExp(regexp));}; | 118 | setLastHitField( -1 ); |
119 | return Qtopia::Record::match( QRegExp( regexp ) ); | ||
120 | }; | ||
115 | 121 | ||
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index f1a22a7..fa5313f 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -2,3 +2,3 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) Stefan Eilers <eilers.stefan@epost.de> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
@@ -29,27 +29,9 @@ | |||
29 | 29 | ||
30 | /********************************************************************** | ||
31 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
32 | ** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) | ||
33 | ** | ||
34 | ** This file may be distributed and/or modified under the terms of the | ||
35 | ** GNU General Public License version 2 as published by the Free Software | ||
36 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
37 | ** packaging of this file. | ||
38 | ** | ||
39 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
40 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
41 | ** | ||
42 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
43 | ** | ||
44 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
45 | ** not clear to you. | ||
46 | ** | ||
47 | **********************************************************************/ | ||
48 | |||
49 | #define QTOPIA_INTERNAL_CONTACT_MRE | 30 | #define QTOPIA_INTERNAL_CONTACT_MRE |
50 | 31 | ||
51 | #include <opie2/ocontact.h> | 32 | #include "ocontact.h" |
33 | |||
34 | /* OPIE */ | ||
52 | #include <opie2/opimresolver.h> | 35 | #include <opie2/opimresolver.h> |
53 | #include <opie2/oconversion.h> | 36 | #include <opie2/oconversion.h> |
54 | |||
55 | #include <qpe/stringutil.h> | 37 | #include <qpe/stringutil.h> |
@@ -58,2 +40,3 @@ | |||
58 | 40 | ||
41 | /* QT */ | ||
59 | #include <qobject.h> | 42 | #include <qobject.h> |
@@ -64,2 +47,3 @@ | |||
64 | 47 | ||
48 | /* STD */ | ||
65 | #include <stdio.h> | 49 | #include <stdio.h> |
@@ -78,3 +62,4 @@ | |||
78 | 62 | ||
79 | namespace Opie { | 63 | namespace Opie |
64 | { | ||
80 | /*! | 65 | /*! |
@@ -82,6 +67,4 @@ namespace Opie { | |||
82 | */ | 67 | */ |
83 | OContact::OContact() | 68 | OContact::OContact():OPimRecord(), mMap(), d( 0 ) |
84 | : OPimRecord(), mMap(), d( 0 ) | 69 | {} |
85 | { | ||
86 | } | ||
87 | 70 | ||
@@ -92,4 +75,3 @@ OContact::OContact() | |||
92 | */ | 75 | */ |
93 | OContact::OContact( const QMap<int, QString> &fromMap ) : | 76 | OContact::OContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 ) |
94 | OPimRecord(), mMap( fromMap ), d( 0 ) | ||
95 | { | 77 | { |
@@ -101,6 +83,8 @@ OContact::OContact( const QMap<int, QString> &fromMap ) : | |||
101 | 83 | ||
102 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ | 84 | if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) |
85 | { | ||
103 | qWarning( "Invalid UID found. Generate new one.." ); | 86 | qWarning( "Invalid UID found. Generate new one.." ); |
104 | setUid( uidGen().generate() ); | 87 | setUid( uidGen().generate() ); |
105 | }else | 88 | } |
89 | else | ||
106 | setUid( uidStr.toInt() ); | 90 | setUid( uidStr.toInt() ); |
@@ -115,4 +99,3 @@ OContact::OContact( const QMap<int, QString> &fromMap ) : | |||
115 | OContact::~OContact() | 99 | OContact::~OContact() |
116 | { | 100 | {} |
117 | } | ||
118 | 101 | ||
@@ -483,3 +466,4 @@ QString OContact::toRichText() const | |||
483 | comp = company(); | 466 | comp = company(); |
484 | if ( !(value = department()).isEmpty() ) { | 467 | if ( !( value = department() ).isEmpty() ) |
468 | { | ||
485 | text += Qtopia::escapeString(value); | 469 | text += Qtopia::escapeString(value); |
@@ -487,3 +471,4 @@ QString OContact::toRichText() const | |||
487 | text += ", " + Qtopia::escapeString(comp); | 471 | text += ", " + Qtopia::escapeString(comp); |
488 | }else if ( comp ) | 472 | } |
473 | else if ( comp ) | ||
489 | text += "<br>" + Qtopia::escapeString(comp); | 474 | text += "<br>" + Qtopia::escapeString(comp); |
@@ -493,3 +478,4 @@ QString OContact::toRichText() const | |||
493 | QString defEmail = defaultEmail(); | 478 | QString defEmail = defaultEmail(); |
494 | if ( !defEmail.isEmpty() ){ | 479 | if ( !defEmail.isEmpty() ) |
480 | { | ||
495 | text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" | 481 | text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" |
@@ -501,3 +487,4 @@ QString OContact::toRichText() const | |||
501 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 487 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
502 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 488 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) |
489 | { | ||
503 | text += QObject::tr( "<br><b>Work Address:</b>" ); | 490 | text += QObject::tr( "<br><b>Work Address:</b>" ); |
@@ -506,3 +493,4 @@ QString OContact::toRichText() const | |||
506 | 493 | ||
507 | if ( !(value = businessStreet()).isEmpty() ){ | 494 | if ( !( value = businessStreet() ).isEmpty() ) |
495 | { | ||
508 | text += "<br>" + Qtopia::escapeString(value); | 496 | text += "<br>" + Qtopia::escapeString(value); |
@@ -511,6 +499,9 @@ QString OContact::toRichText() const | |||
511 | 499 | ||
512 | switch( addressformat ){ | 500 | switch ( addressformat ) |
513 | case Zip_City_State:{ // Zip_Code City, State | 501 | { |
502 | case Zip_City_State: | ||
503 | { // Zip_Code City, State | ||
514 | state = businessState(); | 504 | state = businessState(); |
515 | if ( !(value = businessZip()).isEmpty() ){ | 505 | if ( !( value = businessZip() ).isEmpty() ) |
506 | { | ||
516 | text += "<br>" + Qtopia::escapeString(value) + " "; | 507 | text += "<br>" + Qtopia::escapeString(value) + " "; |
@@ -519,3 +510,4 @@ QString OContact::toRichText() const | |||
519 | } | 510 | } |
520 | if ( !(value = businessCity()).isEmpty() ) { | 511 | if ( !( value = businessCity() ).isEmpty() ) |
512 | { | ||
521 | marker = true; | 513 | marker = true; |
@@ -526,3 +518,5 @@ QString OContact::toRichText() const | |||
526 | text += ", " + Qtopia::escapeString(state); | 518 | text += ", " + Qtopia::escapeString(state); |
527 | } else if ( !state.isEmpty() ){ | 519 | } |
520 | else if ( !state.isEmpty() ) | ||
521 | { | ||
528 | text += "<br>" + Qtopia::escapeString(state); | 522 | text += "<br>" + Qtopia::escapeString(state); |
@@ -532,5 +526,7 @@ QString OContact::toRichText() const | |||
532 | } | 526 | } |
533 | case City_State_Zip:{ // City, State Zip_Code | 527 | case City_State_Zip: |
528 | { // City, State Zip_Code | ||
534 | state = businessState(); | 529 | state = businessState(); |
535 | if ( !(value = businessCity()).isEmpty() ) { | 530 | if ( !( value = businessCity() ).isEmpty() ) |
531 | { | ||
536 | marker = true; | 532 | marker = true; |
@@ -539,3 +535,5 @@ QString OContact::toRichText() const | |||
539 | text += ", " + Qtopia::escapeString(state); | 535 | text += ", " + Qtopia::escapeString(state); |
540 | } else if ( !state.isEmpty() ){ | 536 | } |
537 | else if ( !state.isEmpty() ) | ||
538 | { | ||
541 | text += "<br>" + Qtopia::escapeString(state); | 539 | text += "<br>" + Qtopia::escapeString(state); |
@@ -543,3 +541,4 @@ QString OContact::toRichText() const | |||
543 | } | 541 | } |
544 | if ( !(value = businessZip()).isEmpty() ){ | 542 | if ( !( value = businessZip() ).isEmpty() ) |
543 | { | ||
545 | text += " " + Qtopia::escapeString(value); | 544 | text += " " + Qtopia::escapeString(value); |
@@ -551,3 +550,4 @@ QString OContact::toRichText() const | |||
551 | 550 | ||
552 | if ( !(value = businessCountry()).isEmpty() ){ | 551 | if ( !( value = businessCountry() ).isEmpty() ) |
552 | { | ||
553 | text += "<br>" + Qtopia::escapeString(value); | 553 | text += "<br>" + Qtopia::escapeString(value); |
@@ -558,3 +558,4 @@ QString OContact::toRichText() const | |||
558 | str = office(); | 558 | str = office(); |
559 | if ( !str.isEmpty() ){ | 559 | if ( !str.isEmpty() ) |
560 | { | ||
560 | text += "<br><b>" + QObject::tr("Office: ") + "</b>" | 561 | text += "<br><b>" + QObject::tr("Office: ") + "</b>" |
@@ -564,3 +565,4 @@ QString OContact::toRichText() const | |||
564 | str = businessWebpage(); | 565 | str = businessWebpage(); |
565 | if ( !str.isEmpty() ){ | 566 | if ( !str.isEmpty() ) |
567 | { | ||
566 | text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" | 568 | text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" |
@@ -570,3 +572,4 @@ QString OContact::toRichText() const | |||
570 | str = businessPhone(); | 572 | str = businessPhone(); |
571 | if ( !str.isEmpty() ){ | 573 | if ( !str.isEmpty() ) |
574 | { | ||
572 | text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" | 575 | text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" |
@@ -576,3 +579,4 @@ QString OContact::toRichText() const | |||
576 | str = businessFax(); | 579 | str = businessFax(); |
577 | if ( !str.isEmpty() ){ | 580 | if ( !str.isEmpty() ) |
581 | { | ||
578 | text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" | 582 | text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" |
@@ -582,3 +586,4 @@ QString OContact::toRichText() const | |||
582 | str = businessMobile(); | 586 | str = businessMobile(); |
583 | if ( !str.isEmpty() ){ | 587 | if ( !str.isEmpty() ) |
588 | { | ||
584 | text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" | 589 | text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" |
@@ -588,3 +593,4 @@ QString OContact::toRichText() const | |||
588 | str = businessPager(); | 593 | str = businessPager(); |
589 | if ( !str.isEmpty() ){ | 594 | if ( !str.isEmpty() ) |
595 | { | ||
590 | text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" | 596 | text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" |
@@ -598,3 +604,4 @@ QString OContact::toRichText() const | |||
598 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 604 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
599 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 605 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) |
606 | { | ||
600 | text += QObject::tr( "<br><b>Home Address:</b>" ); | 607 | text += QObject::tr( "<br><b>Home Address:</b>" ); |
@@ -603,3 +610,4 @@ QString OContact::toRichText() const | |||
603 | 610 | ||
604 | if ( !(value = homeStreet()).isEmpty() ){ | 611 | if ( !( value = homeStreet() ).isEmpty() ) |
612 | { | ||
605 | text += "<br>" + Qtopia::escapeString(value); | 613 | text += "<br>" + Qtopia::escapeString(value); |
@@ -608,6 +616,9 @@ QString OContact::toRichText() const | |||
608 | 616 | ||
609 | switch( addressformat ){ | 617 | switch ( addressformat ) |
610 | case Zip_City_State:{ // Zip_Code City, State | 618 | { |
619 | case Zip_City_State: | ||
620 | { // Zip_Code City, State | ||
611 | state = homeState(); | 621 | state = homeState(); |
612 | if ( !(value = homeZip()).isEmpty() ){ | 622 | if ( !( value = homeZip() ).isEmpty() ) |
623 | { | ||
613 | text += "<br>" + Qtopia::escapeString(value) + " "; | 624 | text += "<br>" + Qtopia::escapeString(value) + " "; |
@@ -615,3 +626,4 @@ QString OContact::toRichText() const | |||
615 | } | 626 | } |
616 | if ( !(value = homeCity()).isEmpty() ) { | 627 | if ( !( value = homeCity() ).isEmpty() ) |
628 | { | ||
617 | marker = true; | 629 | marker = true; |
@@ -622,3 +634,5 @@ QString OContact::toRichText() const | |||
622 | text += ", " + Qtopia::escapeString(state); | 634 | text += ", " + Qtopia::escapeString(state); |
623 | } else if (!state.isEmpty()) { | 635 | } |
636 | else if ( !state.isEmpty() ) | ||
637 | { | ||
624 | text += "<br>" + Qtopia::escapeString(state); | 638 | text += "<br>" + Qtopia::escapeString(state); |
@@ -628,5 +642,7 @@ QString OContact::toRichText() const | |||
628 | } | 642 | } |
629 | case City_State_Zip:{ // City, State Zip_Code | 643 | case City_State_Zip: |
644 | { // City, State Zip_Code | ||
630 | state = homeState(); | 645 | state = homeState(); |
631 | if ( !(value = homeCity()).isEmpty() ) { | 646 | if ( !( value = homeCity() ).isEmpty() ) |
647 | { | ||
632 | marker = true; | 648 | marker = true; |
@@ -635,3 +651,5 @@ QString OContact::toRichText() const | |||
635 | text += ", " + Qtopia::escapeString(state); | 651 | text += ", " + Qtopia::escapeString(state); |
636 | } else if ( !state.isEmpty() ){ | 652 | } |
653 | else if ( !state.isEmpty() ) | ||
654 | { | ||
637 | text += "<br>" + Qtopia::escapeString(state); | 655 | text += "<br>" + Qtopia::escapeString(state); |
@@ -639,3 +657,4 @@ QString OContact::toRichText() const | |||
639 | } | 657 | } |
640 | if ( !(value = homeZip()).isEmpty() ){ | 658 | if ( !( value = homeZip() ).isEmpty() ) |
659 | { | ||
641 | text += " " + Qtopia::escapeString(value); | 660 | text += " " + Qtopia::escapeString(value); |
@@ -647,3 +666,4 @@ QString OContact::toRichText() const | |||
647 | 666 | ||
648 | if ( !(value = homeCountry()).isEmpty() ){ | 667 | if ( !( value = homeCountry() ).isEmpty() ) |
668 | { | ||
649 | text += "<br>" + Qtopia::escapeString(value); | 669 | text += "<br>" + Qtopia::escapeString(value); |
@@ -654,3 +674,4 @@ QString OContact::toRichText() const | |||
654 | str = homeWebpage(); | 674 | str = homeWebpage(); |
655 | if ( !str.isEmpty() ){ | 675 | if ( !str.isEmpty() ) |
676 | { | ||
656 | text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" | 677 | text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" |
@@ -660,3 +681,4 @@ QString OContact::toRichText() const | |||
660 | str = homePhone(); | 681 | str = homePhone(); |
661 | if ( !str.isEmpty() ){ | 682 | if ( !str.isEmpty() ) |
683 | { | ||
662 | text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" | 684 | text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" |
@@ -666,3 +688,4 @@ QString OContact::toRichText() const | |||
666 | str = homeFax(); | 688 | str = homeFax(); |
667 | if ( !str.isEmpty() ){ | 689 | if ( !str.isEmpty() ) |
690 | { | ||
668 | text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" | 691 | text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" |
@@ -672,3 +695,4 @@ QString OContact::toRichText() const | |||
672 | str = homeMobile(); | 695 | str = homeMobile(); |
673 | if ( !str.isEmpty() ){ | 696 | if ( !str.isEmpty() ) |
697 | { | ||
674 | text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" | 698 | text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" |
@@ -699,3 +723,4 @@ QString OContact::toRichText() const | |||
699 | str = gender(); | 723 | str = gender(); |
700 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 724 | if ( !str.isEmpty() && str.toInt() != 0 ) |
725 | { | ||
701 | text += "<br>"; | 726 | text += "<br>"; |
@@ -711,3 +736,4 @@ QString OContact::toRichText() const | |||
711 | + Qtopia::escapeString(str); | 736 | + Qtopia::escapeString(str); |
712 | if ( birthday().isValid() ){ | 737 | if ( birthday().isValid() ) |
738 | { | ||
713 | str = TimeString::numberDateString( birthday() ); | 739 | str = TimeString::numberDateString( birthday() ); |
@@ -716,3 +742,4 @@ QString OContact::toRichText() const | |||
716 | } | 742 | } |
717 | if ( anniversary().isValid() ){ | 743 | if ( anniversary().isValid() ) |
744 | { | ||
718 | str = TimeString::numberDateString( anniversary() ); | 745 | str = TimeString::numberDateString( anniversary() ); |
@@ -732,3 +759,4 @@ QString OContact::toRichText() const | |||
732 | // categories | 759 | // categories |
733 | if ( categoryNames("Contacts").count() ){ | 760 | if ( categoryNames( "Contacts" ).count() ) |
761 | { | ||
734 | text += "<br><b>" + QObject::tr( "Category:") + "</b> "; | 762 | text += "<br><b>" + QObject::tr( "Category:") + "</b> "; |
@@ -738,3 +766,4 @@ QString OContact::toRichText() const | |||
738 | // notes last | 766 | // notes last |
739 | if ( !(value = notes()).isEmpty() ) { | 767 | if ( !( value = notes() ).isEmpty() ) |
768 | { | ||
740 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; | 769 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; |
@@ -839,3 +868,4 @@ QString OContact::fullName() const | |||
839 | QString name = title; | 868 | QString name = title; |
840 | if ( !firstName.isEmpty() ) { | 869 | if ( !firstName.isEmpty() ) |
870 | { | ||
841 | if ( !name.isEmpty() ) | 871 | if ( !name.isEmpty() ) |
@@ -844,3 +874,4 @@ QString OContact::fullName() const | |||
844 | } | 874 | } |
845 | if ( !middleName.isEmpty() ) { | 875 | if ( !middleName.isEmpty() ) |
876 | { | ||
846 | if ( !name.isEmpty() ) | 877 | if ( !name.isEmpty() ) |
@@ -849,3 +880,4 @@ QString OContact::fullName() const | |||
849 | } | 880 | } |
850 | if ( !lastName.isEmpty() ) { | 881 | if ( !lastName.isEmpty() ) |
882 | { | ||
851 | if ( !name.isEmpty() ) | 883 | if ( !name.isEmpty() ) |
@@ -854,3 +886,4 @@ QString OContact::fullName() const | |||
854 | } | 886 | } |
855 | if ( !suffix.isEmpty() ) { | 887 | if ( !suffix.isEmpty() ) |
888 | { | ||
856 | if ( !name.isEmpty() ) | 889 | if ( !name.isEmpty() ) |
@@ -902,3 +935,4 @@ QStringList OContact::emailList() const | |||
902 | QStringList r; | 935 | QStringList r; |
903 | if ( !emailStr.isEmpty() ) { | 936 | if ( !emailStr.isEmpty() ) |
937 | { | ||
904 | qDebug(" emailstr "); | 938 | qDebug(" emailstr "); |
@@ -948,6 +982,8 @@ void OContact::save( QString &buf ) const | |||
948 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 982 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
949 | it != mMap.end(); ++it ) { | 983 | it != mMap.end(); ++it ) |
984 | { | ||
950 | const QString &value = it.data(); | 985 | const QString &value = it.data(); |
951 | int key = it.key(); | 986 | int key = it.key(); |
952 | if ( !value.isEmpty() ) { | 987 | if ( !value.isEmpty() ) |
988 | { | ||
953 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 989 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
@@ -1063,4 +1099,6 @@ bool OContact::match( const QRegExp &r ) const | |||
1063 | QMap<int, QString>::ConstIterator it; | 1099 | QMap<int, QString>::ConstIterator it; |
1064 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 1100 | for ( it = mMap.begin(); it != mMap.end(); ++it ) |
1065 | if ( (*it).find( r ) > -1 ) { | 1101 | { |
1102 | if ( ( *it ).find( r ) > -1 ) | ||
1103 | { | ||
1066 | setLastHitField( it.key() ); | 1104 | setLastHitField( it.key() ); |
@@ -1078,2 +1116,4 @@ QString OContact::toShortText() const | |||
1078 | } | 1116 | } |
1117 | |||
1118 | |||
1079 | QString OContact::type() const | 1119 | QString OContact::type() const |
@@ -1084,3 +1124,2 @@ QString OContact::type() const | |||
1084 | 1124 | ||
1085 | |||
1086 | class QString OContact::recordField( int pos ) const | 1125 | class QString OContact::recordField( int pos ) const |
@@ -1101,3 +1140,4 @@ void OContact::setBirthday( const QDate &v ) | |||
1101 | { | 1140 | { |
1102 | if ( v.isNull() ){ | 1141 | if ( v.isNull() ) |
1142 | { | ||
1103 | qWarning( "Remove Birthday"); | 1143 | qWarning( "Remove Birthday"); |
@@ -1119,3 +1159,4 @@ void OContact::setAnniversary( const QDate &v ) | |||
1119 | { | 1159 | { |
1120 | if ( v.isNull() ){ | 1160 | if ( v.isNull() ) |
1161 | { | ||
1121 | qWarning( "Remove Anniversary"); | 1162 | qWarning( "Remove Anniversary"); |
@@ -1129,2 +1170,3 @@ void OContact::setAnniversary( const QDate &v ) | |||
1129 | 1170 | ||
1171 | |||
1130 | /*! \fn QDate OContact::birthday() const | 1172 | /*! \fn QDate OContact::birthday() const |
@@ -1165,3 +1207,4 @@ void OContact::insertEmail( const QString &v ) | |||
1165 | // if no default, set it as the default email and don't insert | 1207 | // if no default, set it as the default email and don't insert |
1166 | if ( def.isEmpty() ) { | 1208 | if ( def.isEmpty() ) |
1209 | { | ||
1167 | setDefaultEmail( e ); // will insert into the list for us | 1210 | setDefaultEmail( e ); // will insert into the list for us |
@@ -1180,2 +1223,3 @@ void OContact::insertEmail( const QString &v ) | |||
1180 | 1223 | ||
1224 | |||
1181 | void OContact::removeEmail( const QString &v ) | 1225 | void OContact::removeEmail( const QString &v ) |
@@ -1199,3 +1243,4 @@ void OContact::removeEmail( const QString &v ) | |||
1199 | // if default, then replace the default email with the first one | 1243 | // if default, then replace the default email with the first one |
1200 | if ( def == e ) { | 1244 | if ( def == e ) |
1245 | { | ||
1201 | //qDebug("removeEmail is default; setting new default"); | 1246 | //qDebug("removeEmail is default; setting new default"); |
@@ -1207,2 +1252,4 @@ void OContact::removeEmail( const QString &v ) | |||
1207 | } | 1252 | } |
1253 | |||
1254 | |||
1208 | void OContact::clearEmails() | 1255 | void OContact::clearEmails() |
@@ -1212,2 +1259,4 @@ void OContact::clearEmails() | |||
1212 | } | 1259 | } |
1260 | |||
1261 | |||
1213 | void OContact::setDefaultEmail( const QString &v ) | 1262 | void OContact::setDefaultEmail( const QString &v ) |
@@ -1224,2 +1273,3 @@ void OContact::setDefaultEmail( const QString &v ) | |||
1224 | 1273 | ||
1274 | |||
1225 | void OContact::insertEmails( const QStringList &v ) | 1275 | void OContact::insertEmails( const QStringList &v ) |
@@ -1229,5 +1279,10 @@ void OContact::insertEmails( const QStringList &v ) | |||
1229 | } | 1279 | } |
1230 | int OContact::rtti() { | 1280 | |
1281 | |||
1282 | int OContact::rtti() | ||
1283 | { | ||
1231 | return OPimResolver::AddressBook; | 1284 | return OPimResolver::AddressBook; |
1232 | } | 1285 | } |
1286 | |||
1287 | |||
1233 | void OContact::setUid( int i ) | 1288 | void OContact::setUid( int i ) |
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h index 34888dc..445fd7d 100644 --- a/libopie2/opiepim/ocontact.h +++ b/libopie2/opiepim/ocontact.h | |||
@@ -28,5 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | #ifndef __OCONTACT_H__ | ||
30 | #define __OCONTACT_H__ | ||
31 | 29 | ||
30 | #ifndef OCONTACT_H | ||
31 | #define OCONTACT_H | ||
32 | |||
33 | /* OPIE */ | ||
32 | #include <opie2/opimrecord.h> | 34 | #include <opie2/opimrecord.h> |
@@ -34,2 +36,3 @@ | |||
34 | 36 | ||
37 | /* QT */ | ||
35 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
@@ -43,3 +46,4 @@ QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; | |||
43 | 46 | ||
44 | namespace Opie { | 47 | namespace Opie |
48 | { | ||
45 | class OContactPrivate; | 49 | class OContactPrivate; |
@@ -56,2 +60,3 @@ class QPC_EXPORT OContact : public OPimRecord | |||
56 | friend class DataSet; | 60 | friend class DataSet; |
61 | |||
57 | public: | 62 | public: |
diff --git a/libopie2/opiepim/ocontactfields.cpp b/libopie2/opiepim/ocontactfields.cpp index deaa1e5..bec00f7 100644 --- a/libopie2/opiepim/ocontactfields.cpp +++ b/libopie2/opiepim/ocontactfields.cpp | |||
@@ -2,3 +2,3 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) Stefan Eilers <eilers.stefan@epost.de> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
@@ -29,13 +29,16 @@ | |||
29 | 29 | ||
30 | #include <opie2/ocontactfields.h> | 30 | #include "ocontactfields.h" |
31 | 31 | ||
32 | #include <qstringlist.h> | 32 | /* OPIE */ |
33 | #include <opie2/ocontact.h> | ||
34 | #include <qpe/recordfields.h> // We should use our own enum in the future .. | ||
35 | #include <qpe/config.h> | ||
36 | |||
37 | /* QT */ | ||
33 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | #include <qstringlist.h> | ||
34 | 40 | ||
35 | // We should use our own enum in the future .. | ||
36 | #include <qpe/recordfields.h> | ||
37 | #include <qpe/config.h> | ||
38 | #include <opie2/ocontact.h> | ||
39 | 41 | ||
40 | namespace Opie { | 42 | namespace Opie |
43 | { | ||
41 | /*! | 44 | /*! |
@@ -425,3 +428,4 @@ OContactFields::OContactFields(): | |||
425 | 428 | ||
426 | OContactFields::~OContactFields(){ | 429 | OContactFields::~OContactFields() |
430 | { | ||
427 | 431 | ||
@@ -429,3 +433,4 @@ OContactFields::~OContactFields(){ | |||
429 | // to reuse it for the future.. | 433 | // to reuse it for the future.. |
430 | if ( changedFieldOrder ){ | 434 | if ( changedFieldOrder ) |
435 | { | ||
431 | Config cfg ( "AddressBook" ); | 436 | Config cfg ( "AddressBook" ); |
@@ -438,3 +443,4 @@ OContactFields::~OContactFields(){ | |||
438 | 443 | ||
439 | void OContactFields::saveToRecord( OContact &cnt ){ | 444 | void OContactFields::saveToRecord( OContact &cnt ) |
445 | { | ||
440 | 446 | ||
@@ -450,3 +456,4 @@ void OContactFields::saveToRecord( OContact &cnt ){ | |||
450 | 456 | ||
451 | void OContactFields::loadFromRecord( const OContact &cnt ){ | 457 | void OContactFields::loadFromRecord( const OContact &cnt ) |
458 | { | ||
452 | qDebug("ocontactfields loadFromRecord"); | 459 | qDebug("ocontactfields loadFromRecord"); |
@@ -461,3 +468,4 @@ void OContactFields::loadFromRecord( const OContact &cnt ){ | |||
461 | 468 | ||
462 | if (fieldOrder.isEmpty()){ | 469 | if ( fieldOrder.isEmpty() ) |
470 | { | ||
463 | fieldOrder = globalFieldOrder; | 471 | fieldOrder = globalFieldOrder; |
@@ -469,3 +477,4 @@ void OContactFields::loadFromRecord( const OContact &cnt ){ | |||
469 | 477 | ||
470 | void OContactFields::setFieldOrder( int num, int index ){ | 478 | void OContactFields::setFieldOrder( int num, int index ) |
479 | { | ||
471 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); | 480 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); |
@@ -482,3 +491,4 @@ void OContactFields::setFieldOrder( int num, int index ){ | |||
482 | 491 | ||
483 | int OContactFields::getFieldOrder( int num, int defIndex ){ | 492 | int OContactFields::getFieldOrder( int num, int defIndex ) |
493 | { | ||
484 | qDebug("ocontactfields getFieldOrder"); | 494 | qDebug("ocontactfields getFieldOrder"); |
diff --git a/libopie2/opiepim/ocontactfields.h b/libopie2/opiepim/ocontactfields.h index 993ce3b..9e89532 100644 --- a/libopie2/opiepim/ocontactfields.h +++ b/libopie2/opiepim/ocontactfields.h | |||
@@ -28,4 +28,5 @@ | |||
28 | */ | 28 | */ |
29 | #ifndef OPIE_CONTACTS_FIELDS | 29 | |
30 | #define OPIE_CONTACTS_FIELDS | 30 | #ifndef OCONTACTFIELDS_H |
31 | #define OCONTACTFIELDS_H | ||
31 | 32 | ||
@@ -33,5 +34,8 @@ class QStringList; | |||
33 | 34 | ||
35 | /* OPIE */ | ||
36 | #include <opie2/ocontact.h> | ||
37 | |||
38 | /* QT */ | ||
34 | #include <qmap.h> | 39 | #include <qmap.h> |
35 | #include <qstring.h> | 40 | #include <qstring.h> |
36 | #include <opie2/ocontact.h> | ||
37 | 41 | ||
@@ -40,4 +44,6 @@ class QStringList; | |||
40 | 44 | ||
41 | namespace Opie { | 45 | namespace Opie |
42 | class OContactFields{ | 46 | { |
47 | class OContactFields | ||
48 | { | ||
43 | 49 | ||
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index de5e30b..d9cee2b 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/oevent.cpp | |||
@@ -2,3 +2,3 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | 3 | Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
@@ -28,9 +28,6 @@ | |||
28 | */ | 28 | */ |
29 | #include <qshared.h> | ||
30 | #include <qarray.h> | ||
31 | 29 | ||
32 | #include <qpe/palmtopuidgen.h> | 30 | #include "oevent.h" |
33 | #include <qpe/categories.h> | ||
34 | #include <qpe/stringutil.h> | ||
35 | 31 | ||
32 | /* OPIE */ | ||
36 | #include <opie2/orecur.h> | 33 | #include <opie2/orecur.h> |
@@ -38,8 +35,15 @@ | |||
38 | #include <opie2/opimnotifymanager.h> | 35 | #include <opie2/opimnotifymanager.h> |
36 | #include <qpe/categories.h> | ||
37 | #include <qpe/palmtopuidgen.h> | ||
38 | #include <qpe/stringutil.h> | ||
39 | 39 | ||
40 | #include <opie2/oevent.h> | 40 | /* QT */ |
41 | #include <qshared.h> | ||
42 | #include <qarray.h> | ||
41 | 43 | ||
42 | namespace Opie { | 44 | namespace Opie |
45 | { | ||
43 | 46 | ||
44 | int OCalendarHelper::week( const QDate& date) { | 47 | int OCalendarHelper::week( const QDate& date ) |
48 | { | ||
45 | // Calculates the week this date is in within that | 49 | // Calculates the week this date is in within that |
@@ -55,3 +59,6 @@ int OCalendarHelper::week( const QDate& date) { | |||
55 | } | 59 | } |
56 | int OCalendarHelper::ocurrence( const QDate& date) { | 60 | |
61 | |||
62 | int OCalendarHelper::ocurrence( const QDate& date ) | ||
63 | { | ||
57 | // calculates the number of occurrances of this day of the | 64 | // calculates the number of occurrances of this day of the |
@@ -60,6 +67,10 @@ int OCalendarHelper::ocurrence( const QDate& date) { | |||
60 | } | 67 | } |
61 | int OCalendarHelper::dayOfWeek( char day ) { | 68 | |
69 | |||
70 | int OCalendarHelper::dayOfWeek( char day ) | ||
71 | { | ||
62 | int dayOfWeek = 1; | 72 | int dayOfWeek = 1; |
63 | char i = ORecur::MON; | 73 | char i = ORecur::MON; |
64 | while ( !( i & day ) && i <= ORecur::SUN ) { | 74 | while ( !( i & day ) && i <= ORecur::SUN ) |
75 | { | ||
65 | i <<= 1; | 76 | i <<= 1; |
@@ -69,3 +80,6 @@ int OCalendarHelper::dayOfWeek( char day ) { | |||
69 | } | 80 | } |
70 | int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) { | 81 | |
82 | |||
83 | int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) | ||
84 | { | ||
71 | return ( second.year() - first.year() ) * 12 + | 85 | return ( second.year() - first.year() ) * 12 + |
@@ -74,4 +88,7 @@ int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) { | |||
74 | 88 | ||
75 | struct OEvent::Data : public QShared { | 89 | |
76 | Data() : QShared() { | 90 | struct OEvent::Data : public QShared |
91 | { | ||
92 | Data() : QShared() | ||
93 | { | ||
77 | child = 0; | 94 | child = 0; |
@@ -82,3 +99,4 @@ struct OEvent::Data : public QShared { | |||
82 | } | 99 | } |
83 | ~Data() { | 100 | ~Data() |
101 | { | ||
84 | delete manager; | 102 | delete manager; |
@@ -100,6 +118,10 @@ struct OEvent::Data : public QShared { | |||
100 | 118 | ||
119 | |||
101 | OEvent::OEvent( int uid ) | 120 | OEvent::OEvent( int uid ) |
102 | : OPimRecord( uid ) { | 121 | : OPimRecord( uid ) |
122 | { | ||
103 | data = new Data; | 123 | data = new Data; |
104 | } | 124 | } |
125 | |||
126 | |||
105 | OEvent::OEvent( const OEvent& ev) | 127 | OEvent::OEvent( const OEvent& ev) |
@@ -110,2 +132,3 @@ OEvent::OEvent( const OEvent& ev) | |||
110 | 132 | ||
133 | |||
111 | OEvent::OEvent( const QMap<int, QString> map ) | 134 | OEvent::OEvent( const QMap<int, QString> map ) |
@@ -118,4 +141,7 @@ OEvent::OEvent( const QMap<int, QString> map ) | |||
118 | 141 | ||
119 | OEvent::~OEvent() { | 142 | |
120 | if ( data->deref() ) { | 143 | OEvent::~OEvent() |
144 | { | ||
145 | if ( data->deref() ) | ||
146 | { | ||
121 | delete data; | 147 | delete data; |
@@ -124,3 +150,6 @@ OEvent::~OEvent() { | |||
124 | } | 150 | } |
125 | OEvent& OEvent::operator=( const OEvent& ev) { | 151 | |
152 | |||
153 | OEvent& OEvent::operator=( const OEvent& ev ) | ||
154 | { | ||
126 | if ( this == &ev ) return *this; | 155 | if ( this == &ev ) return *this; |
@@ -135,6 +164,12 @@ OEvent& OEvent::operator=( const OEvent& ev) { | |||
135 | } | 164 | } |
136 | QString OEvent::description()const { | 165 | |
166 | |||
167 | QString OEvent::description() const | ||
168 | { | ||
137 | return data->description; | 169 | return data->description; |
138 | } | 170 | } |
139 | void OEvent::setDescription( const QString& description ) { | 171 | |
172 | |||
173 | void OEvent::setDescription( const QString& description ) | ||
174 | { | ||
140 | changeOrModify(); | 175 | changeOrModify(); |
@@ -142,3 +177,6 @@ void OEvent::setDescription( const QString& description ) { | |||
142 | } | 177 | } |
143 | void OEvent::setLocation( const QString& loc ) { | 178 | |
179 | |||
180 | void OEvent::setLocation( const QString& loc ) | ||
181 | { | ||
144 | changeOrModify(); | 182 | changeOrModify(); |
@@ -146,6 +184,12 @@ void OEvent::setLocation( const QString& loc ) { | |||
146 | } | 184 | } |
147 | QString OEvent::location()const { | 185 | |
186 | |||
187 | QString OEvent::location() const | ||
188 | { | ||
148 | return data->location; | 189 | return data->location; |
149 | } | 190 | } |
150 | OPimNotifyManager &OEvent::notifiers()const { | 191 | |
192 | |||
193 | OPimNotifyManager &OEvent::notifiers() const | ||
194 | { | ||
151 | // I hope we can skip the changeOrModify here | 195 | // I hope we can skip the changeOrModify here |
@@ -158,3 +202,6 @@ OPimNotifyManager &OEvent::notifiers()const { | |||
158 | } | 202 | } |
159 | bool OEvent::hasNotifiers()const { | 203 | |
204 | |||
205 | bool OEvent::hasNotifiers() const | ||
206 | { | ||
160 | if (!data->manager ) | 207 | if (!data->manager ) |
@@ -167,3 +214,6 @@ bool OEvent::hasNotifiers()const { | |||
167 | } | 214 | } |
168 | ORecur OEvent::recurrence()const { | 215 | |
216 | |||
217 | ORecur OEvent::recurrence() const | ||
218 | { | ||
169 | if (!data->recur) | 219 | if (!data->recur) |
@@ -173,3 +223,6 @@ ORecur OEvent::recurrence()const { | |||
173 | } | 223 | } |
174 | void OEvent::setRecurrence( const ORecur& rec) { | 224 | |
225 | |||
226 | void OEvent::setRecurrence( const ORecur& rec ) | ||
227 | { | ||
175 | changeOrModify(); | 228 | changeOrModify(); |
@@ -180,3 +233,6 @@ void OEvent::setRecurrence( const ORecur& rec) { | |||
180 | } | 233 | } |
181 | bool OEvent::hasRecurrence()const { | 234 | |
235 | |||
236 | bool OEvent::hasRecurrence() const | ||
237 | { | ||
182 | if (!data->recur ) return false; | 238 | if (!data->recur ) return false; |
@@ -184,6 +240,12 @@ bool OEvent::hasRecurrence()const { | |||
184 | } | 240 | } |
185 | QString OEvent::note()const { | 241 | |
242 | |||
243 | QString OEvent::note() const | ||
244 | { | ||
186 | return data->note; | 245 | return data->note; |
187 | } | 246 | } |
188 | void OEvent::setNote( const QString& note ) { | 247 | |
248 | |||
249 | void OEvent::setNote( const QString& note ) | ||
250 | { | ||
189 | changeOrModify(); | 251 | changeOrModify(); |
@@ -191,6 +253,12 @@ void OEvent::setNote( const QString& note ) { | |||
191 | } | 253 | } |
192 | QDateTime OEvent::createdDateTime()const { | 254 | |
255 | |||
256 | QDateTime OEvent::createdDateTime() const | ||
257 | { | ||
193 | return data->created; | 258 | return data->created; |
194 | } | 259 | } |
195 | void OEvent::setCreatedDateTime( const QDateTime& time ) { | 260 | |
261 | |||
262 | void OEvent::setCreatedDateTime( const QDateTime& time ) | ||
263 | { | ||
196 | changeOrModify(); | 264 | changeOrModify(); |
@@ -198,3 +266,6 @@ void OEvent::setCreatedDateTime( const QDateTime& time ) { | |||
198 | } | 266 | } |
199 | QDateTime OEvent::startDateTime()const { | 267 | |
268 | |||
269 | QDateTime OEvent::startDateTime() const | ||
270 | { | ||
200 | if ( data->isAllDay ) | 271 | if ( data->isAllDay ) |
@@ -203,3 +274,6 @@ QDateTime OEvent::startDateTime()const { | |||
203 | } | 274 | } |
204 | QDateTime OEvent::startDateTimeInZone()const { | 275 | |
276 | |||
277 | QDateTime OEvent::startDateTimeInZone() const | ||
278 | { | ||
205 | /* if no timezone, or all day event or if the current and this timeZone match... */ | 279 | /* if no timezone, or all day event or if the current and this timeZone match... */ |
@@ -210,3 +284,6 @@ QDateTime OEvent::startDateTimeInZone()const { | |||
210 | } | 284 | } |
211 | void OEvent::setStartDateTime( const QDateTime& dt ) { | 285 | |
286 | |||
287 | void OEvent::setStartDateTime( const QDateTime& dt ) | ||
288 | { | ||
212 | changeOrModify(); | 289 | changeOrModify(); |
@@ -214,3 +291,6 @@ void OEvent::setStartDateTime( const QDateTime& dt ) { | |||
214 | } | 291 | } |
215 | QDateTime OEvent::endDateTime()const { | 292 | |
293 | |||
294 | QDateTime OEvent::endDateTime() const | ||
295 | { | ||
216 | /* | 296 | /* |
@@ -223,3 +303,6 @@ QDateTime OEvent::endDateTime()const { | |||
223 | } | 303 | } |
224 | QDateTime OEvent::endDateTimeInZone()const { | 304 | |
305 | |||
306 | QDateTime OEvent::endDateTimeInZone() const | ||
307 | { | ||
225 | /* if no timezone, or all day event or if the current and this timeZone match... */ | 308 | /* if no timezone, or all day event or if the current and this timeZone match... */ |
@@ -230,3 +313,6 @@ QDateTime OEvent::endDateTimeInZone()const { | |||
230 | } | 313 | } |
231 | void OEvent::setEndDateTime( const QDateTime& dt ) { | 314 | |
315 | |||
316 | void OEvent::setEndDateTime( const QDateTime& dt ) | ||
317 | { | ||
232 | changeOrModify(); | 318 | changeOrModify(); |
@@ -234,9 +320,18 @@ void OEvent::setEndDateTime( const QDateTime& dt ) { | |||
234 | } | 320 | } |
235 | bool OEvent::isMultipleDay()const { | 321 | |
322 | |||
323 | bool OEvent::isMultipleDay() const | ||
324 | { | ||
236 | return data->end.date().day() - data->start.date().day(); | 325 | return data->end.date().day() - data->start.date().day(); |
237 | } | 326 | } |
238 | bool OEvent::isAllDay()const { | 327 | |
328 | |||
329 | bool OEvent::isAllDay() const | ||
330 | { | ||
239 | return data->isAllDay; | 331 | return data->isAllDay; |
240 | } | 332 | } |
241 | void OEvent::setAllDay( bool allDay ) { | 333 | |
334 | |||
335 | void OEvent::setAllDay( bool allDay ) | ||
336 | { | ||
242 | changeOrModify(); | 337 | changeOrModify(); |
@@ -245,3 +340,6 @@ void OEvent::setAllDay( bool allDay ) { | |||
245 | } | 340 | } |
246 | void OEvent::setTimeZone( const QString& tz ) { | 341 | |
342 | |||
343 | void OEvent::setTimeZone( const QString& tz ) | ||
344 | { | ||
247 | changeOrModify(); | 345 | changeOrModify(); |
@@ -249,3 +347,6 @@ void OEvent::setTimeZone( const QString& tz ) { | |||
249 | } | 347 | } |
250 | QString OEvent::timeZone()const { | 348 | |
349 | |||
350 | QString OEvent::timeZone() const | ||
351 | { | ||
251 | if (data->isAllDay ) return QString::fromLatin1("UTC"); | 352 | if (data->isAllDay ) return QString::fromLatin1("UTC"); |
@@ -253,4 +354,8 @@ QString OEvent::timeZone()const { | |||
253 | } | 354 | } |
254 | bool OEvent::match( const QRegExp& re )const { | 355 | |
255 | if ( re.match( data->description ) != -1 ){ | 356 | |
357 | bool OEvent::match( const QRegExp& re ) const | ||
358 | { | ||
359 | if ( re.match( data->description ) != -1 ) | ||
360 | { | ||
256 | setLastHitField( Qtopia::DatebookDescription ); | 361 | setLastHitField( Qtopia::DatebookDescription ); |
@@ -258,3 +363,4 @@ bool OEvent::match( const QRegExp& re )const { | |||
258 | } | 363 | } |
259 | if ( re.match( data->note ) != -1 ){ | 364 | if ( re.match( data->note ) != -1 ) |
365 | { | ||
260 | setLastHitField( Qtopia::Note ); | 366 | setLastHitField( Qtopia::Note ); |
@@ -262,3 +368,4 @@ bool OEvent::match( const QRegExp& re )const { | |||
262 | } | 368 | } |
263 | if ( re.match( data->location ) != -1 ){ | 369 | if ( re.match( data->location ) != -1 ) |
370 | { | ||
264 | setLastHitField( Qtopia::Location ); | 371 | setLastHitField( Qtopia::Location ); |
@@ -266,3 +373,4 @@ bool OEvent::match( const QRegExp& re )const { | |||
266 | } | 373 | } |
267 | if ( re.match( data->start.toString() ) != -1 ){ | 374 | if ( re.match( data->start.toString() ) != -1 ) |
375 | { | ||
268 | setLastHitField( Qtopia::StartDateTime ); | 376 | setLastHitField( Qtopia::StartDateTime ); |
@@ -270,3 +378,4 @@ bool OEvent::match( const QRegExp& re )const { | |||
270 | } | 378 | } |
271 | if ( re.match( data->end.toString() ) != -1 ){ | 379 | if ( re.match( data->end.toString() ) != -1 ) |
380 | { | ||
272 | setLastHitField( Qtopia::EndDateTime ); | 381 | setLastHitField( Qtopia::EndDateTime ); |
@@ -276,3 +385,6 @@ bool OEvent::match( const QRegExp& re )const { | |||
276 | } | 385 | } |
277 | QString OEvent::toRichText()const { | 386 | |
387 | |||
388 | QString OEvent::toRichText() const | ||
389 | { | ||
278 | QString text, value; | 390 | QString text, value; |
@@ -281,3 +393,4 @@ QString OEvent::toRichText()const { | |||
281 | text += "<b><h3><img src=\"datebook/DateBook\">"; | 393 | text += "<b><h3><img src=\"datebook/DateBook\">"; |
282 | if ( !description().isEmpty() ) { | 394 | if ( !description().isEmpty() ) |
395 | { | ||
283 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); | 396 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); |
@@ -287,3 +400,4 @@ QString OEvent::toRichText()const { | |||
287 | // location | 400 | // location |
288 | if ( !(value = location()).isEmpty() ) { | 401 | if ( !( value = location() ).isEmpty() ) |
402 | { | ||
289 | text += "<b>" + QObject::tr( "Location:" ) + "</b> "; | 403 | text += "<b>" + QObject::tr( "Location:" ) + "</b> "; |
@@ -293,3 +407,4 @@ QString OEvent::toRichText()const { | |||
293 | // all day event | 407 | // all day event |
294 | if ( isAllDay() ) { | 408 | if ( isAllDay() ) |
409 | { | ||
295 | text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; | 410 | text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; |
@@ -297,3 +412,4 @@ QString OEvent::toRichText()const { | |||
297 | // multiple day event | 412 | // multiple day event |
298 | else if ( isMultipleDay () ) { | 413 | else if ( isMultipleDay () ) |
414 | { | ||
299 | text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; | 415 | text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; |
@@ -301,5 +417,7 @@ QString OEvent::toRichText()const { | |||
301 | // start & end times | 417 | // start & end times |
302 | else { | 418 | else |
419 | { | ||
303 | // start time | 420 | // start time |
304 | if ( startDateTime().isValid() ) { | 421 | if ( startDateTime().isValid() ) |
422 | { | ||
305 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | 423 | text += "<b>" + QObject::tr( "Start:") + "</b> "; |
@@ -310,3 +428,4 @@ QString OEvent::toRichText()const { | |||
310 | // end time | 428 | // end time |
311 | if ( endDateTime().isValid() ) { | 429 | if ( endDateTime().isValid() ) |
430 | { | ||
312 | text += "<b>" + QObject::tr( "End:") + "</b> "; | 431 | text += "<b>" + QObject::tr( "End:") + "</b> "; |
@@ -318,3 +437,4 @@ QString OEvent::toRichText()const { | |||
318 | // categories | 437 | // categories |
319 | if ( categoryNames("Calendar").count() ){ | 438 | if ( categoryNames( "Calendar" ).count() ) |
439 | { | ||
320 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 440 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
@@ -325,3 +445,4 @@ QString OEvent::toRichText()const { | |||
325 | //notes | 445 | //notes |
326 | if ( !note().isEmpty() ) { | 446 | if ( !note().isEmpty() ) |
447 | { | ||
327 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; | 448 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; |
@@ -333,3 +454,6 @@ QString OEvent::toRichText()const { | |||
333 | } | 454 | } |
334 | QString OEvent::toShortText()const { | 455 | |
456 | |||
457 | QString OEvent::toShortText() const | ||
458 | { | ||
335 | QString text; | 459 | QString text; |
@@ -348,19 +472,38 @@ QString OEvent::toShortText()const { | |||
348 | } | 472 | } |
349 | QString OEvent::type()const { | 473 | |
474 | |||
475 | QString OEvent::type() const | ||
476 | { | ||
350 | return QString::fromLatin1("OEvent"); | 477 | return QString::fromLatin1("OEvent"); |
351 | } | 478 | } |
352 | QString OEvent::recordField( int /*id */ )const { | 479 | |
480 | |||
481 | QString OEvent::recordField( int /*id */ ) const | ||
482 | { | ||
353 | return QString::null; | 483 | return QString::null; |
354 | } | 484 | } |
355 | int OEvent::rtti() { | 485 | |
486 | |||
487 | int OEvent::rtti() | ||
488 | { | ||
356 | return OPimResolver::DateBook; | 489 | return OPimResolver::DateBook; |
357 | } | 490 | } |
358 | bool OEvent::loadFromStream( QDataStream& ) { | 491 | |
492 | |||
493 | bool OEvent::loadFromStream( QDataStream& ) | ||
494 | { | ||
359 | return true; | 495 | return true; |
360 | } | 496 | } |
361 | bool OEvent::saveToStream( QDataStream& )const { | 497 | |
498 | |||
499 | bool OEvent::saveToStream( QDataStream& ) const | ||
500 | { | ||
362 | return true; | 501 | return true; |
363 | } | 502 | } |
364 | void OEvent::changeOrModify() { | 503 | |
365 | if ( data->count != 1 ) { | 504 | |
505 | void OEvent::changeOrModify() | ||
506 | { | ||
507 | if ( data->count != 1 ) | ||
508 | { | ||
366 | data->deref(); | 509 | data->deref(); |
@@ -384,3 +527,4 @@ void OEvent::changeOrModify() { | |||
384 | 527 | ||
385 | if ( data->child ) { | 528 | if ( data->child ) |
529 | { | ||
386 | d2->child = new QArray<int>( *data->child ); | 530 | d2->child = new QArray<int>( *data->child ); |
@@ -392,4 +536,8 @@ void OEvent::changeOrModify() { | |||
392 | } | 536 | } |
393 | void OEvent::deref() { | 537 | |
394 | if ( data->deref() ) { | 538 | |
539 | void OEvent::deref() | ||
540 | { | ||
541 | if ( data->deref() ) | ||
542 | { | ||
395 | delete data; | 543 | delete data; |
@@ -403,3 +551,4 @@ void OEvent::deref() { | |||
403 | // Encoding should happen at one place, only ! (eilers) | 551 | // Encoding should happen at one place, only ! (eilers) |
404 | QMap<int, QString> OEvent::toMap()const { | 552 | QMap<int, QString> OEvent::toMap() const |
553 | { | ||
405 | QMap<int, QString> retMap; | 554 | QMap<int, QString> retMap; |
@@ -422,6 +571,8 @@ QMap<int, QString> OEvent::toMap()const { | |||
422 | retMap.insert( OEvent::FRecParent, QString::number( parent() ) ); | 571 | retMap.insert( OEvent::FRecParent, QString::number( parent() ) ); |
423 | if( children().count() ){ | 572 | if ( children().count() ) |
573 | { | ||
424 | QArray<int> childr = children(); | 574 | QArray<int> childr = children(); |
425 | QString buf; | 575 | QString buf; |
426 | for ( uint i = 0; i < childr.count(); i++ ) { | 576 | for ( uint i = 0; i < childr.count(); i++ ) |
577 | { | ||
427 | if ( i != 0 ) buf += " "; | 578 | if ( i != 0 ) buf += " "; |
@@ -433,3 +584,4 @@ QMap<int, QString> OEvent::toMap()const { | |||
433 | // Add recurrence stuff | 584 | // Add recurrence stuff |
434 | if( hasRecurrence() ){ | 585 | if ( hasRecurrence() ) |
586 | { | ||
435 | ORecur recur = recurrence(); | 587 | ORecur recur = recurrence(); |
@@ -444,3 +596,5 @@ QMap<int, QString> OEvent::toMap()const { | |||
444 | retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] ); | 596 | retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] ); |
445 | } else { | 597 | } |
598 | else | ||
599 | { | ||
446 | ORecur recur = recurrence(); | 600 | ORecur recur = recurrence(); |
@@ -453,2 +607,3 @@ QMap<int, QString> OEvent::toMap()const { | |||
453 | 607 | ||
608 | |||
454 | void OEvent::fromMap( const QMap<int, QString>& map ) | 609 | void OEvent::fromMap( const QMap<int, QString>& map ) |
@@ -474,3 +629,4 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
474 | int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); | 629 | int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); |
475 | if ( ( alarmTime != -1 ) ){ | 630 | if ( ( alarmTime != -1 ) ) |
631 | { | ||
476 | QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 ); | 632 | QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 ); |
@@ -479,3 +635,4 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
479 | } | 635 | } |
480 | if ( !map[OEvent::FTimeZone].isEmpty() && ( map[OEvent::FTimeZone] != "None" ) ){ | 636 | if ( !map[ OEvent::FTimeZone ].isEmpty() && ( map[ OEvent::FTimeZone ] != "None" ) ) |
637 | { | ||
481 | setTimeZone( map[OEvent::FTimeZone] ); | 638 | setTimeZone( map[OEvent::FTimeZone] ); |
@@ -487,3 +644,4 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
487 | /* AllDay is always in UTC */ | 644 | /* AllDay is always in UTC */ |
488 | if ( isAllDay() ) { | 645 | if ( isAllDay() ) |
646 | { | ||
489 | OTimeZone utc = OTimeZone::utc(); | 647 | OTimeZone utc = OTimeZone::utc(); |
@@ -492,3 +650,5 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
492 | setTimeZone( "UTC"); // make sure it is really utc | 650 | setTimeZone( "UTC"); // make sure it is really utc |
493 | }else { | 651 | } |
652 | else | ||
653 | { | ||
494 | /* to current date time */ | 654 | /* to current date time */ |
@@ -507,5 +667,7 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
507 | 667 | ||
508 | if ( !map[OEvent::FRecChildren].isEmpty() ){ | 668 | if ( !map[ OEvent::FRecChildren ].isEmpty() ) |
669 | { | ||
509 | QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] ); | 670 | QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] ); |
510 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 671 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
672 | { | ||
511 | addChild( (*it).toInt() ); | 673 | addChild( (*it).toInt() ); |
@@ -515,3 +677,4 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
515 | // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap.. | 677 | // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap.. |
516 | if( !map[OEvent::FRType].isEmpty() ){ | 678 | if ( !map[ OEvent::FRType ].isEmpty() ) |
679 | { | ||
517 | QMap<int, QString> recFields; | 680 | QMap<int, QString> recFields; |
@@ -532,6 +695,10 @@ void OEvent::fromMap( const QMap<int, QString>& map ) | |||
532 | 695 | ||
533 | int OEvent::parent()const { | 696 | int OEvent::parent() const |
697 | { | ||
534 | return data->parent; | 698 | return data->parent; |
535 | } | 699 | } |
536 | void OEvent::setParent( int uid ) { | 700 | |
701 | |||
702 | void OEvent::setParent( int uid ) | ||
703 | { | ||
537 | changeOrModify(); | 704 | changeOrModify(); |
@@ -539,3 +706,6 @@ void OEvent::setParent( int uid ) { | |||
539 | } | 706 | } |
540 | QArray<int> OEvent::children() const{ | 707 | |
708 | |||
709 | QArray<int> OEvent::children() const | ||
710 | { | ||
541 | if (!data->child) return QArray<int>(); | 711 | if (!data->child) return QArray<int>(); |
@@ -544,3 +714,6 @@ QArray<int> OEvent::children() const{ | |||
544 | } | 714 | } |
545 | void OEvent::setChildren( const QArray<int>& arr ) { | 715 | |
716 | |||
717 | void OEvent::setChildren( const QArray<int>& arr ) | ||
718 | { | ||
546 | changeOrModify(); | 719 | changeOrModify(); |
@@ -551,8 +724,14 @@ void OEvent::setChildren( const QArray<int>& arr ) { | |||
551 | } | 724 | } |
552 | void OEvent::addChild( int uid ) { | 725 | |
726 | |||
727 | void OEvent::addChild( int uid ) | ||
728 | { | ||
553 | changeOrModify(); | 729 | changeOrModify(); |
554 | if (!data->child ) { | 730 | if ( !data->child ) |
731 | { | ||
555 | data->child = new QArray<int>(1); | 732 | data->child = new QArray<int>(1); |
556 | (*data->child)[0] = uid; | 733 | (*data->child)[0] = uid; |
557 | }else{ | 734 | } |
735 | else | ||
736 | { | ||
558 | int count = data->child->count(); | 737 | int count = data->child->count(); |
@@ -562,3 +741,6 @@ void OEvent::addChild( int uid ) { | |||
562 | } | 741 | } |
563 | void OEvent::removeChild( int uid ) { | 742 | |
743 | |||
744 | void OEvent::removeChild( int uid ) | ||
745 | { | ||
564 | if (!data->child || !data->child->contains( uid ) ) return; | 746 | if (!data->child || !data->child->contains( uid ) ) return; |
@@ -568,4 +750,6 @@ void OEvent::removeChild( int uid ) { | |||
568 | uint count = data->child->count(); | 750 | uint count = data->child->count(); |
569 | for ( uint i = 0; i < count; i++ ) { | 751 | for ( uint i = 0; i < count; i++ ) |
570 | if ( (*data->child)[i] != uid ) { | 752 | { |
753 | if ( ( *data->child ) [ i ] != uid ) | ||
754 | { | ||
571 | newAr[j] = (*data->child)[i]; | 755 | newAr[j] = (*data->child)[i]; |
@@ -576,5 +760,8 @@ void OEvent::removeChild( int uid ) { | |||
576 | } | 760 | } |
577 | struct OEffectiveEvent::Data : public QShared { | 761 | |
578 | Data() : QShared() { | 762 | |
579 | } | 763 | struct OEffectiveEvent::Data : public QShared |
764 | { | ||
765 | Data() : QShared() | ||
766 | {} | ||
580 | OEvent event; | 767 | OEvent event; |
@@ -586,3 +773,5 @@ struct OEffectiveEvent::Data : public QShared { | |||
586 | 773 | ||
587 | OEffectiveEvent::OEffectiveEvent() { | 774 | |
775 | OEffectiveEvent::OEffectiveEvent() | ||
776 | { | ||
588 | data = new Data; | 777 | data = new Data; |
@@ -592,4 +781,7 @@ OEffectiveEvent::OEffectiveEvent() { | |||
592 | } | 781 | } |
782 | |||
783 | |||
593 | OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate, | 784 | OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate, |
594 | Position pos ) { | 785 | Position pos ) |
786 | { | ||
595 | data = new Data; | 787 | data = new Data; |
@@ -609,3 +801,6 @@ OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate, | |||
609 | } | 801 | } |
610 | OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) { | 802 | |
803 | |||
804 | OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev ) | ||
805 | { | ||
611 | data = ev.data; | 806 | data = ev.data; |
@@ -613,4 +808,8 @@ OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) { | |||
613 | } | 808 | } |
614 | OEffectiveEvent::~OEffectiveEvent() { | 809 | |
615 | if ( data->deref() ) { | 810 | |
811 | OEffectiveEvent::~OEffectiveEvent() | ||
812 | { | ||
813 | if ( data->deref() ) | ||
814 | { | ||
616 | delete data; | 815 | delete data; |
@@ -619,3 +818,6 @@ OEffectiveEvent::~OEffectiveEvent() { | |||
619 | } | 818 | } |
620 | OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) { | 819 | |
820 | |||
821 | OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) | ||
822 | { | ||
621 | if ( *this == ev ) return *this; | 823 | if ( *this == ev ) return *this; |
@@ -629,3 +831,5 @@ OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) { | |||
629 | 831 | ||
630 | void OEffectiveEvent::setStartTime( const QTime& ti) { | 832 | |
833 | void OEffectiveEvent::setStartTime( const QTime& ti ) | ||
834 | { | ||
631 | changeOrModify(); | 835 | changeOrModify(); |
@@ -633,3 +837,6 @@ void OEffectiveEvent::setStartTime( const QTime& ti) { | |||
633 | } | 837 | } |
634 | void OEffectiveEvent::setEndTime( const QTime& en) { | 838 | |
839 | |||
840 | void OEffectiveEvent::setEndTime( const QTime& en ) | ||
841 | { | ||
635 | changeOrModify(); | 842 | changeOrModify(); |
@@ -637,3 +844,6 @@ void OEffectiveEvent::setEndTime( const QTime& en) { | |||
637 | } | 844 | } |
638 | void OEffectiveEvent::setEvent( const OEvent& ev) { | 845 | |
846 | |||
847 | void OEffectiveEvent::setEvent( const OEvent& ev ) | ||
848 | { | ||
639 | changeOrModify(); | 849 | changeOrModify(); |
@@ -641,3 +851,6 @@ void OEffectiveEvent::setEvent( const OEvent& ev) { | |||
641 | } | 851 | } |
642 | void OEffectiveEvent::setDate( const QDate& da) { | 852 | |
853 | |||
854 | void OEffectiveEvent::setDate( const QDate& da ) | ||
855 | { | ||
643 | changeOrModify(); | 856 | changeOrModify(); |
@@ -645,5 +858,9 @@ void OEffectiveEvent::setDate( const QDate& da) { | |||
645 | } | 858 | } |
859 | |||
860 | |||
646 | void OEffectiveEvent::setEffectiveDates( const QDate& from, | 861 | void OEffectiveEvent::setEffectiveDates( const QDate& from, |
647 | const QDate& to ) { | 862 | const QDate& to ) |
648 | if (!from.isValid() ) { | 863 | { |
864 | if ( !from.isValid() ) | ||
865 | { | ||
649 | data->dates = false; | 866 | data->dates = false; |
@@ -655,24 +872,48 @@ void OEffectiveEvent::setEffectiveDates( const QDate& from, | |||
655 | } | 872 | } |
656 | QString OEffectiveEvent::description()const { | 873 | |
874 | |||
875 | QString OEffectiveEvent::description() const | ||
876 | { | ||
657 | return data->event.description(); | 877 | return data->event.description(); |
658 | } | 878 | } |
659 | QString OEffectiveEvent::location()const { | 879 | |
880 | |||
881 | QString OEffectiveEvent::location() const | ||
882 | { | ||
660 | return data->event.location(); | 883 | return data->event.location(); |
661 | } | 884 | } |
662 | QString OEffectiveEvent::note()const { | 885 | |
886 | |||
887 | QString OEffectiveEvent::note() const | ||
888 | { | ||
663 | return data->event.note(); | 889 | return data->event.note(); |
664 | } | 890 | } |
665 | OEvent OEffectiveEvent::event()const { | 891 | |
892 | |||
893 | OEvent OEffectiveEvent::event() const | ||
894 | { | ||
666 | return data->event; | 895 | return data->event; |
667 | } | 896 | } |
668 | QTime OEffectiveEvent::startTime()const { | 897 | |
898 | |||
899 | QTime OEffectiveEvent::startTime() const | ||
900 | { | ||
669 | return data->start; | 901 | return data->start; |
670 | } | 902 | } |
671 | QTime OEffectiveEvent::endTime()const { | 903 | |
904 | |||
905 | QTime OEffectiveEvent::endTime() const | ||
906 | { | ||
672 | return data->end; | 907 | return data->end; |
673 | } | 908 | } |
674 | QDate OEffectiveEvent::date()const { | 909 | |
910 | |||
911 | QDate OEffectiveEvent::date() const | ||
912 | { | ||
675 | return data->date; | 913 | return data->date; |
676 | } | 914 | } |
677 | int OEffectiveEvent::length()const { | 915 | |
916 | |||
917 | int OEffectiveEvent::length() const | ||
918 | { | ||
678 | return (data->end.hour() * 60 - data->start.hour() * 60) | 919 | return (data->end.hour() * 60 - data->start.hour() * 60) |
@@ -680,3 +921,6 @@ int OEffectiveEvent::length()const { | |||
680 | } | 921 | } |
681 | int OEffectiveEvent::size()const { | 922 | |
923 | |||
924 | int OEffectiveEvent::size() const | ||
925 | { | ||
682 | return ( data->end.hour() - data->start.hour() ) * 3600 | 926 | return ( data->end.hour() - data->start.hour() ) * 3600 |
@@ -685,3 +929,6 @@ int OEffectiveEvent::size()const { | |||
685 | } | 929 | } |
686 | QDate OEffectiveEvent::startDate()const { | 930 | |
931 | |||
932 | QDate OEffectiveEvent::startDate() const | ||
933 | { | ||
687 | if ( data->dates ) | 934 | if ( data->dates ) |
@@ -693,3 +940,6 @@ QDate OEffectiveEvent::startDate()const { | |||
693 | } | 940 | } |
694 | QDate OEffectiveEvent::endDate()const { | 941 | |
942 | |||
943 | QDate OEffectiveEvent::endDate() const | ||
944 | { | ||
695 | if ( data->dates ) | 945 | if ( data->dates ) |
@@ -701,4 +951,8 @@ QDate OEffectiveEvent::endDate()const { | |||
701 | } | 951 | } |
702 | void OEffectiveEvent::deref() { | 952 | |
703 | if ( data->deref() ) { | 953 | |
954 | void OEffectiveEvent::deref() | ||
955 | { | ||
956 | if ( data->deref() ) | ||
957 | { | ||
704 | delete data; | 958 | delete data; |
@@ -707,4 +961,8 @@ void OEffectiveEvent::deref() { | |||
707 | } | 961 | } |
708 | void OEffectiveEvent::changeOrModify() { | 962 | |
709 | if ( data->count != 1 ) { | 963 | |
964 | void OEffectiveEvent::changeOrModify() | ||
965 | { | ||
966 | if ( data->count != 1 ) | ||
967 | { | ||
710 | data->deref(); | 968 | data->deref(); |
@@ -721,3 +979,6 @@ void OEffectiveEvent::changeOrModify() { | |||
721 | } | 979 | } |
722 | bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const{ | 980 | |
981 | |||
982 | bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const | ||
983 | { | ||
723 | if ( data->date < e.date() ) | 984 | if ( data->date < e.date() ) |
@@ -729,6 +990,12 @@ bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const{ | |||
729 | } | 990 | } |
730 | bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const{ | 991 | |
992 | |||
993 | bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const | ||
994 | { | ||
731 | return (data->date <= e.date() ); | 995 | return (data->date <= e.date() ); |
732 | } | 996 | } |
733 | bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const { | 997 | |
998 | |||
999 | bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const | ||
1000 | { | ||
734 | return ( date() == e.date() | 1001 | return ( date() == e.date() |
@@ -738,9 +1005,18 @@ bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const { | |||
738 | } | 1005 | } |
739 | bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const { | 1006 | |
1007 | |||
1008 | bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const | ||
1009 | { | ||
740 | return !(*this == e ); | 1010 | return !(*this == e ); |
741 | } | 1011 | } |
742 | bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const { | 1012 | |
1013 | |||
1014 | bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const | ||
1015 | { | ||
743 | return !(*this <= e ); | 1016 | return !(*this <= e ); |
744 | } | 1017 | } |
745 | bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const { | 1018 | |
1019 | |||
1020 | bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const | ||
1021 | { | ||
746 | return !(*this < e); | 1022 | return !(*this < e); |
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h index 9502efa..dc5e4d6 100644 --- a/libopie2/opiepim/oevent.h +++ b/libopie2/opiepim/oevent.h | |||
@@ -2,3 +2,3 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | 3 | Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
@@ -30,9 +30,8 @@ | |||
30 | 30 | ||
31 | #ifndef OPIE_PIM_EVENT_H | 31 | #ifndef OEVENT_H |
32 | #define OPIE_PIM_EVENT_H | 32 | #define OEVENT_H |
33 | |||
34 | #include <qstring.h> | ||
35 | #include <qdatetime.h> | ||
36 | #include <qvaluelist.h> | ||
37 | 33 | ||
34 | /* OPIE */ | ||
35 | #include <opie2/otimezone.h> | ||
36 | #include <opie2/opimrecord.h> | ||
38 | #include <qpe/recordfields.h> | 37 | #include <qpe/recordfields.h> |
@@ -40,7 +39,11 @@ | |||
40 | 39 | ||
41 | #include <opie2/otimezone.h> | 40 | /* QT */ |
42 | #include <opie2/opimrecord.h> | 41 | #include <qstring.h> |
42 | #include <qdatetime.h> | ||
43 | #include <qvaluelist.h> | ||
43 | 44 | ||
44 | namespace Opie { | 45 | namespace Opie |
45 | struct OCalendarHelper { | 46 | { |
47 | struct OCalendarHelper | ||
48 | { | ||
46 | /** calculate the week number of the date */ | 49 | /** calculate the week number of the date */ |
@@ -67,3 +70,4 @@ class ORecur; | |||
67 | */ | 70 | */ |
68 | class OEvent : public OPimRecord { | 71 | class OEvent : public OPimRecord |
72 | { | ||
69 | public: | 73 | public: |
@@ -193,2 +197,3 @@ public: | |||
193 | */ | 197 | */ |
198 | |||
194 | private: | 199 | private: |
@@ -206,3 +211,5 @@ private: | |||
206 | */ | 211 | */ |
207 | class OEffectiveEvent { | 212 | class OEffectiveEvent |
213 | { | ||
214 | |||
208 | public: | 215 | public: |
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index 8f0011b..1742dcc 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #ifndef OPIE_RECORD_LIST_H | 30 | #ifndef ORECORDLIST_H |
31 | #define OPIE_RECORD_LIST_H | 31 | #define ORECORDLIST_H |
32 | |||
33 | #include <qarray.h> | ||
34 | 32 | ||
33 | /* OPIE */ | ||
35 | #include <opie2/otemplatebase.h> | 34 | #include <opie2/otemplatebase.h> |
@@ -37,3 +36,7 @@ | |||
37 | 36 | ||
38 | namespace Opie { | 37 | /* QT */ |
38 | #include <qarray.h> | ||
39 | |||
40 | namespace Opie | ||
41 | { | ||
39 | 42 | ||
@@ -49,4 +52,6 @@ template <class T> class ORecordList; | |||
49 | template <class T = OPimRecord> | 52 | template <class T = OPimRecord> |
50 | class ORecordListIterator { | 53 | class ORecordListIterator |
54 | { | ||
51 | friend class ORecordList<T>; | 55 | friend class ORecordList<T>; |
56 | |||
52 | public: | 57 | public: |
@@ -107,2 +112,3 @@ private: | |||
107 | 112 | ||
113 | |||
108 | class ORecordListPrivate; | 114 | class ORecordListPrivate; |
@@ -113,3 +119,4 @@ class ORecordListPrivate; | |||
113 | template <class T = OPimRecord > | 119 | template <class T = OPimRecord > |
114 | class ORecordList { | 120 | class ORecordList |
121 | { | ||
115 | public: | 122 | public: |
@@ -121,4 +128,4 @@ public: | |||
121 | */ | 128 | */ |
122 | ORecordList () { | 129 | ORecordList () |
123 | } | 130 | {} |
124 | ORecordList( const QArray<int>& ids, | 131 | ORecordList( const QArray<int>& ids, |
@@ -160,5 +167,7 @@ private: | |||
160 | 167 | ||
168 | |||
161 | /* ok now implement it */ | 169 | /* ok now implement it */ |
162 | template <class T> | 170 | template <class T> |
163 | ORecordListIterator<T>::ORecordListIterator() { | 171 | ORecordListIterator<T>::ORecordListIterator() |
172 | { | ||
164 | m_current = 0; | 173 | m_current = 0; |
@@ -170,4 +179,7 @@ ORecordListIterator<T>::ORecordListIterator() { | |||
170 | } | 179 | } |
180 | |||
181 | |||
171 | template <class T> | 182 | template <class T> |
172 | ORecordListIterator<T>::~ORecordListIterator() { | 183 | ORecordListIterator<T>::~ORecordListIterator() |
184 | { | ||
173 | /* nothing to delete */ | 185 | /* nothing to delete */ |
@@ -175,4 +187,6 @@ ORecordListIterator<T>::~ORecordListIterator() { | |||
175 | 187 | ||
188 | |||
176 | template <class T> | 189 | template <class T> |
177 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { | 190 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it ) |
191 | { | ||
178 | // qWarning("ORecordListIterator copy c'tor"); | 192 | // qWarning("ORecordListIterator copy c'tor"); |
@@ -186,4 +200,6 @@ ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { | |||
186 | 200 | ||
201 | |||
187 | template <class T> | 202 | template <class T> |
188 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { | 203 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it ) |
204 | { | ||
189 | m_uids = it.m_uids; | 205 | m_uids = it.m_uids; |
@@ -197,4 +213,6 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIter | |||
197 | 213 | ||
214 | |||
198 | template <class T> | 215 | template <class T> |
199 | T ORecordListIterator<T>::operator*() { | 216 | T ORecordListIterator<T>::operator*() |
217 | { | ||
200 | //qWarning("operator* %d %d", m_current, m_uids[m_current] ); | 218 | //qWarning("operator* %d %d", m_current, m_uids[m_current] ); |
@@ -210,9 +228,13 @@ T ORecordListIterator<T>::operator*() { | |||
210 | 228 | ||
229 | |||
211 | template <class T> | 230 | template <class T> |
212 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 231 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() |
232 | { | ||
213 | m_direction = true; | 233 | m_direction = true; |
214 | if (m_current < m_uids.count() ) { | 234 | if ( m_current < m_uids.count() ) |
235 | { | ||
215 | m_end = false; | 236 | m_end = false; |
216 | ++m_current; | 237 | ++m_current; |
217 | }else | 238 | } |
239 | else | ||
218 | m_end = true; | 240 | m_end = true; |
@@ -221,9 +243,14 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | |||
221 | } | 243 | } |
244 | |||
245 | |||
222 | template <class T> | 246 | template <class T> |
223 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | 247 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() |
248 | { | ||
224 | m_direction = false; | 249 | m_direction = false; |
225 | if ( m_current > 0 ) { | 250 | if ( m_current > 0 ) |
251 | { | ||
226 | --m_current; | 252 | --m_current; |
227 | m_end = false; | 253 | m_end = false; |
228 | } else | 254 | } |
255 | else | ||
229 | m_end = true; | 256 | m_end = true; |
@@ -233,4 +260,6 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | |||
233 | 260 | ||
261 | |||
234 | template <class T> | 262 | template <class T> |
235 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | 263 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) |
264 | { | ||
236 | 265 | ||
@@ -245,6 +274,11 @@ bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | |||
245 | } | 274 | } |
275 | |||
276 | |||
246 | template <class T> | 277 | template <class T> |
247 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { | 278 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) |
279 | { | ||
248 | return !(*this == it ); | 280 | return !(*this == it ); |
249 | } | 281 | } |
282 | |||
283 | |||
250 | template <class T> | 284 | template <class T> |
@@ -259,9 +293,16 @@ ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | |||
259 | } | 293 | } |
294 | |||
295 | |||
260 | template <class T> | 296 | template <class T> |
261 | uint ORecordListIterator<T>::current()const { | 297 | uint ORecordListIterator<T>::current() const |
298 | { | ||
262 | return m_current; | 299 | return m_current; |
263 | } | 300 | } |
301 | |||
302 | |||
264 | template <class T> | 303 | template <class T> |
265 | void ORecordListIterator<T>::setCurrent( uint cur ) { | 304 | void ORecordListIterator<T>::setCurrent( uint cur ) |
266 | if( cur < m_uids.count() ) { | 305 | { |
306 | if ( cur < m_uids.count() ) | ||
307 | { | ||
267 | m_end = false; | 308 | m_end = false; |
@@ -271,5 +312,8 @@ void ORecordListIterator<T>::setCurrent( uint cur ) { | |||
271 | template <class T> | 312 | template <class T> |
272 | uint ORecordListIterator<T>::count()const { | 313 | uint ORecordListIterator<T>::count() const |
314 | { | ||
273 | return m_uids.count(); | 315 | return m_uids.count(); |
274 | } | 316 | } |
317 | |||
318 | |||
275 | template <class T> | 319 | template <class T> |
@@ -278,10 +322,15 @@ ORecordList<T>::ORecordList( const QArray<int>& ids, | |||
278 | : m_ids( ids ), m_acc( acc ) | 322 | : m_ids( ids ), m_acc( acc ) |
279 | { | 323 | {} |
280 | } | 324 | |
325 | |||
281 | template <class T> | 326 | template <class T> |
282 | ORecordList<T>::~ORecordList() { | 327 | ORecordList<T>::~ORecordList() |
328 | { | ||
283 | /* nothing to do here */ | 329 | /* nothing to do here */ |
284 | } | 330 | } |
331 | |||
332 | |||
285 | template <class T> | 333 | template <class T> |
286 | typename ORecordList<T>::Iterator ORecordList<T>::begin() { | 334 | typename ORecordList<T>::Iterator ORecordList<T>::begin() |
335 | { | ||
287 | Iterator it( m_ids, m_acc ); | 336 | Iterator it( m_ids, m_acc ); |
@@ -289,4 +338,7 @@ typename ORecordList<T>::Iterator ORecordList<T>::begin() { | |||
289 | } | 338 | } |
339 | |||
340 | |||
290 | template <class T> | 341 | template <class T> |
291 | typename ORecordList<T>::Iterator ORecordList<T>::end() { | 342 | typename ORecordList<T>::Iterator ORecordList<T>::end() |
343 | { | ||
292 | Iterator it( m_ids, m_acc ); | 344 | Iterator it( m_ids, m_acc ); |
@@ -297,8 +349,14 @@ typename ORecordList<T>::Iterator ORecordList<T>::end() { | |||
297 | } | 349 | } |
350 | |||
351 | |||
298 | template <class T> | 352 | template <class T> |
299 | uint ORecordList<T>::count()const { | 353 | uint ORecordList<T>::count() const |
354 | { | ||
300 | return m_ids.count(); | 355 | return m_ids.count(); |
301 | } | 356 | } |
357 | |||
358 | |||
302 | template <class T> | 359 | template <class T> |
303 | T ORecordList<T>::operator[]( uint i ) { | 360 | T ORecordList<T>::operator[] ( uint i ) |
361 | { | ||
304 | if ( i >= m_ids.count() ) | 362 | if ( i >= m_ids.count() ) |
@@ -308,4 +366,7 @@ T ORecordList<T>::operator[]( uint i ) { | |||
308 | } | 366 | } |
367 | |||
368 | |||
309 | template <class T> | 369 | template <class T> |
310 | int ORecordList<T>::uidAt( uint i ) { | 370 | int ORecordList<T>::uidAt( uint i ) |
371 | { | ||
311 | return m_ids[i]; | 372 | return m_ids[i]; |
@@ -313,4 +374,6 @@ int ORecordList<T>::uidAt( uint i ) { | |||
313 | 374 | ||
375 | |||
314 | template <class T> | 376 | template <class T> |
315 | bool ORecordList<T>::remove( int uid ) { | 377 | bool ORecordList<T>::remove( int uid ) |
378 | { | ||
316 | QArray<int> copy( m_ids.count() ); | 379 | QArray<int> copy( m_ids.count() ); |
@@ -319,7 +382,10 @@ bool ORecordList<T>::remove( int uid ) { | |||
319 | 382 | ||
320 | for (uint i = 0; i < m_ids.count(); i++){ | 383 | for ( uint i = 0; i < m_ids.count(); i++ ) |
321 | if ( m_ids[i] != uid ){ | 384 | { |
385 | if ( m_ids[ i ] != uid ) | ||
386 | { | ||
322 | copy[counter++] = m_ids[i]; | 387 | copy[counter++] = m_ids[i]; |
323 | 388 | ||
324 | }else | 389 | } |
390 | else | ||
325 | ret_val = true; | 391 | ret_val = true; |
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 3eb0026..f534067 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -28,7 +28,11 @@ | |||
28 | */ | 28 | */ |
29 | #include <qobject.h> | ||
30 | #include <qshared.h> | ||
31 | |||
32 | 29 | ||
30 | #include "otodo.h" | ||
33 | 31 | ||
32 | /* OPIE */ | ||
33 | #include <opie2/opimstate.h> | ||
34 | #include <opie2/orecur.h> | ||
35 | #include <opie2/opimmaintainer.h> | ||
36 | #include <opie2/opimnotifymanager.h> | ||
37 | #include <opie2/opimresolver.h> | ||
34 | #include <qpe/palmtopuidgen.h> | 38 | #include <qpe/palmtopuidgen.h> |
@@ -40,15 +44,13 @@ | |||
40 | 44 | ||
45 | /* QT */ | ||
46 | #include <qobject.h> | ||
47 | #include <qshared.h> | ||
41 | 48 | ||
42 | #include <opie2/opimstate.h> | 49 | namespace Opie |
43 | #include <opie2/orecur.h> | 50 | { |
44 | #include <opie2/opimmaintainer.h> | ||
45 | #include <opie2/opimnotifymanager.h> | ||
46 | #include <opie2/opimresolver.h> | ||
47 | |||
48 | #include <opie2/otodo.h> | ||
49 | |||
50 | namespace Opie { | ||
51 | 51 | ||
52 | struct OTodo::OTodoData : public QShared { | 52 | struct OTodo::OTodoData : public QShared |
53 | OTodoData() : QShared() { | 53 | { |
54 | OTodoData() : QShared() | ||
55 | { | ||
54 | recur = 0; | 56 | recur = 0; |
@@ -58,3 +60,4 @@ struct OTodo::OTodoData : public QShared { | |||
58 | }; | 60 | }; |
59 | ~OTodoData() { | 61 | ~OTodoData() |
62 | { | ||
60 | delete recur; | 63 | delete recur; |
@@ -80,2 +83,3 @@ struct OTodo::OTodoData : public QShared { | |||
80 | 83 | ||
84 | |||
81 | OTodo::OTodo(const OTodo &event ) | 85 | OTodo::OTodo(const OTodo &event ) |
@@ -86,6 +90,10 @@ OTodo::OTodo(const OTodo &event ) | |||
86 | } | 90 | } |
87 | OTodo::~OTodo() { | 91 | |
92 | |||
93 | OTodo::~OTodo() | ||
94 | { | ||
88 | 95 | ||
89 | // qWarning("~OTodo " ); | 96 | // qWarning("~OTodo " ); |
90 | if ( data->deref() ) { | 97 | if ( data->deref() ) |
98 | { | ||
91 | // qWarning("OTodo::dereffing"); | 99 | // qWarning("OTodo::dereffing"); |
@@ -95,2 +103,4 @@ OTodo::~OTodo() { | |||
95 | } | 103 | } |
104 | |||
105 | |||
96 | OTodo::OTodo(bool completed, int priority, | 106 | OTodo::OTodo(bool completed, int priority, |
@@ -116,2 +126,4 @@ OTodo::OTodo(bool completed, int priority, | |||
116 | } | 126 | } |
127 | |||
128 | |||
117 | OTodo::OTodo(bool completed, int priority, | 129 | OTodo::OTodo(bool completed, int priority, |
@@ -137,14 +149,23 @@ OTodo::OTodo(bool completed, int priority, | |||
137 | } | 149 | } |
150 | |||
151 | |||
138 | bool OTodo::match( const QRegExp ®Exp )const | 152 | bool OTodo::match( const QRegExp ®Exp )const |
139 | { | 153 | { |
140 | if( QString::number( data->priority ).find( regExp ) != -1 ){ | 154 | if ( QString::number( data->priority ).find( regExp ) != -1 ) |
155 | { | ||
141 | setLastHitField( Priority ); | 156 | setLastHitField( Priority ); |
142 | return true; | 157 | return true; |
143 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ | 158 | } |
159 | else if ( data->hasDate && data->date.toString().find( regExp ) != -1 ) | ||
160 | { | ||
144 | setLastHitField( HasDate ); | 161 | setLastHitField( HasDate ); |
145 | return true; | 162 | return true; |
146 | }else if(data->desc.find( regExp ) != -1 ){ | 163 | } |
164 | else if ( data->desc.find( regExp ) != -1 ) | ||
165 | { | ||
147 | setLastHitField( Description ); | 166 | setLastHitField( Description ); |
148 | return true; | 167 | return true; |
149 | }else if(data->sum.find( regExp ) != -1 ) { | 168 | } |
169 | else if ( data->sum.find( regExp ) != -1 ) | ||
170 | { | ||
150 | setLastHitField( Summary ); | 171 | setLastHitField( Summary ); |
@@ -154,2 +175,4 @@ bool OTodo::match( const QRegExp ®Exp )const | |||
154 | } | 175 | } |
176 | |||
177 | |||
155 | bool OTodo::isCompleted() const | 178 | bool OTodo::isCompleted() const |
@@ -158,2 +181,4 @@ bool OTodo::isCompleted() const | |||
158 | } | 181 | } |
182 | |||
183 | |||
159 | bool OTodo::hasDueDate() const | 184 | bool OTodo::hasDueDate() const |
@@ -162,8 +187,16 @@ bool OTodo::hasDueDate() const | |||
162 | } | 187 | } |
163 | bool OTodo::hasStartDate()const { | 188 | |
189 | |||
190 | bool OTodo::hasStartDate() const | ||
191 | { | ||
164 | return data->start.isValid(); | 192 | return data->start.isValid(); |
165 | } | 193 | } |
166 | bool OTodo::hasCompletedDate()const { | 194 | |
195 | |||
196 | bool OTodo::hasCompletedDate() const | ||
197 | { | ||
167 | return data->completed.isValid(); | 198 | return data->completed.isValid(); |
168 | } | 199 | } |
200 | |||
201 | |||
169 | int OTodo::priority()const | 202 | int OTodo::priority()const |
@@ -172,2 +205,4 @@ int OTodo::priority()const | |||
172 | } | 205 | } |
206 | |||
207 | |||
173 | QString OTodo::summary() const | 208 | QString OTodo::summary() const |
@@ -176,2 +211,4 @@ QString OTodo::summary() const | |||
176 | } | 211 | } |
212 | |||
213 | |||
177 | ushort OTodo::progress() const | 214 | ushort OTodo::progress() const |
@@ -180,2 +217,4 @@ ushort OTodo::progress() const | |||
180 | } | 217 | } |
218 | |||
219 | |||
181 | QDate OTodo::dueDate()const | 220 | QDate OTodo::dueDate()const |
@@ -184,8 +223,16 @@ QDate OTodo::dueDate()const | |||
184 | } | 223 | } |
185 | QDate OTodo::startDate()const { | 224 | |
225 | |||
226 | QDate OTodo::startDate() const | ||
227 | { | ||
186 | return data->start; | 228 | return data->start; |
187 | } | 229 | } |
188 | QDate OTodo::completedDate()const { | 230 | |
231 | |||
232 | QDate OTodo::completedDate() const | ||
233 | { | ||
189 | return data->completed; | 234 | return data->completed; |
190 | } | 235 | } |
236 | |||
237 | |||
191 | QString OTodo::description()const | 238 | QString OTodo::description()const |
@@ -194,3 +241,6 @@ QString OTodo::description()const | |||
194 | } | 241 | } |
195 | bool OTodo::hasState() const{ | 242 | |
243 | |||
244 | bool OTodo::hasState() const | ||
245 | { | ||
196 | if (!data->state ) return false; | 246 | if (!data->state ) return false; |
@@ -198,4 +248,8 @@ bool OTodo::hasState() const{ | |||
198 | } | 248 | } |
199 | OPimState OTodo::state()const { | 249 | |
200 | if (!data->state ) { | 250 | |
251 | OPimState OTodo::state() const | ||
252 | { | ||
253 | if ( !data->state ) | ||
254 | { | ||
201 | OPimState state; | 255 | OPimState state; |
@@ -206,3 +260,6 @@ OPimState OTodo::state()const { | |||
206 | } | 260 | } |
207 | bool OTodo::hasRecurrence()const { | 261 | |
262 | |||
263 | bool OTodo::hasRecurrence() const | ||
264 | { | ||
208 | if (!data->recur) return false; | 265 | if (!data->recur) return false; |
@@ -210,3 +267,6 @@ bool OTodo::hasRecurrence()const { | |||
210 | } | 267 | } |
211 | ORecur OTodo::recurrence()const { | 268 | |
269 | |||
270 | ORecur OTodo::recurrence() const | ||
271 | { | ||
212 | if (!data->recur) return ORecur(); | 272 | if (!data->recur) return ORecur(); |
@@ -215,3 +275,6 @@ ORecur OTodo::recurrence()const { | |||
215 | } | 275 | } |
216 | bool OTodo::hasMaintainer()const { | 276 | |
277 | |||
278 | bool OTodo::hasMaintainer() const | ||
279 | { | ||
217 | if (!data->maintainer) return false; | 280 | if (!data->maintainer) return false; |
@@ -220,3 +283,6 @@ bool OTodo::hasMaintainer()const { | |||
220 | } | 283 | } |
221 | OPimMaintainer OTodo::maintainer()const { | 284 | |
285 | |||
286 | OPimMaintainer OTodo::maintainer() const | ||
287 | { | ||
222 | if (!data->maintainer) return OPimMaintainer(); | 288 | if (!data->maintainer) return OPimMaintainer(); |
@@ -225,2 +291,4 @@ OPimMaintainer OTodo::maintainer()const { | |||
225 | } | 291 | } |
292 | |||
293 | |||
226 | void OTodo::setCompleted( bool completed ) | 294 | void OTodo::setCompleted( bool completed ) |
@@ -230,2 +298,4 @@ void OTodo::setCompleted( bool completed ) | |||
230 | } | 298 | } |
299 | |||
300 | |||
231 | void OTodo::setHasDueDate( bool hasDate ) | 301 | void OTodo::setHasDueDate( bool hasDate ) |
@@ -235,2 +305,4 @@ void OTodo::setHasDueDate( bool hasDate ) | |||
235 | } | 305 | } |
306 | |||
307 | |||
236 | void OTodo::setDescription(const QString &desc ) | 308 | void OTodo::setDescription(const QString &desc ) |
@@ -241,2 +313,4 @@ void OTodo::setDescription(const QString &desc ) | |||
241 | } | 313 | } |
314 | |||
315 | |||
242 | void OTodo::setSummary( const QString& sum ) | 316 | void OTodo::setSummary( const QString& sum ) |
@@ -246,2 +320,4 @@ void OTodo::setSummary( const QString& sum ) | |||
246 | } | 320 | } |
321 | |||
322 | |||
247 | void OTodo::setPriority(int prio ) | 323 | void OTodo::setPriority(int prio ) |
@@ -251,2 +327,4 @@ void OTodo::setPriority(int prio ) | |||
251 | } | 327 | } |
328 | |||
329 | |||
252 | void OTodo::setDueDate( const QDate& date ) | 330 | void OTodo::setDueDate( const QDate& date ) |
@@ -256,3 +334,6 @@ void OTodo::setDueDate( const QDate& date ) | |||
256 | } | 334 | } |
257 | void OTodo::setStartDate( const QDate& date ) { | 335 | |
336 | |||
337 | void OTodo::setStartDate( const QDate& date ) | ||
338 | { | ||
258 | changeOrModify(); | 339 | changeOrModify(); |
@@ -260,3 +341,6 @@ void OTodo::setStartDate( const QDate& date ) { | |||
260 | } | 341 | } |
261 | void OTodo::setCompletedDate( const QDate& date ) { | 342 | |
343 | |||
344 | void OTodo::setCompletedDate( const QDate& date ) | ||
345 | { | ||
262 | changeOrModify(); | 346 | changeOrModify(); |
@@ -264,3 +348,6 @@ void OTodo::setCompletedDate( const QDate& date ) { | |||
264 | } | 348 | } |
265 | void OTodo::setState( const OPimState& state ) { | 349 | |
350 | |||
351 | void OTodo::setState( const OPimState& state ) | ||
352 | { | ||
266 | changeOrModify(); | 353 | changeOrModify(); |
@@ -271,3 +358,6 @@ void OTodo::setState( const OPimState& state ) { | |||
271 | } | 358 | } |
272 | void OTodo::setRecurrence( const ORecur& rec) { | 359 | |
360 | |||
361 | void OTodo::setRecurrence( const ORecur& rec ) | ||
362 | { | ||
273 | changeOrModify(); | 363 | changeOrModify(); |
@@ -278,3 +368,6 @@ void OTodo::setRecurrence( const ORecur& rec) { | |||
278 | } | 368 | } |
279 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { | 369 | |
370 | |||
371 | void OTodo::setMaintainer( const OPimMaintainer& pim ) | ||
372 | { | ||
280 | changeOrModify(); | 373 | changeOrModify(); |
@@ -286,2 +379,4 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) { | |||
286 | } | 379 | } |
380 | |||
381 | |||
287 | bool OTodo::isOverdue( ) | 382 | bool OTodo::isOverdue( ) |
@@ -292,2 +387,4 @@ bool OTodo::isOverdue( ) | |||
292 | } | 387 | } |
388 | |||
389 | |||
293 | void OTodo::setProgress(ushort progress ) | 390 | void OTodo::setProgress(ushort progress ) |
@@ -297,5 +394,10 @@ void OTodo::setProgress(ushort progress ) | |||
297 | } | 394 | } |
298 | QString OTodo::toShortText() const { | 395 | |
396 | |||
397 | QString OTodo::toShortText() const | ||
398 | { | ||
299 | return summary(); | 399 | return summary(); |
300 | } | 400 | } |
401 | |||
402 | |||
301 | /*! | 403 | /*! |
@@ -310,3 +412,4 @@ QString OTodo::toRichText() const | |||
310 | text += "<b><h3><img src=\"todo/TodoList\"> "; | 412 | text += "<b><h3><img src=\"todo/TodoList\"> "; |
311 | if ( !summary().isEmpty() ) { | 413 | if ( !summary().isEmpty() ) |
414 | { | ||
312 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); | 415 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); |
@@ -316,3 +419,4 @@ QString OTodo::toRichText() const | |||
316 | // description | 419 | // description |
317 | if( !description().isEmpty() ){ | 420 | if ( !description().isEmpty() ) |
421 | { | ||
318 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 422 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
@@ -346,3 +450,4 @@ QString OTodo::toRichText() const | |||
346 | // due date | 450 | // due date |
347 | if (hasDueDate() ){ | 451 | if ( hasDueDate() ) |
452 | { | ||
348 | QDate dd = dueDate(); | 453 | QDate dd = dueDate(); |
@@ -368,3 +473,6 @@ QString OTodo::toRichText() const | |||
368 | } | 473 | } |
369 | bool OTodo::hasNotifiers()const { | 474 | |
475 | |||
476 | bool OTodo::hasNotifiers() const | ||
477 | { | ||
370 | if (!data->notifiers) return false; | 478 | if (!data->notifiers) return false; |
@@ -372,3 +480,6 @@ bool OTodo::hasNotifiers()const { | |||
372 | } | 480 | } |
373 | OPimNotifyManager& OTodo::notifiers() { | 481 | |
482 | |||
483 | OPimNotifyManager& OTodo::notifiers() | ||
484 | { | ||
374 | if (!data->notifiers ) | 485 | if (!data->notifiers ) |
@@ -377,3 +488,6 @@ OPimNotifyManager& OTodo::notifiers() { | |||
377 | } | 488 | } |
378 | const OPimNotifyManager& OTodo::notifiers()const{ | 489 | |
490 | |||
491 | const OPimNotifyManager& OTodo::notifiers() const | ||
492 | { | ||
379 | if (!data->notifiers ) | 493 | if (!data->notifiers ) |
@@ -384,9 +498,15 @@ const OPimNotifyManager& OTodo::notifiers()const{ | |||
384 | 498 | ||
385 | bool OTodo::operator<( const OTodo &toDoEvent )const{ | 499 | |
500 | bool OTodo::operator<( const OTodo &toDoEvent ) const | ||
501 | { | ||
386 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 502 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
387 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 503 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
388 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 504 | if ( hasDueDate() && toDoEvent.hasDueDate() ) |
389 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 505 | { |
506 | if ( dueDate() == toDoEvent.dueDate() ) | ||
507 | { // let's the priority decide | ||
390 | return priority() < toDoEvent.priority(); | 508 | return priority() < toDoEvent.priority(); |
391 | }else{ | 509 | } |
510 | else | ||
511 | { | ||
392 | return dueDate() < toDoEvent.dueDate(); | 512 | return dueDate() < toDoEvent.dueDate(); |
@@ -396,2 +516,4 @@ bool OTodo::operator<( const OTodo &toDoEvent )const{ | |||
396 | } | 516 | } |
517 | |||
518 | |||
397 | bool OTodo::operator<=(const OTodo &toDoEvent )const | 519 | bool OTodo::operator<=(const OTodo &toDoEvent )const |
@@ -400,6 +522,10 @@ bool OTodo::operator<=(const OTodo &toDoEvent )const | |||
400 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; | 522 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; |
401 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 523 | if ( hasDueDate() && toDoEvent.hasDueDate() ) |
402 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 524 | { |
525 | if ( dueDate() == toDoEvent.dueDate() ) | ||
526 | { // let's the priority decide | ||
403 | return priority() <= toDoEvent.priority(); | 527 | return priority() <= toDoEvent.priority(); |
404 | }else{ | 528 | } |
529 | else | ||
530 | { | ||
405 | return dueDate() <= toDoEvent.dueDate(); | 531 | return dueDate() <= toDoEvent.dueDate(); |
@@ -409,2 +535,4 @@ bool OTodo::operator<=(const OTodo &toDoEvent )const | |||
409 | } | 535 | } |
536 | |||
537 | |||
410 | bool OTodo::operator>(const OTodo &toDoEvent )const | 538 | bool OTodo::operator>(const OTodo &toDoEvent )const |
@@ -413,6 +541,10 @@ bool OTodo::operator>(const OTodo &toDoEvent )const | |||
413 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 541 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
414 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 542 | if ( hasDueDate() && toDoEvent.hasDueDate() ) |
415 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 543 | { |
544 | if ( dueDate() == toDoEvent.dueDate() ) | ||
545 | { // let's the priority decide | ||
416 | return priority() > toDoEvent.priority(); | 546 | return priority() > toDoEvent.priority(); |
417 | }else{ | 547 | } |
548 | else | ||
549 | { | ||
418 | return dueDate() > toDoEvent.dueDate(); | 550 | return dueDate() > toDoEvent.dueDate(); |
@@ -422,2 +554,4 @@ bool OTodo::operator>(const OTodo &toDoEvent )const | |||
422 | } | 554 | } |
555 | |||
556 | |||
423 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 557 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
@@ -426,6 +560,10 @@ bool OTodo::operator>=(const OTodo &toDoEvent )const | |||
426 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 560 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
427 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 561 | if ( hasDueDate() && toDoEvent.hasDueDate() ) |
428 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 562 | { |
563 | if ( dueDate() == toDoEvent.dueDate() ) | ||
564 | { // let's the priority decide | ||
429 | return priority() > toDoEvent.priority(); | 565 | return priority() > toDoEvent.priority(); |
430 | }else{ | 566 | } |
567 | else | ||
568 | { | ||
431 | return dueDate() > toDoEvent.dueDate(); | 569 | return dueDate() > toDoEvent.dueDate(); |
@@ -435,2 +573,4 @@ bool OTodo::operator>=(const OTodo &toDoEvent )const | |||
435 | } | 573 | } |
574 | |||
575 | |||
436 | bool OTodo::operator==(const OTodo &toDoEvent )const | 576 | bool OTodo::operator==(const OTodo &toDoEvent )const |
@@ -449,6 +589,10 @@ bool OTodo::operator==(const OTodo &toDoEvent )const | |||
449 | } | 589 | } |
450 | void OTodo::deref() { | 590 | |
591 | |||
592 | void OTodo::deref() | ||
593 | { | ||
451 | 594 | ||
452 | // qWarning("deref in ToDoEvent"); | 595 | // qWarning("deref in ToDoEvent"); |
453 | if ( data->deref() ) { | 596 | if ( data->deref() ) |
597 | { | ||
454 | // qWarning("deleting"); | 598 | // qWarning("deleting"); |
@@ -458,2 +602,4 @@ void OTodo::deref() { | |||
458 | } | 602 | } |
603 | |||
604 | |||
459 | OTodo &OTodo::operator=(const OTodo &item ) | 605 | OTodo &OTodo::operator=(const OTodo &item ) |
@@ -471,3 +617,5 @@ OTodo &OTodo::operator=(const OTodo &item ) | |||
471 | 617 | ||
472 | QMap<int, QString> OTodo::toMap() const { | 618 | |
619 | QMap<int, QString> OTodo::toMap() const | ||
620 | { | ||
473 | QMap<int, QString> map; | 621 | QMap<int, QString> map; |
@@ -494,2 +642,3 @@ QMap<int, QString> OTodo::toMap() const { | |||
494 | 642 | ||
643 | |||
495 | /** | 644 | /** |
@@ -499,4 +648,6 @@ QMap<int, QString> OTodo::toMap() const { | |||
499 | */ | 648 | */ |
500 | void OTodo::changeOrModify() { | 649 | void OTodo::changeOrModify() |
501 | if ( data->count != 1 ) { | 650 | { |
651 | if ( data->count != 1 ) | ||
652 | { | ||
502 | qWarning("changeOrModify"); | 653 | qWarning("changeOrModify"); |
@@ -508,2 +659,4 @@ void OTodo::changeOrModify() { | |||
508 | } | 659 | } |
660 | |||
661 | |||
509 | // WATCHOUT | 662 | // WATCHOUT |
@@ -513,3 +666,4 @@ void OTodo::changeOrModify() { | |||
513 | */ | 666 | */ |
514 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { | 667 | void OTodo::copy( OTodoData* src, OTodoData* dest ) |
668 | { | ||
515 | dest->date = src->date; | 669 | dest->date = src->date; |
@@ -538,6 +692,12 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) { | |||
538 | } | 692 | } |
539 | QString OTodo::type() const { | 693 | |
694 | |||
695 | QString OTodo::type() const | ||
696 | { | ||
540 | return QString::fromLatin1("OTodo"); | 697 | return QString::fromLatin1("OTodo"); |
541 | } | 698 | } |
542 | QString OTodo::recordField(int /*id*/ )const { | 699 | |
700 | |||
701 | QString OTodo::recordField( int /*id*/ ) const | ||
702 | { | ||
543 | return QString::null; | 703 | return QString::null; |
@@ -545,3 +705,5 @@ QString OTodo::recordField(int /*id*/ )const { | |||
545 | 705 | ||
546 | int OTodo::rtti(){ | 706 | |
707 | int OTodo::rtti() | ||
708 | { | ||
547 | return OPimResolver::TodoList; | 709 | return OPimResolver::TodoList; |
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h index 61add04..04dd269 100644 --- a/libopie2/opiepim/otodo.h +++ b/libopie2/opiepim/otodo.h | |||
@@ -28,6 +28,12 @@ | |||
28 | */ | 28 | */ |
29 | #ifndef OPIE_TODO_EVENT_H | ||
30 | #define OPIE_TODO_EVENT_H | ||
31 | 29 | ||
30 | #ifndef OTODOEVENT_H | ||
31 | #define OTODOEVENT_H | ||
32 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/opimrecord.h> | ||
35 | #include <qpe/recordfields.h> | ||
36 | #include <qpe/palmtopuidgen.h> | ||
37 | |||
38 | /* QT */ | ||
33 | #include <qarray.h> | 39 | #include <qarray.h> |
@@ -39,9 +45,4 @@ | |||
39 | 45 | ||
40 | #include <qpe/recordfields.h> | 46 | namespace Opie |
41 | #include <qpe/palmtopuidgen.h> | 47 | { |
42 | |||
43 | #include <opie2/opimrecord.h> | ||
44 | |||
45 | |||
46 | namespace Opie { | ||
47 | 48 | ||
@@ -51,3 +52,4 @@ class OPimMaintainer; | |||
51 | class OPimNotifyManager; | 52 | class OPimNotifyManager; |
52 | class OTodo : public OPimRecord { | 53 | class OTodo : public OPimRecord |
54 | { | ||
53 | public: | 55 | public: |
@@ -308,3 +310,6 @@ public: | |||
308 | }; | 310 | }; |
309 | inline bool OTodo::operator!=(const OTodo &toDoEvent )const { | 311 | |
312 | |||
313 | inline bool OTodo::operator!=( const OTodo &toDoEvent ) const | ||
314 | { | ||
310 | return !(*this == toDoEvent); | 315 | return !(*this == toDoEvent); |