summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimevent.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core/opimevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimevent.cpp36
1 files changed, 22 insertions, 14 deletions
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
@@ -555,9 +555,12 @@ QMap<int, QString> OPimEvent::toMap() const
retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) );
retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) );
retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" );
- OPimAlarm alarm = notifiers().alarms() [ 0 ];
- retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
- retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
+ if ( notifiers().alarms().count() ){
+ // Currently we just support one alarm.. (eilers)
+ OPimAlarm alarm = notifiers().alarms() [ 0 ];
+ retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
+ retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
+ }
OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() );
retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) );
@@ -619,17 +622,6 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
else
setAllDay( false );
- int alarmTime = -1;
- if ( !map[ OPimEvent::FAlarm ].isEmpty() )
- alarmTime = map[ OPimEvent::FAlarm ].toInt();
-
- int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
- if ( ( alarmTime != -1 ) )
- {
- QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
- OPimAlarm al( sound , dt );
- notifiers().add( al );
- }
if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) )
{
setTimeZone( map[ OPimEvent::FTimeZone ] );
@@ -659,6 +651,22 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) );
}
+ int alarmTime = -1;
+ if ( !map[ OPimEvent::FAlarm ].isEmpty() )
+ alarmTime = map[ OPimEvent::FAlarm ].toInt();
+
+ int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
+ if ( ( alarmTime != -1 ) )
+ {
+ QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
+ OPimAlarm al( sound , dt );
+ notifiers().add( al );
+ }
+
+
+ if ( !map[ OPimEvent::FNote ].isEmpty() )
+ setNote( map[ OPimEvent::FNote ] );
+
if ( !map[ OPimEvent::FRecParent ].isEmpty() )
setParent( map[ OPimEvent::FRecParent ].toInt() );