author | eilers <eilers> | 2003-12-22 10:19:25 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-12-22 10:19:25 (UTC) |
commit | ae70312b1613e26b4ef89a2c9821d9531b82e987 (patch) (unidiff) | |
tree | 7eb70bc45ee29e94da27a18b0136eb4a14e59fa6 /libopie2/opiepim/oevent.cpp | |
parent | 9e7aafdb7c76d29fee742d53131a73dd60aded2b (diff) | |
download | opie-ae70312b1613e26b4ef89a2c9821d9531b82e987.zip opie-ae70312b1613e26b4ef89a2c9821d9531b82e987.tar.gz opie-ae70312b1613e26b4ef89a2c9821d9531b82e987.tar.bz2 |
Finishing implementation of sql-backend for datebook. But I have to
port the PIM datebook application to use it, before I could debug the
whole stuff.
Thus, PIM-Database backend is finished, but highly experimental. And some
parts are still generic. For instance, the "queryByExample()" methods are
not (or not fully) implemented. Todo: custom-entries not stored.
The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
expression search in the database, which is not supported by sqlite !
Therefore we need either an extended sqlite or a workaround which would
be very slow and memory consuming..
-rw-r--r-- | libopie2/opiepim/oevent.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index ec05e77..9b31957 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/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 | ||