author | zecke <zecke> | 2003-06-20 15:40:07 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-06-20 15:40:07 (UTC) |
commit | ec80e207cce9ebb55be771603fc47a4e7892fd6c (patch) (unidiff) | |
tree | 0ec055e15a0ca1ec9ff0e9c674ecbcca389acbf4 /libopie2/opiepim/backend/otodoaccessxml.cpp | |
parent | c57f817ceca0eff0f6f3e90ad01654252911c1c5 (diff) | |
download | opie-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 (limited to 'libopie2/opiepim/backend/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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 | |||
@@ -476,51 +476,73 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
476 | else if ( val == "MonthlyDate" ) | 476 | else if ( val == "MonthlyDate" ) |
477 | recur()->setType( ORecur::MonthlyDate ); | 477 | recur()->setType( ORecur::MonthlyDate ); |
478 | else if ( val == "Yearly" ) | 478 | else if ( val == "Yearly" ) |
479 | recur()->setType( ORecur::Yearly ); | 479 | recur()->setType( ORecur::Yearly ); |
480 | else | 480 | else |
481 | recur()->setType( ORecur::NoRepeat ); | 481 | recur()->setType( ORecur::NoRepeat ); |
482 | break; | 482 | break; |
483 | case FRWeekdays: | 483 | case FRWeekdays: |
484 | recur()->setDays( val.toInt() ); | 484 | recur()->setDays( val.toInt() ); |
485 | break; | 485 | break; |
486 | case FRPosition: | 486 | case FRPosition: |
487 | recur()->setPosition( val.toInt() ); | 487 | recur()->setPosition( val.toInt() ); |
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 | ||
506 | namespace { | ||
507 | QString 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 | |||
503 | QString OTodoAccessXML::toString( const OTodo& ev )const { | 525 | QString 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 | ||
515 | if ( ev.hasDueDate() ) { | 537 | if ( ev.hasDueDate() ) { |
516 | str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; | 538 | str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; |
517 | str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; | 539 | str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; |
518 | str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; | 540 | str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; |
519 | } | 541 | } |
520 | // qWarning( "Uid %d", ev.uid() ); | 542 | // qWarning( "Uid %d", ev.uid() ); |
521 | str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; | 543 | str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; |
522 | 544 | ||
523 | // append the extra options | 545 | // append the extra options |
524 | /* FIXME Qtopia::Record this is currently not | 546 | /* FIXME Qtopia::Record this is currently not |
525 | * possible you can set custom fields | 547 | * possible you can set custom fields |
526 | * but don' iterate over the list | 548 | * but don' iterate over the list |
@@ -560,48 +582,49 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
560 | als << OConversion::dateTimeToString( (*it).dateTime() ) | 582 | als << OConversion::dateTimeToString( (*it).dateTime() ) |
561 | + ":" + QString::number( (*it).duration() ) | 583 | + ":" + QString::number( (*it).duration() ) |
562 | + ":" + QString::number( (*it).sound() ) | 584 | + ":" + QString::number( (*it).sound() ) |
563 | + ":"; | 585 | + ":"; |
564 | } | 586 | } |
565 | } | 587 | } |
566 | // now write the list | 588 | // now write the list |
567 | qWarning("als: %s", als.join("____________").latin1() ); | 589 | qWarning("als: %s", als.join("____________").latin1() ); |
568 | str += "Alarms=\""+als.join(";") +"\" "; | 590 | str += "Alarms=\""+als.join(";") +"\" "; |
569 | } | 591 | } |
570 | 592 | ||
571 | /* | 593 | /* |
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 | } |
588 | QString OTodoAccessXML::toString( const QArray<int>& ints ) const { | 611 | QString 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 | */ |
596 | 619 | ||
597 | struct OTodoXMLContainer { | 620 | struct OTodoXMLContainer { |
598 | OTodo todo; | 621 | OTodo todo; |
599 | }; | 622 | }; |
600 | 623 | ||
601 | namespace { | 624 | namespace { |
602 | inline QString string( const OTodo& todo) { | 625 | inline QString string( const OTodo& todo) { |
603 | return todo.summary().isEmpty() ? | 626 | return todo.summary().isEmpty() ? |
604 | todo.description().left(20 ) : | 627 | todo.description().left(20 ) : |
605 | todo.summary(); | 628 | todo.summary(); |
606 | } | 629 | } |
607 | inline int completed( const OTodo& todo1, const OTodo& todo2) { | 630 | inline int completed( const OTodo& todo1, const OTodo& todo2) { |