-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 6f65c48..12a8bea 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp @@ -458,4 +458,6 @@ OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{ } + +// Remember: uid is already in the list of uids, called ints ! OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, uint cur, Frontend::CacheDirection dir ) const{ @@ -469,5 +471,5 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, switch( dir ) { /* forward */ - case 0: // FIXME: Not a good style to use magic numbers here (eilers) + case Frontend::Forward: for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { odebug << "size " << size << " " << ints[i] << "" << oendl; @@ -477,5 +479,5 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, break; /* reverse */ - case 1: // FIXME: Not a good style to use magic numbers here (eilers) + case Frontend::Reverse: for (uint i = cur; i != 0 && size < CACHE; i-- ) { search[size] = ints[i]; @@ -484,4 +486,5 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, break; } + search.resize( size ); FindQuery query( search ); @@ -490,6 +493,8 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, return to; - return todo( res ); + todo( res ); //FIXME: Don't like polymorphism here. It makes the code hard to read here..(eilers) + return cacheFind( uid ); } + void OPimTodoAccessBackendSQL::clear() { ClearQuery cle; |