-rw-r--r-- | libopie2/opiepim/backend/otodoaccessbackend.h | 1 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 27 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.h | 1 |
5 files changed, 24 insertions, 13 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h index 3bad6b7..7944a2c 100644 --- a/libopie2/opiepim/backend/otodoaccessbackend.h +++ b/libopie2/opiepim/backend/otodoaccessbackend.h | |||
@@ -11,10 +11,11 @@ public: | |||
11 | virtual QArray<int> effectiveToDos( const QDate& start, | 11 | virtual QArray<int> effectiveToDos( const QDate& start, |
12 | const QDate& end, | 12 | const QDate& end, |
13 | bool includeNoDates ) = 0; | 13 | bool includeNoDates ) = 0; |
14 | virtual QArray<int> overDue() = 0; | 14 | virtual QArray<int> overDue() = 0; |
15 | virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, | 15 | virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, |
16 | int cat ) = 0; | 16 | int cat ) = 0; |
17 | virtual void removeAllCompleted() = 0; | ||
17 | 18 | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | #endif | 21 | #endif |
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index ac70ea0..e96cc3c 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp | |||
@@ -151,12 +151,18 @@ bool OTodoAccessVCal::add( const OTodo& to ) { | |||
151 | } | 151 | } |
152 | bool OTodoAccessVCal::remove( int uid ) { | 152 | bool OTodoAccessVCal::remove( int uid ) { |
153 | m_map.remove( uid ); | 153 | m_map.remove( uid ); |
154 | m_dirty = true; | 154 | m_dirty = true; |
155 | return true; | 155 | return true; |
156 | } | 156 | } |
157 | void OTodoAccessVCal::removeAllCompleted() { | ||
158 | for ( QMap<int, OTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) { | ||
159 | if ( (*it).isCompleted() ) | ||
160 | m_map.remove( it ); | ||
161 | } | ||
162 | } | ||
157 | bool OTodoAccessVCal::replace( const OTodo& to ) { | 163 | bool OTodoAccessVCal::replace( const OTodo& to ) { |
158 | m_map.replace( to.uid(), to ); | 164 | m_map.replace( to.uid(), to ); |
159 | m_dirty = true; | 165 | m_dirty = true; |
160 | return true; | 166 | return true; |
161 | } | 167 | } |
162 | OTodo OTodoAccessVCal::find(int uid )const { | 168 | OTodo OTodoAccessVCal::find(int uid )const { |
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h index 4499a7e..452f602 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.h +++ b/libopie2/opiepim/backend/otodoaccessvcal.h | |||
@@ -23,12 +23,14 @@ public: | |||
23 | OTodo find(int uid)const; | 23 | OTodo find(int uid)const; |
24 | void clear(); | 24 | void clear(); |
25 | bool add( const OTodo& ); | 25 | bool add( const OTodo& ); |
26 | bool remove( int uid ); | 26 | bool remove( int uid ); |
27 | bool replace( const OTodo& ); | 27 | bool replace( const OTodo& ); |
28 | 28 | ||
29 | void removeAllCompleted(); | ||
30 | |||
29 | private: | 31 | private: |
30 | bool m_dirty : 1; | 32 | bool m_dirty : 1; |
31 | QString m_file; | 33 | QString m_file; |
32 | QMap<int, OTodo> m_map; | 34 | QMap<int, OTodo> m_map; |
33 | }; | 35 | }; |
34 | 36 | ||
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index c1682c6..b2dfe80 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp | |||
@@ -25,13 +25,13 @@ bool OTodoAccessXML::load() { | |||
25 | m_opened = true; | 25 | m_opened = true; |
26 | m_changed = false; | 26 | m_changed = false; |
27 | /* initialize dict */ | 27 | /* initialize dict */ |
28 | /* | 28 | /* |
29 | * UPDATE dict if you change anything!!! | 29 | * UPDATE dict if you change anything!!! |
30 | */ | 30 | */ |
31 | QAsciiDict<int> dict(15); | 31 | QAsciiDict<int> dict(21); |
32 | dict.setAutoDelete( TRUE ); | 32 | dict.setAutoDelete( TRUE ); |
33 | dict.insert("Categories" , new int(OTodo::Category) ); | 33 | dict.insert("Categories" , new int(OTodo::Category) ); |
34 | dict.insert("Uid" , new int(OTodo::Uid) ); | 34 | dict.insert("Uid" , new int(OTodo::Uid) ); |
35 | dict.insert("HasDate" , new int(OTodo::HasDate) ); | 35 | dict.insert("HasDate" , new int(OTodo::HasDate) ); |
36 | dict.insert("Completed" , new int(OTodo::Completed) ); | 36 | dict.insert("Completed" , new int(OTodo::Completed) ); |
37 | dict.insert("Description" , new int(OTodo::Description) ); | 37 | dict.insert("Description" , new int(OTodo::Description) ); |
@@ -40,17 +40,21 @@ bool OTodoAccessXML::load() { | |||
40 | dict.insert("DateDay" , new int(OTodo::DateDay) ); | 40 | dict.insert("DateDay" , new int(OTodo::DateDay) ); |
41 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); | 41 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); |
42 | dict.insert("DateYear" , new int(OTodo::DateYear) ); | 42 | dict.insert("DateYear" , new int(OTodo::DateYear) ); |
43 | dict.insert("Progress" , new int(OTodo::Progress) ); | 43 | dict.insert("Progress" , new int(OTodo::Progress) ); |
44 | dict.insert("Completed", new int(OTodo::Completed) ); | 44 | dict.insert("Completed", new int(OTodo::Completed) ); |
45 | dict.insert("CrossReference", new int(OTodo::CrossReference) ); | 45 | dict.insert("CrossReference", new int(OTodo::CrossReference) ); |
46 | dict.insert("HasAlarmDateTime",new int(OTodo::HasAlarmDateTime) ); | 46 | dict.insert("State", new int(OTodo::State) ); |
47 | dict.insert("AlarmDateTime", new int(OTodo::AlarmDateTime) ); | 47 | dict.insert("Recurrence", new int(OTodo::Recurrence) ); |
48 | dict.insert("Alarms", new int(OTodo::Alarms) ); | ||
49 | dict.insert("Reminders", new int(OTodo::Reminders) ); | ||
50 | dict.insert("Notifiers", new int(OTodo::Notifiers) ); | ||
51 | dict.insert("Maintainer", new int(OTodo::Maintainer) ); | ||
48 | 52 | ||
49 | // here the custom XML parser from TT it's GPL | 53 | // here the custom XML parser from TT it's GPL |
50 | // but we want to push that to TT..... | 54 | // but we want to push OpiePIM... to TT..... |
51 | QFile f(m_file ); | 55 | QFile f(m_file ); |
52 | if (!f.open(IO_ReadOnly) ) | 56 | if (!f.open(IO_ReadOnly) ) |
53 | return false; | 57 | return false; |
54 | 58 | ||
55 | QByteArray ba = f.readAll(); | 59 | QByteArray ba = f.readAll(); |
56 | f.close(); | 60 | f.close(); |
@@ -333,20 +337,12 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
333 | if ( pos > -1 ) | 337 | if ( pos > -1 ) |
334 | ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() ); | 338 | ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() ); |
335 | 339 | ||
336 | } | 340 | } |
337 | break; | 341 | break; |
338 | } | 342 | } |
339 | case OTodo::HasAlarmDateTime: | ||
340 | ev.setHasAlarmDateTime( val.toInt() ); | ||
341 | break; | ||
342 | case OTodo::AlarmDateTime: { | ||
343 | /* this sounds better ;) zecke */ | ||
344 | ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) ); | ||
345 | break; | ||
346 | } | ||
347 | default: | 343 | default: |
348 | break; | 344 | break; |
349 | } | 345 | } |
350 | } | 346 | } |
351 | QString OTodoAccessXML::toString( const OTodo& ev )const { | 347 | QString OTodoAccessXML::toString( const OTodo& ev )const { |
352 | QString str; | 348 | QString str; |
@@ -380,13 +376,12 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
380 | QMap<QString, QString>::Iterator extIt; | 376 | QMap<QString, QString>::Iterator extIt; |
381 | for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) | 377 | for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) |
382 | str += extIt.key() + "=\"" + extIt.data() + "\" "; | 378 | str += extIt.key() + "=\"" + extIt.data() + "\" "; |
383 | */ | 379 | */ |
384 | // cross refernce | 380 | // cross refernce |
385 | 381 | ||
386 | str += "AlarmDateTime=\"" + TimeConversion::toISO8601( ev.alarmDateTime() ) + "\" "; | ||
387 | 382 | ||
388 | return str; | 383 | return str; |
389 | } | 384 | } |
390 | QString OTodoAccessXML::toString( const QArray<int>& ints ) const { | 385 | QString OTodoAccessXML::toString( const QArray<int>& ints ) const { |
391 | return Qtopia::Record::idsToString( ints ); | 386 | return Qtopia::Record::idsToString( ints ); |
392 | } | 387 | } |
@@ -613,6 +608,12 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, | |||
613 | for (uint i= 0; i < vector.count(); i++ ) { | 608 | for (uint i= 0; i < vector.count(); i++ ) { |
614 | array[i] = ( vector.at(i) )->todo.uid(); | 609 | array[i] = ( vector.at(i) )->todo.uid(); |
615 | } | 610 | } |
616 | qWarning("array count = %d %d", array.count(), vector.count() ); | 611 | qWarning("array count = %d %d", array.count(), vector.count() ); |
617 | return array; | 612 | return array; |
618 | }; | 613 | }; |
614 | void OTodoAccessXML::removeAllCompleted() { | ||
615 | for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { | ||
616 | if ( (*it).isCompleted() ) | ||
617 | m_events.remove( it ); | ||
618 | } | ||
619 | } | ||
diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h index dc41c32..93609fe 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.h +++ b/libopie2/opiepim/backend/otodoaccessxml.h | |||
@@ -26,12 +26,13 @@ public: | |||
26 | QArray<int> allRecords()const; | 26 | QArray<int> allRecords()const; |
27 | QArray<int> queryByExample( const OTodo&, int querysettings ); | 27 | QArray<int> queryByExample( const OTodo&, int querysettings ); |
28 | OTodo find( int uid )const; | 28 | OTodo find( int uid )const; |
29 | void clear(); | 29 | void clear(); |
30 | bool add( const OTodo& ); | 30 | bool add( const OTodo& ); |
31 | bool remove( int uid ); | 31 | bool remove( int uid ); |
32 | void removeAllCompleted(); | ||
32 | bool replace( const OTodo& ); | 33 | bool replace( const OTodo& ); |
33 | 34 | ||
34 | /* our functions */ | 35 | /* our functions */ |
35 | QArray<int> effectiveToDos( const QDate& start, | 36 | QArray<int> effectiveToDos( const QDate& start, |
36 | const QDate& end, | 37 | const QDate& end, |
37 | bool includeNoDates ); | 38 | bool includeNoDates ); |