summaryrefslogtreecommitdiff
authorzecke <zecke>2003-06-20 15:40:07 (UTC)
committer zecke <zecke>2003-06-20 15:40:07 (UTC)
commitec80e207cce9ebb55be771603fc47a4e7892fd6c (patch) (unidiff)
tree0ec055e15a0ca1ec9ff0e9c674ecbcca389acbf4
parentc57f817ceca0eff0f6f3e90ad01654252911c1c5 (diff)
downloadopie-ec80e207cce9ebb55be771603fc47a4e7892fd6c.zip
opie-ec80e207cce9ebb55be771603fc47a4e7892fd6c.tar.gz
opie-ec80e207cce9ebb55be771603fc47a4e7892fd6c.tar.bz2
toExtraMap is no more virtual
we save custom entries now setExtraMap added as well
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp10
-rw-r--r--libopie/pim/oevent.cpp11
-rw-r--r--libopie/pim/oevent.h1
-rw-r--r--libopie/pim/opimrecord.cpp6
-rw-r--r--libopie/pim/opimrecord.h8
-rw-r--r--libopie/pim/otodo.cpp13
-rw-r--r--libopie/pim/otodo.h1
-rw-r--r--libopie/pim/otodoaccessxml.cpp23
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp23
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp6
-rw-r--r--libopie2/opiepim/core/opimrecord.h8
-rw-r--r--libopie2/opiepim/ocontact.cpp10
-rw-r--r--libopie2/opiepim/oevent.cpp11
-rw-r--r--libopie2/opiepim/oevent.h1
-rw-r--r--libopie2/opiepim/otodo.cpp13
-rw-r--r--libopie2/opiepim/otodo.h1
16 files changed, 94 insertions, 52 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index a2fb68c..be4ce0a 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -432,25 +432,25 @@ QMap<int, QString> OContact::toMap() const
432 Returns a rich text formatted QString representing the contents the contact. 432 Returns a rich text formatted QString representing the contents the contact.
433*/ 433*/
434QString OContact::toRichText() const 434QString OContact::toRichText() const
435{ 435{
436 QString text; 436 QString text;
437 QString value, comp, state; 437 QString value, comp, state;
438 QString str; 438 QString str;
439 bool marker = false; 439 bool marker = false;
440 440
441 // name, jobtitle and company 441 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 442 if ( !(value = fullName()).isEmpty() )
443 text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>"; 443 text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>";
444 444
445 if ( !(value = jobTitle()).isEmpty() ) 445 if ( !(value = jobTitle()).isEmpty() )
446 text += Qtopia::escapeString(value) + "<br>"; 446 text += Qtopia::escapeString(value) + "<br>";
447 447
448 comp = company(); 448 comp = company();
449 if ( !(value = department()).isEmpty() ) { 449 if ( !(value = department()).isEmpty() ) {
450 text += Qtopia::escapeString(value); 450 text += Qtopia::escapeString(value);
451 if ( comp ) 451 if ( comp )
452 text += ", "; 452 text += ", ";
453 else 453 else
454 text += "<br>"; 454 text += "<br>";
455 } 455 }
456 if ( !comp.isEmpty() ) 456 if ( !comp.isEmpty() )
@@ -973,31 +973,25 @@ bool OContact::match( const QRegExp &r ) const
973} 973}
974 974
975 975
976QString OContact::toShortText() const 976QString OContact::toShortText() const
977{ 977{
978 return ( fullName() ); 978 return ( fullName() );
979} 979}
980QString OContact::type() const 980QString OContact::type() const
981{ 981{
982 return QString::fromLatin1( "OContact" ); 982 return QString::fromLatin1( "OContact" );
983} 983}
984 984
985// Definition is missing ! (se) 985
986QMap<QString,QString> OContact::toExtraMap() const
987{
988 qWarning ("Function not implemented: OContact::toExtraMap()");
989 QMap <QString,QString> useless;
990 return useless;
991}
992 986
993class QString OContact::recordField( int pos ) const 987class QString OContact::recordField( int pos ) const
994{ 988{
995 QStringList SLFIELDS = fields(); // ?? why this ? (se) 989 QStringList SLFIELDS = fields(); // ?? why this ? (se)
996 return SLFIELDS[pos]; 990 return SLFIELDS[pos];
997} 991}
998 992
999// In future releases, we should store birthday and anniversary 993// In future releases, we should store birthday and anniversary
1000// internally as QDate instead of QString ! 994// internally as QDate instead of QString !
1001// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 995// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1002 996
1003/*! \fn void OContact::setBirthday( const QDate& date ) 997/*! \fn void OContact::setBirthday( const QDate& date )
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index e4f5d92..7bcf944 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -227,32 +227,32 @@ bool OEvent::match( const QRegExp& re )const {
227 if ( re.match( data->start.toString() ) != -1 ){ 227 if ( re.match( data->start.toString() ) != -1 ){
228 setLastHitField( Qtopia::StartDateTime ); 228 setLastHitField( Qtopia::StartDateTime );
229 return true; 229 return true;
230 } 230 }
231 if ( re.match( data->end.toString() ) != -1 ){ 231 if ( re.match( data->end.toString() ) != -1 ){
232 setLastHitField( Qtopia::EndDateTime ); 232 setLastHitField( Qtopia::EndDateTime );
233 return true; 233 return true;
234 } 234 }
235 return false; 235 return false;
236} 236}
237QString OEvent::toRichText()const { 237QString OEvent::toRichText()const {
238 QString text, value; 238 QString text, value;
239 239
240 // description 240 // description
241 text += "<b><h3><img src=\"datebook/DateBook\">"; 241 text += "<b><h3><img src=\"datebook/DateBook\">";
242 if ( !description().isEmpty() ) { 242 if ( !description().isEmpty() ) {
243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); 243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
244 } 244 }
245 text += "</h3></b><br><hr><br>"; 245 text += "</h3></b><br><hr><br>";
246 246
247 // location 247 // location
248 if ( !(value = location()).isEmpty() ) { 248 if ( !(value = location()).isEmpty() ) {
249 text += "<b>" + QObject::tr( "Location:" ) + "</b> "; 249 text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
250 text += Qtopia::escapeString(value) + "<br>"; 250 text += Qtopia::escapeString(value) + "<br>";
251 } 251 }
252 252
253 // all day event 253 // all day event
254 if ( isAllDay() ) { 254 if ( isAllDay() ) {
255 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; 255 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
256 } 256 }
257 // multiple day event 257 // multiple day event
258 else if ( isMultipleDay () ) { 258 else if ( isMultipleDay () ) {
@@ -265,32 +265,32 @@ QString OEvent::toRichText()const {
265 text += "<b>" + QObject::tr( "Start:") + "</b> "; 265 text += "<b>" + QObject::tr( "Start:") + "</b> ";
266 text += Qtopia::escapeString(startDateTime().toString() ). 266 text += Qtopia::escapeString(startDateTime().toString() ).
267 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 267 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
268 } 268 }
269 269
270 // end time 270 // end time
271 if ( endDateTime().isValid() ) { 271 if ( endDateTime().isValid() ) {
272 text += "<b>" + QObject::tr( "End:") + "</b> "; 272 text += "<b>" + QObject::tr( "End:") + "</b> ";
273 text += Qtopia::escapeString(endDateTime().toString() ). 273 text += Qtopia::escapeString(endDateTime().toString() ).
274 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 274 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
275 } 275 }
276 } 276 }
277 277
278 // categories 278 // categories
279 if ( categoryNames("Calendar").count() ){ 279 if ( categoryNames("Calendar").count() ){
280 text += "<b>" + QObject::tr( "Category:") + "</b> "; 280 text += "<b>" + QObject::tr( "Category:") + "</b> ";
281 text += categoryNames("Calendar").join(", "); 281 text += categoryNames("Calendar").join(", ");
282 text += "<br>"; 282 text += "<br>";
283 } 283 }
284 284
285 //notes 285 //notes
286 if ( !note().isEmpty() ) { 286 if ( !note().isEmpty() ) {
287 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 287 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
288 text += note(); 288 text += note();
289// text += Qtopia::escapeString(note() ). 289// text += Qtopia::escapeString(note() ).
290// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 290// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
291 } 291 }
292 return text; 292 return text;
293} 293}
294QString OEvent::toShortText()const { 294QString OEvent::toShortText()const {
295 QString text; 295 QString text;
296 text += QString::number( startDateTime().date().day() ); 296 text += QString::number( startDateTime().date().day() );
@@ -351,27 +351,24 @@ void OEvent::changeOrModify() {
351 } 351 }
352} 352}
353void OEvent::deref() { 353void OEvent::deref() {
354 if ( data->deref() ) { 354 if ( data->deref() ) {
355 delete data; 355 delete data;
356 data = 0; 356 data = 0;
357 } 357 }
358} 358}
359// FIXME 359// FIXME
360QMap<int, QString> OEvent::toMap()const { 360QMap<int, QString> OEvent::toMap()const {
361 return QMap<int, QString>(); 361 return QMap<int, QString>();
362} 362}
363QMap<QString, QString> OEvent::toExtraMap()const {
364 return QMap<QString, QString>();
365}
366int OEvent::parent()const { 363int OEvent::parent()const {
367 return data->parent; 364 return data->parent;
368} 365}
369void OEvent::setParent( int uid ) { 366void OEvent::setParent( int uid ) {
370 changeOrModify(); 367 changeOrModify();
371 data->parent = uid; 368 data->parent = uid;
372} 369}
373QArray<int> OEvent::children() const{ 370QArray<int> OEvent::children() const{
374 if (!data->child) return QArray<int>(); 371 if (!data->child) return QArray<int>();
375 else 372 else
376 return data->child->copy(); 373 return data->child->copy();
377} 374}
diff --git a/libopie/pim/oevent.h b/libopie/pim/oevent.h
index b696d81..30f442e 100644
--- a/libopie/pim/oevent.h
+++ b/libopie/pim/oevent.h
@@ -123,25 +123,24 @@ public:
123 123
124 /** return the parent OEvent */ 124 /** return the parent OEvent */
125 int parent()const; 125 int parent()const;
126 void setParent( int uid ); 126 void setParent( int uid );
127 127
128 128
129 /* needed reimp */ 129 /* needed reimp */
130 QString toRichText()const; 130 QString toRichText()const;
131 QString toShortText()const; 131 QString toShortText()const;
132 QString type()const; 132 QString type()const;
133 133
134 QMap<int, QString> toMap()const; 134 QMap<int, QString> toMap()const;
135 QMap<QString, QString> toExtraMap()const;
136 QString recordField(int )const; 135 QString recordField(int )const;
137 136
138 static int rtti(); 137 static int rtti();
139 138
140 bool loadFromStream( QDataStream& ); 139 bool loadFromStream( QDataStream& );
141 bool saveToStream( QDataStream& )const; 140 bool saveToStream( QDataStream& )const;
142 141
143/* bool operator==( const OEvent& ); 142/* bool operator==( const OEvent& );
144 bool operator!=( const OEvent& ); 143 bool operator!=( const OEvent& );
145 bool operator<( const OEvent& ); 144 bool operator<( const OEvent& );
146 bool operator<=( const OEvent& ); 145 bool operator<=( const OEvent& );
147 bool operator>( const OEvent& ); 146 bool operator>( const OEvent& );
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp
index 0c9734d..2365748 100644
--- a/libopie/pim/opimrecord.cpp
+++ b/libopie/pim/opimrecord.cpp
@@ -165,12 +165,18 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
165 165
166 stream >> i ; 166 stream >> i ;
167 par.setField( i ); 167 par.setField( i );
168 168
169 return par; 169 return par;
170} 170}
171void OPimRecord::setLastHitField( int lastHit )const { 171void OPimRecord::setLastHitField( int lastHit )const {
172 m_lastHit = lastHit; 172 m_lastHit = lastHit;
173} 173}
174int OPimRecord::lastHitField()const{ 174int OPimRecord::lastHitField()const{
175 return m_lastHit; 175 return m_lastHit;
176} 176}
177QMap<QString, QString> OPimRecord::toExtraMap()const {
178 return customMap;
179}
180void OPimRecord::setExtraMap( const QMap<QString, QString>& map) {
181 customMap = map;
182}
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index 494c78e..563b19c 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -1,21 +1,26 @@
1#ifndef OPIE_PIM_RECORD_H 1#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 2#define OPIE_PIM_RECORD_H
3 3
4#include <qdatastream.h> 4#include <qdatastream.h>
5#include <qmap.h> 5#include <qmap.h>
6#include <qstring.h> 6#include <qstring.h>
7#include <qstringlist.h> 7#include <qstringlist.h>
8 8
9/*
10 * we need to get customMap which is private...
11 */
12#define private protected
9#include <qpe/palmtoprecord.h> 13#include <qpe/palmtoprecord.h>
14#undef private
10 15
11#include <opie/opimxrefmanager.h> 16#include <opie/opimxrefmanager.h>
12 17
13/** 18/**
14 * This is the base class for 19 * This is the base class for
15 * all PIM Records 20 * all PIM Records
16 * 21 *
17 */ 22 */
18class OPimRecord : public Qtopia::Record { 23class OPimRecord : public Qtopia::Record {
19public: 24public:
20 /** 25 /**
21 * c'tor 26 * c'tor
@@ -85,25 +90,26 @@ public:
85 * or -1 if not implemented or no hit has occured 90 * or -1 if not implemented or no hit has occured
86 */ 91 */
87 int lastHitField()const; 92 int lastHitField()const;
88 93
89 /** 94 /**
90 * converts the internal structure to a map 95 * converts the internal structure to a map
91 */ 96 */
92 virtual QMap<int, QString> toMap()const = 0; 97 virtual QMap<int, QString> toMap()const = 0;
93 98
94 /** 99 /**
95 * key value representation of extra items 100 * key value representation of extra items
96 */ 101 */
97 virtual QMap<QString, QString> toExtraMap()const = 0; 102 QMap<QString, QString> toExtraMap()const;
103 void setExtraMap( const QMap<QString, QString>& );
98 104
99 /** 105 /**
100 * the name for a recordField 106 * the name for a recordField
101 */ 107 */
102 virtual QString recordField(int)const = 0; 108 virtual QString recordField(int)const = 0;
103 109
104 /** 110 /**
105 * returns a reference of the 111 * returns a reference of the
106 * Cross Reference Manager 112 * Cross Reference Manager
107 * Partner 'One' is THIS PIM RECORD! 113 * Partner 'One' is THIS PIM RECORD!
108 * 'Two' is the Partner where we link to 114 * 'Two' is the Partner where we link to
109 */ 115 */
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index c84eeeb..38b93f7 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -270,25 +270,25 @@ QString OTodo::toShortText() const {
270*/ 270*/
271QString OTodo::toRichText() const 271QString OTodo::toRichText() const
272{ 272{
273 QString text; 273 QString text;
274 QStringList catlist; 274 QStringList catlist;
275 275
276 // summary 276 // summary
277 text += "<b><h3><img src=\"todo/TodoList\">"; 277 text += "<b><h3><img src=\"todo/TodoList\">";
278 if ( !summary().isEmpty() ) { 278 if ( !summary().isEmpty() ) {
279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); 279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
280 } 280 }
281 text += "</h3></b><br><hr><br>"; 281 text += "</h3></b><br><hr><br>";
282 282
283 // description 283 // description
284 if( !description().isEmpty() ){ 284 if( !description().isEmpty() ){
285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
287 } 287 }
288 288
289 // priority 289 // priority
290 int priorityval = priority(); 290 int priorityval = priority();
291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + 291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
292 QString::number( priorityval ) + "\">"; 292 QString::number( priorityval ) + "\">";
293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" + 293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
294// QString::number( priority() ) + "\"><br>"; 294// QString::number( priority() ) + "\"><br>";
@@ -297,45 +297,45 @@ QString OTodo::toRichText() const
297 case 1 : text += QObject::tr( "Very high" ); 297 case 1 : text += QObject::tr( "Very high" );
298 break; 298 break;
299 case 2 : text += QObject::tr( "High" ); 299 case 2 : text += QObject::tr( "High" );
300 break; 300 break;
301 case 3 : text += QObject::tr( "Normal" ); 301 case 3 : text += QObject::tr( "Normal" );
302 break; 302 break;
303 case 4 : text += QObject::tr( "Low" ); 303 case 4 : text += QObject::tr( "Low" );
304 break; 304 break;
305 case 5 : text += QObject::tr( "Very low" ); 305 case 5 : text += QObject::tr( "Very low" );
306 break; 306 break;
307 }; 307 };
308 text += "<br>"; 308 text += "<br>";
309 309
310 // progress 310 // progress
311 text += "<b>" + QObject::tr( "Progress:") + " </b>" 311 text += "<b>" + QObject::tr( "Progress:") + " </b>"
312 + QString::number( progress() ) + " %<br>"; 312 + QString::number( progress() ) + " %<br>";
313 313
314 // due date 314 // due date
315 if (hasDueDate() ){ 315 if (hasDueDate() ){
316 QDate dd = dueDate(); 316 QDate dd = dueDate();
317 int off = QDate::currentDate().daysTo( dd ); 317 int off = QDate::currentDate().daysTo( dd );
318 318
319 text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\""; 319 text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
320 if ( off < 0 ) 320 if ( off < 0 )
321 text += "#FF0000"; 321 text += "#FF0000";
322 else if ( off == 0 ) 322 else if ( off == 0 )
323 text += "#FFFF00"; 323 text += "#FFFF00";
324 else if ( off > 0 ) 324 else if ( off > 0 )
325 text += "#00FF00"; 325 text += "#00FF00";
326 326
327 text += "\">" + dd.toString() + "</font><br>"; 327 text += "\">" + dd.toString() + "</font><br>";
328 } 328 }
329 329
330 // categories 330 // categories
331 text += "<b>" + QObject::tr( "Category:") + "</b> "; 331 text += "<b>" + QObject::tr( "Category:") + "</b> ";
332 text += categoryNames( "Todo List" ).join(", "); 332 text += categoryNames( "Todo List" ).join(", ");
333 text += "<br>"; 333 text += "<br>";
334 334
335 return text; 335 return text;
336} 336}
337bool OTodo::hasNotifiers()const { 337bool OTodo::hasNotifiers()const {
338 if (!data->notifiers) return false; 338 if (!data->notifiers) return false;
339 return !data->notifiers->isEmpty(); 339 return !data->notifiers->isEmpty();
340} 340}
341OPimNotifyManager& OTodo::notifiers() { 341OPimNotifyManager& OTodo::notifiers() {
@@ -451,27 +451,24 @@ QMap<int, QString> OTodo::toMap() const {
451 map.insert( DateMonth, QString::number( data->date.month() ) ); 451 map.insert( DateMonth, QString::number( data->date.month() ) );
452 map.insert( DateYear, QString::number( data->date.year() ) ); 452 map.insert( DateYear, QString::number( data->date.year() ) );
453 map.insert( Progress, QString::number( data->prog ) ); 453 map.insert( Progress, QString::number( data->prog ) );
454// map.insert( CrossReference, crossToString() ); 454// map.insert( CrossReference, crossToString() );
455 /* FIXME!!! map.insert( State, ); 455 /* FIXME!!! map.insert( State, );
456 map.insert( Recurrence, ); 456 map.insert( Recurrence, );
457 map.insert( Reminders, ); 457 map.insert( Reminders, );
458 map. 458 map.
459 */ 459 */
460 return map; 460 return map;
461} 461}
462 462
463QMap<QString, QString> OTodo::toExtraMap()const {
464 return data->extra;
465}
466/** 463/**
467 * change or modify looks at the ref count and either 464 * change or modify looks at the ref count and either
468 * creates a new QShared Object or it can modify it 465 * creates a new QShared Object or it can modify it
469 * right in place 466 * right in place
470 */ 467 */
471void OTodo::changeOrModify() { 468void OTodo::changeOrModify() {
472 if ( data->count != 1 ) { 469 if ( data->count != 1 ) {
473 qWarning("changeOrModify"); 470 qWarning("changeOrModify");
474 data->deref(); 471 data->deref();
475 OTodoData* d2 = new OTodoData(); 472 OTodoData* d2 = new OTodoData();
476 copy(data, d2 ); 473 copy(data, d2 );
477 data = d2; 474 data = d2;
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index 4d5ee36..f9a345a 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -184,25 +184,24 @@ public:
184 OPimNotifyManager &notifiers(); 184 OPimNotifyManager &notifiers();
185 185
186 /** 186 /**
187 * 187 *
188 */ 188 */
189 const OPimNotifyManager &notifiers()const; 189 const OPimNotifyManager &notifiers()const;
190 190
191 /** 191 /**
192 * reimplementations 192 * reimplementations
193 */ 193 */
194 QString type()const; 194 QString type()const;
195 QString toShortText()const; 195 QString toShortText()const;
196 QMap<QString, QString> toExtraMap()const;
197 QString recordField(int id )const; 196 QString recordField(int id )const;
198 197
199 /** 198 /**
200 * toMap puts all data into the map. int relates 199 * toMap puts all data into the map. int relates
201 * to ToDoEvent RecordFields enum 200 * to ToDoEvent RecordFields enum
202 */ 201 */
203 QMap<int, QString> toMap()const; 202 QMap<int, QString> toMap()const;
204 203
205 /** 204 /**
206 * Set if this Todo is completed 205 * Set if this Todo is completed
207 */ 206 */
208 void setCompleted(bool completed ); 207 void setCompleted(bool completed );
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 2b62f0d..3d15354 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -488,27 +488,49 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
488 break; 488 break;
489 case FRFreq: 489 case FRFreq:
490 recur()->setFrequency( val.toInt() ); 490 recur()->setFrequency( val.toInt() );
491 break; 491 break;
492 case FRHasEndDate: 492 case FRHasEndDate:
493 recur()->setHasEndDate( val.toInt() ); 493 recur()->setHasEndDate( val.toInt() );
494 break; 494 break;
495 case FREndDate: { 495 case FREndDate: {
496 rp_end = (time_t) val.toLong(); 496 rp_end = (time_t) val.toLong();
497 break; 497 break;
498 } 498 }
499 default: 499 default:
500 ev.setCustomField( attr, val );
500 break; 501 break;
501 } 502 }
502} 503}
504
505// from PalmtopRecord... GPL ### FIXME
506namespace {
507QString customToXml(const QMap<QString, QString>& customMap )
508{
509 //qWarning(QString("writing custom %1").arg(customMap.count()));
510 QString buf(" ");
511 for ( QMap<QString, QString>::ConstIterator cit = customMap.begin();
512 cit != customMap.end(); ++cit) {
513 // qWarning(".ITEM.");
514 buf += cit.key();
515 buf += "=\"";
516 buf += Qtopia::escapeString(cit.data());
517 buf += "\" ";
518 }
519 return buf;
520}
521
522
523}
524
503QString OTodoAccessXML::toString( const OTodo& ev )const { 525QString OTodoAccessXML::toString( const OTodo& ev )const {
504 QString str; 526 QString str;
505 527
506 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 528 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
507 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 529 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
508 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 530 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
509 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 531 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
510 532
511 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 533 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
512 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 534 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
513 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 535 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
514 536
@@ -572,24 +594,25 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
572 * now the same for reminders but more easy. We just save the uid of the OEvent. 594 * now the same for reminders but more easy. We just save the uid of the OEvent.
573 */ 595 */
574 OPimNotifyManager::Reminders reminders = manager.reminders(); 596 OPimNotifyManager::Reminders reminders = manager.reminders();
575 if (!reminders.isEmpty() ) { 597 if (!reminders.isEmpty() ) {
576 OPimNotifyManager::Reminders::Iterator it = reminders.begin(); 598 OPimNotifyManager::Reminders::Iterator it = reminders.begin();
577 QStringList records; 599 QStringList records;
578 for ( ; it != reminders.end(); ++it ) { 600 for ( ; it != reminders.end(); ++it ) {
579 records << QString::number( (*it).recordUid() ); 601 records << QString::number( (*it).recordUid() );
580 } 602 }
581 str += "Reminders=\""+ records.join(";") +"\" "; 603 str += "Reminders=\""+ records.join(";") +"\" ";
582 } 604 }
583 } 605 }
606 str += customToXml( ev.toExtraMap() );
584 607
585 608
586 return str; 609 return str;
587} 610}
588QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 611QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
589 return Qtopia::Record::idsToString( ints ); 612 return Qtopia::Record::idsToString( ints );
590} 613}
591 614
592/* internal class for sorting 615/* internal class for sorting
593 * 616 *
594 * Inspired by todoxmlio.cpp from TT 617 * Inspired by todoxmlio.cpp from TT
595 */ 618 */
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 2b62f0d..3d15354 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -488,27 +488,49 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
488 break; 488 break;
489 case FRFreq: 489 case FRFreq:
490 recur()->setFrequency( val.toInt() ); 490 recur()->setFrequency( val.toInt() );
491 break; 491 break;
492 case FRHasEndDate: 492 case FRHasEndDate:
493 recur()->setHasEndDate( val.toInt() ); 493 recur()->setHasEndDate( val.toInt() );
494 break; 494 break;
495 case FREndDate: { 495 case FREndDate: {
496 rp_end = (time_t) val.toLong(); 496 rp_end = (time_t) val.toLong();
497 break; 497 break;
498 } 498 }
499 default: 499 default:
500 ev.setCustomField( attr, val );
500 break; 501 break;
501 } 502 }
502} 503}
504
505// from PalmtopRecord... GPL ### FIXME
506namespace {
507QString customToXml(const QMap<QString, QString>& customMap )
508{
509 //qWarning(QString("writing custom %1").arg(customMap.count()));
510 QString buf(" ");
511 for ( QMap<QString, QString>::ConstIterator cit = customMap.begin();
512 cit != customMap.end(); ++cit) {
513 // qWarning(".ITEM.");
514 buf += cit.key();
515 buf += "=\"";
516 buf += Qtopia::escapeString(cit.data());
517 buf += "\" ";
518 }
519 return buf;
520}
521
522
523}
524
503QString OTodoAccessXML::toString( const OTodo& ev )const { 525QString OTodoAccessXML::toString( const OTodo& ev )const {
504 QString str; 526 QString str;
505 527
506 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 528 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
507 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 529 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
508 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 530 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
509 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 531 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
510 532
511 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 533 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
512 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 534 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
513 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 535 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
514 536
@@ -572,24 +594,25 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
572 * now the same for reminders but more easy. We just save the uid of the OEvent. 594 * now the same for reminders but more easy. We just save the uid of the OEvent.
573 */ 595 */
574 OPimNotifyManager::Reminders reminders = manager.reminders(); 596 OPimNotifyManager::Reminders reminders = manager.reminders();
575 if (!reminders.isEmpty() ) { 597 if (!reminders.isEmpty() ) {
576 OPimNotifyManager::Reminders::Iterator it = reminders.begin(); 598 OPimNotifyManager::Reminders::Iterator it = reminders.begin();
577 QStringList records; 599 QStringList records;
578 for ( ; it != reminders.end(); ++it ) { 600 for ( ; it != reminders.end(); ++it ) {
579 records << QString::number( (*it).recordUid() ); 601 records << QString::number( (*it).recordUid() );
580 } 602 }
581 str += "Reminders=\""+ records.join(";") +"\" "; 603 str += "Reminders=\""+ records.join(";") +"\" ";
582 } 604 }
583 } 605 }
606 str += customToXml( ev.toExtraMap() );
584 607
585 608
586 return str; 609 return str;
587} 610}
588QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 611QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
589 return Qtopia::Record::idsToString( ints ); 612 return Qtopia::Record::idsToString( ints );
590} 613}
591 614
592/* internal class for sorting 615/* internal class for sorting
593 * 616 *
594 * Inspired by todoxmlio.cpp from TT 617 * Inspired by todoxmlio.cpp from TT
595 */ 618 */
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index 0c9734d..2365748 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -165,12 +165,18 @@ OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
165 165
166 stream >> i ; 166 stream >> i ;
167 par.setField( i ); 167 par.setField( i );
168 168
169 return par; 169 return par;
170} 170}
171void OPimRecord::setLastHitField( int lastHit )const { 171void OPimRecord::setLastHitField( int lastHit )const {
172 m_lastHit = lastHit; 172 m_lastHit = lastHit;
173} 173}
174int OPimRecord::lastHitField()const{ 174int OPimRecord::lastHitField()const{
175 return m_lastHit; 175 return m_lastHit;
176} 176}
177QMap<QString, QString> OPimRecord::toExtraMap()const {
178 return customMap;
179}
180void OPimRecord::setExtraMap( const QMap<QString, QString>& map) {
181 customMap = map;
182}
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index 494c78e..563b19c 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -1,21 +1,26 @@
1#ifndef OPIE_PIM_RECORD_H 1#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 2#define OPIE_PIM_RECORD_H
3 3
4#include <qdatastream.h> 4#include <qdatastream.h>
5#include <qmap.h> 5#include <qmap.h>
6#include <qstring.h> 6#include <qstring.h>
7#include <qstringlist.h> 7#include <qstringlist.h>
8 8
9/*
10 * we need to get customMap which is private...
11 */
12#define private protected
9#include <qpe/palmtoprecord.h> 13#include <qpe/palmtoprecord.h>
14#undef private
10 15
11#include <opie/opimxrefmanager.h> 16#include <opie/opimxrefmanager.h>
12 17
13/** 18/**
14 * This is the base class for 19 * This is the base class for
15 * all PIM Records 20 * all PIM Records
16 * 21 *
17 */ 22 */
18class OPimRecord : public Qtopia::Record { 23class OPimRecord : public Qtopia::Record {
19public: 24public:
20 /** 25 /**
21 * c'tor 26 * c'tor
@@ -85,25 +90,26 @@ public:
85 * or -1 if not implemented or no hit has occured 90 * or -1 if not implemented or no hit has occured
86 */ 91 */
87 int lastHitField()const; 92 int lastHitField()const;
88 93
89 /** 94 /**
90 * converts the internal structure to a map 95 * converts the internal structure to a map
91 */ 96 */
92 virtual QMap<int, QString> toMap()const = 0; 97 virtual QMap<int, QString> toMap()const = 0;
93 98
94 /** 99 /**
95 * key value representation of extra items 100 * key value representation of extra items
96 */ 101 */
97 virtual QMap<QString, QString> toExtraMap()const = 0; 102 QMap<QString, QString> toExtraMap()const;
103 void setExtraMap( const QMap<QString, QString>& );
98 104
99 /** 105 /**
100 * the name for a recordField 106 * the name for a recordField
101 */ 107 */
102 virtual QString recordField(int)const = 0; 108 virtual QString recordField(int)const = 0;
103 109
104 /** 110 /**
105 * returns a reference of the 111 * returns a reference of the
106 * Cross Reference Manager 112 * Cross Reference Manager
107 * Partner 'One' is THIS PIM RECORD! 113 * Partner 'One' is THIS PIM RECORD!
108 * 'Two' is the Partner where we link to 114 * 'Two' is the Partner where we link to
109 */ 115 */
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index a2fb68c..be4ce0a 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -432,25 +432,25 @@ QMap<int, QString> OContact::toMap() const
432 Returns a rich text formatted QString representing the contents the contact. 432 Returns a rich text formatted QString representing the contents the contact.
433*/ 433*/
434QString OContact::toRichText() const 434QString OContact::toRichText() const
435{ 435{
436 QString text; 436 QString text;
437 QString value, comp, state; 437 QString value, comp, state;
438 QString str; 438 QString str;
439 bool marker = false; 439 bool marker = false;
440 440
441 // name, jobtitle and company 441 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 442 if ( !(value = fullName()).isEmpty() )
443 text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>"; 443 text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>";
444 444
445 if ( !(value = jobTitle()).isEmpty() ) 445 if ( !(value = jobTitle()).isEmpty() )
446 text += Qtopia::escapeString(value) + "<br>"; 446 text += Qtopia::escapeString(value) + "<br>";
447 447
448 comp = company(); 448 comp = company();
449 if ( !(value = department()).isEmpty() ) { 449 if ( !(value = department()).isEmpty() ) {
450 text += Qtopia::escapeString(value); 450 text += Qtopia::escapeString(value);
451 if ( comp ) 451 if ( comp )
452 text += ", "; 452 text += ", ";
453 else 453 else
454 text += "<br>"; 454 text += "<br>";
455 } 455 }
456 if ( !comp.isEmpty() ) 456 if ( !comp.isEmpty() )
@@ -973,31 +973,25 @@ bool OContact::match( const QRegExp &r ) const
973} 973}
974 974
975 975
976QString OContact::toShortText() const 976QString OContact::toShortText() const
977{ 977{
978 return ( fullName() ); 978 return ( fullName() );
979} 979}
980QString OContact::type() const 980QString OContact::type() const
981{ 981{
982 return QString::fromLatin1( "OContact" ); 982 return QString::fromLatin1( "OContact" );
983} 983}
984 984
985// Definition is missing ! (se) 985
986QMap<QString,QString> OContact::toExtraMap() const
987{
988 qWarning ("Function not implemented: OContact::toExtraMap()");
989 QMap <QString,QString> useless;
990 return useless;
991}
992 986
993class QString OContact::recordField( int pos ) const 987class QString OContact::recordField( int pos ) const
994{ 988{
995 QStringList SLFIELDS = fields(); // ?? why this ? (se) 989 QStringList SLFIELDS = fields(); // ?? why this ? (se)
996 return SLFIELDS[pos]; 990 return SLFIELDS[pos];
997} 991}
998 992
999// In future releases, we should store birthday and anniversary 993// In future releases, we should store birthday and anniversary
1000// internally as QDate instead of QString ! 994// internally as QDate instead of QString !
1001// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 995// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1002 996
1003/*! \fn void OContact::setBirthday( const QDate& date ) 997/*! \fn void OContact::setBirthday( const QDate& date )
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index e4f5d92..7bcf944 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -227,32 +227,32 @@ bool OEvent::match( const QRegExp& re )const {
227 if ( re.match( data->start.toString() ) != -1 ){ 227 if ( re.match( data->start.toString() ) != -1 ){
228 setLastHitField( Qtopia::StartDateTime ); 228 setLastHitField( Qtopia::StartDateTime );
229 return true; 229 return true;
230 } 230 }
231 if ( re.match( data->end.toString() ) != -1 ){ 231 if ( re.match( data->end.toString() ) != -1 ){
232 setLastHitField( Qtopia::EndDateTime ); 232 setLastHitField( Qtopia::EndDateTime );
233 return true; 233 return true;
234 } 234 }
235 return false; 235 return false;
236} 236}
237QString OEvent::toRichText()const { 237QString OEvent::toRichText()const {
238 QString text, value; 238 QString text, value;
239 239
240 // description 240 // description
241 text += "<b><h3><img src=\"datebook/DateBook\">"; 241 text += "<b><h3><img src=\"datebook/DateBook\">";
242 if ( !description().isEmpty() ) { 242 if ( !description().isEmpty() ) {
243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); 243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
244 } 244 }
245 text += "</h3></b><br><hr><br>"; 245 text += "</h3></b><br><hr><br>";
246 246
247 // location 247 // location
248 if ( !(value = location()).isEmpty() ) { 248 if ( !(value = location()).isEmpty() ) {
249 text += "<b>" + QObject::tr( "Location:" ) + "</b> "; 249 text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
250 text += Qtopia::escapeString(value) + "<br>"; 250 text += Qtopia::escapeString(value) + "<br>";
251 } 251 }
252 252
253 // all day event 253 // all day event
254 if ( isAllDay() ) { 254 if ( isAllDay() ) {
255 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; 255 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
256 } 256 }
257 // multiple day event 257 // multiple day event
258 else if ( isMultipleDay () ) { 258 else if ( isMultipleDay () ) {
@@ -265,32 +265,32 @@ QString OEvent::toRichText()const {
265 text += "<b>" + QObject::tr( "Start:") + "</b> "; 265 text += "<b>" + QObject::tr( "Start:") + "</b> ";
266 text += Qtopia::escapeString(startDateTime().toString() ). 266 text += Qtopia::escapeString(startDateTime().toString() ).
267 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 267 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
268 } 268 }
269 269
270 // end time 270 // end time
271 if ( endDateTime().isValid() ) { 271 if ( endDateTime().isValid() ) {
272 text += "<b>" + QObject::tr( "End:") + "</b> "; 272 text += "<b>" + QObject::tr( "End:") + "</b> ";
273 text += Qtopia::escapeString(endDateTime().toString() ). 273 text += Qtopia::escapeString(endDateTime().toString() ).
274 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 274 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
275 } 275 }
276 } 276 }
277 277
278 // categories 278 // categories
279 if ( categoryNames("Calendar").count() ){ 279 if ( categoryNames("Calendar").count() ){
280 text += "<b>" + QObject::tr( "Category:") + "</b> "; 280 text += "<b>" + QObject::tr( "Category:") + "</b> ";
281 text += categoryNames("Calendar").join(", "); 281 text += categoryNames("Calendar").join(", ");
282 text += "<br>"; 282 text += "<br>";
283 } 283 }
284 284
285 //notes 285 //notes
286 if ( !note().isEmpty() ) { 286 if ( !note().isEmpty() ) {
287 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 287 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
288 text += note(); 288 text += note();
289// text += Qtopia::escapeString(note() ). 289// text += Qtopia::escapeString(note() ).
290// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 290// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
291 } 291 }
292 return text; 292 return text;
293} 293}
294QString OEvent::toShortText()const { 294QString OEvent::toShortText()const {
295 QString text; 295 QString text;
296 text += QString::number( startDateTime().date().day() ); 296 text += QString::number( startDateTime().date().day() );
@@ -351,27 +351,24 @@ void OEvent::changeOrModify() {
351 } 351 }
352} 352}
353void OEvent::deref() { 353void OEvent::deref() {
354 if ( data->deref() ) { 354 if ( data->deref() ) {
355 delete data; 355 delete data;
356 data = 0; 356 data = 0;
357 } 357 }
358} 358}
359// FIXME 359// FIXME
360QMap<int, QString> OEvent::toMap()const { 360QMap<int, QString> OEvent::toMap()const {
361 return QMap<int, QString>(); 361 return QMap<int, QString>();
362} 362}
363QMap<QString, QString> OEvent::toExtraMap()const {
364 return QMap<QString, QString>();
365}
366int OEvent::parent()const { 363int OEvent::parent()const {
367 return data->parent; 364 return data->parent;
368} 365}
369void OEvent::setParent( int uid ) { 366void OEvent::setParent( int uid ) {
370 changeOrModify(); 367 changeOrModify();
371 data->parent = uid; 368 data->parent = uid;
372} 369}
373QArray<int> OEvent::children() const{ 370QArray<int> OEvent::children() const{
374 if (!data->child) return QArray<int>(); 371 if (!data->child) return QArray<int>();
375 else 372 else
376 return data->child->copy(); 373 return data->child->copy();
377} 374}
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h
index b696d81..30f442e 100644
--- a/libopie2/opiepim/oevent.h
+++ b/libopie2/opiepim/oevent.h
@@ -123,25 +123,24 @@ public:
123 123
124 /** return the parent OEvent */ 124 /** return the parent OEvent */
125 int parent()const; 125 int parent()const;
126 void setParent( int uid ); 126 void setParent( int uid );
127 127
128 128
129 /* needed reimp */ 129 /* needed reimp */
130 QString toRichText()const; 130 QString toRichText()const;
131 QString toShortText()const; 131 QString toShortText()const;
132 QString type()const; 132 QString type()const;
133 133
134 QMap<int, QString> toMap()const; 134 QMap<int, QString> toMap()const;
135 QMap<QString, QString> toExtraMap()const;
136 QString recordField(int )const; 135 QString recordField(int )const;
137 136
138 static int rtti(); 137 static int rtti();
139 138
140 bool loadFromStream( QDataStream& ); 139 bool loadFromStream( QDataStream& );
141 bool saveToStream( QDataStream& )const; 140 bool saveToStream( QDataStream& )const;
142 141
143/* bool operator==( const OEvent& ); 142/* bool operator==( const OEvent& );
144 bool operator!=( const OEvent& ); 143 bool operator!=( const OEvent& );
145 bool operator<( const OEvent& ); 144 bool operator<( const OEvent& );
146 bool operator<=( const OEvent& ); 145 bool operator<=( const OEvent& );
147 bool operator>( const OEvent& ); 146 bool operator>( const OEvent& );
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index c84eeeb..38b93f7 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -270,25 +270,25 @@ QString OTodo::toShortText() const {
270*/ 270*/
271QString OTodo::toRichText() const 271QString OTodo::toRichText() const
272{ 272{
273 QString text; 273 QString text;
274 QStringList catlist; 274 QStringList catlist;
275 275
276 // summary 276 // summary
277 text += "<b><h3><img src=\"todo/TodoList\">"; 277 text += "<b><h3><img src=\"todo/TodoList\">";
278 if ( !summary().isEmpty() ) { 278 if ( !summary().isEmpty() ) {
279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); 279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
280 } 280 }
281 text += "</h3></b><br><hr><br>"; 281 text += "</h3></b><br><hr><br>";
282 282
283 // description 283 // description
284 if( !description().isEmpty() ){ 284 if( !description().isEmpty() ){
285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
287 } 287 }
288 288
289 // priority 289 // priority
290 int priorityval = priority(); 290 int priorityval = priority();
291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + 291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
292 QString::number( priorityval ) + "\">"; 292 QString::number( priorityval ) + "\">";
293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" + 293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
294// QString::number( priority() ) + "\"><br>"; 294// QString::number( priority() ) + "\"><br>";
@@ -297,45 +297,45 @@ QString OTodo::toRichText() const
297 case 1 : text += QObject::tr( "Very high" ); 297 case 1 : text += QObject::tr( "Very high" );
298 break; 298 break;
299 case 2 : text += QObject::tr( "High" ); 299 case 2 : text += QObject::tr( "High" );
300 break; 300 break;
301 case 3 : text += QObject::tr( "Normal" ); 301 case 3 : text += QObject::tr( "Normal" );
302 break; 302 break;
303 case 4 : text += QObject::tr( "Low" ); 303 case 4 : text += QObject::tr( "Low" );
304 break; 304 break;
305 case 5 : text += QObject::tr( "Very low" ); 305 case 5 : text += QObject::tr( "Very low" );
306 break; 306 break;
307 }; 307 };
308 text += "<br>"; 308 text += "<br>";
309 309
310 // progress 310 // progress
311 text += "<b>" + QObject::tr( "Progress:") + " </b>" 311 text += "<b>" + QObject::tr( "Progress:") + " </b>"
312 + QString::number( progress() ) + " %<br>"; 312 + QString::number( progress() ) + " %<br>";
313 313
314 // due date 314 // due date
315 if (hasDueDate() ){ 315 if (hasDueDate() ){
316 QDate dd = dueDate(); 316 QDate dd = dueDate();
317 int off = QDate::currentDate().daysTo( dd ); 317 int off = QDate::currentDate().daysTo( dd );
318 318
319 text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\""; 319 text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
320 if ( off < 0 ) 320 if ( off < 0 )
321 text += "#FF0000"; 321 text += "#FF0000";
322 else if ( off == 0 ) 322 else if ( off == 0 )
323 text += "#FFFF00"; 323 text += "#FFFF00";
324 else if ( off > 0 ) 324 else if ( off > 0 )
325 text += "#00FF00"; 325 text += "#00FF00";
326 326
327 text += "\">" + dd.toString() + "</font><br>"; 327 text += "\">" + dd.toString() + "</font><br>";
328 } 328 }
329 329
330 // categories 330 // categories
331 text += "<b>" + QObject::tr( "Category:") + "</b> "; 331 text += "<b>" + QObject::tr( "Category:") + "</b> ";
332 text += categoryNames( "Todo List" ).join(", "); 332 text += categoryNames( "Todo List" ).join(", ");
333 text += "<br>"; 333 text += "<br>";
334 334
335 return text; 335 return text;
336} 336}
337bool OTodo::hasNotifiers()const { 337bool OTodo::hasNotifiers()const {
338 if (!data->notifiers) return false; 338 if (!data->notifiers) return false;
339 return !data->notifiers->isEmpty(); 339 return !data->notifiers->isEmpty();
340} 340}
341OPimNotifyManager& OTodo::notifiers() { 341OPimNotifyManager& OTodo::notifiers() {
@@ -451,27 +451,24 @@ QMap<int, QString> OTodo::toMap() const {
451 map.insert( DateMonth, QString::number( data->date.month() ) ); 451 map.insert( DateMonth, QString::number( data->date.month() ) );
452 map.insert( DateYear, QString::number( data->date.year() ) ); 452 map.insert( DateYear, QString::number( data->date.year() ) );
453 map.insert( Progress, QString::number( data->prog ) ); 453 map.insert( Progress, QString::number( data->prog ) );
454// map.insert( CrossReference, crossToString() ); 454// map.insert( CrossReference, crossToString() );
455 /* FIXME!!! map.insert( State, ); 455 /* FIXME!!! map.insert( State, );
456 map.insert( Recurrence, ); 456 map.insert( Recurrence, );
457 map.insert( Reminders, ); 457 map.insert( Reminders, );
458 map. 458 map.
459 */ 459 */
460 return map; 460 return map;
461} 461}
462 462
463QMap<QString, QString> OTodo::toExtraMap()const {
464 return data->extra;
465}
466/** 463/**
467 * change or modify looks at the ref count and either 464 * change or modify looks at the ref count and either
468 * creates a new QShared Object or it can modify it 465 * creates a new QShared Object or it can modify it
469 * right in place 466 * right in place
470 */ 467 */
471void OTodo::changeOrModify() { 468void OTodo::changeOrModify() {
472 if ( data->count != 1 ) { 469 if ( data->count != 1 ) {
473 qWarning("changeOrModify"); 470 qWarning("changeOrModify");
474 data->deref(); 471 data->deref();
475 OTodoData* d2 = new OTodoData(); 472 OTodoData* d2 = new OTodoData();
476 copy(data, d2 ); 473 copy(data, d2 );
477 data = d2; 474 data = d2;
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index 4d5ee36..f9a345a 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -184,25 +184,24 @@ public:
184 OPimNotifyManager &notifiers(); 184 OPimNotifyManager &notifiers();
185 185
186 /** 186 /**
187 * 187 *
188 */ 188 */
189 const OPimNotifyManager &notifiers()const; 189 const OPimNotifyManager &notifiers()const;
190 190
191 /** 191 /**
192 * reimplementations 192 * reimplementations
193 */ 193 */
194 QString type()const; 194 QString type()const;
195 QString toShortText()const; 195 QString toShortText()const;
196 QMap<QString, QString> toExtraMap()const;
197 QString recordField(int id )const; 196 QString recordField(int id )const;
198 197
199 /** 198 /**
200 * toMap puts all data into the map. int relates 199 * toMap puts all data into the map. int relates
201 * to ToDoEvent RecordFields enum 200 * to ToDoEvent RecordFields enum
202 */ 201 */
203 QMap<int, QString> toMap()const; 202 QMap<int, QString> toMap()const;
204 203
205 /** 204 /**
206 * Set if this Todo is completed 205 * Set if this Todo is completed
207 */ 206 */
208 void setCompleted(bool completed ); 207 void setCompleted(bool completed );