summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/otodoaccessbackend.cpp
authoreilers <eilers>2004-12-28 14:19:26 (UTC)
committer eilers <eilers>2004-12-28 14:19:26 (UTC)
commit47c87c92a46f56bc9190025e7a653fa48718431e (patch) (side-by-side diff)
tree2c8d87f8a8132d6b59d56cdb35762a479515b1d1 /libopie2/opiepim/backend/otodoaccessbackend.cpp
parent521e3eed02205bca9baca9000ac7ff095a15abde (diff)
downloadopie-47c87c92a46f56bc9190025e7a653fa48718431e.zip
opie-47c87c92a46f56bc9190025e7a653fa48718431e.tar.gz
opie-47c87c92a46f56bc9190025e7a653fa48718431e.tar.bz2
Fixing bug #1501 and preparing for implementation of generic QueryByExample and
sorted for datebook and todo..
Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessbackend.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.cpp b/libopie2/opiepim/backend/otodoaccessbackend.cpp
index 5f86be9..f979976 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.cpp
+++ b/libopie2/opiepim/backend/otodoaccessbackend.cpp
@@ -1,95 +1,121 @@
/*
This file is part of the Opie Project
Copyright (C) The Main Author <main-author@whereever.org>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/otodoaccessbackend.h>
#include <opie2/private/opimtodosortvector.h>
#include <opie2/otodoaccess.h>
#include <qintdict.h>
namespace Opie {
OPimTodoAccessBackend::OPimTodoAccessBackend()
: OPimAccessBackend<OPimTodo>()
{
}
OPimTodoAccessBackend::~OPimTodoAccessBackend() {
}
-UIDArray OPimTodoAccessBackend::queryByExample( const OPimTodo&, int settings,
- const QDateTime& d)const {
+const uint OPimTodoAccessBackend::querySettings() const
+{
+ return 0;
+}
+
+bool OPimTodoAccessBackend::hasQuerySettings (uint querySettings) const
+{
+ return false;
+}
+
+
+UIDArray OPimTodoAccessBackend::queryByExample( const UIDArray& uidlist, const OPimTodo& query, int settings,
+ const QDateTime& endperiod )const
+{
+ qDebug( "Accessing OPimTodoAccessBackend::queryByExample() which is not implemented!" );
return UIDArray();
+
+// odebug << "Using Unaccelerated OPimContactAccessBackend implementation of queryByExample!" << oendl;
+
+// UIDArray m_currentQuery( uid_array.count() );
+// uint arraycounter = 0;
+
+// for( uint it = 0; it < uid_array.count(); ++it ){
+// /* Search all fields and compare them with query object. Store them into list
+// * if all fields matches.
+// */
+// }
+
+
}
UIDArray OPimTodoAccessBackend::sorted( const UIDArray& events, bool asc,
int sortOrder, int sortFilter,
const QArray<int>& categories )const {
odebug << "Using Unaccelerated TodoList sorted Implementation" << oendl;
Internal::OPimTodoSortVector vector(events.count(), asc,sortOrder );
int item = 0;
bool bCat = sortFilter & OPimTodoAccess::FilterCategory ? true : false;
bool bOnly = sortFilter & OPimTodoAccess::OnlyOverDue ? true : false;
bool comp = sortFilter & OPimTodoAccess::DoNotShowCompleted ? true : false;
bool catPassed = false;
int cat;
for ( uint i = 0; i < events.count(); ++i ) {
OPimTodo todo = find( events[i], events, i, Frontend::Forward );
if ( todo.isEmpty() )
continue;
/* show category */
/* -1 == unfiled */
catPassed = false;
for ( uint cat_nu = 0; cat_nu < categories.count(); ++cat_nu ) {
cat = categories[cat_nu];
if ( bCat && cat == -1 ) {
if(!todo.categories().isEmpty() )
continue;
} else if ( bCat && cat != 0)
if (!todo.categories().contains( cat ) )
continue;
catPassed = true;
break;
}
/*
* If none of the Categories matched
* continue
*/
if ( !catPassed )
continue;
if ( !todo.isOverdue() && bOnly )
continue;
if (todo.isCompleted() && comp )
continue;
vector.insert(item++, todo );
}