Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index 2d50ecd..cce6111 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp | |||
@@ -44,9 +44,9 @@ | |||
44 | #include <qpe/timeconversion.h> | 44 | #include <qpe/timeconversion.h> |
45 | 45 | ||
46 | #include <opie2/oconversion.h> | 46 | #include <opie2/opimdateconversion.h> |
47 | #include <opie2/opimstate.h> | 47 | #include <opie2/opimstate.h> |
48 | #include <opie2/otimezone.h> | 48 | #include <opie2/opimtimezone.h> |
49 | #include <opie2/opimnotifymanager.h> | 49 | #include <opie2/opimnotifymanager.h> |
50 | #include <opie2/orecur.h> | 50 | #include <opie2/opimrecurrence.h> |
51 | #include <opie2/otodoaccessxml.h> | 51 | #include <opie2/otodoaccessxml.h> |
52 | 52 | ||
@@ -55,12 +55,12 @@ using namespace Opie; | |||
55 | namespace { | 55 | namespace { |
56 | time_t rp_end; | 56 | time_t rp_end; |
57 | ORecur* rec; | 57 | OPimRecurrence* rec; |
58 | ORecur *recur() { | 58 | OPimRecurrence *recur() { |
59 | if (!rec ) rec = new ORecur; | 59 | if (!rec ) rec = new OPimRecurrence; |
60 | return rec; | 60 | return rec; |
61 | } | 61 | } |
62 | int snd; | 62 | int snd; |
63 | enum MoreAttributes { | 63 | enum MoreAttributes { |
64 | FRType = OTodo::CompletedDate + 2, | 64 | FRType = OPimTodo::CompletedDate + 2, |
65 | FRWeekdays, | 65 | FRWeekdays, |
66 | FRPosition, | 66 | FRPosition, |
@@ -99,7 +99,7 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) | |||
99 | namespace Opie { | 99 | namespace Opie { |
100 | 100 | ||
101 | OTodoAccessXML::OTodoAccessXML( const QString& appName, | 101 | OPimTodoAccessXML::OPimTodoAccessXML( const QString& appName, |
102 | const QString& fileName ) | 102 | const QString& fileName ) |
103 | : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) | 103 | : OPimTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) |
104 | { | 104 | { |
105 | if (!fileName.isEmpty() ) | 105 | if (!fileName.isEmpty() ) |
@@ -108,8 +108,8 @@ OTodoAccessXML::OTodoAccessXML( const QString& appName, | |||
108 | m_file = Global::applicationFileName( "todolist", "todolist.xml" ); | 108 | m_file = Global::applicationFileName( "todolist", "todolist.xml" ); |
109 | } | 109 | } |
110 | OTodoAccessXML::~OTodoAccessXML() { | 110 | OPimTodoAccessXML::~OPimTodoAccessXML() { |
111 | 111 | ||
112 | } | 112 | } |
113 | bool OTodoAccessXML::load() { | 113 | bool OPimTodoAccessXML::load() { |
114 | rec = 0; | 114 | rec = 0; |
115 | m_opened = true; | 115 | m_opened = true; |
@@ -121,23 +121,23 @@ bool OTodoAccessXML::load() { | |||
121 | QAsciiDict<int> dict(26); | 121 | QAsciiDict<int> dict(26); |
122 | dict.setAutoDelete( TRUE ); | 122 | dict.setAutoDelete( TRUE ); |
123 | dict.insert("Categories" , new int(OTodo::Category) ); | 123 | dict.insert("Categories" , new int(OPimTodo::Category) ); |
124 | dict.insert("Uid" , new int(OTodo::Uid) ); | 124 | dict.insert("Uid" , new int(OPimTodo::Uid) ); |
125 | dict.insert("HasDate" , new int(OTodo::HasDate) ); | 125 | dict.insert("HasDate" , new int(OPimTodo::HasDate) ); |
126 | dict.insert("Completed" , new int(OTodo::Completed) ); | 126 | dict.insert("Completed" , new int(OPimTodo::Completed) ); |
127 | dict.insert("Description" , new int(OTodo::Description) ); | 127 | dict.insert("Description" , new int(OPimTodo::Description) ); |
128 | dict.insert("Summary" , new int(OTodo::Summary) ); | 128 | dict.insert("Summary" , new int(OPimTodo::Summary) ); |
129 | dict.insert("Priority" , new int(OTodo::Priority) ); | 129 | dict.insert("Priority" , new int(OPimTodo::Priority) ); |
130 | dict.insert("DateDay" , new int(OTodo::DateDay) ); | 130 | dict.insert("DateDay" , new int(OPimTodo::DateDay) ); |
131 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); | 131 | dict.insert("DateMonth" , new int(OPimTodo::DateMonth) ); |
132 | dict.insert("DateYear" , new int(OTodo::DateYear) ); | 132 | dict.insert("DateYear" , new int(OPimTodo::DateYear) ); |
133 | dict.insert("Progress" , new int(OTodo::Progress) ); | 133 | dict.insert("Progress" , new int(OPimTodo::Progress) ); |
134 | dict.insert("CompletedDate", new int(OTodo::CompletedDate) ); | 134 | dict.insert("CompletedDate", new int(OPimTodo::CompletedDate) ); |
135 | dict.insert("StartDate", new int(OTodo::StartDate) ); | 135 | dict.insert("StartDate", new int(OPimTodo::StartDate) ); |
136 | dict.insert("CrossReference", new int(OTodo::CrossReference) ); | 136 | dict.insert("CrossReference", new int(OPimTodo::CrossReference) ); |
137 | dict.insert("State", new int(OTodo::State) ); | 137 | dict.insert("State", new int(OPimTodo::State) ); |
138 | dict.insert("Alarms", new int(OTodo::Alarms) ); | 138 | dict.insert("Alarms", new int(OPimTodo::Alarms) ); |
139 | dict.insert("Reminders", new int(OTodo::Reminders) ); | 139 | dict.insert("Reminders", new int(OPimTodo::Reminders) ); |
140 | dict.insert("Notifiers", new int(OTodo::Notifiers) ); | 140 | dict.insert("Notifiers", new int(OPimTodo::Notifiers) ); |
141 | dict.insert("Maintainer", new int(OTodo::Maintainer) ); | 141 | dict.insert("Maintainer", new int(OPimTodo::Maintainer) ); |
142 | dict.insert("rtype", new int(FRType) ); | 142 | dict.insert("rtype", new int(FRType) ); |
143 | dict.insert("rweekdays", new int(FRWeekdays) ); | 143 | dict.insert("rweekdays", new int(FRWeekdays) ); |
@@ -180,5 +180,5 @@ bool OTodoAccessXML::load() { | |||
180 | qWarning("Found a start at %d %d", i, (point-dt) ); | 180 | qWarning("Found a start at %d %d", i, (point-dt) ); |
181 | 181 | ||
182 | OTodo ev; | 182 | OPimTodo ev; |
183 | m_year = m_month = m_day = 0; | 183 | m_year = m_month = m_day = 0; |
184 | 184 | ||
@@ -243,6 +243,6 @@ bool OTodoAccessXML::load() { | |||
243 | } | 243 | } |
244 | if ( rec && rec->doesRecur() ) { | 244 | if ( rec && rec->doesRecur() ) { |
245 | OTimeZone utc = OTimeZone::utc(); | 245 | OPimTimeZone utc = OPimTimeZone::utc(); |
246 | ORecur recu( *rec ); // call copy c'tor | 246 | OPimRecurrence recu( *rec ); // call copy c'tor |
247 | recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() ); | 247 | recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() ); |
248 | recu.setStart( ev.dueDate() ); | 248 | recu.setStart( ev.dueDate() ); |
@@ -260,9 +260,9 @@ bool OTodoAccessXML::load() { | |||
260 | return true; | 260 | return true; |
261 | } | 261 | } |
262 | bool OTodoAccessXML::reload() { | 262 | bool OPimTodoAccessXML::reload() { |
263 | m_events.clear(); | 263 | m_events.clear(); |
264 | return load(); | 264 | return load(); |
265 | } | 265 | } |
266 | bool OTodoAccessXML::save() { | 266 | bool OPimTodoAccessXML::save() { |
267 | // qWarning("saving"); | 267 | // qWarning("saving"); |
268 | if (!m_opened || !m_changed ) { | 268 | if (!m_opened || !m_changed ) { |
@@ -280,5 +280,5 @@ bool OTodoAccessXML::save() { | |||
280 | 280 | ||
281 | // for all todos | 281 | // for all todos |
282 | QMap<int, OTodo>::Iterator it; | 282 | QMap<int, OPimTodo>::Iterator it; |
283 | for (it = m_events.begin(); it != m_events.end(); ++it ) { | 283 | for (it = m_events.begin(); it != m_events.end(); ++it ) { |
284 | out+= "<Task " + toString( (*it) ) + " />\n"; | 284 | out+= "<Task " + toString( (*it) ) + " />\n"; |
@@ -315,7 +315,7 @@ bool OTodoAccessXML::save() { | |||
315 | return true; | 315 | return true; |
316 | } | 316 | } |
317 | QArray<int> OTodoAccessXML::allRecords()const { | 317 | QArray<int> OPimTodoAccessXML::allRecords()const { |
318 | QArray<int> ids( m_events.count() ); | 318 | QArray<int> ids( m_events.count() ); |
319 | QMap<int, OTodo>::ConstIterator it; | 319 | QMap<int, OPimTodo>::ConstIterator it; |
320 | int i = 0; | 320 | int i = 0; |
321 | 321 | ||
@@ -326,12 +326,12 @@ QArray<int> OTodoAccessXML::allRecords()const { | |||
326 | return ids; | 326 | return ids; |
327 | } | 327 | } |
328 | QArray<int> OTodoAccessXML::queryByExample( const OTodo&, int, const QDateTime& ) { | 328 | QArray<int> OPimTodoAccessXML::queryByExample( const OPimTodo&, int, const QDateTime& ) { |
329 | QArray<int> ids(0); | 329 | QArray<int> ids(0); |
330 | return ids; | 330 | return ids; |
331 | } | 331 | } |
332 | OTodo OTodoAccessXML::find( int uid )const { | 332 | OPimTodo OPimTodoAccessXML::find( int uid )const { |
333 | OTodo todo; | 333 | OPimTodo todo; |
334 | todo.setUid( 0 ); // isEmpty() | 334 | todo.setUid( 0 ); // isEmpty() |
335 | QMap<int, OTodo>::ConstIterator it = m_events.find( uid ); | 335 | QMap<int, OPimTodo>::ConstIterator it = m_events.find( uid ); |
336 | if ( it != m_events.end() ) | 336 | if ( it != m_events.end() ) |
337 | todo = it.data(); | 337 | todo = it.data(); |
@@ -339,5 +339,5 @@ OTodo OTodoAccessXML::find( int uid )const { | |||
339 | return todo; | 339 | return todo; |
340 | } | 340 | } |
341 | void OTodoAccessXML::clear() { | 341 | void OPimTodoAccessXML::clear() { |
342 | if (m_opened ) | 342 | if (m_opened ) |
343 | m_changed = true; | 343 | m_changed = true; |
@@ -345,5 +345,5 @@ void OTodoAccessXML::clear() { | |||
345 | m_events.clear(); | 345 | m_events.clear(); |
346 | } | 346 | } |
347 | bool OTodoAccessXML::add( const OTodo& todo ) { | 347 | bool OPimTodoAccessXML::add( const OPimTodo& todo ) { |
348 | // qWarning("add"); | 348 | // qWarning("add"); |
349 | m_changed = true; | 349 | m_changed = true; |
@@ -352,5 +352,5 @@ bool OTodoAccessXML::add( const OTodo& todo ) { | |||
352 | return true; | 352 | return true; |
353 | } | 353 | } |
354 | bool OTodoAccessXML::remove( int uid ) { | 354 | bool OPimTodoAccessXML::remove( int uid ) { |
355 | m_changed = true; | 355 | m_changed = true; |
356 | m_events.remove( uid ); | 356 | m_events.remove( uid ); |
@@ -358,5 +358,5 @@ bool OTodoAccessXML::remove( int uid ) { | |||
358 | return true; | 358 | return true; |
359 | } | 359 | } |
360 | bool OTodoAccessXML::replace( const OTodo& todo) { | 360 | bool OPimTodoAccessXML::replace( const OPimTodo& todo) { |
361 | m_changed = true; | 361 | m_changed = true; |
362 | m_events.replace( todo.uid(), todo ); | 362 | m_events.replace( todo.uid(), todo ); |
@@ -364,9 +364,9 @@ bool OTodoAccessXML::replace( const OTodo& todo) { | |||
364 | return true; | 364 | return true; |
365 | } | 365 | } |
366 | QArray<int> OTodoAccessXML::effectiveToDos( const QDate& start, | 366 | QArray<int> OPimTodoAccessXML::effectiveToDos( const QDate& start, |
367 | const QDate& end, | 367 | const QDate& end, |
368 | bool includeNoDates ) { | 368 | bool includeNoDates ) { |
369 | QArray<int> ids( m_events.count() ); | 369 | QArray<int> ids( m_events.count() ); |
370 | QMap<int, OTodo>::Iterator it; | 370 | QMap<int, OPimTodo>::Iterator it; |
371 | 371 | ||
372 | int i = 0; | 372 | int i = 0; |
@@ -386,9 +386,9 @@ QArray<int> OTodoAccessXML::effectiveToDos( const QDate& start, | |||
386 | return ids; | 386 | return ids; |
387 | } | 387 | } |
388 | QArray<int> OTodoAccessXML::overDue() { | 388 | QArray<int> OPimTodoAccessXML::overDue() { |
389 | QArray<int> ids( m_events.count() ); | 389 | QArray<int> ids( m_events.count() ); |
390 | int i = 0; | 390 | int i = 0; |
391 | 391 | ||
392 | QMap<int, OTodo>::Iterator it; | 392 | QMap<int, OPimTodo>::Iterator it; |
393 | for ( it = m_events.begin(); it != m_events.end(); ++it ) { | 393 | for ( it = m_events.begin(); it != m_events.end(); ++it ) { |
394 | if ( it.data().isOverdue() ) { | 394 | if ( it.data().isOverdue() ) { |
@@ -403,5 +403,5 @@ QArray<int> OTodoAccessXML::overDue() { | |||
403 | 403 | ||
404 | /* private */ | 404 | /* private */ |
405 | void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | 405 | void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev, |
406 | const QCString& attr, const QString& val) { | 406 | const QCString& attr, const QString& val) { |
407 | // qWarning("parse to do from XMLElement" ); | 407 | // qWarning("parse to do from XMLElement" ); |
@@ -417,47 +417,47 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
417 | 417 | ||
418 | switch( *find ) { | 418 | switch( *find ) { |
419 | case OTodo::Uid: | 419 | case OPimTodo::Uid: |
420 | ev.setUid( val.toInt() ); | 420 | ev.setUid( val.toInt() ); |
421 | break; | 421 | break; |
422 | case OTodo::Category: | 422 | case OPimTodo::Category: |
423 | ev.setCategories( ev.idsFromString( val ) ); | 423 | ev.setCategories( ev.idsFromString( val ) ); |
424 | break; | 424 | break; |
425 | case OTodo::HasDate: | 425 | case OPimTodo::HasDate: |
426 | ev.setHasDueDate( val.toInt() ); | 426 | ev.setHasDueDate( val.toInt() ); |
427 | break; | 427 | break; |
428 | case OTodo::Completed: | 428 | case OPimTodo::Completed: |
429 | ev.setCompleted( val.toInt() ); | 429 | ev.setCompleted( val.toInt() ); |
430 | break; | 430 | break; |
431 | case OTodo::Description: | 431 | case OPimTodo::Description: |
432 | ev.setDescription( val ); | 432 | ev.setDescription( val ); |
433 | break; | 433 | break; |
434 | case OTodo::Summary: | 434 | case OPimTodo::Summary: |
435 | ev.setSummary( val ); | 435 | ev.setSummary( val ); |
436 | break; | 436 | break; |
437 | case OTodo::Priority: | 437 | case OPimTodo::Priority: |
438 | ev.setPriority( val.toInt() ); | 438 | ev.setPriority( val.toInt() ); |
439 | break; | 439 | break; |
440 | case OTodo::DateDay: | 440 | case OPimTodo::DateDay: |
441 | m_day = val.toInt(); | 441 | m_day = val.toInt(); |
442 | break; | 442 | break; |
443 | case OTodo::DateMonth: | 443 | case OPimTodo::DateMonth: |
444 | m_month = val.toInt(); | 444 | m_month = val.toInt(); |
445 | break; | 445 | break; |
446 | case OTodo::DateYear: | 446 | case OPimTodo::DateYear: |
447 | m_year = val.toInt(); | 447 | m_year = val.toInt(); |
448 | break; | 448 | break; |
449 | case OTodo::Progress: | 449 | case OPimTodo::Progress: |
450 | ev.setProgress( val.toInt() ); | 450 | ev.setProgress( val.toInt() ); |
451 | break; | 451 | break; |
452 | case OTodo::CompletedDate: | 452 | case OPimTodo::CompletedDate: |
453 | ev.setCompletedDate( OConversion::dateFromString( val ) ); | 453 | ev.setCompletedDate( OPimDateConversion::dateFromString( val ) ); |
454 | break; | 454 | break; |
455 | case OTodo::StartDate: | 455 | case OPimTodo::StartDate: |
456 | ev.setStartDate( OConversion::dateFromString( val ) ); | 456 | ev.setStartDate( OPimDateConversion::dateFromString( val ) ); |
457 | break; | 457 | break; |
458 | case OTodo::State: | 458 | case OPimTodo::State: |
459 | ev.setState( val.toInt() ); | 459 | ev.setState( val.toInt() ); |
460 | break; | 460 | break; |
461 | case OTodo::Alarms:{ | 461 | case OPimTodo::Alarms:{ |
462 | OPimNotifyManager &manager = ev.notifiers(); | 462 | OPimNotifyManager &manager = ev.notifiers(); |
463 | QStringList als = QStringList::split(";", val ); | 463 | QStringList als = QStringList::split(";", val ); |
@@ -465,11 +465,11 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
465 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty | 465 | QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty |
466 | qWarning("alarm: %s", alarm.join("___").latin1() ); | 466 | qWarning("alarm: %s", alarm.join("___").latin1() ); |
467 | qWarning("alarm[0]: %s %s", alarm[0].latin1(), OConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); | 467 | qWarning("alarm[0]: %s %s", alarm[0].latin1(), OPimDateConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); |
468 | OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() ); | 468 | OPimAlarm al( alarm[2].toInt(), OPimDateConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() ); |
469 | manager.add( al ); | 469 | manager.add( al ); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | break; | 472 | break; |
473 | case OTodo::Reminders:{ | 473 | case OPimTodo::Reminders:{ |
474 | OPimNotifyManager &manager = ev.notifiers(); | 474 | OPimNotifyManager &manager = ev.notifiers(); |
475 | QStringList rems = QStringList::split(";", val ); | 475 | QStringList rems = QStringList::split(";", val ); |
@@ -480,5 +480,5 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
480 | } | 480 | } |
481 | break; | 481 | break; |
482 | case OTodo::CrossReference: | 482 | case OPimTodo::CrossReference: |
483 | { | 483 | { |
484 | /* | 484 | /* |
@@ -500,15 +500,15 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
500 | case FRType: | 500 | case FRType: |
501 | if ( val == "Daily" ) | 501 | if ( val == "Daily" ) |
502 | recur()->setType( ORecur::Daily ); | 502 | recur()->setType( OPimRecurrence::Daily ); |
503 | else if ( val == "Weekly" ) | 503 | else if ( val == "Weekly" ) |
504 | recur()->setType( ORecur::Weekly); | 504 | recur()->setType( OPimRecurrence::Weekly); |
505 | else if ( val == "MonthlyDay" ) | 505 | else if ( val == "MonthlyDay" ) |
506 | recur()->setType( ORecur::MonthlyDay ); | 506 | recur()->setType( OPimRecurrence::MonthlyDay ); |
507 | else if ( val == "MonthlyDate" ) | 507 | else if ( val == "MonthlyDate" ) |
508 | recur()->setType( ORecur::MonthlyDate ); | 508 | recur()->setType( OPimRecurrence::MonthlyDate ); |
509 | else if ( val == "Yearly" ) | 509 | else if ( val == "Yearly" ) |
510 | recur()->setType( ORecur::Yearly ); | 510 | recur()->setType( OPimRecurrence::Yearly ); |
511 | else | 511 | else |
512 | recur()->setType( ORecur::NoRepeat ); | 512 | recur()->setType( OPimRecurrence::NoRepeat ); |
513 | break; | 513 | break; |
514 | case FRWeekdays: | 514 | case FRWeekdays: |
@@ -554,5 +554,5 @@ QString customToXml(const QMap<QString, QString>& customMap ) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | QString OTodoAccessXML::toString( const OTodo& ev )const { | 556 | QString OPimTodoAccessXML::toString( const OPimTodo& ev )const { |
557 | QString str; | 557 | QString str; |
558 | 558 | ||
@@ -592,7 +592,7 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
592 | } | 592 | } |
593 | if ( ev.hasStartDate() ) | 593 | if ( ev.hasStartDate() ) |
594 | str += "StartDate=\""+ OConversion::dateToString( ev.startDate() ) +"\" "; | 594 | str += "StartDate=\""+ OPimDateConversion::dateToString( ev.startDate() ) +"\" "; |
595 | if ( ev.hasCompletedDate() ) | 595 | if ( ev.hasCompletedDate() ) |
596 | str += "CompletedDate=\""+ OConversion::dateToString( ev.completedDate() ) +"\" "; | 596 | str += "CompletedDate=\""+ OPimDateConversion::dateToString( ev.completedDate() ) +"\" "; |
597 | if ( ev.hasState() ) | 597 | if ( ev.hasState() ) |
598 | str += "State=\""+QString::number( ev.state().state() )+"\" "; | 598 | str += "State=\""+QString::number( ev.state().state() )+"\" "; |
@@ -611,5 +611,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
611 | /* only if time is valid */ | 611 | /* only if time is valid */ |
612 | if ( (*it).dateTime().isValid() ) { | 612 | if ( (*it).dateTime().isValid() ) { |
613 | als << OConversion::dateTimeToString( (*it).dateTime() ) | 613 | als << OPimDateConversion::dateTimeToString( (*it).dateTime() ) |
614 | + ":" + QString::number( (*it).duration() ) | 614 | + ":" + QString::number( (*it).duration() ) |
615 | + ":" + QString::number( (*it).sound() ) | 615 | + ":" + QString::number( (*it).sound() ) |
@@ -623,5 +623,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
623 | 623 | ||
624 | /* | 624 | /* |
625 | * now the same for reminders but more easy. We just save the uid of the OEvent. | 625 | * now the same for reminders but more easy. We just save the uid of the OPimEvent. |
626 | */ | 626 | */ |
627 | OPimNotifyManager::Reminders reminders = manager.reminders(); | 627 | OPimNotifyManager::Reminders reminders = manager.reminders(); |
@@ -640,5 +640,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
640 | return str; | 640 | return str; |
641 | } | 641 | } |
642 | QString OTodoAccessXML::toString( const QArray<int>& ints ) const { | 642 | QString OPimTodoAccessXML::toString( const QArray<int>& ints ) const { |
643 | return Qtopia::Record::idsToString( ints ); | 643 | return Qtopia::Record::idsToString( ints ); |
644 | } | 644 | } |
@@ -649,15 +649,15 @@ QString OTodoAccessXML::toString( const QArray<int>& ints ) const { | |||
649 | */ | 649 | */ |
650 | 650 | ||
651 | struct OTodoXMLContainer { | 651 | struct OPimTodoXMLContainer { |
652 | OTodo todo; | 652 | OPimTodo todo; |
653 | }; | 653 | }; |
654 | 654 | ||
655 | namespace { | 655 | namespace { |
656 | inline QString string( const OTodo& todo) { | 656 | inline QString string( const OPimTodo& todo) { |
657 | return todo.summary().isEmpty() ? | 657 | return todo.summary().isEmpty() ? |
658 | todo.description().left(20 ) : | 658 | todo.description().left(20 ) : |
659 | todo.summary(); | 659 | todo.summary(); |
660 | } | 660 | } |
661 | inline int completed( const OTodo& todo1, const OTodo& todo2) { | 661 | inline int completed( const OPimTodo& todo1, const OPimTodo& todo2) { |
662 | int ret = 0; | 662 | int ret = 0; |
663 | if ( todo1.isCompleted() ) ret++; | 663 | if ( todo1.isCompleted() ) ret++; |
@@ -665,11 +665,11 @@ namespace { | |||
665 | return ret; | 665 | return ret; |
666 | } | 666 | } |
667 | inline int priority( const OTodo& t1, const OTodo& t2) { | 667 | inline int priority( const OPimTodo& t1, const OPimTodo& t2) { |
668 | return ( t1.priority() - t2.priority() ); | 668 | return ( t1.priority() - t2.priority() ); |
669 | } | 669 | } |
670 | inline int description( const OTodo& t1, const OTodo& t2) { | 670 | inline int description( const OPimTodo& t1, const OPimTodo& t2) { |
671 | return QString::compare( string(t1), string(t2) ); | 671 | return QString::compare( string(t1), string(t2) ); |
672 | } | 672 | } |
673 | inline int deadline( const OTodo& t1, const OTodo& t2) { | 673 | inline int deadline( const OPimTodo& t1, const OPimTodo& t2) { |
674 | int ret = 0; | 674 | int ret = 0; |
675 | if ( t1.hasDueDate() && | 675 | if ( t1.hasDueDate() && |
@@ -704,8 +704,8 @@ namespace { | |||
704 | * | 704 | * |
705 | */ | 705 | */ |
706 | class OTodoXMLVector : public QVector<OTodoXMLContainer> { | 706 | class OPimTodoXMLVector : public QVector<OPimTodoXMLContainer> { |
707 | public: | 707 | public: |
708 | OTodoXMLVector(int size, bool asc, int sort) | 708 | OPimTodoXMLVector(int size, bool asc, int sort) |
709 | : QVector<OTodoXMLContainer>( size ) | 709 | : QVector<OPimTodoXMLContainer>( size ) |
710 | { | 710 | { |
711 | setAutoDelete( true ); | 711 | setAutoDelete( true ); |
@@ -714,5 +714,5 @@ public: | |||
714 | } | 714 | } |
715 | /* return the summary/description */ | 715 | /* return the summary/description */ |
716 | QString string( const OTodo& todo) { | 716 | QString string( const OPimTodo& todo) { |
717 | return todo.summary().isEmpty() ? | 717 | return todo.summary().isEmpty() ? |
718 | todo.description().left(20 ) : | 718 | todo.description().left(20 ) : |
@@ -727,6 +727,6 @@ public: | |||
727 | seComp = sePrio = seDeadline = seDesc = false; | 727 | seComp = sePrio = seDeadline = seDesc = false; |
728 | int ret =0; | 728 | int ret =0; |
729 | OTodoXMLContainer* con1 = (OTodoXMLContainer*)d1; | 729 | OPimTodoXMLContainer* con1 = (OPimTodoXMLContainer*)d1; |
730 | OTodoXMLContainer* con2 = (OTodoXMLContainer*)d2; | 730 | OPimTodoXMLContainer* con2 = (OPimTodoXMLContainer*)d2; |
731 | 731 | ||
732 | /* same item */ | 732 | /* same item */ |
@@ -817,8 +817,8 @@ public: | |||
817 | }; | 817 | }; |
818 | 818 | ||
819 | QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, | 819 | QArray<int> OPimTodoAccessXML::sorted( bool asc, int sortOrder, |
820 | int sortFilter, int cat ) { | 820 | int sortFilter, int cat ) { |
821 | OTodoXMLVector vector(m_events.count(), asc,sortOrder ); | 821 | OPimTodoXMLVector vector(m_events.count(), asc,sortOrder ); |
822 | QMap<int, OTodo>::Iterator it; | 822 | QMap<int, OPimTodo>::Iterator it; |
823 | int item = 0; | 823 | int item = 0; |
824 | 824 | ||
@@ -852,5 +852,5 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, | |||
852 | 852 | ||
853 | 853 | ||
854 | OTodoXMLContainer* con = new OTodoXMLContainer(); | 854 | OPimTodoXMLContainer* con = new OPimTodoXMLContainer(); |
855 | con->todo = (*it); | 855 | con->todo = (*it); |
856 | vector.insert(item, con ); | 856 | vector.insert(item, con ); |
@@ -867,7 +867,7 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, | |||
867 | return array; | 867 | return array; |
868 | }; | 868 | }; |
869 | void OTodoAccessXML::removeAllCompleted() { | 869 | void OPimTodoAccessXML::removeAllCompleted() { |
870 | QMap<int, OTodo> events = m_events; | 870 | QMap<int, OPimTodo> events = m_events; |
871 | for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { | 871 | for ( QMap<int, OPimTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { |
872 | if ( (*it).isCompleted() ) | 872 | if ( (*it).isCompleted() ) |
873 | events.remove( it.key() ); | 873 | events.remove( it.key() ); |
@@ -875,25 +875,25 @@ void OTodoAccessXML::removeAllCompleted() { | |||
875 | m_events = events; | 875 | m_events = events; |
876 | } | 876 | } |
877 | QBitArray OTodoAccessXML::supports()const { | 877 | QBitArray OPimTodoAccessXML::supports()const { |
878 | static QBitArray ar = sup(); | 878 | static QBitArray ar = sup(); |
879 | return ar; | 879 | return ar; |
880 | } | 880 | } |
881 | QBitArray OTodoAccessXML::sup() { | 881 | QBitArray OPimTodoAccessXML::sup() { |
882 | QBitArray ar( OTodo::CompletedDate +1 ); | 882 | QBitArray ar( OPimTodo::CompletedDate +1 ); |
883 | ar.fill( true ); | 883 | ar.fill( true ); |
884 | ar[OTodo::CrossReference] = false; | 884 | ar[OPimTodo::CrossReference] = false; |
885 | ar[OTodo::State ] = false; | 885 | ar[OPimTodo::State ] = false; |
886 | ar[OTodo::Reminders] = false; | 886 | ar[OPimTodo::Reminders] = false; |
887 | ar[OTodo::Notifiers] = false; | 887 | ar[OPimTodo::Notifiers] = false; |
888 | ar[OTodo::Maintainer] = false; | 888 | ar[OPimTodo::Maintainer] = false; |
889 | 889 | ||
890 | return ar; | 890 | return ar; |
891 | } | 891 | } |
892 | QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const | 892 | QArray<int> OPimTodoAccessXML::matchRegexp( const QRegExp &r ) const |
893 | { | 893 | { |
894 | QArray<int> m_currentQuery( m_events.count() ); | 894 | QArray<int> m_currentQuery( m_events.count() ); |
895 | uint arraycounter = 0; | 895 | uint arraycounter = 0; |
896 | 896 | ||
897 | QMap<int, OTodo>::ConstIterator it; | 897 | QMap<int, OPimTodo>::ConstIterator it; |
898 | for (it = m_events.begin(); it != m_events.end(); ++it ) { | 898 | for (it = m_events.begin(); it != m_events.end(); ++it ) { |
899 | if ( it.data().match( r ) ) | 899 | if ( it.data().match( r ) ) |