Diffstat (limited to 'libopie2/opiepim/core/otodoaccess.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index 37f6fbc..2a3695d 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp | |||
@@ -1,62 +1,93 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
1 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
2 | 30 | ||
3 | #include <qpe/alarmserver.h> | 31 | #include <qpe/alarmserver.h> |
4 | 32 | ||
5 | // #include "otodoaccesssql.h" | 33 | // #include "otodoaccesssql.h" |
6 | #include "otodoaccess.h" | 34 | #include <opie2/otodoaccess.h> |
7 | #include "obackendfactory.h" | 35 | #include <opie2/obackendfactory.h> |
8 | 36 | ||
37 | namespace Opie { | ||
9 | OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access ) | 38 | OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access ) |
10 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) | 39 | : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) |
11 | { | 40 | { |
12 | // if (end == 0l ) | 41 | // if (end == 0l ) |
13 | // m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); | 42 | // m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); |
14 | 43 | ||
15 | // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben ! | 44 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! |
16 | if (end == 0l ) | 45 | if (end == 0l ) |
17 | m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); | 46 | m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); |
18 | 47 | ||
19 | setBackEnd( m_todoBackEnd ); | 48 | setBackEnd( m_todoBackEnd ); |
20 | } | 49 | } |
21 | OTodoAccess::~OTodoAccess() { | 50 | OTodoAccess::~OTodoAccess() { |
22 | // qWarning("~OTodoAccess"); | 51 | // qWarning("~OTodoAccess"); |
23 | } | 52 | } |
24 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { | 53 | void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { |
25 | QValueList<OTodo>::ConstIterator it; | 54 | QValueList<OTodo>::ConstIterator it; |
26 | for ( it = list.begin(); it != list.end(); ++it ) { | 55 | for ( it = list.begin(); it != list.end(); ++it ) { |
27 | replace( (*it) ); | 56 | replace( (*it) ); |
28 | } | 57 | } |
29 | } | 58 | } |
30 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, | 59 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, |
31 | const QDate& end, | 60 | const QDate& end, |
32 | bool includeNoDates ) { | 61 | bool includeNoDates ) { |
33 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); | 62 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); |
34 | 63 | ||
35 | List lis( ints, this ); | 64 | List lis( ints, this ); |
36 | return lis; | 65 | return lis; |
37 | } | 66 | } |
38 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, | 67 | OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, |
39 | bool includeNoDates ) { | 68 | bool includeNoDates ) { |
40 | return effectiveToDos( start, QDate::currentDate(), | 69 | return effectiveToDos( start, QDate::currentDate(), |
41 | includeNoDates ); | 70 | includeNoDates ); |
42 | } | 71 | } |
43 | OTodoAccess::List OTodoAccess::overDue() { | 72 | OTodoAccess::List OTodoAccess::overDue() { |
44 | List lis( m_todoBackEnd->overDue(), this ); | 73 | List lis( m_todoBackEnd->overDue(), this ); |
45 | return lis; | 74 | return lis; |
46 | } | 75 | } |
47 | /* sort order */ | 76 | /* sort order */ |
48 | OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) { | 77 | OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) { |
49 | QArray<int> ints = m_todoBackEnd->sorted( ascending, sort, | 78 | QArray<int> ints = m_todoBackEnd->sorted( ascending, sort, |
50 | filter, cat ); | 79 | filter, cat ); |
51 | OTodoAccess::List list( ints, this ); | 80 | OTodoAccess::List list( ints, this ); |
52 | return list; | 81 | return list; |
53 | } | 82 | } |
54 | void OTodoAccess::removeAllCompleted() { | 83 | void OTodoAccess::removeAllCompleted() { |
55 | m_todoBackEnd->removeAllCompleted(); | 84 | m_todoBackEnd->removeAllCompleted(); |
56 | } | 85 | } |
57 | QBitArray OTodoAccess::backendSupport( const QString& ) const{ | 86 | QBitArray OTodoAccess::backendSupport( const QString& ) const{ |
58 | return m_todoBackEnd->supports(); | 87 | return m_todoBackEnd->supports(); |
59 | } | 88 | } |
60 | bool OTodoAccess::backendSupports( int attr, const QString& ar) const{ | 89 | bool OTodoAccess::backendSupports( int attr, const QString& ar) const{ |
61 | return backendSupport(ar).testBit( attr ); | 90 | return backendSupport(ar).testBit( attr ); |
62 | } | 91 | } |
92 | |||
93 | } | ||