Diffstat (limited to 'libopie2/opiepim/backend/otodoaccesssql.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h index 1c55567..1a6f614 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.h +++ b/libopie2/opiepim/backend/otodoaccesssql.h | |||
@@ -1,56 +1,88 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | ||
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 | #ifndef OPIE_PIM_ACCESS_SQL_H | 29 | #ifndef OPIE_PIM_ACCESS_SQL_H |
2 | #define OPIE_PIM_ACCESS_SQL_H | 30 | #define OPIE_PIM_ACCESS_SQL_H |
3 | 31 | ||
4 | #include <qasciidict.h> | 32 | #include <qasciidict.h> |
5 | 33 | ||
6 | #include "otodoaccessbackend.h" | 34 | #include <opie2/otodoaccessbackend.h> |
7 | 35 | ||
8 | class OSQLDriver; | 36 | class OSQLDriver; |
9 | class OSQLResult; | 37 | class OSQLResult; |
10 | class OSQLResultItem; | 38 | class OSQLResultItem; |
39 | |||
40 | namespace Opie { | ||
41 | |||
11 | class OTodoAccessBackendSQL : public OTodoAccessBackend { | 42 | class OTodoAccessBackendSQL : public OTodoAccessBackend { |
12 | public: | 43 | public: |
13 | OTodoAccessBackendSQL( const QString& file ); | 44 | OTodoAccessBackendSQL( const QString& file ); |
14 | ~OTodoAccessBackendSQL(); | 45 | ~OTodoAccessBackendSQL(); |
15 | 46 | ||
16 | bool load(); | 47 | bool load(); |
17 | bool reload(); | 48 | bool reload(); |
18 | bool save(); | 49 | bool save(); |
19 | QArray<int> allRecords()const; | 50 | QArray<int> allRecords()const; |
20 | 51 | ||
21 | QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() ); | 52 | QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() ); |
22 | OTodo find(int uid)const; | 53 | OTodo find(int uid)const; |
23 | OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; | 54 | OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; |
24 | void clear(); | 55 | void clear(); |
25 | bool add( const OTodo& t ); | 56 | bool add( const OTodo& t ); |
26 | bool remove( int uid ); | 57 | bool remove( int uid ); |
27 | bool replace( const OTodo& t ); | 58 | bool replace( const OTodo& t ); |
28 | 59 | ||
29 | QArray<int> overDue(); | 60 | QArray<int> overDue(); |
30 | QArray<int> effectiveToDos( const QDate& start, | 61 | QArray<int> effectiveToDos( const QDate& start, |
31 | const QDate& end, bool includeNoDates ); | 62 | const QDate& end, bool includeNoDates ); |
32 | QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); | 63 | QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); |
33 | 64 | ||
34 | QBitArray supports()const; | 65 | QBitArray supports()const; |
35 | QArray<int> matchRegexp( const QRegExp &r ) const; | 66 | QArray<int> matchRegexp( const QRegExp &r ) const; |
36 | void removeAllCompleted(); | 67 | void removeAllCompleted(); |
37 | 68 | ||
38 | 69 | ||
39 | private: | 70 | private: |
40 | void update()const; | 71 | void update()const; |
41 | void fillDict(); | 72 | void fillDict(); |
42 | inline bool date( QDate& date, const QString& )const; | 73 | inline bool date( QDate& date, const QString& )const; |
43 | inline OTodo todo( const OSQLResult& )const; | 74 | inline OTodo todo( const OSQLResult& )const; |
44 | inline OTodo todo( OSQLResultItem& )const; | 75 | inline OTodo todo( OSQLResultItem& )const; |
45 | inline QArray<int> uids( const OSQLResult& )const; | 76 | inline QArray<int> uids( const OSQLResult& )const; |
46 | OTodo todo( int uid )const; | 77 | OTodo todo( int uid )const; |
47 | QBitArray sup() const; | 78 | QBitArray sup() const; |
48 | 79 | ||
49 | QAsciiDict<int> m_dict; | 80 | QAsciiDict<int> m_dict; |
50 | OSQLDriver* m_driver; | 81 | OSQLDriver* m_driver; |
51 | QArray<int> m_uids; | 82 | QArray<int> m_uids; |
52 | bool m_dirty : 1; | 83 | bool m_dirty : 1; |
53 | }; | 84 | }; |
54 | 85 | ||
86 | } | ||
55 | 87 | ||
56 | #endif | 88 | #endif |