summaryrefslogtreecommitdiff
path: root/noncore/unsupported/libopie/pim/otodoaccesssql.h
Unidiff
Diffstat (limited to 'noncore/unsupported/libopie/pim/otodoaccesssql.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/libopie/pim/otodoaccesssql.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/noncore/unsupported/libopie/pim/otodoaccesssql.h b/noncore/unsupported/libopie/pim/otodoaccesssql.h
new file mode 100644
index 0000000..72214de
--- a/dev/null
+++ b/noncore/unsupported/libopie/pim/otodoaccesssql.h
@@ -0,0 +1,61 @@
1#ifndef OPIE_PIM_ACCESS_SQL_H
2#define OPIE_PIM_ACCESS_SQL_H
3
4#include <qasciidict.h>
5
6#include "otodoaccessbackend.h"
7
8namespace Opie{
9namespace DB {
10class OSQLDriver;
11class OSQLResult;
12class OSQLResultItem;
13}
14}
15
16class OTodoAccessBackendSQL : public OTodoAccessBackend {
17public:
18 OTodoAccessBackendSQL( const QString& file );
19 ~OTodoAccessBackendSQL();
20
21 bool load();
22 bool reload();
23 bool save();
24 QArray<int> allRecords()const;
25
26 QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() );
27 OTodo find(int uid)const;
28 OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const;
29 void clear();
30 bool add( const OTodo& t );
31 bool remove( int uid );
32 bool replace( const OTodo& t );
33
34 QArray<int> overDue();
35 QArray<int> effectiveToDos( const QDate& start,
36 const QDate& end, bool includeNoDates );
37 QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat );
38
39 QBitArray supports()const;
40 QArray<int> matchRegexp( const QRegExp &r ) const;
41 void removeAllCompleted();
42
43
44private:
45 void update()const;
46 void fillDict();
47 inline bool date( QDate& date, const QString& )const;
48 inline OTodo todo( const Opie::DB::OSQLResult& )const;
49 inline OTodo todo( Opie::DB::OSQLResultItem& )const;
50 inline QArray<int> uids( const Opie::DB::OSQLResult& )const;
51 OTodo todo( int uid )const;
52 QBitArray sup() const;
53
54 QAsciiDict<int> m_dict;
55 Opie::DB::OSQLDriver* m_driver;
56 QArray<int> m_uids;
57 bool m_dirty : 1;
58};
59
60
61#endif