-rw-r--r-- | libopie/pim/opimnotifymanager.cpp | 3 | ||||
-rw-r--r-- | libopie/pim/opimnotifymanager.h | 3 | ||||
-rw-r--r-- | libopie/pim/orecur.cpp | 0 | ||||
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 72 |
4 files changed, 75 insertions, 3 deletions
diff --git a/libopie/pim/opimnotifymanager.cpp b/libopie/pim/opimnotifymanager.cpp index be4a1c2..49af757 100644 --- a/libopie/pim/opimnotifymanager.cpp +++ b/libopie/pim/opimnotifymanager.cpp | |||
@@ -67,3 +67,6 @@ void OPimNotifyManager::registerNotify( const OPimNotify& ) { | |||
67 | void OPimNotifyManager::deregister( const OPimNotify& ) { | 67 | void OPimNotifyManager::deregister( const OPimNotify& ) { |
68 | 68 | ||
69 | } | 69 | } |
70 | bool OPimNotifyManager::isEmpty()const { | ||
71 | return ( m_rem.isEmpty() && m_al.isEmpty() ); | ||
72 | } | ||
diff --git a/libopie/pim/opimnotifymanager.h b/libopie/pim/opimnotifymanager.h index 0eebc9b..0ac30a1 100644 --- a/libopie/pim/opimnotifymanager.h +++ b/libopie/pim/opimnotifymanager.h | |||
@@ -39,6 +39,9 @@ public: | |||
39 | */ | 39 | */ |
40 | void deregister( const OPimNotify& ); | 40 | void deregister( const OPimNotify& ); |
41 | 41 | ||
42 | |||
43 | bool isEmpty()const; | ||
44 | |||
42 | private: | 45 | private: |
43 | Reminders m_rem; | 46 | Reminders m_rem; |
44 | Alarms m_al; | 47 | Alarms m_al; |
diff --git a/libopie/pim/orecur.cpp b/libopie/pim/orecur.cpp index e3b45b4..eae1fdc 100644 --- a/libopie/pim/orecur.cpp +++ b/libopie/pim/orecur.cpp | |||
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index c0d8dfc..71b6a7e 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp | |||
@@ -15,10 +15,28 @@ | |||
15 | #include <qpe/stringutil.h> | 15 | #include <qpe/stringutil.h> |
16 | #include <qpe/timeconversion.h> | 16 | #include <qpe/timeconversion.h> |
17 | 17 | ||
18 | #include "otimezone.h" | ||
18 | #include "orecur.h" | 19 | #include "orecur.h" |
19 | #include "otodoaccessxml.h" | 20 | #include "otodoaccessxml.h" |
20 | 21 | ||
21 | namespace { | 22 | namespace { |
23 | time_t rp_end; | ||
24 | ORecur* rec; | ||
25 | ORecur *recur() { | ||
26 | if (!rec ) rec = new ORecur; | ||
27 | return rec; | ||
28 | } | ||
29 | int snd; | ||
30 | enum MoreAttributes { | ||
31 | FRType = OTodo::CompletedDate + 2, | ||
32 | FRWeekdays, | ||
33 | FRPosition, | ||
34 | FRFreq, | ||
35 | FRHasEndDate, | ||
36 | FREndDate, | ||
37 | FRStart, | ||
38 | FREnd | ||
39 | }; | ||
22 | // FROM TT again | 40 | // FROM TT again |
23 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) | 41 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) |
24 | { | 42 | { |
@@ -59,6 +77,7 @@ OTodoAccessXML::~OTodoAccessXML() { | |||
59 | 77 | ||
60 | } | 78 | } |
61 | bool OTodoAccessXML::load() { | 79 | bool OTodoAccessXML::load() { |
80 | rec = 0; | ||
62 | m_opened = true; | 81 | m_opened = true; |
63 | m_changed = false; | 82 | m_changed = false; |
64 | /* initialize dict */ | 83 | /* initialize dict */ |
@@ -78,14 +97,20 @@ bool OTodoAccessXML::load() { | |||
78 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); | 97 | dict.insert("DateMonth" , new int(OTodo::DateMonth) ); |
79 | dict.insert("DateYear" , new int(OTodo::DateYear) ); | 98 | dict.insert("DateYear" , new int(OTodo::DateYear) ); |
80 | dict.insert("Progress" , new int(OTodo::Progress) ); | 99 | dict.insert("Progress" , new int(OTodo::Progress) ); |
81 | dict.insert("Completed", new int(OTodo::Completed) ); | 100 | dict.insert("CompletedDate", new int(OTodo::CompletedDate) ); |
82 | dict.insert("CrossReference", new int(OTodo::CrossReference) ); | 101 | dict.insert("CrossReference", new int(OTodo::CrossReference) ); |
83 | dict.insert("State", new int(OTodo::State) ); | 102 | dict.insert("State", new int(OTodo::State) ); |
84 | dict.insert("Recurrence", new int(OTodo::Recurrence) ); | ||
85 | dict.insert("Alarms", new int(OTodo::Alarms) ); | 103 | dict.insert("Alarms", new int(OTodo::Alarms) ); |
86 | dict.insert("Reminders", new int(OTodo::Reminders) ); | 104 | dict.insert("Reminders", new int(OTodo::Reminders) ); |
87 | dict.insert("Notifiers", new int(OTodo::Notifiers) ); | 105 | dict.insert("Notifiers", new int(OTodo::Notifiers) ); |
88 | dict.insert("Maintainer", new int(OTodo::Maintainer) ); | 106 | dict.insert("Maintainer", new int(OTodo::Maintainer) ); |
107 | dict.insert("rtype", new int(FRType) ); | ||
108 | dict.insert("rweekdays", new int(FRWeekdays) ); | ||
109 | dict.insert("rposition", new int(FRPosition) ); | ||
110 | dict.insert("rfreq", new int(FRFreq) ); | ||
111 | dict.insert("start", new int(FRStart) ); | ||
112 | dict.insert("rhasenddate", new int(FRHasEndDate) ); | ||
113 | dict.insert("enddt", new int(FREndDate) ); | ||
89 | 114 | ||
90 | // here the custom XML parser from TT it's GPL | 115 | // here the custom XML parser from TT it's GPL |
91 | // but we want to push OpiePIM... to TT..... | 116 | // but we want to push OpiePIM... to TT..... |
@@ -181,8 +206,17 @@ bool OTodoAccessXML::load() { | |||
181 | if ( ev.hasDueDate() ) { | 206 | if ( ev.hasDueDate() ) { |
182 | ev.setDueDate( QDate(m_year, m_month, m_day) ); | 207 | ev.setDueDate( QDate(m_year, m_month, m_day) ); |
183 | } | 208 | } |
209 | if ( rec && rec->doesRecur() ) { | ||
210 | OTimeZone utc = OTimeZone::utc(); | ||
211 | ORecur recu( *rec ); // call copy c'tor | ||
212 | recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() ); | ||
213 | recu.setStart( ev.dueDate() ); | ||
214 | ev.setRecurrence( recu ); | ||
215 | } | ||
184 | m_events.insert(ev.uid(), ev ); | 216 | m_events.insert(ev.uid(), ev ); |
185 | m_year = m_month = m_day = -1; | 217 | m_year = m_month = m_day = -1; |
218 | delete rec; | ||
219 | rec = 0; | ||
186 | } | 220 | } |
187 | 221 | ||
188 | munmap(map_addr, attribut.st_size ); | 222 | munmap(map_addr, attribut.st_size ); |
@@ -397,6 +431,37 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, | |||
397 | } | 431 | } |
398 | break; | 432 | break; |
399 | } | 433 | } |
434 | /* Recurrence stuff below + post processing later */ | ||
435 | case FRType: | ||
436 | if ( val == "Daily" ) | ||
437 | recur()->setType( ORecur::Daily ); | ||
438 | else if ( val == "Weekly" ) | ||
439 | recur()->setType( ORecur::Weekly); | ||
440 | else if ( val == "MonthlyDay" ) | ||
441 | recur()->setType( ORecur::MonthlyDay ); | ||
442 | else if ( val == "MonthlyDate" ) | ||
443 | recur()->setType( ORecur::MonthlyDate ); | ||
444 | else if ( val == "Yearly" ) | ||
445 | recur()->setType( ORecur::Yearly ); | ||
446 | else | ||
447 | recur()->setType( ORecur::NoRepeat ); | ||
448 | break; | ||
449 | case FRWeekdays: | ||
450 | recur()->setDays( val.toInt() ); | ||
451 | break; | ||
452 | case FRPosition: | ||
453 | recur()->setPosition( val.toInt() ); | ||
454 | break; | ||
455 | case FRFreq: | ||
456 | recur()->setFrequency( val.toInt() ); | ||
457 | break; | ||
458 | case FRHasEndDate: | ||
459 | recur()->setHasEndDate( val.toInt() ); | ||
460 | break; | ||
461 | case FREndDate: { | ||
462 | rp_end = (time_t) val.toLong(); | ||
463 | break; | ||
464 | } | ||
400 | default: | 465 | default: |
401 | break; | 466 | break; |
402 | } | 467 | } |
@@ -435,8 +500,9 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
435 | str += extIt.key() + "=\"" + extIt.data() + "\" "; | 500 | str += extIt.key() + "=\"" + extIt.data() + "\" "; |
436 | */ | 501 | */ |
437 | // cross refernce | 502 | // cross refernce |
438 | if ( ev.hasRecurrence() ) | 503 | if ( ev.hasRecurrence() ) { |
439 | str += ev.recurrence().toString(); | 504 | str += ev.recurrence().toString(); |
505 | } | ||
440 | 506 | ||
441 | return str; | 507 | return str; |
442 | } | 508 | } |