-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimevent.cpp | 36 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimevent.h | 2 |
3 files changed, 24 insertions, 16 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp index 6c32b40..f4f3c94 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp | |||
@@ -140,3 +140,3 @@ void ODateBookAccessBackend_SQL::initFields() | |||
140 | QMapConstIterator<int, QString> it; | 140 | QMapConstIterator<int, QString> it; |
141 | for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ | 141 | for ( it = m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ |
142 | m_reverseFieldMap.insert( it.data(), it.key() ); | 142 | m_reverseFieldMap.insert( it.data(), it.key() ); |
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp index 8bf8b25..9d46651 100644 --- a/libopie2/opiepim/core/opimevent.cpp +++ b/libopie2/opiepim/core/opimevent.cpp | |||
@@ -557,5 +557,8 @@ QMap<int, QString> OPimEvent::toMap() const | |||
557 | retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); | 557 | retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); |
558 | OPimAlarm alarm = notifiers().alarms() [ 0 ]; | 558 | if ( notifiers().alarms().count() ){ |
559 | retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); | 559 | // Currently we just support one alarm.. (eilers) |
560 | retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); | 560 | OPimAlarm alarm = notifiers().alarms() [ 0 ]; |
561 | retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); | ||
562 | retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); | ||
563 | } | ||
561 | 564 | ||
@@ -621,13 +624,2 @@ void OPimEvent::fromMap( const QMap<int, QString>& map ) | |||
621 | 624 | ||
622 | int alarmTime = -1; | ||
623 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) | ||
624 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); | ||
625 | |||
626 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); | ||
627 | if ( ( alarmTime != -1 ) ) | ||
628 | { | ||
629 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); | ||
630 | OPimAlarm al( sound , dt ); | ||
631 | notifiers().add( al ); | ||
632 | } | ||
633 | if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) | 625 | if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) |
@@ -661,2 +653,18 @@ void OPimEvent::fromMap( const QMap<int, QString>& map ) | |||
661 | 653 | ||
654 | int alarmTime = -1; | ||
655 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) | ||
656 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); | ||
657 | |||
658 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); | ||
659 | if ( ( alarmTime != -1 ) ) | ||
660 | { | ||
661 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); | ||
662 | OPimAlarm al( sound , dt ); | ||
663 | notifiers().add( al ); | ||
664 | } | ||
665 | |||
666 | |||
667 | if ( !map[ OPimEvent::FNote ].isEmpty() ) | ||
668 | setNote( map[ OPimEvent::FNote ] ); | ||
669 | |||
662 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) | 670 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) |
diff --git a/libopie2/opiepim/core/opimevent.h b/libopie2/opiepim/core/opimevent.h index 56fe917..5553cac 100644 --- a/libopie2/opiepim/core/opimevent.h +++ b/libopie2/opiepim/core/opimevent.h | |||
@@ -81,3 +81,3 @@ class OPimEvent : public OPimRecord | |||
81 | FCategories = Qtopia::CATEGORY_ID, | 81 | FCategories = Qtopia::CATEGORY_ID, |
82 | FDescription = 0, | 82 | FDescription /* = 0 Why this ? (eilers) */, |
83 | FLocation, | 83 | FLocation, |