-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 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 72 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.h | 3 | ||||
-rw-r--r-- | libopie2/opiepim/core/orecur.cpp | 0 |
8 files changed, 150 insertions, 6 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& ) { } +bool OPimNotifyManager::isEmpty()const { + return ( m_rem.isEmpty() && m_al.isEmpty() ); +} 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: + + bool isEmpty()const; + private: 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 @@ -17,2 +17,3 @@ +#include "otimezone.h" #include "orecur.h" @@ -21,2 +22,19 @@ namespace { + time_t rp_end; + ORecur* rec; + ORecur *recur() { + if (!rec ) rec = new ORecur; + return rec; + } + int snd; + enum MoreAttributes { + FRType = OTodo::CompletedDate + 2, + FRWeekdays, + FRPosition, + FRFreq, + FRHasEndDate, + FREndDate, + FRStart, + FREnd + }; // FROM TT again @@ -61,2 +79,3 @@ OTodoAccessXML::~OTodoAccessXML() { bool OTodoAccessXML::load() { + rec = 0; m_opened = true; @@ -80,6 +99,5 @@ bool OTodoAccessXML::load() { dict.insert("Progress" , new int(OTodo::Progress) ); - dict.insert("Completed", new int(OTodo::Completed) ); + dict.insert("CompletedDate", new int(OTodo::CompletedDate) ); dict.insert("CrossReference", new int(OTodo::CrossReference) ); dict.insert("State", new int(OTodo::State) ); - dict.insert("Recurrence", new int(OTodo::Recurrence) ); dict.insert("Alarms", new int(OTodo::Alarms) ); @@ -88,2 +106,9 @@ bool OTodoAccessXML::load() { dict.insert("Maintainer", new int(OTodo::Maintainer) ); + dict.insert("rtype", new int(FRType) ); + dict.insert("rweekdays", new int(FRWeekdays) ); + dict.insert("rposition", new int(FRPosition) ); + dict.insert("rfreq", new int(FRFreq) ); + dict.insert("start", new int(FRStart) ); + dict.insert("rhasenddate", new int(FRHasEndDate) ); + dict.insert("enddt", new int(FREndDate) ); @@ -183,4 +208,13 @@ bool OTodoAccessXML::load() { } + if ( rec && rec->doesRecur() ) { + OTimeZone utc = OTimeZone::utc(); + ORecur recu( *rec ); // call copy c'tor + recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() ); + recu.setStart( ev.dueDate() ); + ev.setRecurrence( recu ); + } m_events.insert(ev.uid(), ev ); m_year = m_month = m_day = -1; + delete rec; + rec = 0; } @@ -399,2 +433,33 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, } + /* Recurrence stuff below + post processing later */ + case FRType: + if ( val == "Daily" ) + recur()->setType( ORecur::Daily ); + else if ( val == "Weekly" ) + recur()->setType( ORecur::Weekly); + else if ( val == "MonthlyDay" ) + recur()->setType( ORecur::MonthlyDay ); + else if ( val == "MonthlyDate" ) + recur()->setType( ORecur::MonthlyDate ); + else if ( val == "Yearly" ) + recur()->setType( ORecur::Yearly ); + else + recur()->setType( ORecur::NoRepeat ); + break; + case FRWeekdays: + recur()->setDays( val.toInt() ); + break; + case FRPosition: + recur()->setPosition( val.toInt() ); + break; + case FRFreq: + recur()->setFrequency( val.toInt() ); + break; + case FRHasEndDate: + recur()->setHasEndDate( val.toInt() ); + break; + case FREndDate: { + rp_end = (time_t) val.toLong(); + break; + } default: @@ -437,4 +502,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { // cross refernce - if ( ev.hasRecurrence() ) + if ( ev.hasRecurrence() ) { str += ev.recurrence().toString(); + } 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 @@ +#include "otimezone.h" #include "orecur.h" @@ -21,2 +22,19 @@ namespace { + time_t rp_end; + ORecur* rec; + ORecur *recur() { + if (!rec ) rec = new ORecur; + return rec; + } + int snd; + enum MoreAttributes { + FRType = OTodo::CompletedDate + 2, + FRWeekdays, + FRPosition, + FRFreq, + FRHasEndDate, + FREndDate, + FRStart, + FREnd + }; // FROM TT again @@ -61,2 +79,3 @@ OTodoAccessXML::~OTodoAccessXML() { bool OTodoAccessXML::load() { + rec = 0; m_opened = true; @@ -80,6 +99,5 @@ bool OTodoAccessXML::load() { dict.insert("Progress" , new int(OTodo::Progress) ); - dict.insert("Completed", new int(OTodo::Completed) ); + dict.insert("CompletedDate", new int(OTodo::CompletedDate) ); dict.insert("CrossReference", new int(OTodo::CrossReference) ); dict.insert("State", new int(OTodo::State) ); - dict.insert("Recurrence", new int(OTodo::Recurrence) ); dict.insert("Alarms", new int(OTodo::Alarms) ); @@ -88,2 +106,9 @@ bool OTodoAccessXML::load() { dict.insert("Maintainer", new int(OTodo::Maintainer) ); + dict.insert("rtype", new int(FRType) ); + dict.insert("rweekdays", new int(FRWeekdays) ); + dict.insert("rposition", new int(FRPosition) ); + dict.insert("rfreq", new int(FRFreq) ); + dict.insert("start", new int(FRStart) ); + dict.insert("rhasenddate", new int(FRHasEndDate) ); + dict.insert("enddt", new int(FREndDate) ); @@ -183,4 +208,13 @@ bool OTodoAccessXML::load() { } + if ( rec && rec->doesRecur() ) { + OTimeZone utc = OTimeZone::utc(); + ORecur recu( *rec ); // call copy c'tor + recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() ); + recu.setStart( ev.dueDate() ); + ev.setRecurrence( recu ); + } m_events.insert(ev.uid(), ev ); m_year = m_month = m_day = -1; + delete rec; + rec = 0; } @@ -399,2 +433,33 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, } + /* Recurrence stuff below + post processing later */ + case FRType: + if ( val == "Daily" ) + recur()->setType( ORecur::Daily ); + else if ( val == "Weekly" ) + recur()->setType( ORecur::Weekly); + else if ( val == "MonthlyDay" ) + recur()->setType( ORecur::MonthlyDay ); + else if ( val == "MonthlyDate" ) + recur()->setType( ORecur::MonthlyDate ); + else if ( val == "Yearly" ) + recur()->setType( ORecur::Yearly ); + else + recur()->setType( ORecur::NoRepeat ); + break; + case FRWeekdays: + recur()->setDays( val.toInt() ); + break; + case FRPosition: + recur()->setPosition( val.toInt() ); + break; + case FRFreq: + recur()->setFrequency( val.toInt() ); + break; + case FRHasEndDate: + recur()->setHasEndDate( val.toInt() ); + break; + case FREndDate: { + rp_end = (time_t) val.toLong(); + break; + } default: @@ -437,4 +502,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { // cross refernce - if ( ev.hasRecurrence() ) + if ( ev.hasRecurrence() ) { str += ev.recurrence().toString(); + } 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& ) { } +bool OPimNotifyManager::isEmpty()const { + return ( m_rem.isEmpty() && m_al.isEmpty() ); +} 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: + + bool isEmpty()const; + private: 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 |