summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-07 17:49:07 (UTC)
committer zecke <zecke>2003-05-07 17:49:07 (UTC)
commitc13ada0f5e418b25b177e132ff2e1dfe7821577f (patch) (unidiff)
tree40e8d6cc67a1de638ef3c278fd827ba0cbea5b76
parentac895871f93dce9734189daf9cb95dbbda605096 (diff)
downloadopie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.zip
opie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.tar.gz
opie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.tar.bz2
implement loading of Recurrence
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimnotifymanager.cpp3
-rw-r--r--libopie/pim/opimnotifymanager.h3
-rw-r--r--libopie/pim/orecur.cpp2
-rw-r--r--libopie/pim/otodoaccessxml.cpp72
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp72
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp3
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h3
-rw-r--r--libopie2/opiepim/core/orecur.cpp2
8 files changed, 152 insertions, 8 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
@@ -69 +69,4 @@ void OPimNotifyManager::deregister( const OPimNotify& ) {
69} 69}
70bool 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
@@ -41,2 +41,5 @@ public:
41 41
42
43 bool isEmpty()const;
44
42private: 45private:
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
@@ -506,3 +506,3 @@ QString ORecur::toString()const {
506 } 506 }
507 buf += "\""; 507 buf += "\" ";
508 508
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
@@ -17,2 +17,3 @@
17 17
18#include "otimezone.h"
18#include "orecur.h" 19#include "orecur.h"
@@ -21,2 +22,19 @@
21namespace { 22namespace {
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
@@ -61,2 +79,3 @@ OTodoAccessXML::~OTodoAccessXML() {
61bool OTodoAccessXML::load() { 79bool OTodoAccessXML::load() {
80 rec = 0;
62 m_opened = true; 81 m_opened = true;
@@ -80,6 +99,5 @@ bool OTodoAccessXML::load() {
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) );
@@ -88,2 +106,9 @@ bool OTodoAccessXML::load() {
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
@@ -183,4 +208,13 @@ bool OTodoAccessXML::load() {
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 }
@@ -399,2 +433,33 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
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:
@@ -437,4 +502,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
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
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index c0d8dfc..71b6a7e 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -17,2 +17,3 @@
17 17
18#include "otimezone.h"
18#include "orecur.h" 19#include "orecur.h"
@@ -21,2 +22,19 @@
21namespace { 22namespace {
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
@@ -61,2 +79,3 @@ OTodoAccessXML::~OTodoAccessXML() {
61bool OTodoAccessXML::load() { 79bool OTodoAccessXML::load() {
80 rec = 0;
62 m_opened = true; 81 m_opened = true;
@@ -80,6 +99,5 @@ bool OTodoAccessXML::load() {
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) );
@@ -88,2 +106,9 @@ bool OTodoAccessXML::load() {
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
@@ -183,4 +208,13 @@ bool OTodoAccessXML::load() {
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 }
@@ -399,2 +433,33 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
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:
@@ -437,4 +502,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
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
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp
index be4a1c2..49af757 100644
--- a/libopie2/opiepim/core/opimnotifymanager.cpp
+++ b/libopie2/opiepim/core/opimnotifymanager.cpp
@@ -69 +69,4 @@ void OPimNotifyManager::deregister( const OPimNotify& ) {
69} 69}
70bool OPimNotifyManager::isEmpty()const {
71 return ( m_rem.isEmpty() && m_al.isEmpty() );
72}
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h
index 0eebc9b..0ac30a1 100644
--- a/libopie2/opiepim/core/opimnotifymanager.h
+++ b/libopie2/opiepim/core/opimnotifymanager.h
@@ -41,2 +41,5 @@ public:
41 41
42
43 bool isEmpty()const;
44
42private: 45private:
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp
index e3b45b4..eae1fdc 100644
--- a/libopie2/opiepim/core/orecur.cpp
+++ b/libopie2/opiepim/core/orecur.cpp
@@ -506,3 +506,3 @@ QString ORecur::toString()const {
506 } 506 }
507 buf += "\""; 507 buf += "\" ";
508 508