-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 52 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 2 |
3 files changed, 36 insertions, 20 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index d255c66..ebd03bb 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp | |||
@@ -9,6 +9,9 @@ | |||
9 | #include <opie2/osqlquery.h> | 9 | #include <opie2/osqlquery.h> |
10 | 10 | ||
11 | #include "otodoaccesssql.h" | 11 | #include "otodoaccesssql.h" |
12 | #include "opimstate.h" | ||
13 | #include "opimnotifymanager.h" | ||
14 | #include "orecur.h" | ||
12 | 15 | ||
13 | /* | 16 | /* |
14 | * first some query | 17 | * first some query |
@@ -120,7 +123,8 @@ namespace { | |||
120 | QString qu; | 123 | QString qu; |
121 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; | 124 | qu += "create table todolist( uid PRIMARY KEY, categories, completed, "; |
122 | qu += "description, summary, priority, DueDate, progress , state, "; | 125 | qu += "description, summary, priority, DueDate, progress , state, "; |
123 | qu += "Recurrence, notifiers, maintainer, startdate, completeddate)"; | 126 | qu += "Recurrence, 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) );"; | ||
124 | return qu; | 128 | return qu; |
125 | } | 129 | } |
126 | 130 | ||
@@ -181,14 +185,23 @@ namespace { | |||
181 | + QString::number(month) | 185 | + QString::number(month) |
182 | + "-" + QString::number( day ) + "'" + "," | 186 | + "-" + QString::number( day ) + "'" + "," |
183 | + QString::number( m_todo.progress() ) + "," | 187 | + QString::number( m_todo.progress() ) + "," |
184 | + "''" + "," // state (conversion needed) | 188 | + QString::number( m_todo.state().state() ) + "," |
185 | // + QString::number( m_todo.state() ) + "," | 189 | + "'" + m_todo.recurrence().toString() + "'"+ ","; |
186 | + "''" + "," // Recurrence (conversion needed) | 190 | |
187 | + "''" + "," // Notifiers (conversion needed) | 191 | if ( m_todo.hasNotifiers() ) { |
188 | + "''" + "," // Maintainers (conversion needed) | 192 | OPimNotifyManager manager = m_todo.notifiers(); |
193 | qu += "'" + manager.remindersToString() + "'" + "," | ||
194 | + "'" + manager.alarmsToString() + "'" + ","; | ||
195 | } | ||
196 | else{ | ||
197 | qu += QString( "''" ) + "," | ||
198 | + "''" + ","; | ||
199 | } | ||
200 | |||
201 | qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) | ||
189 | + "'" + QString::number(sYear) + "-" | 202 | + "'" + QString::number(sYear) + "-" |
190 | + QString::number(sMonth) | 203 | + QString::number(sMonth) |
191 | + "-" + QString::number(sDay) + "'" + "," | 204 | + "-" + QString::number(sDay) + "'" + "," |
192 | + "'" + QString::number(eYear) + "-" | 205 | + "'" + QString::number(eYear) + "-" |
193 | + QString::number(eMonth) | 206 | + QString::number(eMonth) |
194 | + "-"+QString::number(eDay) + "'" | 207 | + "-"+QString::number(eDay) + "'" |
@@ -530,6 +543,17 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
530 | to.setStartDate( startDate ); | 543 | to.setStartDate( startDate ); |
531 | if ( hasCompletedDate ) | 544 | if ( hasCompletedDate ) |
532 | to.setCompletedDate( completedDate ); | 545 | to.setCompletedDate( completedDate ); |
546 | |||
547 | OPimNotifyManager& manager = to.notifiers(); | ||
548 | manager.alarmsFromString( item.data("alarms") ); | ||
549 | manager.remindersFromString( item.data("reminders") ); | ||
550 | |||
551 | OPimState pimState; | ||
552 | pimState.setState( QString( item.data("state") ).toInt() ); | ||
553 | to.setState( pimState ); | ||
554 | |||
555 | // Recurrence not supported yet | ||
556 | // to.setRecurrence( | ||
533 | 557 | ||
534 | return to; | 558 | return to; |
535 | } | 559 | } |
@@ -621,18 +645,10 @@ QArray<int> OTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const | |||
621 | } | 645 | } |
622 | QBitArray OTodoAccessBackendSQL::supports()const { | 646 | QBitArray OTodoAccessBackendSQL::supports()const { |
623 | 647 | ||
624 | QBitArray ar( OTodo::CompletedDate + 1 ); | 648 | return sup(); |
625 | ar.fill( true ); | ||
626 | ar[OTodo::CrossReference] = false; | ||
627 | ar[OTodo::State ] = false; | ||
628 | ar[OTodo::Reminders] = false; | ||
629 | ar[OTodo::Notifiers] = false; | ||
630 | ar[OTodo::Maintainer] = false; | ||
631 | |||
632 | return ar; | ||
633 | } | 649 | } |
634 | 650 | ||
635 | QBitArray OTodoAccessBackendSQL::sup() { | 651 | QBitArray OTodoAccessBackendSQL::sup() const{ |
636 | 652 | ||
637 | QBitArray ar( OTodo::CompletedDate + 1 ); | 653 | QBitArray ar( OTodo::CompletedDate + 1 ); |
638 | ar.fill( true ); | 654 | ar.fill( true ); |
diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h index 77d8b77..1c55567 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.h +++ b/libopie2/opiepim/backend/otodoaccesssql.h | |||
@@ -44,7 +44,7 @@ private: | |||
44 | inline OTodo todo( OSQLResultItem& )const; | 44 | inline OTodo todo( OSQLResultItem& )const; |
45 | inline QArray<int> uids( const OSQLResult& )const; | 45 | inline QArray<int> uids( const OSQLResult& )const; |
46 | OTodo todo( int uid )const; | 46 | OTodo todo( int uid )const; |
47 | QBitArray sup(); | 47 | QBitArray sup() const; |
48 | 48 | ||
49 | QAsciiDict<int> m_dict; | 49 | QAsciiDict<int> m_dict; |
50 | OSQLDriver* m_driver; | 50 | OSQLDriver* m_driver; |
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp index f688735..4a5cb33 100644 --- a/libopie2/opiepim/backend/otodoaccessxml.cpp +++ b/libopie2/opiepim/backend/otodoaccessxml.cpp | |||
@@ -568,7 +568,7 @@ QString OTodoAccessXML::toString( const OTodo& ev )const { | |||
568 | 568 | ||
569 | /* | 569 | /* |
570 | * save reminders and notifiers! | 570 | * save reminders and notifiers! |
571 | * DATE_TIME:DURATION:SOUND:NOT_USED_YET;OTHER_DATE_TIME:OTHER:DURATION:SOUND:.... | 571 | * DATE_TIME:DURATION:SOUND:NOT_USED_YET;OTHER_DATE_TIME:OTHER_DURATION:SOUND:.... |
572 | */ | 572 | */ |
573 | if ( ev.hasNotifiers() ) { | 573 | if ( ev.hasNotifiers() ) { |
574 | OPimNotifyManager manager = ev.notifiers(); | 574 | OPimNotifyManager manager = ev.notifiers(); |