-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index ebd03bb..3913661 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp | |||
@@ -124,5 +124,7 @@ namespace { | |||
124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; | 124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; |
125 | qu += "description, summary, priority, DueDate, progress , state, "; | 125 | qu += "description, summary, priority, DueDate, progress , state, "; |
126 | qu += "Recurrence, reminders, alarms, maintainer, startdate, completeddate);"; | 126 | // This is the recurrance-stuff .. Exceptions are currently not supported (see ORecur.cpp) ! (eilers) |
127 | qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; | ||
128 | qu += "reminders, alarms, maintainer, startdate, completeddate);"; | ||
127 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; | 129 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; |
128 | return qu; | 130 | return qu; |
@@ -175,4 +177,5 @@ namespace { | |||
175 | } | 177 | } |
176 | QString qu; | 178 | QString qu; |
179 | QMap<int, QString> recMap = m_todo.recurrence().toMap(); | ||
177 | qu = "insert into todolist VALUES(" | 180 | qu = "insert into todolist VALUES(" |
178 | + QString::number( m_todo.uid() ) + "," | 181 | + QString::number( m_todo.uid() ) + "," |
@@ -187,5 +190,12 @@ namespace { | |||
187 | + QString::number( m_todo.progress() ) + "," | 190 | + QString::number( m_todo.progress() ) + "," |
188 | + QString::number( m_todo.state().state() ) + "," | 191 | + QString::number( m_todo.state().state() ) + "," |
189 | + "'" + m_todo.recurrence().toString() + "'"+ ","; | 192 | + "'" + recMap[ ORecur::RType ] + "'" + "," |
193 | + "'" + recMap[ ORecur::RWeekdays ] + "'" + "," | ||
194 | + "'" + recMap[ ORecur::RPosition ] + "'" + "," | ||
195 | + "'" + recMap[ ORecur::RFreq ] + "'" + "," | ||
196 | + "'" + recMap[ ORecur::RHasEndDate ] + "'" + "," | ||
197 | + "'" + recMap[ ORecur::EndDate ] + "'" + "," | ||
198 | + "'" + recMap[ ORecur::Created ] + "'" + "," | ||
199 | + "'" + recMap[ ORecur::Exceptions ] + "'" + ","; | ||
190 | 200 | ||
191 | if ( m_todo.hasNotifiers() ) { | 201 | if ( m_todo.hasNotifiers() ) { |
@@ -525,4 +535,6 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
525 | QStringList cats = QStringList::split(";", item.data("categories") ); | 535 | QStringList cats = QStringList::split(";", item.data("categories") ); |
526 | 536 | ||
537 | qWarning("Item is completed: %d", item.data("completed").toInt() ); | ||
538 | |||
527 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), | 539 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), |
528 | cats, item.data("summary"), item.data("description"), | 540 | cats, item.data("summary"), item.data("description"), |
@@ -553,6 +565,17 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
553 | to.setState( pimState ); | 565 | to.setState( pimState ); |
554 | 566 | ||
555 | // Recurrence not supported yet | 567 | QMap<int, QString> recMap; |
556 | // to.setRecurrence( | 568 | recMap.insert( ORecur::RType , item.data("RType") ); |
569 | recMap.insert( ORecur::RWeekdays , item.data("RWeekdays") ); | ||
570 | recMap.insert( ORecur::RPosition , item.data("RPosition") ); | ||
571 | recMap.insert( ORecur::RFreq , item.data("RFreq") ); | ||
572 | recMap.insert( ORecur::RHasEndDate, item.data("RHasEndDate") ); | ||
573 | recMap.insert( ORecur::EndDate , item.data("EndDate") ); | ||
574 | recMap.insert( ORecur::Created , item.data("Created") ); | ||
575 | recMap.insert( ORecur::Exceptions , item.data("Exceptions") ); | ||
576 | |||
577 | ORecur recur; | ||
578 | recur.fromMap( recMap ); | ||
579 | to.setRecurrence( recur ); | ||
557 | 580 | ||
558 | return to; | 581 | return to; |