author | zecke <zecke> | 2002-09-22 23:32:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-22 23:32:49 (UTC) |
commit | d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f (patch) (unidiff) | |
tree | 5ff52b48fd514c6f24da6d3204bc98b66c48a652 /libopie/pim/otodo.cpp | |
parent | 4f142e98ee63e88fa0df61161b93228ee719d551 (diff) | |
download | opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.zip opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.tar.gz opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.tar.bz2 |
Two brown paper bags later OTodo is ok again... pointers can be so fscking awesome
I had problems with QShared because I forgot to copy it in &operator=
And the other one was d = 0
-rw-r--r-- | libopie/pim/otodo.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index b3c14e6..cc46b21 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -36,12 +36,13 @@ OTodo::OTodo(const OTodo &event ) | |||
36 | : OPimRecord( event ), data( event.data ) | 36 | : OPimRecord( event ), data( event.data ) |
37 | { | 37 | { |
38 | data->ref(); | 38 | data->ref(); |
39 | qWarning("ref up"); | 39 | // qWarning("ref up"); |
40 | } | 40 | } |
41 | OTodo::~OTodo() { | 41 | OTodo::~OTodo() { |
42 | qWarning("~OTodo " + data->sum ); | 42 | |
43 | // qWarning("~OTodo " ); | ||
43 | if ( data->deref() ) { | 44 | if ( data->deref() ) { |
44 | qWarning("OTodo::dereffing"); | 45 | // qWarning("OTodo::dereffing"); |
45 | delete data; | 46 | delete data; |
46 | data = 0l; | 47 | data = 0l; |
47 | } | 48 | } |
@@ -54,7 +55,7 @@ OTodo::OTodo(bool completed, int priority, | |||
54 | bool hasDate, QDate date, int uid ) | 55 | bool hasDate, QDate date, int uid ) |
55 | : OPimRecord( uid ) | 56 | : OPimRecord( uid ) |
56 | { | 57 | { |
57 | qWarning("OTodoData " + summary); | 58 | // qWarning("OTodoData " + summary); |
58 | setCategories( category ); | 59 | setCategories( category ); |
59 | 60 | ||
60 | data = new OTodoData; | 61 | data = new OTodoData; |
@@ -77,12 +78,12 @@ OTodo::OTodo(bool completed, int priority, | |||
77 | bool hasDate, QDate date, int uid ) | 78 | bool hasDate, QDate date, int uid ) |
78 | : OPimRecord( uid ) | 79 | : OPimRecord( uid ) |
79 | { | 80 | { |
80 | qWarning("OTodoData" + summary); | 81 | // qWarning("OTodoData" + summary); |
81 | setCategories( idsFromString( category.join(";") ) ); | 82 | setCategories( idsFromString( category.join(";") ) ); |
82 | 83 | ||
83 | data = new OTodoData; | 84 | data = new OTodoData; |
84 | data->date = date; | ||
85 | 85 | ||
86 | data->date = date; | ||
86 | data->isCompleted = completed; | 87 | data->isCompleted = completed; |
87 | data->hasDate = hasDate; | 88 | data->hasDate = hasDate; |
88 | data->priority = priority; | 89 | data->priority = priority; |
@@ -160,6 +161,7 @@ void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | |||
160 | } | 161 | } |
161 | void OTodo::setDescription(const QString &desc ) | 162 | void OTodo::setDescription(const QString &desc ) |
162 | { | 163 | { |
164 | qWarning( "desc " + desc ); | ||
163 | changeOrModify(); | 165 | changeOrModify(); |
164 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
165 | } | 167 | } |
@@ -311,15 +313,16 @@ void OTodo::deref() { | |||
311 | if ( data->deref() ) { | 313 | if ( data->deref() ) { |
312 | //qWarning("deleting"); | 314 | //qWarning("deleting"); |
313 | delete data; | 315 | delete data; |
314 | d= 0; | 316 | data= 0; |
315 | } | 317 | } |
316 | } | 318 | } |
317 | OTodo &OTodo::operator=(const OTodo &item ) | 319 | OTodo &OTodo::operator=(const OTodo &item ) |
318 | { | 320 | { |
319 | OPimRecord::operator=( item ); | 321 | // OPimRecord::operator=( item ); |
320 | //qWarning("operator= ref "); | 322 | //qWarning("operator= ref "); |
321 | item.data->ref(); | 323 | item.data->ref(); |
322 | deref(); | 324 | deref(); |
325 | data = item.data; | ||
323 | 326 | ||
324 | return *this; | 327 | return *this; |
325 | } | 328 | } |
@@ -355,7 +358,7 @@ QMap<QString, QString> OTodo::toExtraMap()const { | |||
355 | */ | 358 | */ |
356 | void OTodo::changeOrModify() { | 359 | void OTodo::changeOrModify() { |
357 | if ( data->count != 1 ) { | 360 | if ( data->count != 1 ) { |
358 | qWarning("changeOrModify"); | 361 | // qWarning("changeOrModify"); |
359 | data->deref(); | 362 | data->deref(); |
360 | OTodoData* d2 = new OTodoData(); | 363 | OTodoData* d2 = new OTodoData(); |
361 | copy(data, d2 ); | 364 | copy(data, d2 ); |