Diffstat (limited to 'libopie2/opiepim/backend/otodoaccesssql.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 12a8bea..4e3e47b 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp | |||
@@ -409,136 +409,135 @@ namespace { | |||
409 | 409 | ||
410 | namespace Opie { | 410 | namespace Opie { |
411 | OPimTodoAccessBackendSQL::OPimTodoAccessBackendSQL( const QString& file ) | 411 | OPimTodoAccessBackendSQL::OPimTodoAccessBackendSQL( const QString& file ) |
412 | : OPimTodoAccessBackend(),/* m_dict(15),*/ m_driver(NULL), m_dirty(true) | 412 | : OPimTodoAccessBackend(),/* m_dict(15),*/ m_driver(NULL), m_dirty(true) |
413 | { | 413 | { |
414 | QString fi = file; | 414 | QString fi = file; |
415 | if ( fi.isEmpty() ) | 415 | if ( fi.isEmpty() ) |
416 | fi = Global::applicationFileName( "todolist", "todolist.db" ); | 416 | fi = Global::applicationFileName( "todolist", "todolist.db" ); |
417 | OSQLManager man; | 417 | OSQLManager man; |
418 | m_driver = man.standard(); | 418 | m_driver = man.standard(); |
419 | m_driver->setUrl(fi); | 419 | m_driver->setUrl(fi); |
420 | // fillDict(); | 420 | // fillDict(); |
421 | } | 421 | } |
422 | 422 | ||
423 | OPimTodoAccessBackendSQL::~OPimTodoAccessBackendSQL(){ | 423 | OPimTodoAccessBackendSQL::~OPimTodoAccessBackendSQL(){ |
424 | if( m_driver ) | 424 | if( m_driver ) |
425 | delete m_driver; | 425 | delete m_driver; |
426 | } | 426 | } |
427 | 427 | ||
428 | bool OPimTodoAccessBackendSQL::load(){ | 428 | bool OPimTodoAccessBackendSQL::load(){ |
429 | if (!m_driver->open() ) | 429 | if (!m_driver->open() ) |
430 | return false; | 430 | return false; |
431 | 431 | ||
432 | CreateQuery creat; | 432 | CreateQuery creat; |
433 | OSQLResult res = m_driver->query(&creat ); | 433 | OSQLResult res = m_driver->query(&creat ); |
434 | 434 | ||
435 | m_dirty = true; | 435 | m_dirty = true; |
436 | return true; | 436 | return true; |
437 | } | 437 | } |
438 | bool OPimTodoAccessBackendSQL::reload(){ | 438 | bool OPimTodoAccessBackendSQL::reload(){ |
439 | return load(); | 439 | return load(); |
440 | } | 440 | } |
441 | 441 | ||
442 | bool OPimTodoAccessBackendSQL::save(){ | 442 | bool OPimTodoAccessBackendSQL::save(){ |
443 | return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) | 443 | return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) |
444 | } | 444 | } |
445 | QArray<int> OPimTodoAccessBackendSQL::allRecords()const { | 445 | QArray<int> OPimTodoAccessBackendSQL::allRecords()const { |
446 | if (m_dirty ) | 446 | if (m_dirty ) |
447 | update(); | 447 | update(); |
448 | 448 | ||
449 | return m_uids; | 449 | return m_uids; |
450 | } | 450 | } |
451 | QArray<int> OPimTodoAccessBackendSQL::queryByExample( const OPimTodo& , int, const QDateTime& ){ | 451 | QArray<int> OPimTodoAccessBackendSQL::queryByExample( const OPimTodo& , int, const QDateTime& ){ |
452 | QArray<int> ints(0); | 452 | QArray<int> ints(0); |
453 | return ints; | 453 | return ints; |
454 | } | 454 | } |
455 | OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{ | 455 | OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{ |
456 | FindQuery query( uid ); | 456 | FindQuery query( uid ); |
457 | return todo( m_driver->query(&query) ); | 457 | return parseResultAndCache( uid, m_driver->query(&query) ); |
458 | 458 | ||
459 | } | 459 | } |
460 | 460 | ||
461 | // Remember: uid is already in the list of uids, called ints ! | 461 | // Remember: uid is already in the list of uids, called ints ! |
462 | OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, | 462 | OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, |
463 | uint cur, Frontend::CacheDirection dir ) const{ | 463 | uint cur, Frontend::CacheDirection dir ) const{ |
464 | uint CACHE = readAhead(); | 464 | uint CACHE = readAhead(); |
465 | odebug << "searching for " << uid << "" << oendl; | 465 | odebug << "searching for " << uid << "" << oendl; |
466 | QArray<int> search( CACHE ); | 466 | QArray<int> search( CACHE ); |
467 | uint size =0; | 467 | uint size =0; |
468 | OPimTodo to; | 468 | OPimTodo to; |
469 | 469 | ||
470 | // we try to cache CACHE items | 470 | // we try to cache CACHE items |
471 | switch( dir ) { | 471 | switch( dir ) { |
472 | /* forward */ | 472 | /* forward */ |
473 | case Frontend::Forward: | 473 | case Frontend::Forward: |
474 | for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { | 474 | for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { |
475 | odebug << "size " << size << " " << ints[i] << "" << oendl; | 475 | odebug << "size " << size << " " << ints[i] << "" << oendl; |
476 | search[size] = ints[i]; | 476 | search[size] = ints[i]; |
477 | size++; | 477 | size++; |
478 | } | 478 | } |
479 | break; | 479 | break; |
480 | /* reverse */ | 480 | /* reverse */ |
481 | case Frontend::Reverse: | 481 | case Frontend::Reverse: |
482 | for (uint i = cur; i != 0 && size < CACHE; i-- ) { | 482 | for (uint i = cur; i != 0 && size < CACHE; i-- ) { |
483 | search[size] = ints[i]; | 483 | search[size] = ints[i]; |
484 | size++; | 484 | size++; |
485 | } | 485 | } |
486 | break; | 486 | break; |
487 | } | 487 | } |
488 | 488 | ||
489 | search.resize( size ); | 489 | search.resize( size ); |
490 | FindQuery query( search ); | 490 | FindQuery query( search ); |
491 | OSQLResult res = m_driver->query( &query ); | 491 | OSQLResult res = m_driver->query( &query ); |
492 | if ( res.state() != OSQLResult::Success ) | 492 | if ( res.state() != OSQLResult::Success ) |
493 | return to; | 493 | return to; |
494 | 494 | ||
495 | todo( res ); //FIXME: Don't like polymorphism here. It makes the code hard to read here..(eilers) | 495 | return parseResultAndCache( uid, res ); |
496 | return cacheFind( uid ); | ||
497 | } | 496 | } |
498 | 497 | ||
499 | void OPimTodoAccessBackendSQL::clear() { | 498 | void OPimTodoAccessBackendSQL::clear() { |
500 | ClearQuery cle; | 499 | ClearQuery cle; |
501 | OSQLResult res = m_driver->query( &cle ); | 500 | OSQLResult res = m_driver->query( &cle ); |
502 | CreateQuery qu; | 501 | CreateQuery qu; |
503 | res = m_driver->query(&qu); | 502 | res = m_driver->query(&qu); |
504 | } | 503 | } |
505 | bool OPimTodoAccessBackendSQL::add( const OPimTodo& t) { | 504 | bool OPimTodoAccessBackendSQL::add( const OPimTodo& t) { |
506 | InsertQuery ins( t ); | 505 | InsertQuery ins( t ); |
507 | OSQLResult res = m_driver->query( &ins ); | 506 | OSQLResult res = m_driver->query( &ins ); |
508 | 507 | ||
509 | if ( res.state() == OSQLResult::Failure ) | 508 | if ( res.state() == OSQLResult::Failure ) |
510 | return false; | 509 | return false; |
511 | int c = m_uids.count(); | 510 | int c = m_uids.count(); |
512 | m_uids.resize( c+1 ); | 511 | m_uids.resize( c+1 ); |
513 | m_uids[c] = t.uid(); | 512 | m_uids[c] = t.uid(); |
514 | 513 | ||
515 | return true; | 514 | return true; |
516 | } | 515 | } |
517 | bool OPimTodoAccessBackendSQL::remove( int uid ) { | 516 | bool OPimTodoAccessBackendSQL::remove( int uid ) { |
518 | RemoveQuery rem( uid ); | 517 | RemoveQuery rem( uid ); |
519 | OSQLResult res = m_driver->query(&rem ); | 518 | OSQLResult res = m_driver->query(&rem ); |
520 | 519 | ||
521 | if ( res.state() == OSQLResult::Failure ) | 520 | if ( res.state() == OSQLResult::Failure ) |
522 | return false; | 521 | return false; |
523 | 522 | ||
524 | m_dirty = true; | 523 | m_dirty = true; |
525 | return true; | 524 | return true; |
526 | } | 525 | } |
527 | /* | 526 | /* |
528 | * FIXME better set query | 527 | * FIXME better set query |
529 | * but we need the cache for that | 528 | * but we need the cache for that |
530 | * now we remove | 529 | * now we remove |
531 | */ | 530 | */ |
532 | bool OPimTodoAccessBackendSQL::replace( const OPimTodo& t) { | 531 | bool OPimTodoAccessBackendSQL::replace( const OPimTodo& t) { |
533 | remove( t.uid() ); | 532 | remove( t.uid() ); |
534 | bool b= add(t); | 533 | bool b= add(t); |
535 | m_dirty = false; // we changed some stuff but the UID stayed the same | 534 | m_dirty = false; // we changed some stuff but the UID stayed the same |
536 | return b; | 535 | return b; |
537 | } | 536 | } |
538 | QArray<int> OPimTodoAccessBackendSQL::overDue() { | 537 | QArray<int> OPimTodoAccessBackendSQL::overDue() { |
539 | OverDueQuery qu; | 538 | OverDueQuery qu; |
540 | return uids( m_driver->query(&qu ) ); | 539 | return uids( m_driver->query(&qu ) ); |
541 | } | 540 | } |
542 | QArray<int> OPimTodoAccessBackendSQL::effectiveToDos( const QDate& s, | 541 | QArray<int> OPimTodoAccessBackendSQL::effectiveToDos( const QDate& s, |
543 | const QDate& t, | 542 | const QDate& t, |
544 | bool u) { | 543 | bool u) { |
@@ -585,176 +584,183 @@ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, | |||
585 | } | 584 | } |
586 | /* strip the end */ | 585 | /* strip the end */ |
587 | query = query.remove( query.length()-3, 3 ); | 586 | query = query.remove( query.length()-3, 3 ); |
588 | 587 | ||
589 | 588 | ||
590 | /* | 589 | /* |
591 | * sort order stuff | 590 | * sort order stuff |
592 | * quite straight forward | 591 | * quite straight forward |
593 | */ | 592 | */ |
594 | query += "ORDER BY "; | 593 | query += "ORDER BY "; |
595 | switch( sortOrder ) { | 594 | switch( sortOrder ) { |
596 | /* completed */ | 595 | /* completed */ |
597 | case 0: | 596 | case 0: |
598 | query += "completed"; | 597 | query += "completed"; |
599 | break; | 598 | break; |
600 | case 1: | 599 | case 1: |
601 | query += "priority"; | 600 | query += "priority"; |
602 | break; | 601 | break; |
603 | case 2: | 602 | case 2: |
604 | query += "summary"; | 603 | query += "summary"; |
605 | break; | 604 | break; |
606 | case 3: | 605 | case 3: |
607 | query += "DueDate"; | 606 | query += "DueDate"; |
608 | break; | 607 | break; |
609 | } | 608 | } |
610 | 609 | ||
611 | if ( !asc ) { | 610 | if ( !asc ) { |
612 | odebug << "not ascending!" << oendl; | 611 | odebug << "not ascending!" << oendl; |
613 | query += " DESC"; | 612 | query += " DESC"; |
614 | } | 613 | } |
615 | 614 | ||
616 | odebug << query << oendl; | 615 | odebug << query << oendl; |
617 | OSQLRawQuery raw(query ); | 616 | OSQLRawQuery raw(query ); |
618 | return uids( m_driver->query(&raw) ); | 617 | return uids( m_driver->query(&raw) ); |
619 | } | 618 | } |
620 | bool OPimTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ | 619 | bool OPimTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ |
621 | if ( str == "0-0-0" ) | 620 | if ( str == "0-0-0" ) |
622 | return false; | 621 | return false; |
623 | else{ | 622 | else{ |
624 | int day, year, month; | 623 | int day, year, month; |
625 | QStringList list = QStringList::split("-", str ); | 624 | QStringList list = QStringList::split("-", str ); |
626 | year = list[0].toInt(); | 625 | year = list[0].toInt(); |
627 | month = list[1].toInt(); | 626 | month = list[1].toInt(); |
628 | day = list[2].toInt(); | 627 | day = list[2].toInt(); |
629 | da.setYMD( year, month, day ); | 628 | da.setYMD( year, month, day ); |
630 | return true; | 629 | return true; |
631 | } | 630 | } |
632 | } | 631 | } |
633 | OPimTodo OPimTodoAccessBackendSQL::todo( const OSQLResult& res ) const{ | 632 | OPimTodo OPimTodoAccessBackendSQL::parseResultAndCache( int uid, const OSQLResult& res ) const{ |
634 | if ( res.state() == OSQLResult::Failure ) { | 633 | if ( res.state() == OSQLResult::Failure ) { |
635 | OPimTodo to; | 634 | OPimTodo to; |
636 | return to; | 635 | return to; |
637 | } | 636 | } |
638 | 637 | ||
638 | OPimTodo retTodo; | ||
639 | |||
639 | OSQLResultItem::ValueList list = res.results(); | 640 | OSQLResultItem::ValueList list = res.results(); |
640 | OSQLResultItem::ValueList::Iterator it = list.begin(); | 641 | OSQLResultItem::ValueList::Iterator it = list.begin(); |
641 | odebug << "todo1" << oendl; | 642 | odebug << "todo1" << oendl; |
642 | OPimTodo to = todo( (*it) ); | 643 | OPimTodo to = todo( (*it) ); |
643 | cache( to ); | 644 | cache( to ); |
644 | ++it; | 645 | ++it; |
645 | 646 | ||
646 | for ( ; it != list.end(); ++it ) { | 647 | for ( ; it != list.end(); ++it ) { |
647 | odebug << "caching" << oendl; | 648 | odebug << "caching" << oendl; |
648 | cache( todo( (*it) ) ); | 649 | OPimTodo newTodo = todo( (*it) ); |
650 | cache( newTodo ); | ||
651 | if ( newTodo.uid() == uid ) | ||
652 | retTodo = newTodo; | ||
649 | } | 653 | } |
650 | return to; | 654 | return retTodo; |
651 | } | 655 | } |
652 | OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { | 656 | OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { |
653 | odebug << "todo(ResultItem)" << oendl; | 657 | odebug << "todo(ResultItem)" << oendl; |
654 | 658 | ||
655 | // Request information from addressbook table and create the OPimTodo-object. | 659 | // Request information from addressbook table and create the OPimTodo-object. |
656 | 660 | ||
657 | bool hasDueDate = false; QDate dueDate = QDate::currentDate(); | 661 | bool hasDueDate = false; QDate dueDate = QDate::currentDate(); |
658 | hasDueDate = date( dueDate, item.data("DueDate") ); | 662 | hasDueDate = date( dueDate, item.data("DueDate") ); |
659 | QStringList cats = QStringList::split(";", item.data("categories") ); | 663 | QStringList cats = QStringList::split(";", item.data("categories") ); |
660 | 664 | ||
661 | odebug << "Item is completed: " << item.data("completed").toInt() << "" << oendl; | 665 | odebug << "Item is completed: " << item.data("completed").toInt() << "" << oendl; |
662 | 666 | ||
663 | OPimTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), | 667 | OPimTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), |
664 | cats, item.data("summary"), item.data("description"), | 668 | cats, item.data("summary"), item.data("description"), |
665 | item.data("progress").toUShort(), hasDueDate, dueDate, | 669 | item.data("progress").toUShort(), hasDueDate, dueDate, |
666 | item.data("uid").toInt() ); | 670 | item.data("uid").toInt() ); |
667 | 671 | ||
668 | bool isOk; | 672 | bool isOk; |
669 | int prioInt = QString( item.data("priority") ).toInt( &isOk ); | 673 | int prioInt = QString( item.data("priority") ).toInt( &isOk ); |
670 | if ( isOk ) | 674 | if ( isOk ) |
671 | to.setPriority( prioInt ); | 675 | to.setPriority( prioInt ); |
672 | 676 | ||
673 | bool hasStartDate = false; QDate startDate = QDate::currentDate(); | 677 | bool hasStartDate = false; QDate startDate = QDate::currentDate(); |
674 | hasStartDate = date( startDate, item.data("startdate") ); | 678 | hasStartDate = date( startDate, item.data("startdate") ); |
675 | bool hasCompletedDate = false; QDate completedDate = QDate::currentDate(); | 679 | bool hasCompletedDate = false; QDate completedDate = QDate::currentDate(); |
676 | hasCompletedDate = date( completedDate, item.data("completeddate") ); | 680 | hasCompletedDate = date( completedDate, item.data("completeddate") ); |
677 | 681 | ||
678 | if ( hasStartDate ) | 682 | if ( hasStartDate ) |
679 | to.setStartDate( startDate ); | 683 | to.setStartDate( startDate ); |
680 | if ( hasCompletedDate ) | 684 | if ( hasCompletedDate ) |
681 | to.setCompletedDate( completedDate ); | 685 | to.setCompletedDate( completedDate ); |
682 | 686 | ||
683 | OPimNotifyManager& manager = to.notifiers(); | 687 | OPimNotifyManager& manager = to.notifiers(); |
684 | manager.alarmsFromString( item.data("alarms") ); | 688 | manager.alarmsFromString( item.data("alarms") ); |
685 | manager.remindersFromString( item.data("reminders") ); | 689 | manager.remindersFromString( item.data("reminders") ); |
686 | 690 | ||
687 | OPimState pimState; | 691 | OPimState pimState; |
688 | pimState.setState( QString( item.data("state") ).toInt() ); | 692 | pimState.setState( QString( item.data("state") ).toInt() ); |
689 | to.setState( pimState ); | 693 | to.setState( pimState ); |
690 | 694 | ||
691 | QMap<int, QString> recMap; | 695 | QMap<int, QString> recMap; |
692 | recMap.insert( OPimRecurrence::RType , item.data("RType") ); | 696 | recMap.insert( OPimRecurrence::RType , item.data("RType") ); |
693 | recMap.insert( OPimRecurrence::RWeekdays , item.data("RWeekdays") ); | 697 | recMap.insert( OPimRecurrence::RWeekdays , item.data("RWeekdays") ); |
694 | recMap.insert( OPimRecurrence::RPosition , item.data("RPosition") ); | 698 | recMap.insert( OPimRecurrence::RPosition , item.data("RPosition") ); |
695 | recMap.insert( OPimRecurrence::RFreq , item.data("RFreq") ); | 699 | recMap.insert( OPimRecurrence::RFreq , item.data("RFreq") ); |
696 | recMap.insert( OPimRecurrence::RHasEndDate, item.data("RHasEndDate") ); | 700 | recMap.insert( OPimRecurrence::RHasEndDate, item.data("RHasEndDate") ); |
697 | recMap.insert( OPimRecurrence::EndDate , item.data("EndDate") ); | 701 | recMap.insert( OPimRecurrence::EndDate , item.data("EndDate") ); |
698 | recMap.insert( OPimRecurrence::Created , item.data("Created") ); | 702 | recMap.insert( OPimRecurrence::Created , item.data("Created") ); |
699 | recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") ); | 703 | recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") ); |
700 | 704 | ||
701 | OPimRecurrence recur; | 705 | OPimRecurrence recur; |
702 | recur.fromMap( recMap ); | 706 | recur.fromMap( recMap ); |
703 | to.setRecurrence( recur ); | 707 | to.setRecurrence( recur ); |
704 | 708 | ||
705 | // Finally load the custom-entries for this UID and put it into the created object | 709 | // Finally load the custom-entries for this UID and put it into the created object |
706 | to.setExtraMap( requestCustom( to.uid() ) ); | 710 | to.setExtraMap( requestCustom( to.uid() ) ); |
707 | 711 | ||
708 | return to; | 712 | return to; |
709 | } | 713 | } |
714 | |||
715 | // FIXME: Where is the difference to "find" ? (eilers) | ||
710 | OPimTodo OPimTodoAccessBackendSQL::todo( int uid )const { | 716 | OPimTodo OPimTodoAccessBackendSQL::todo( int uid )const { |
711 | FindQuery find( uid ); | 717 | FindQuery find( uid ); |
712 | return todo( m_driver->query(&find) ); | 718 | return parseResultAndCache( uid, m_driver->query(&find) ); |
713 | } | 719 | } |
714 | /* | 720 | /* |
715 | * update the dict | 721 | * update the dict |
716 | */ | 722 | */ |
717 | void OPimTodoAccessBackendSQL::fillDict() { | 723 | void OPimTodoAccessBackendSQL::fillDict() { |
718 | 724 | ||
719 | #if 0 | 725 | #if 0 |
720 | /* initialize dict */ | 726 | /* initialize dict */ |
721 | /* | 727 | /* |
722 | * UPDATE dict if you change anything!!! | 728 | * UPDATE dict if you change anything!!! |
723 | * FIXME: Isn't this dict obsolete ? (eilers) | 729 | * FIXME: Isn't this dict obsolete ? (eilers) |
724 | */ | 730 | */ |
725 | m_dict.setAutoDelete( TRUE ); | 731 | m_dict.setAutoDelete( TRUE ); |
726 | m_dict.insert("Categories" , new int(OPimTodo::Category) ); | 732 | m_dict.insert("Categories" , new int(OPimTodo::Category) ); |
727 | m_dict.insert("Uid" , new int(OPimTodo::Uid) ); | 733 | m_dict.insert("Uid" , new int(OPimTodo::Uid) ); |
728 | m_dict.insert("HasDate" , new int(OPimTodo::HasDate) ); | 734 | m_dict.insert("HasDate" , new int(OPimTodo::HasDate) ); |
729 | m_dict.insert("Completed" , new int(OPimTodo::Completed) ); | 735 | m_dict.insert("Completed" , new int(OPimTodo::Completed) ); |
730 | m_dict.insert("Description" , new int(OPimTodo::Description) ); | 736 | m_dict.insert("Description" , new int(OPimTodo::Description) ); |
731 | m_dict.insert("Summary" , new int(OPimTodo::Summary) ); | 737 | m_dict.insert("Summary" , new int(OPimTodo::Summary) ); |
732 | m_dict.insert("Priority" , new int(OPimTodo::Priority) ); | 738 | m_dict.insert("Priority" , new int(OPimTodo::Priority) ); |
733 | m_dict.insert("DateDay" , new int(OPimTodo::DateDay) ); | 739 | m_dict.insert("DateDay" , new int(OPimTodo::DateDay) ); |
734 | m_dict.insert("DateMonth" , new int(OPimTodo::DateMonth) ); | 740 | m_dict.insert("DateMonth" , new int(OPimTodo::DateMonth) ); |
735 | m_dict.insert("DateYear" , new int(OPimTodo::DateYear) ); | 741 | m_dict.insert("DateYear" , new int(OPimTodo::DateYear) ); |
736 | m_dict.insert("Progress" , new int(OPimTodo::Progress) ); | 742 | m_dict.insert("Progress" , new int(OPimTodo::Progress) ); |
737 | m_dict.insert("Completed", new int(OPimTodo::Completed) ); // Why twice ? (eilers) | 743 | m_dict.insert("Completed", new int(OPimTodo::Completed) ); // Why twice ? (eilers) |
738 | m_dict.insert("CrossReference", new int(OPimTodo::CrossReference) ); | 744 | m_dict.insert("CrossReference", new int(OPimTodo::CrossReference) ); |
739 | // m_dict.insert("HasAlarmDateTime",new int(OPimTodo::HasAlarmDateTime) ); // old stuff (eilers) | 745 | // m_dict.insert("HasAlarmDateTime",new int(OPimTodo::HasAlarmDateTime) ); // old stuff (eilers) |
740 | // m_dict.insert("AlarmDateTime", new int(OPimTodo::AlarmDateTime) ); // old stuff (eilers) | 746 | // m_dict.insert("AlarmDateTime", new int(OPimTodo::AlarmDateTime) ); // old stuff (eilers) |
741 | 747 | ||
742 | #endif | 748 | #endif |
743 | } | 749 | } |
744 | /* | 750 | /* |
745 | * need to be const so let's fool the | 751 | * need to be const so let's fool the |
746 | * compiler :( | 752 | * compiler :( |
747 | */ | 753 | */ |
748 | void OPimTodoAccessBackendSQL::update()const { | 754 | void OPimTodoAccessBackendSQL::update()const { |
749 | ((OPimTodoAccessBackendSQL*)this)->m_dirty = false; | 755 | ((OPimTodoAccessBackendSQL*)this)->m_dirty = false; |
750 | LoadQuery lo; | 756 | LoadQuery lo; |
751 | OSQLResult res = m_driver->query(&lo); | 757 | OSQLResult res = m_driver->query(&lo); |
752 | if ( res.state() != OSQLResult::Success ) | 758 | if ( res.state() != OSQLResult::Success ) |
753 | return; | 759 | return; |
754 | 760 | ||
755 | ((OPimTodoAccessBackendSQL*)this)->m_uids = uids( res ); | 761 | ((OPimTodoAccessBackendSQL*)this)->m_uids = uids( res ); |
756 | } | 762 | } |
757 | QArray<int> OPimTodoAccessBackendSQL::uids( const OSQLResult& res) const{ | 763 | QArray<int> OPimTodoAccessBackendSQL::uids( const OSQLResult& res) const{ |
758 | 764 | ||
759 | OSQLResultItem::ValueList list = res.results(); | 765 | OSQLResultItem::ValueList list = res.results(); |
760 | OSQLResultItem::ValueList::Iterator it; | 766 | OSQLResultItem::ValueList::Iterator it; |