author | eilers <eilers> | 2003-09-22 14:31:15 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-09-22 14:31:15 (UTC) |
commit | 34e86ddf4f9b1045a5b730beab2d8d72e2dd4d56 (patch) (unidiff) | |
tree | cee19bfcf7c8d6a24cd4aaf578bd64b38b2d0ee4 /libopie/pim/otodoaccesssql.cpp | |
parent | fd500184450e37c239e573adf1c12a6ff62b65f6 (diff) | |
download | opie-34e86ddf4f9b1045a5b730beab2d8d72e2dd4d56.zip opie-34e86ddf4f9b1045a5b730beab2d8d72e2dd4d56.tar.gz opie-34e86ddf4f9b1045a5b730beab2d8d72e2dd4d56.tar.bz2 |
Added first experimental incarnation of sql-backend for addressbook.
Some modifications to be able to compile the todo sql-backend.
A lot of changes fill follow...
Diffstat (limited to 'libopie/pim/otodoaccesssql.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/otodoaccesssql.cpp | 73 |
1 files changed, 63 insertions, 10 deletions
diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp index ec9c14c..23e0c3e 100644 --- a/libopie/pim/otodoaccesssql.cpp +++ b/libopie/pim/otodoaccesssql.cpp | |||
@@ -3,10 +3,10 @@ | |||
3 | 3 | ||
4 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
5 | 5 | ||
6 | #include <opie/osqldriver.h> | 6 | #include <opie2/osqldriver.h> |
7 | #include <opie/osqlresult.h> | 7 | #include <opie2/osqlresult.h> |
8 | #include <opie/osqlmanager.h> | 8 | #include <opie2/osqlmanager.h> |
9 | #include <opie/osqlquery.h> | 9 | #include <opie2/osqlquery.h> |
10 | 10 | ||
11 | #include "otodoaccesssql.h" | 11 | #include "otodoaccesssql.h" |
12 | 12 | ||
@@ -249,7 +249,7 @@ OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file ) | |||
249 | OSQLManager man; | 249 | OSQLManager man; |
250 | m_driver = man.standard(); | 250 | m_driver = man.standard(); |
251 | m_driver->setUrl(fi); | 251 | m_driver->setUrl(fi); |
252 | fillDict(); | 252 | // fillDict(); |
253 | } | 253 | } |
254 | 254 | ||
255 | OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){ | 255 | OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){ |
@@ -297,7 +297,7 @@ OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, | |||
297 | // we try to cache CACHE items | 297 | // we try to cache CACHE items |
298 | switch( dir ) { | 298 | switch( dir ) { |
299 | /* forward */ | 299 | /* forward */ |
300 | case 0: | 300 | case 0: // FIXME: Not a good style to use magic numbers here (eilers) |
301 | for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { | 301 | for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { |
302 | qWarning("size %d %d", size, ints[i] ); | 302 | qWarning("size %d %d", size, ints[i] ); |
303 | search[size] = ints[i]; | 303 | search[size] = ints[i]; |
@@ -305,7 +305,7 @@ OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, | |||
305 | } | 305 | } |
306 | break; | 306 | break; |
307 | /* reverse */ | 307 | /* reverse */ |
308 | case 1: | 308 | case 1: // FIXME: Not a good style to use magic numbers here (eilers) |
309 | for (uint i = cur; i != 0 && size < CACHE; i-- ) { | 309 | for (uint i = cur; i != 0 && size < CACHE; i-- ) { |
310 | search[size] = ints[i]; | 310 | search[size] = ints[i]; |
311 | size++; | 311 | size++; |
@@ -381,6 +381,7 @@ QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, | |||
381 | /* | 381 | /* |
382 | * Sort Filter stuff | 382 | * Sort Filter stuff |
383 | * not that straight forward | 383 | * not that straight forward |
384 | * FIXME: Replace magic numbers | ||
384 | * | 385 | * |
385 | */ | 386 | */ |
386 | /* Category */ | 387 | /* Category */ |
@@ -492,6 +493,7 @@ void OTodoAccessBackendSQL::fillDict() { | |||
492 | /* initialize dict */ | 493 | /* initialize dict */ |
493 | /* | 494 | /* |
494 | * UPDATE dict if you change anything!!! | 495 | * UPDATE dict if you change anything!!! |
496 | * FIXME: Isn't this dict obsolete ? (eilers) | ||
495 | */ | 497 | */ |
496 | m_dict.setAutoDelete( TRUE ); | 498 | m_dict.setAutoDelete( TRUE ); |
497 | m_dict.insert("Categories" , new int(OTodo::Category) ); | 499 | m_dict.insert("Categories" , new int(OTodo::Category) ); |
@@ -505,10 +507,10 @@ void OTodoAccessBackendSQL::fillDict() { | |||
505 | m_dict.insert("DateMonth" , new int(OTodo::DateMonth) ); | 507 | m_dict.insert("DateMonth" , new int(OTodo::DateMonth) ); |
506 | m_dict.insert("DateYear" , new int(OTodo::DateYear) ); | 508 | m_dict.insert("DateYear" , new int(OTodo::DateYear) ); |
507 | m_dict.insert("Progress" , new int(OTodo::Progress) ); | 509 | m_dict.insert("Progress" , new int(OTodo::Progress) ); |
508 | m_dict.insert("Completed", new int(OTodo::Completed) ); | 510 | m_dict.insert("Completed", new int(OTodo::Completed) ); // Why twice ? (eilers) |
509 | m_dict.insert("CrossReference", new int(OTodo::CrossReference) ); | 511 | m_dict.insert("CrossReference", new int(OTodo::CrossReference) ); |
510 | m_dict.insert("HasAlarmDateTime",new int(OTodo::HasAlarmDateTime) ); | 512 | // m_dict.insert("HasAlarmDateTime",new int(OTodo::HasAlarmDateTime) ); // old stuff (eilers) |
511 | m_dict.insert("AlarmDateTime", new int(OTodo::AlarmDateTime) ); | 513 | // m_dict.insert("AlarmDateTime", new int(OTodo::AlarmDateTime) ); // old stuff (eilers) |
512 | } | 514 | } |
513 | /* | 515 | /* |
514 | * need to be const so let's fool the | 516 | * need to be const so let's fool the |
@@ -538,3 +540,54 @@ QArray<int> OTodoAccessBackendSQL::uids( const OSQLResult& res) const{ | |||
538 | return ints; | 540 | return ints; |
539 | } | 541 | } |
540 | 542 | ||
543 | QArray<int> OTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const | ||
544 | { | ||
545 | |||
546 | #warning OTodoAccessBackendSQL::matchRegexp() not implemented !! | ||
547 | |||
548 | #if 0 | ||
549 | |||
550 | Copied from xml-backend by not adapted to sql (eilers) | ||
551 | |||
552 | QArray<int> m_currentQuery( m_events.count() ); | ||
553 | uint arraycounter = 0; | ||
554 | |||
555 | |||
556 | |||
557 | QMap<int, OTodo>::ConstIterator it; | ||
558 | for (it = m_events.begin(); it != m_events.end(); ++it ) { | ||
559 | if ( it.data().match( r ) ) | ||
560 | m_currentQuery[arraycounter++] = it.data().uid(); | ||
561 | |||
562 | } | ||
563 | // Shrink to fit.. | ||
564 | m_currentQuery.resize(arraycounter); | ||
565 | |||
566 | return m_currentQuery; | ||
567 | #endif | ||
568 | QArray<int> empty; | ||
569 | return empty; | ||
570 | } | ||
571 | QBitArray OTodoAccessBackendSQL::supports()const { | ||
572 | |||
573 | static QBitArray ar = sup(); | ||
574 | return ar; | ||
575 | } | ||
576 | |||
577 | QBitArray OTodoAccessBackendSQL::sup() { | ||
578 | |||
579 | QBitArray ar( OTodo::CompletedDate + 1 ); | ||
580 | ar.fill( true ); | ||
581 | ar[OTodo::CrossReference] = false; | ||
582 | ar[OTodo::State ] = false; | ||
583 | ar[OTodo::Reminders] = false; | ||
584 | ar[OTodo::Notifiers] = false; | ||
585 | ar[OTodo::Maintainer] = false; | ||
586 | |||
587 | return ar; | ||
588 | } | ||
589 | |||
590 | void OTodoAccessBackendSQL::removeAllCompleted(){ | ||
591 | #warning OTodoAccessBackendSQL::removeAllCompleted() not implemented !! | ||
592 | |||
593 | } | ||