author | zecke <zecke> | 2004-07-29 19:42:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-29 19:42:59 (UTC) |
commit | 52b1ae9281920cf5a40fe543112d8b00e7699ef6 (patch) (unidiff) | |
tree | 0b0a79ff9a45a66f32fe555ee662b4acc8f6eff9 /libopie2/opiepim/core/opimrecurrence.cpp | |
parent | c170d1f931ae03c2ec917b7abf4bd5d0e94a3760 (diff) | |
download | opie-52b1ae9281920cf5a40fe543112d8b00e7699ef6.zip opie-52b1ae9281920cf5a40fe543112d8b00e7699ef6.tar.gz opie-52b1ae9281920cf5a40fe543112d8b00e7699ef6.tar.bz2 |
-UTC -> Europe/London when referring to no timezone
-special handling for allDay Event in OPImEvent, avoid setting timezone
as it is by default UTC
-No timezone set by default for an Event
-Recurrence is UTC (no timezone)
-Provide upgrade path from DateBook as by default events were in the current timezone but didn't have the timezone attribute
-unified handling of timezones, compatible with QtopiaDesktop
-do less conversions
-...
Diffstat (limited to 'libopie2/opiepim/core/opimrecurrence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimrecurrence.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libopie2/opiepim/core/opimrecurrence.cpp b/libopie2/opiepim/core/opimrecurrence.cpp index 4b1d886..c3ae350 100644 --- a/libopie2/opiepim/core/opimrecurrence.cpp +++ b/libopie2/opiepim/core/opimrecurrence.cpp | |||
@@ -619,73 +619,73 @@ QMap<QString, OPimRecurrence::RepeatType> OPimRecurrence::rTypeValueConvertMap() | |||
619 | QMap<QString, RepeatType> convertMap; | 619 | QMap<QString, RepeatType> convertMap; |
620 | 620 | ||
621 | convertMap.insert( QString( "Daily" ), OPimRecurrence::Daily ); | 621 | convertMap.insert( QString( "Daily" ), OPimRecurrence::Daily ); |
622 | convertMap.insert( QString( "Weekly" ), OPimRecurrence::Weekly ); | 622 | convertMap.insert( QString( "Weekly" ), OPimRecurrence::Weekly ); |
623 | convertMap.insert( QString( "MonthlyDay" ), OPimRecurrence::MonthlyDay ); | 623 | convertMap.insert( QString( "MonthlyDay" ), OPimRecurrence::MonthlyDay ); |
624 | convertMap.insert( QString( "MonthlyDate" ), OPimRecurrence::MonthlyDate ); | 624 | convertMap.insert( QString( "MonthlyDate" ), OPimRecurrence::MonthlyDate ); |
625 | convertMap.insert( QString( "Yearly" ), OPimRecurrence::Yearly ); | 625 | convertMap.insert( QString( "Yearly" ), OPimRecurrence::Yearly ); |
626 | convertMap.insert( QString( "NoRepeat" ), OPimRecurrence::NoRepeat ); | 626 | convertMap.insert( QString( "NoRepeat" ), OPimRecurrence::NoRepeat ); |
627 | 627 | ||
628 | return convertMap; | 628 | return convertMap; |
629 | } | 629 | } |
630 | 630 | ||
631 | 631 | ||
632 | QMap<int, QString> OPimRecurrence::toMap() const | 632 | QMap<int, QString> OPimRecurrence::toMap() const |
633 | { | 633 | { |
634 | QMap<int, QString> retMap; | 634 | QMap<int, QString> retMap; |
635 | 635 | ||
636 | retMap.insert( OPimRecurrence::RType, rTypeString() ); | 636 | retMap.insert( OPimRecurrence::RType, rTypeString() ); |
637 | retMap.insert( OPimRecurrence::RWeekdays, QString::number( static_cast<int>( data->days ) ) ); | 637 | retMap.insert( OPimRecurrence::RWeekdays, QString::number( static_cast<int>( data->days ) ) ); |
638 | retMap.insert( OPimRecurrence::RPosition, QString::number(data->pos ) ); | 638 | retMap.insert( OPimRecurrence::RPosition, QString::number(data->pos ) ); |
639 | retMap.insert( OPimRecurrence::RFreq, QString::number( data->freq ) ); | 639 | retMap.insert( OPimRecurrence::RFreq, QString::number( data->freq ) ); |
640 | retMap.insert( OPimRecurrence::RHasEndDate, QString::number( static_cast<int>( data->hasEnd ) ) ); | 640 | retMap.insert( OPimRecurrence::RHasEndDate, QString::number( static_cast<int>( data->hasEnd ) ) ); |
641 | if( data -> hasEnd ) | 641 | if( data -> hasEnd ) |
642 | retMap.insert( OPimRecurrence::EndDate, QString::number( OPimTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) ); | 642 | retMap.insert( OPimRecurrence::EndDate, QString::number( OPimTimeZone::current().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) ); |
643 | retMap.insert( OPimRecurrence::Created, QString::number( OPimTimeZone::utc().fromUTCDateTime( data->create ) ) ); | 643 | retMap.insert( OPimRecurrence::Created, QString::number( OPimTimeZone::current().fromUTCDateTime( data->create ) ) ); |
644 | 644 | ||
645 | if ( data->list.isEmpty() ) return retMap; | 645 | if ( data->list.isEmpty() ) return retMap; |
646 | 646 | ||
647 | // save exceptions list here!! | 647 | // save exceptions list here!! |
648 | ExceptionList::ConstIterator it; | 648 | ExceptionList::ConstIterator it; |
649 | ExceptionList list = data->list; | 649 | ExceptionList list = data->list; |
650 | QString exceptBuf; | 650 | QString exceptBuf; |
651 | QDate date; | 651 | QDate date; |
652 | for ( it = list.begin(); it != list.end(); ++it ) { | 652 | for ( it = list.begin(); it != list.end(); ++it ) { |
653 | date = (*it); | 653 | date = (*it); |
654 | if ( it != list.begin() ) exceptBuf += " "; | 654 | if ( it != list.begin() ) exceptBuf += " "; |
655 | 655 | ||
656 | exceptBuf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); | 656 | exceptBuf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); |
657 | } | 657 | } |
658 | 658 | ||
659 | retMap.insert( OPimRecurrence::Exceptions, exceptBuf ); | 659 | retMap.insert( OPimRecurrence::Exceptions, exceptBuf ); |
660 | 660 | ||
661 | return retMap; | 661 | return retMap; |
662 | } | 662 | } |
663 | 663 | ||
664 | void OPimRecurrence::fromMap( const QMap<int, QString>& map ) | 664 | void OPimRecurrence::fromMap( const QMap<int, QString>& map ) |
665 | { | 665 | { |
666 | QMap<QString, RepeatType> repTypeMap = rTypeValueConvertMap(); | 666 | QMap<QString, RepeatType> repTypeMap = rTypeValueConvertMap(); |
667 | 667 | ||
668 | data -> type = repTypeMap[ map [OPimRecurrence::RType] ]; | 668 | data -> type = repTypeMap[ map [OPimRecurrence::RType] ]; |
669 | data -> days = (char) map[ OPimRecurrence::RWeekdays ].toInt(); | 669 | data -> days = (char) map[ OPimRecurrence::RWeekdays ].toInt(); |
670 | data -> pos = map[ OPimRecurrence::RPosition ].toInt(); | 670 | data -> pos = map[ OPimRecurrence::RPosition ].toInt(); |
671 | data -> freq = map[ OPimRecurrence::RFreq ].toInt(); | 671 | data -> freq = map[ OPimRecurrence::RFreq ].toInt(); |
672 | data -> hasEnd= map[ OPimRecurrence::RHasEndDate ].toInt() ? true : false; | 672 | data -> hasEnd= map[ OPimRecurrence::RHasEndDate ].toInt() ? true : false; |
673 | OPimTimeZone utc = OPimTimeZone::utc(); | 673 | OPimTimeZone cur = OPimTimeZone::current(); |
674 | if ( data -> hasEnd ){ | 674 | if ( data -> hasEnd ){ |
675 | data -> end = utc.fromUTCDateTime( (time_t) map[ OPimRecurrence::EndDate ].toLong() ).date(); | 675 | data -> end = cur.fromUTCDateTime( (time_t) map[ OPimRecurrence::EndDate ].toLong() ).date(); |
676 | } | 676 | } |
677 | data -> create = utc.fromUTCDateTime( (time_t) map[ OPimRecurrence::Created ].toLong() ).date(); | 677 | data -> create = cur.fromUTCDateTime( (time_t) map[ OPimRecurrence::Created ].toLong() ).date(); |
678 | 678 | ||
679 | #if 0 | 679 | #if 0 |
680 | // FIXME: Exceptions currently not supported... | 680 | // FIXME: Exceptions currently not supported... |
681 | // Convert the list of exceptions from QString into ExceptionList | 681 | // Convert the list of exceptions from QString into ExceptionList |
682 | data -> list.clear(); | 682 | data -> list.clear(); |
683 | QString exceptStr = map[ OPimRecurrence::Exceptions ]; | 683 | QString exceptStr = map[ OPimRecurrence::Exceptions ]; |
684 | QStringList exceptList = QStringList::split( " ", exceptStr ); | 684 | QStringList exceptList = QStringList::split( " ", exceptStr ); |
685 | ... | 685 | ... |
686 | #endif | 686 | #endif |
687 | 687 | ||
688 | 688 | ||
689 | } | 689 | } |
690 | 690 | ||
691 | } | 691 | } |