-rw-r--r-- | libopie/pim/oevent.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp index ec05e77..9b31957 100644 --- a/libopie/pim/oevent.cpp +++ b/libopie/pim/oevent.cpp | |||
@@ -68,24 +68,33 @@ struct OEvent::Data : public QShared { | |||
68 | int parent; | 68 | int parent; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | OEvent::OEvent( int uid ) | 71 | OEvent::OEvent( int uid ) |
72 | : OPimRecord( uid ) { | 72 | : OPimRecord( uid ) { |
73 | data = new Data; | 73 | data = new Data; |
74 | } | 74 | } |
75 | OEvent::OEvent( const OEvent& ev) | 75 | OEvent::OEvent( const OEvent& ev) |
76 | : OPimRecord( ev ), data( ev.data ) | 76 | : OPimRecord( ev ), data( ev.data ) |
77 | { | 77 | { |
78 | data->ref(); | 78 | data->ref(); |
79 | } | 79 | } |
80 | |||
81 | OEvent::OEvent( const QMap<int, QString> map ) | ||
82 | : OPimRecord( 0 ) | ||
83 | { | ||
84 | data = new Data; | ||
85 | |||
86 | fromMap( map ); | ||
87 | } | ||
88 | |||
80 | OEvent::~OEvent() { | 89 | OEvent::~OEvent() { |
81 | if ( data->deref() ) { | 90 | if ( data->deref() ) { |
82 | delete data; | 91 | delete data; |
83 | data = 0; | 92 | data = 0; |
84 | } | 93 | } |
85 | } | 94 | } |
86 | OEvent& OEvent::operator=( const OEvent& ev) { | 95 | OEvent& OEvent::operator=( const OEvent& ev) { |
87 | if ( this == &ev ) return *this; | 96 | if ( this == &ev ) return *this; |
88 | 97 | ||
89 | OPimRecord::operator=( ev ); | 98 | OPimRecord::operator=( ev ); |
90 | ev.data->ref(); | 99 | ev.data->ref(); |
91 | deref(); | 100 | deref(); |
@@ -394,24 +403,28 @@ QMap<int, QString> OEvent::toMap()const { | |||
394 | // Add recurrence stuff | 403 | // Add recurrence stuff |
395 | if( hasRecurrence() ){ | 404 | if( hasRecurrence() ){ |
396 | ORecur recur = recurrence(); | 405 | ORecur recur = recurrence(); |
397 | QMap<int, QString> recFields = recur.toMap(); | 406 | QMap<int, QString> recFields = recur.toMap(); |
398 | retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); | 407 | retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); |
399 | retMap.insert( OEvent::FRWeekdays, recFields[ORecur::RWeekdays] ); | 408 | retMap.insert( OEvent::FRWeekdays, recFields[ORecur::RWeekdays] ); |
400 | retMap.insert( OEvent::FRPosition, recFields[ORecur::RPosition] ); | 409 | retMap.insert( OEvent::FRPosition, recFields[ORecur::RPosition] ); |
401 | retMap.insert( OEvent::FRFreq, recFields[ORecur::RFreq] ); | 410 | retMap.insert( OEvent::FRFreq, recFields[ORecur::RFreq] ); |
402 | retMap.insert( OEvent::FRHasEndDate, recFields[ORecur::RHasEndDate] ); | 411 | retMap.insert( OEvent::FRHasEndDate, recFields[ORecur::RHasEndDate] ); |
403 | retMap.insert( OEvent::FREndDate, recFields[ORecur::EndDate] ); | 412 | retMap.insert( OEvent::FREndDate, recFields[ORecur::EndDate] ); |
404 | retMap.insert( OEvent::FRCreated, recFields[ORecur::Created] ); | 413 | retMap.insert( OEvent::FRCreated, recFields[ORecur::Created] ); |
405 | retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] ); | 414 | retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] ); |
415 | } else { | ||
416 | ORecur recur = recurrence(); | ||
417 | QMap<int, QString> recFields = recur.toMap(); | ||
418 | retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); | ||
406 | } | 419 | } |
407 | 420 | ||
408 | return retMap; | 421 | return retMap; |
409 | } | 422 | } |
410 | 423 | ||
411 | void OEvent::fromMap( const QMap<int, QString>& map ) | 424 | void OEvent::fromMap( const QMap<int, QString>& map ) |
412 | { | 425 | { |
413 | 426 | ||
414 | // We just want to set the UID if it is really stored. | 427 | // We just want to set the UID if it is really stored. |
415 | if ( !map[OEvent::FUid].isEmpty() ) | 428 | if ( !map[OEvent::FUid].isEmpty() ) |
416 | setUid( map[OEvent::FUid].toInt() ); | 429 | setUid( map[OEvent::FUid].toInt() ); |
417 | 430 | ||