Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp index 0f99d50..55e47e2 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | |||
@@ -119,13 +119,12 @@ namespace { | |||
119 | FRecChildren, | 119 | FRecChildren, |
120 | FExceptions | 120 | FExceptions |
121 | }; | 121 | }; |
122 | 122 | ||
123 | // FIXME: Use OPimEvent::toMap() here !! (eilers) | 123 | // FIXME: Use OPimEvent::toMap() here !! (eilers) |
124 | static void save( const OPimEvent& ev, QString& buf ) { | 124 | static void save( const OPimEvent& ev, QString& buf ) { |
125 | owarn << "Saving " << ev.uid() << " " << ev.description() << "" << oendl; | ||
126 | buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\""; | 125 | buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\""; |
127 | if (!ev.location().isEmpty() ) | 126 | if (!ev.location().isEmpty() ) |
128 | buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\""; | 127 | buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\""; |
129 | 128 | ||
130 | if (!ev.categories().isEmpty() ) | 129 | if (!ev.categories().isEmpty() ) |
131 | buf += " categories=\""+ Qtopia::escapeString( Qtopia::Record::idsToString( ev.categories() ) ) + "\""; | 130 | buf += " categories=\""+ Qtopia::escapeString( Qtopia::Record::idsToString( ev.categories() ) ) + "\""; |
@@ -323,15 +322,13 @@ bool ODateBookAccessBackend_XML::remove( int uid ) { | |||
323 | return true; | 322 | return true; |
324 | } | 323 | } |
325 | bool ODateBookAccessBackend_XML::replace( const OPimEvent& ev ) { | 324 | bool ODateBookAccessBackend_XML::replace( const OPimEvent& ev ) { |
326 | replace( ev.uid() ); // ??? Shouldn't this be "remove( ev.uid() ) ??? (eilers) | 325 | replace( ev.uid() ); // ??? Shouldn't this be "remove( ev.uid() ) ??? (eilers) |
327 | return add( ev ); | 326 | return add( ev ); |
328 | } | 327 | } |
329 | QArray<int> ODateBookAccessBackend_XML::rawEvents()const { | 328 | |
330 | return allRecords(); | ||
331 | } | ||
332 | QArray<int> ODateBookAccessBackend_XML::rawRepeats()const { | 329 | QArray<int> ODateBookAccessBackend_XML::rawRepeats()const { |
333 | QArray<int> ints( m_rep.count() ); | 330 | QArray<int> ints( m_rep.count() ); |
334 | uint i = 0; | 331 | uint i = 0; |
335 | QMap<int, OPimEvent>::ConstIterator it; | 332 | QMap<int, OPimEvent>::ConstIterator it; |
336 | 333 | ||
337 | for ( it = m_rep.begin(); it != m_rep.end(); ++it ) { | 334 | for ( it = m_rep.begin(); it != m_rep.end(); ++it ) { |
@@ -350,21 +347,21 @@ QArray<int> ODateBookAccessBackend_XML::nonRepeats()const { | |||
350 | ints[i] = it.key(); | 347 | ints[i] = it.key(); |
351 | i++; | 348 | i++; |
352 | } | 349 | } |
353 | 350 | ||
354 | return ints; | 351 | return ints; |
355 | } | 352 | } |
356 | OPimEvent::ValueList ODateBookAccessBackend_XML::directNonRepeats() { | 353 | OPimEvent::ValueList ODateBookAccessBackend_XML::directNonRepeats()const { |
357 | OPimEvent::ValueList list; | 354 | OPimEvent::ValueList list; |
358 | QMap<int, OPimEvent>::ConstIterator it; | 355 | QMap<int, OPimEvent>::ConstIterator it; |
359 | for (it = m_raw.begin(); it != m_raw.end(); ++it ) | 356 | for (it = m_raw.begin(); it != m_raw.end(); ++it ) |
360 | list.append( it.data() ); | 357 | list.append( it.data() ); |
361 | 358 | ||
362 | return list; | 359 | return list; |
363 | } | 360 | } |
364 | OPimEvent::ValueList ODateBookAccessBackend_XML::directRawRepeats() { | 361 | OPimEvent::ValueList ODateBookAccessBackend_XML::directRawRepeats()const { |
365 | OPimEvent::ValueList list; | 362 | OPimEvent::ValueList list; |
366 | QMap<int, OPimEvent>::ConstIterator it; | 363 | QMap<int, OPimEvent>::ConstIterator it; |
367 | for (it = m_rep.begin(); it != m_rep.end(); ++it ) | 364 | for (it = m_rep.begin(); it != m_rep.end(); ++it ) |
368 | list.append( it.data() ); | 365 | list.append( it.data() ); |
369 | 366 | ||
370 | return list; | 367 | return list; |
@@ -536,24 +533,22 @@ void ODateBookAccessBackend_XML::finalizeRecord( OPimEvent& ev ) { | |||
536 | if (alarmTime != -1 ) { | 533 | if (alarmTime != -1 ) { |
537 | QDateTime dt = ev.startDateTime().addSecs( -1*alarmTime*60 ); | 534 | QDateTime dt = ev.startDateTime().addSecs( -1*alarmTime*60 ); |
538 | OPimAlarm al( snd , dt ); | 535 | OPimAlarm al( snd , dt ); |
539 | ev.notifiers().add( al ); | 536 | ev.notifiers().add( al ); |
540 | } | 537 | } |
541 | if ( m_raw.contains( ev.uid() ) || m_rep.contains( ev.uid() ) ) { | 538 | if ( m_raw.contains( ev.uid() ) || m_rep.contains( ev.uid() ) ) { |
542 | owarn << "already contains assign uid" << oendl; | ||
543 | ev.setUid( 1 ); | 539 | ev.setUid( 1 ); |
544 | } | 540 | } |
545 | 541 | ||
546 | if ( ev.hasRecurrence() ) | 542 | if ( ev.hasRecurrence() ) |
547 | m_rep.insert( ev.uid(), ev ); | 543 | m_rep.insert( ev.uid(), ev ); |
548 | else | 544 | else |
549 | m_raw.insert( ev.uid(), ev ); | 545 | m_raw.insert( ev.uid(), ev ); |
550 | 546 | ||
551 | } | 547 | } |
552 | void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString& value) { | 548 | void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString& value) { |
553 | // owarn << " setting " << value << "" << oendl; | ||
554 | switch( id ) { | 549 | switch( id ) { |
555 | case FDescription: | 550 | case FDescription: |
556 | e.setDescription( value ); | 551 | e.setDescription( value ); |
557 | break; | 552 | break; |
558 | case FLocation: | 553 | case FLocation: |
559 | e.setLocation( value ); | 554 | e.setLocation( value ); |
@@ -631,13 +626,12 @@ void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString& | |||
631 | } | 626 | } |
632 | break; | 627 | break; |
633 | case FExceptions:{ | 628 | case FExceptions:{ |
634 | QStringList list = QStringList::split(' ', value ); | 629 | QStringList list = QStringList::split(' ', value ); |
635 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 630 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
636 | QDate date( (*it).left(4).toInt(), (*it).mid(4, 2).toInt(), (*it).right(2).toInt() ); | 631 | QDate date( (*it).left(4).toInt(), (*it).mid(4, 2).toInt(), (*it).right(2).toInt() ); |
637 | owarn << "adding exception " << date.toString() << "" << oendl; | ||
638 | recur()->exceptions().append( date ); | 632 | recur()->exceptions().append( date ); |
639 | } | 633 | } |
640 | } | 634 | } |
641 | break; | 635 | break; |
642 | case FTimeZone: | 636 | case FTimeZone: |
643 | m_noTimeZone = false; | 637 | m_noTimeZone = false; |