Diffstat (limited to 'libopie2/opiepim/backend/otodoaccesssql.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 944f82a..72232e5 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp | |||
@@ -41,3 +41,3 @@ | |||
41 | #include <opie2/opimnotifymanager.h> | 41 | #include <opie2/opimnotifymanager.h> |
42 | #include <opie2/orecur.h> | 42 | #include <opie2/opimrecurrence.h> |
43 | 43 | ||
@@ -75,3 +75,3 @@ namespace { | |||
75 | /** | 75 | /** |
76 | * inserts/adds a OTodo to the table | 76 | * inserts/adds a OPimTodo to the table |
77 | */ | 77 | */ |
@@ -79,3 +79,3 @@ namespace { | |||
79 | public: | 79 | public: |
80 | InsertQuery(const OTodo& ); | 80 | InsertQuery(const OPimTodo& ); |
81 | ~InsertQuery(); | 81 | ~InsertQuery(); |
@@ -83,3 +83,3 @@ namespace { | |||
83 | private: | 83 | private: |
84 | OTodo m_todo; | 84 | OPimTodo m_todo; |
85 | }; | 85 | }; |
@@ -154,3 +154,3 @@ namespace { | |||
154 | qu += "description, summary, priority, DueDate, progress , state, "; | 154 | qu += "description, summary, priority, DueDate, progress , state, "; |
155 | // This is the recurrance-stuff .. Exceptions are currently not supported (see ORecur.cpp) ! (eilers) | 155 | // This is the recurrance-stuff .. Exceptions are currently not supported (see OPimRecurrence.cpp) ! (eilers) |
156 | qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; | 156 | qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; |
@@ -172,3 +172,3 @@ namespace { | |||
172 | 172 | ||
173 | InsertQuery::InsertQuery( const OTodo& todo ) | 173 | InsertQuery::InsertQuery( const OPimTodo& todo ) |
174 | : OSQLQuery(), m_todo( todo ) { | 174 | : OSQLQuery(), m_todo( todo ) { |
@@ -178,3 +178,3 @@ namespace { | |||
178 | /* | 178 | /* |
179 | * converts from a OTodo to a query | 179 | * converts from a OPimTodo to a query |
180 | * we leave out X-Ref + Alarms | 180 | * we leave out X-Ref + Alarms |
@@ -220,10 +220,10 @@ namespace { | |||
220 | + QString::number( m_todo.state().state() ) + "," | 220 | + QString::number( m_todo.state().state() ) + "," |
221 | + "'" + recMap[ ORecur::RType ] + "'" + "," | 221 | + "'" + recMap[ OPimRecurrence::RType ] + "'" + "," |
222 | + "'" + recMap[ ORecur::RWeekdays ] + "'" + "," | 222 | + "'" + recMap[ OPimRecurrence::RWeekdays ] + "'" + "," |
223 | + "'" + recMap[ ORecur::RPosition ] + "'" + "," | 223 | + "'" + recMap[ OPimRecurrence::RPosition ] + "'" + "," |
224 | + "'" + recMap[ ORecur::RFreq ] + "'" + "," | 224 | + "'" + recMap[ OPimRecurrence::RFreq ] + "'" + "," |
225 | + "'" + recMap[ ORecur::RHasEndDate ] + "'" + "," | 225 | + "'" + recMap[ OPimRecurrence::RHasEndDate ] + "'" + "," |
226 | + "'" + recMap[ ORecur::EndDate ] + "'" + "," | 226 | + "'" + recMap[ OPimRecurrence::EndDate ] + "'" + "," |
227 | + "'" + recMap[ ORecur::Created ] + "'" + "," | 227 | + "'" + recMap[ OPimRecurrence::Created ] + "'" + "," |
228 | + "'" + recMap[ ORecur::Exceptions ] + "'" + ","; | 228 | + "'" + recMap[ OPimRecurrence::Exceptions ] + "'" + ","; |
229 | 229 | ||
@@ -331,4 +331,4 @@ namespace { | |||
331 | namespace Opie { | 331 | namespace Opie { |
332 | OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file ) | 332 | OPimTodoAccessBackendSQL::OPimTodoAccessBackendSQL( const QString& file ) |
333 | : OTodoAccessBackend(), m_dict(15), m_driver(NULL), m_dirty(true) | 333 | : OPimTodoAccessBackend(), m_dict(15), m_driver(NULL), m_dirty(true) |
334 | { | 334 | { |
@@ -343,3 +343,3 @@ OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file ) | |||
343 | 343 | ||
344 | OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){ | 344 | OPimTodoAccessBackendSQL::~OPimTodoAccessBackendSQL(){ |
345 | if( m_driver ) | 345 | if( m_driver ) |
@@ -348,3 +348,3 @@ OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){ | |||
348 | 348 | ||
349 | bool OTodoAccessBackendSQL::load(){ | 349 | bool OPimTodoAccessBackendSQL::load(){ |
350 | if (!m_driver->open() ) | 350 | if (!m_driver->open() ) |
@@ -358,3 +358,3 @@ bool OTodoAccessBackendSQL::load(){ | |||
358 | } | 358 | } |
359 | bool OTodoAccessBackendSQL::reload(){ | 359 | bool OPimTodoAccessBackendSQL::reload(){ |
360 | return load(); | 360 | return load(); |
@@ -362,6 +362,6 @@ bool OTodoAccessBackendSQL::reload(){ | |||
362 | 362 | ||
363 | bool OTodoAccessBackendSQL::save(){ | 363 | bool OPimTodoAccessBackendSQL::save(){ |
364 | return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) | 364 | return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) |
365 | } | 365 | } |
366 | QArray<int> OTodoAccessBackendSQL::allRecords()const { | 366 | QArray<int> OPimTodoAccessBackendSQL::allRecords()const { |
367 | if (m_dirty ) | 367 | if (m_dirty ) |
@@ -371,3 +371,3 @@ QArray<int> OTodoAccessBackendSQL::allRecords()const { | |||
371 | } | 371 | } |
372 | QArray<int> OTodoAccessBackendSQL::queryByExample( const OTodo& , int, const QDateTime& ){ | 372 | QArray<int> OPimTodoAccessBackendSQL::queryByExample( const OPimTodo& , int, const QDateTime& ){ |
373 | QArray<int> ints(0); | 373 | QArray<int> ints(0); |
@@ -375,3 +375,3 @@ QArray<int> OTodoAccessBackendSQL::queryByExample( const OTodo& , int, const QDa | |||
375 | } | 375 | } |
376 | OTodo OTodoAccessBackendSQL::find(int uid ) const{ | 376 | OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{ |
377 | FindQuery query( uid ); | 377 | FindQuery query( uid ); |
@@ -380,3 +380,3 @@ OTodo OTodoAccessBackendSQL::find(int uid ) const{ | |||
380 | } | 380 | } |
381 | OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, | 381 | OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, |
382 | uint cur, Frontend::CacheDirection dir ) const{ | 382 | uint cur, Frontend::CacheDirection dir ) const{ |
@@ -386,3 +386,3 @@ OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, | |||
386 | uint size =0; | 386 | uint size =0; |
387 | OTodo to; | 387 | OPimTodo to; |
388 | 388 | ||
@@ -414,3 +414,3 @@ OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, | |||
414 | } | 414 | } |
415 | void OTodoAccessBackendSQL::clear() { | 415 | void OPimTodoAccessBackendSQL::clear() { |
416 | ClearQuery cle; | 416 | ClearQuery cle; |
@@ -420,3 +420,3 @@ void OTodoAccessBackendSQL::clear() { | |||
420 | } | 420 | } |
421 | bool OTodoAccessBackendSQL::add( const OTodo& t) { | 421 | bool OPimTodoAccessBackendSQL::add( const OPimTodo& t) { |
422 | InsertQuery ins( t ); | 422 | InsertQuery ins( t ); |
@@ -432,3 +432,3 @@ bool OTodoAccessBackendSQL::add( const OTodo& t) { | |||
432 | } | 432 | } |
433 | bool OTodoAccessBackendSQL::remove( int uid ) { | 433 | bool OPimTodoAccessBackendSQL::remove( int uid ) { |
434 | RemoveQuery rem( uid ); | 434 | RemoveQuery rem( uid ); |
@@ -447,3 +447,3 @@ bool OTodoAccessBackendSQL::remove( int uid ) { | |||
447 | */ | 447 | */ |
448 | bool OTodoAccessBackendSQL::replace( const OTodo& t) { | 448 | bool OPimTodoAccessBackendSQL::replace( const OPimTodo& t) { |
449 | remove( t.uid() ); | 449 | remove( t.uid() ); |
@@ -453,3 +453,3 @@ bool OTodoAccessBackendSQL::replace( const OTodo& t) { | |||
453 | } | 453 | } |
454 | QArray<int> OTodoAccessBackendSQL::overDue() { | 454 | QArray<int> OPimTodoAccessBackendSQL::overDue() { |
455 | OverDueQuery qu; | 455 | OverDueQuery qu; |
@@ -457,3 +457,3 @@ QArray<int> OTodoAccessBackendSQL::overDue() { | |||
457 | } | 457 | } |
458 | QArray<int> OTodoAccessBackendSQL::effectiveToDos( const QDate& s, | 458 | QArray<int> OPimTodoAccessBackendSQL::effectiveToDos( const QDate& s, |
459 | const QDate& t, | 459 | const QDate& t, |
@@ -466,3 +466,3 @@ QArray<int> OTodoAccessBackendSQL::effectiveToDos( const QDate& s, | |||
466 | */ | 466 | */ |
467 | QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, | 467 | QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, |
468 | int sortFilter, int cat ) { | 468 | int sortFilter, int cat ) { |
@@ -532,3 +532,3 @@ QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, | |||
532 | } | 532 | } |
533 | bool OTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ | 533 | bool OPimTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ |
534 | if ( str == "0-0-0" ) | 534 | if ( str == "0-0-0" ) |
@@ -545,5 +545,5 @@ bool OTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ | |||
545 | } | 545 | } |
546 | OTodo OTodoAccessBackendSQL::todo( const OSQLResult& res) const{ | 546 | OPimTodo OPimTodoAccessBackendSQL::todo( const OSQLResult& res) const{ |
547 | if ( res.state() == OSQLResult::Failure ) { | 547 | if ( res.state() == OSQLResult::Failure ) { |
548 | OTodo to; | 548 | OPimTodo to; |
549 | return to; | 549 | return to; |
@@ -554,3 +554,3 @@ OTodo OTodoAccessBackendSQL::todo( const OSQLResult& res) const{ | |||
554 | qWarning("todo1"); | 554 | qWarning("todo1"); |
555 | OTodo to = todo( (*it) ); | 555 | OPimTodo to = todo( (*it) ); |
556 | cache( to ); | 556 | cache( to ); |
@@ -564,3 +564,3 @@ OTodo OTodoAccessBackendSQL::todo( const OSQLResult& res) const{ | |||
564 | } | 564 | } |
565 | OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | 565 | OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { |
566 | qWarning("todo"); | 566 | qWarning("todo"); |
@@ -572,3 +572,3 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
572 | 572 | ||
573 | OTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), | 573 | OPimTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), |
574 | cats, item.data("summary"), item.data("description"), | 574 | cats, item.data("summary"), item.data("description"), |
@@ -601,12 +601,12 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
601 | QMap<int, QString> recMap; | 601 | QMap<int, QString> recMap; |
602 | recMap.insert( ORecur::RType , item.data("RType") ); | 602 | recMap.insert( OPimRecurrence::RType , item.data("RType") ); |
603 | recMap.insert( ORecur::RWeekdays , item.data("RWeekdays") ); | 603 | recMap.insert( OPimRecurrence::RWeekdays , item.data("RWeekdays") ); |
604 | recMap.insert( ORecur::RPosition , item.data("RPosition") ); | 604 | recMap.insert( OPimRecurrence::RPosition , item.data("RPosition") ); |
605 | recMap.insert( ORecur::RFreq , item.data("RFreq") ); | 605 | recMap.insert( OPimRecurrence::RFreq , item.data("RFreq") ); |
606 | recMap.insert( ORecur::RHasEndDate, item.data("RHasEndDate") ); | 606 | recMap.insert( OPimRecurrence::RHasEndDate, item.data("RHasEndDate") ); |
607 | recMap.insert( ORecur::EndDate , item.data("EndDate") ); | 607 | recMap.insert( OPimRecurrence::EndDate , item.data("EndDate") ); |
608 | recMap.insert( ORecur::Created , item.data("Created") ); | 608 | recMap.insert( OPimRecurrence::Created , item.data("Created") ); |
609 | recMap.insert( ORecur::Exceptions , item.data("Exceptions") ); | 609 | recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") ); |
610 | 610 | ||
611 | ORecur recur; | 611 | OPimRecurrence recur; |
612 | recur.fromMap( recMap ); | 612 | recur.fromMap( recMap ); |
@@ -616,3 +616,3 @@ OTodo OTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | |||
616 | } | 616 | } |
617 | OTodo OTodoAccessBackendSQL::todo( int uid )const { | 617 | OPimTodo OPimTodoAccessBackendSQL::todo( int uid )const { |
618 | FindQuery find( uid ); | 618 | FindQuery find( uid ); |
@@ -623,3 +623,3 @@ OTodo OTodoAccessBackendSQL::todo( int uid )const { | |||
623 | */ | 623 | */ |
624 | void OTodoAccessBackendSQL::fillDict() { | 624 | void OPimTodoAccessBackendSQL::fillDict() { |
625 | /* initialize dict */ | 625 | /* initialize dict */ |
@@ -630,17 +630,17 @@ void OTodoAccessBackendSQL::fillDict() { | |||
630 | m_dict.setAutoDelete( TRUE ); | 630 | m_dict.setAutoDelete( TRUE ); |
631 | m_dict.insert("Categories" , new int(OTodo::Category) ); | 631 | m_dict.insert("Categories" , new int(OPimTodo::Category) ); |
632 | m_dict.insert("Uid" , new int(OTodo::Uid) ); | 632 | m_dict.insert("Uid" , new int(OPimTodo::Uid) ); |
633 | m_dict.insert("HasDate" , new int(OTodo::HasDate) ); | 633 | m_dict.insert("HasDate" , new int(OPimTodo::HasDate) ); |
634 | m_dict.insert("Completed" , new int(OTodo::Completed) ); | 634 | m_dict.insert("Completed" , new int(OPimTodo::Completed) ); |
635 | m_dict.insert("Description" , new int(OTodo::Description) ); | 635 | m_dict.insert("Description" , new int(OPimTodo::Description) ); |
636 | m_dict.insert("Summary" , new int(OTodo::Summary) ); | 636 | m_dict.insert("Summary" , new int(OPimTodo::Summary) ); |
637 | m_dict.insert("Priority" , new int(OTodo::Priority) ); | 637 | m_dict.insert("Priority" , new int(OPimTodo::Priority) ); |
638 | m_dict.insert("DateDay" , new int(OTodo::DateDay) ); | 638 | m_dict.insert("DateDay" , new int(OPimTodo::DateDay) ); |
639 | m_dict.insert("DateMonth" , new int(OTodo::DateMonth) ); | 639 | m_dict.insert("DateMonth" , new int(OPimTodo::DateMonth) ); |
640 | m_dict.insert("DateYear" , new int(OTodo::DateYear) ); | 640 | m_dict.insert("DateYear" , new int(OPimTodo::DateYear) ); |
641 | m_dict.insert("Progress" , new int(OTodo::Progress) ); | 641 | m_dict.insert("Progress" , new int(OPimTodo::Progress) ); |
642 | m_dict.insert("Completed", new int(OTodo::Completed) ); // Why twice ? (eilers) | 642 | m_dict.insert("Completed", new int(OPimTodo::Completed) ); // Why twice ? (eilers) |
643 | m_dict.insert("CrossReference", new int(OTodo::CrossReference) ); | 643 | m_dict.insert("CrossReference", new int(OPimTodo::CrossReference) ); |
644 | // m_dict.insert("HasAlarmDateTime",new int(OTodo::HasAlarmDateTime) ); // old stuff (eilers) | 644 | // m_dict.insert("HasAlarmDateTime",new int(OPimTodo::HasAlarmDateTime) ); // old stuff (eilers) |
645 | // m_dict.insert("AlarmDateTime", new int(OTodo::AlarmDateTime) ); // old stuff (eilers) | 645 | // m_dict.insert("AlarmDateTime", new int(OPimTodo::AlarmDateTime) ); // old stuff (eilers) |
646 | } | 646 | } |
@@ -650,4 +650,4 @@ void OTodoAccessBackendSQL::fillDict() { | |||
650 | */ | 650 | */ |
651 | void OTodoAccessBackendSQL::update()const { | 651 | void OPimTodoAccessBackendSQL::update()const { |
652 | ((OTodoAccessBackendSQL*)this)->m_dirty = false; | 652 | ((OPimTodoAccessBackendSQL*)this)->m_dirty = false; |
653 | LoadQuery lo; | 653 | LoadQuery lo; |
@@ -657,5 +657,5 @@ void OTodoAccessBackendSQL::update()const { | |||
657 | 657 | ||
658 | ((OTodoAccessBackendSQL*)this)->m_uids = uids( res ); | 658 | ((OPimTodoAccessBackendSQL*)this)->m_uids = uids( res ); |
659 | } | 659 | } |
660 | QArray<int> OTodoAccessBackendSQL::uids( const OSQLResult& res) const{ | 660 | QArray<int> OPimTodoAccessBackendSQL::uids( const OSQLResult& res) const{ |
661 | 661 | ||
@@ -674,6 +674,6 @@ QArray<int> OTodoAccessBackendSQL::uids( const OSQLResult& res) const{ | |||
674 | 674 | ||
675 | QArray<int> OTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const | 675 | QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const |
676 | { | 676 | { |
677 | 677 | ||
678 | #warning OTodoAccessBackendSQL::matchRegexp() not implemented !! | 678 | #warning OPimTodoAccessBackendSQL::matchRegexp() not implemented !! |
679 | 679 | ||
@@ -688,3 +688,3 @@ QArray<int> OTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const | |||
688 | 688 | ||
689 | QMap<int, OTodo>::ConstIterator it; | 689 | QMap<int, OPimTodo>::ConstIterator it; |
690 | for (it = m_events.begin(); it != m_events.end(); ++it ) { | 690 | for (it = m_events.begin(); it != m_events.end(); ++it ) { |
@@ -702,3 +702,3 @@ QArray<int> OTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const | |||
702 | } | 702 | } |
703 | QBitArray OTodoAccessBackendSQL::supports()const { | 703 | QBitArray OPimTodoAccessBackendSQL::supports()const { |
704 | 704 | ||
@@ -707,11 +707,11 @@ QBitArray OTodoAccessBackendSQL::supports()const { | |||
707 | 707 | ||
708 | QBitArray OTodoAccessBackendSQL::sup() const{ | 708 | QBitArray OPimTodoAccessBackendSQL::sup() const{ |
709 | 709 | ||
710 | QBitArray ar( OTodo::CompletedDate + 1 ); | 710 | QBitArray ar( OPimTodo::CompletedDate + 1 ); |
711 | ar.fill( true ); | 711 | ar.fill( true ); |
712 | ar[OTodo::CrossReference] = false; | 712 | ar[OPimTodo::CrossReference] = false; |
713 | ar[OTodo::State ] = false; | 713 | ar[OPimTodo::State ] = false; |
714 | ar[OTodo::Reminders] = false; | 714 | ar[OPimTodo::Reminders] = false; |
715 | ar[OTodo::Notifiers] = false; | 715 | ar[OPimTodo::Notifiers] = false; |
716 | ar[OTodo::Maintainer] = false; | 716 | ar[OPimTodo::Maintainer] = false; |
717 | 717 | ||
@@ -720,4 +720,4 @@ QBitArray OTodoAccessBackendSQL::sup() const{ | |||
720 | 720 | ||
721 | void OTodoAccessBackendSQL::removeAllCompleted(){ | 721 | void OPimTodoAccessBackendSQL::removeAllCompleted(){ |
722 | #warning OTodoAccessBackendSQL::removeAllCompleted() not implemented !! | 722 | #warning OPimTodoAccessBackendSQL::removeAllCompleted() not implemented !! |
723 | 723 | ||