summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-07 15:26:59 (UTC)
committer zecke <zecke>2003-05-07 15:26:59 (UTC)
commite150dfd5151aa59eb373aa58df5d9644c6c65b52 (patch) (unidiff)
tree4cbc036ef9bfc51d9938d6ff6a433081c0b400b8
parent1a550df3248342a8c863951ba733b862ca222216 (diff)
downloadopie-e150dfd5151aa59eb373aa58df5d9644c6c65b52.zip
opie-e150dfd5151aa59eb373aa58df5d9644c6c65b52.tar.gz
opie-e150dfd5151aa59eb373aa58df5d9644c6c65b52.tar.bz2
Make it possible to see what a backend supports
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccess.cpp6
-rw-r--r--libopie/pim/otodoaccess.h15
-rw-r--r--libopie/pim/otodoaccessbackend.h3
-rw-r--r--libopie/pim/otodoaccessvcal.cpp20
-rw-r--r--libopie/pim/otodoaccessvcal.h2
-rw-r--r--libopie/pim/otodoaccessxml.cpp16
-rw-r--r--libopie/pim/otodoaccessxml.h2
-rw-r--r--libopie2/opiepim/backend/otodoaccessbackend.h3
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp20
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.h2
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp16
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.h2
-rw-r--r--libopie2/opiepim/core/otodoaccess.cpp6
-rw-r--r--libopie2/opiepim/core/otodoaccess.h15
14 files changed, 126 insertions, 2 deletions
diff --git a/libopie/pim/otodoaccess.cpp b/libopie/pim/otodoaccess.cpp
index 5e89a1b..37f6fbc 100644
--- a/libopie/pim/otodoaccess.cpp
+++ b/libopie/pim/otodoaccess.cpp
@@ -9,48 +9,54 @@
9OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access ) 9OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access )
10 : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) 10 : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end )
11{ 11{
12// if (end == 0l ) 12// if (end == 0l )
13// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); 13// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null);
14 14
15 // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben ! 15 // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben !
16 if (end == 0l ) 16 if (end == 0l )
17 m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); 17 m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null);
18 18
19 setBackEnd( m_todoBackEnd ); 19 setBackEnd( m_todoBackEnd );
20} 20}
21OTodoAccess::~OTodoAccess() { 21OTodoAccess::~OTodoAccess() {
22// qWarning("~OTodoAccess"); 22// qWarning("~OTodoAccess");
23} 23}
24void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { 24void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) {
25 QValueList<OTodo>::ConstIterator it; 25 QValueList<OTodo>::ConstIterator it;
26 for ( it = list.begin(); it != list.end(); ++it ) { 26 for ( it = list.begin(); it != list.end(); ++it ) {
27 replace( (*it) ); 27 replace( (*it) );
28 } 28 }
29} 29}
30OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, 30OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
31 const QDate& end, 31 const QDate& end,
32 bool includeNoDates ) { 32 bool includeNoDates ) {
33 QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); 33 QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates );
34 34
35 List lis( ints, this ); 35 List lis( ints, this );
36 return lis; 36 return lis;
37} 37}
38OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, 38OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
39 bool includeNoDates ) { 39 bool includeNoDates ) {
40 return effectiveToDos( start, QDate::currentDate(), 40 return effectiveToDos( start, QDate::currentDate(),
41 includeNoDates ); 41 includeNoDates );
42} 42}
43OTodoAccess::List OTodoAccess::overDue() { 43OTodoAccess::List OTodoAccess::overDue() {
44 List lis( m_todoBackEnd->overDue(), this ); 44 List lis( m_todoBackEnd->overDue(), this );
45 return lis; 45 return lis;
46} 46}
47/* sort order */ 47/* sort order */
48OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) { 48OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) {
49 QArray<int> ints = m_todoBackEnd->sorted( ascending, sort, 49 QArray<int> ints = m_todoBackEnd->sorted( ascending, sort,
50 filter, cat ); 50 filter, cat );
51 OTodoAccess::List list( ints, this ); 51 OTodoAccess::List list( ints, this );
52 return list; 52 return list;
53} 53}
54void OTodoAccess::removeAllCompleted() { 54void OTodoAccess::removeAllCompleted() {
55 m_todoBackEnd->removeAllCompleted(); 55 m_todoBackEnd->removeAllCompleted();
56} 56}
57QBitArray OTodoAccess::backendSupport( const QString& ) const{
58 return m_todoBackEnd->supports();
59}
60bool OTodoAccess::backendSupports( int attr, const QString& ar) const{
61 return backendSupport(ar).testBit( attr );
62}
diff --git a/libopie/pim/otodoaccess.h b/libopie/pim/otodoaccess.h
index a626731..916923f 100644
--- a/libopie/pim/otodoaccess.h
+++ b/libopie/pim/otodoaccess.h
@@ -27,64 +27,79 @@ public:
27 /** 27 /**
28 * if you use 0l 28 * if you use 0l
29 * the default resource will be 29 * the default resource will be
30 * picked up 30 * picked up
31 */ 31 */
32 OTodoAccess( OTodoAccessBackend* = 0l, enum Access acc = Random ); 32 OTodoAccess( OTodoAccessBackend* = 0l, enum Access acc = Random );
33 ~OTodoAccess(); 33 ~OTodoAccess();
34 34
35 35
36 /* our functions here */ 36 /* our functions here */
37 /** 37 /**
38 * include todos from start to end 38 * include todos from start to end
39 * includeNoDates whether or not to include 39 * includeNoDates whether or not to include
40 * events with no dates 40 * events with no dates
41 */ 41 */
42 List effectiveToDos( const QDate& start, 42 List effectiveToDos( const QDate& start,
43 const QDate& end, 43 const QDate& end,
44 bool includeNoDates = true ); 44 bool includeNoDates = true );
45 45
46 /** 46 /**
47 * start 47 * start
48 * end date taken from the currentDate() 48 * end date taken from the currentDate()
49 */ 49 */
50 List effectiveToDos( const QDate& start, 50 List effectiveToDos( const QDate& start,
51 bool includeNoDates = true ); 51 bool includeNoDates = true );
52 52
53 53
54 /** 54 /**
55 * return overdue OTodos 55 * return overdue OTodos
56 */ 56 */
57 List overDue(); 57 List overDue();
58 58
59 /** 59 /**
60 * 60 *
61 */ 61 */
62 List sorted( bool ascending, int sortOrder, int sortFilter, int cat ); 62 List sorted( bool ascending, int sortOrder, int sortFilter, int cat );
63 63
64 /** 64 /**
65 * merge a list of OTodos into 65 * merge a list of OTodos into
66 * the resource 66 * the resource
67 */ 67 */
68 void mergeWith( const QValueList<OTodo>& ); 68 void mergeWith( const QValueList<OTodo>& );
69 69
70 /** 70 /**
71 * delete all already completed items 71 * delete all already completed items
72 */ 72 */
73 void removeAllCompleted(); 73 void removeAllCompleted();
74 74
75 /**
76 * request information about what a backend supports.
77 * Supports in the sense of beeing able to store.
78 * This is related to the enum in OTodo
79 *
80 * @param backend Will be used in the future when we support multiple backend
81 */
82 QBitArray backendSupport( const QString& backend = QString::null )const;
83
84 /**
85 * see above but for a specefic attribute. This method was added for convience
86 * @param attr The attribute to be queried for
87 * @param backend Will be used in the future when we support multiple backends
88 */
89 bool backendSupports( int attr, const QString& backend = QString::null )const;
75signals: 90signals:
76 /** 91 /**
77 * if the OTodoAccess was changed 92 * if the OTodoAccess was changed
78 */ 93 */
79 void changed( const OTodoAccess* ); 94 void changed( const OTodoAccess* );
80 void changed( const OTodoAccess*, int uid ); 95 void changed( const OTodoAccess*, int uid );
81 void added( const OTodoAccess*, int uid ); 96 void added( const OTodoAccess*, int uid );
82 void removed( const OTodoAccess*, int uid ); 97 void removed( const OTodoAccess*, int uid );
83private: 98private:
84 int m_cat; 99 int m_cat;
85 OTodoAccessBackend* m_todoBackEnd; 100 OTodoAccessBackend* m_todoBackEnd;
86 class OTodoAccessPrivate; 101 class OTodoAccessPrivate;
87 OTodoAccessPrivate* d; 102 OTodoAccessPrivate* d;
88}; 103};
89 104
90#endif 105#endif
diff --git a/libopie/pim/otodoaccessbackend.h b/libopie/pim/otodoaccessbackend.h
index 7944a2c..05e8ca9 100644
--- a/libopie/pim/otodoaccessbackend.h
+++ b/libopie/pim/otodoaccessbackend.h
@@ -1,21 +1,24 @@
1#ifndef OPIE_TODO_ACCESS_BACKEND_H 1#ifndef OPIE_TODO_ACCESS_BACKEND_H
2#define OPIE_TODO_ACCESS_BACKEND_H 2#define OPIE_TODO_ACCESS_BACKEND_H
3 3
4#include <qbitarray.h>
5
4#include "otodo.h" 6#include "otodo.h"
5#include "opimaccessbackend.h" 7#include "opimaccessbackend.h"
6 8
7class OTodoAccessBackend : public OPimAccessBackend<OTodo> { 9class OTodoAccessBackend : public OPimAccessBackend<OTodo> {
8public: 10public:
9 OTodoAccessBackend(); 11 OTodoAccessBackend();
10 ~OTodoAccessBackend(); 12 ~OTodoAccessBackend();
11 virtual QArray<int> effectiveToDos( const QDate& start, 13 virtual QArray<int> effectiveToDos( const QDate& start,
12 const QDate& end, 14 const QDate& end,
13 bool includeNoDates ) = 0; 15 bool includeNoDates ) = 0;
14 virtual QArray<int> overDue() = 0; 16 virtual QArray<int> overDue() = 0;
15 virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, 17 virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
16 int cat ) = 0; 18 int cat ) = 0;
17 virtual void removeAllCompleted() = 0; 19 virtual void removeAllCompleted() = 0;
20 virtual QBitArray supports()const = 0;
18 21
19}; 22};
20 23
21#endif 24#endif
diff --git a/libopie/pim/otodoaccessvcal.cpp b/libopie/pim/otodoaccessvcal.cpp
index 2136283..9bc16c6 100644
--- a/libopie/pim/otodoaccessvcal.cpp
+++ b/libopie/pim/otodoaccessvcal.cpp
@@ -154,48 +154,68 @@ bool OTodoAccessVCal::add( const OTodo& to ) {
154} 154}
155bool OTodoAccessVCal::remove( int uid ) { 155bool OTodoAccessVCal::remove( int uid ) {
156 m_map.remove( uid ); 156 m_map.remove( uid );
157 m_dirty = true; 157 m_dirty = true;
158 return true; 158 return true;
159} 159}
160void OTodoAccessVCal::removeAllCompleted() { 160void OTodoAccessVCal::removeAllCompleted() {
161 for ( QMap<int, OTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) { 161 for ( QMap<int, OTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) {
162 if ( (*it).isCompleted() ) 162 if ( (*it).isCompleted() )
163 m_map.remove( it ); 163 m_map.remove( it );
164 } 164 }
165} 165}
166bool OTodoAccessVCal::replace( const OTodo& to ) { 166bool OTodoAccessVCal::replace( const OTodo& to ) {
167 m_map.replace( to.uid(), to ); 167 m_map.replace( to.uid(), to );
168 m_dirty = true; 168 m_dirty = true;
169 return true; 169 return true;
170} 170}
171OTodo OTodoAccessVCal::find(int uid )const { 171OTodo OTodoAccessVCal::find(int uid )const {
172 return m_map[uid]; 172 return m_map[uid];
173} 173}
174QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) { 174QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) {
175 QArray<int> ar(0); 175 QArray<int> ar(0);
176 return ar; 176 return ar;
177} 177}
178QArray<int> OTodoAccessVCal::allRecords()const { 178QArray<int> OTodoAccessVCal::allRecords()const {
179 QArray<int> ar( m_map.count() ); 179 QArray<int> ar( m_map.count() );
180 QMap<int, OTodo>::ConstIterator it; 180 QMap<int, OTodo>::ConstIterator it;
181 int i = 0; 181 int i = 0;
182 for ( it = m_map.begin(); it != m_map.end(); ++it ) { 182 for ( it = m_map.begin(); it != m_map.end(); ++it ) {
183 ar[i] = it.key(); 183 ar[i] = it.key();
184 i++; 184 i++;
185 } 185 }
186 return ar; 186 return ar;
187} 187}
188QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { 188QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) {
189 QArray<int> ar(0); 189 QArray<int> ar(0);
190 return ar; 190 return ar;
191} 191}
192QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& , 192QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
193 const QDate& , 193 const QDate& ,
194 bool ) { 194 bool ) {
195 QArray<int> ar(0); 195 QArray<int> ar(0);
196 return ar; 196 return ar;
197} 197}
198QArray<int> OTodoAccessVCal::overDue() { 198QArray<int> OTodoAccessVCal::overDue() {
199 QArray<int> ar(0); 199 QArray<int> ar(0);
200 return ar; 200 return ar;
201} 201}
202QBitArray OTodoAccessVCal::supports()const {
203 static QBitArray ar = sup();
204
205 return ar;
206}
207QBitArray OTodoAccessVCal::sup() {
208 QBitArray ar ( OTodo::CompletedDate +1 );
209 ar.fill( true );
210
211 ar[OTodo::CrossReference] = false;
212 ar[OTodo::State ] = false;
213 ar[OTodo::Reminders] = false;
214 ar[OTodo::Notifiers] = false;
215 ar[OTodo::Maintainer] = false;
216 ar[OTodo::Progress] = false;
217 ar[OTodo::Alarms ] = false;
218 ar[OTodo::Recurrence] = false;
219
220 return ar;
221}
diff --git a/libopie/pim/otodoaccessvcal.h b/libopie/pim/otodoaccessvcal.h
index a90ee9c..489416b 100644
--- a/libopie/pim/otodoaccessvcal.h
+++ b/libopie/pim/otodoaccessvcal.h
@@ -1,37 +1,39 @@
1#ifndef OPIE_OTODO_ACCESS_VCAL_H 1#ifndef OPIE_OTODO_ACCESS_VCAL_H
2#define OPIE_OTODO_ACCESS_VCAL_H 2#define OPIE_OTODO_ACCESS_VCAL_H
3 3
4#include "otodoaccessbackend.h" 4#include "otodoaccessbackend.h"
5 5
6class OTodoAccessVCal : public OTodoAccessBackend { 6class OTodoAccessVCal : public OTodoAccessBackend {
7public: 7public:
8 OTodoAccessVCal(const QString& ); 8 OTodoAccessVCal(const QString& );
9 ~OTodoAccessVCal(); 9 ~OTodoAccessVCal();
10 10
11 bool load(); 11 bool load();
12 bool reload(); 12 bool reload();
13 bool save(); 13 bool save();
14 14
15 QArray<int> allRecords()const; 15 QArray<int> allRecords()const;
16 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() ); 16 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() );
17 QArray<int> effectiveToDos( const QDate& start, 17 QArray<int> effectiveToDos( const QDate& start,
18 const QDate& end, 18 const QDate& end,
19 bool includeNoDates ); 19 bool includeNoDates );
20 QArray<int> overDue(); 20 QArray<int> overDue();
21 QArray<int> sorted( bool asc, int sortOrder, int sortFilter, 21 QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
22 int cat ); 22 int cat );
23 OTodo find(int uid)const; 23 OTodo find(int uid)const;
24 void clear(); 24 void clear();
25 bool add( const OTodo& ); 25 bool add( const OTodo& );
26 bool remove( int uid ); 26 bool remove( int uid );
27 bool replace( const OTodo& ); 27 bool replace( const OTodo& );
28 28
29 void removeAllCompleted(); 29 void removeAllCompleted();
30 virtual QBitArray supports()const;
30 31
31private: 32private:
33 static QBitArray sup();
32 bool m_dirty : 1; 34 bool m_dirty : 1;
33 QString m_file; 35 QString m_file;
34 QMap<int, OTodo> m_map; 36 QMap<int, OTodo> m_map;
35}; 37};
36 38
37#endif 39#endif
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 71e8787..55f268b 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -619,57 +619,71 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
619 int sortFilter, int cat ) { 619 int sortFilter, int cat ) {
620 qWarning("sorted! %d cat", cat); 620 qWarning("sorted! %d cat", cat);
621 OTodoXMLVector vector(m_events.count(), asc,sortOrder ); 621 OTodoXMLVector vector(m_events.count(), asc,sortOrder );
622 QMap<int, OTodo>::Iterator it; 622 QMap<int, OTodo>::Iterator it;
623 int item = 0; 623 int item = 0;
624 624
625 bool bCat = sortFilter & 1 ? true : false; 625 bool bCat = sortFilter & 1 ? true : false;
626 bool bOnly = sortFilter & 2 ? true : false; 626 bool bOnly = sortFilter & 2 ? true : false;
627 bool comp = sortFilter & 4 ? true : false; 627 bool comp = sortFilter & 4 ? true : false;
628 for ( it = m_events.begin(); it != m_events.end(); ++it ) { 628 for ( it = m_events.begin(); it != m_events.end(); ++it ) {
629 629
630 /* show category */ 630 /* show category */
631 if ( bCat && cat != 0) 631 if ( bCat && cat != 0)
632 if (!(*it).categories().contains( cat ) ) { 632 if (!(*it).categories().contains( cat ) ) {
633 qWarning("category mis match"); 633 qWarning("category mis match");
634 continue; 634 continue;
635 } 635 }
636 /* isOverdue but we should not show overdue - why?*/ 636 /* isOverdue but we should not show overdue - why?*/
637/* if ( (*it).isOverdue() && !bOnly ) { 637/* if ( (*it).isOverdue() && !bOnly ) {
638 qWarning("item is overdue but !bOnly"); 638 qWarning("item is overdue but !bOnly");
639 continue; 639 continue;
640 } 640 }
641*/ 641*/
642 if ( !(*it).isOverdue() && bOnly ) { 642 if ( !(*it).isOverdue() && bOnly ) {
643 qWarning("item is not overdue but bOnly checked"); 643 qWarning("item is not overdue but bOnly checked");
644 continue; 644 continue;
645 } 645 }
646 646
647 if ((*it).isCompleted() && comp ) { 647 if ((*it).isCompleted() && comp ) {
648 qWarning("completed continue!"); 648 qWarning("completed continue!");
649 continue; 649 continue;
650 } 650 }
651 651
652 652
653 OTodoXMLContainer* con = new OTodoXMLContainer(); 653 OTodoXMLContainer* con = new OTodoXMLContainer();
654 con->todo = (*it); 654 con->todo = (*it);
655 vector.insert(item, con ); 655 vector.insert(item, con );
656 item++; 656 item++;
657 } 657 }
658 qWarning("XXX %d Items added", item); 658 qWarning("XXX %d Items added", item);
659 vector.resize( item ); 659 vector.resize( item );
660 /* sort it now */ 660 /* sort it now */
661 vector.sort(); 661 vector.sort();
662 /* now get the uids */ 662 /* now get the uids */
663 QArray<int> array( vector.count() ); 663 QArray<int> array( vector.count() );
664 for (uint i= 0; i < vector.count(); i++ ) { 664 for (uint i= 0; i < vector.count(); i++ ) {
665 array[i] = ( vector.at(i) )->todo.uid(); 665 array[i] = ( vector.at(i) )->todo.uid();
666 } 666 }
667 qWarning("array count = %d %d", array.count(), vector.count() );
668 return array; 667 return array;
669}; 668};
670void OTodoAccessXML::removeAllCompleted() { 669void OTodoAccessXML::removeAllCompleted() {
671 for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { 670 for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
672 if ( (*it).isCompleted() ) 671 if ( (*it).isCompleted() )
673 m_events.remove( it ); 672 m_events.remove( it );
674 } 673 }
675} 674}
675QBitArray OTodoAccessXML::supports()const {
676 static QBitArray ar = sup();
677 return ar;
678}
679QBitArray OTodoAccessXML::sup() {
680 QBitArray ar( OTodo::CompletedDate +1 );
681 ar.fill( true );
682 ar[OTodo::CrossReference] = false;
683 ar[OTodo::State ] = false;
684 ar[OTodo::Reminders] = false;
685 ar[OTodo::Notifiers] = false;
686 ar[OTodo::Maintainer] = false;
687
688 return ar;
689}
diff --git a/libopie/pim/otodoaccessxml.h b/libopie/pim/otodoaccessxml.h
index 1032c92..cc4a16f 100644
--- a/libopie/pim/otodoaccessxml.h
+++ b/libopie/pim/otodoaccessxml.h
@@ -1,57 +1,59 @@
1#ifndef OPIE_TODO_ACCESS_XML_H 1#ifndef OPIE_TODO_ACCESS_XML_H
2#define OPIE_TODO_ACCESS_XML_H 2#define OPIE_TODO_ACCESS_XML_H
3 3
4#include <qasciidict.h> 4#include <qasciidict.h>
5#include <qmap.h> 5#include <qmap.h>
6 6
7#include "otodoaccessbackend.h" 7#include "otodoaccessbackend.h"
8 8
9namespace Opie { 9namespace Opie {
10 class XMLElement; 10 class XMLElement;
11}; 11};
12 12
13class OTodoAccessXML : public OTodoAccessBackend { 13class OTodoAccessXML : public OTodoAccessBackend {
14public: 14public:
15 /** 15 /**
16 * fileName if Empty we will use the default path 16 * fileName if Empty we will use the default path
17 */ 17 */
18 OTodoAccessXML( const QString& appName, 18 OTodoAccessXML( const QString& appName,
19 const QString& fileName = QString::null ); 19 const QString& fileName = QString::null );
20 ~OTodoAccessXML(); 20 ~OTodoAccessXML();
21 21
22 bool load(); 22 bool load();
23 bool reload(); 23 bool reload();
24 bool save(); 24 bool save();
25 25
26 QArray<int> allRecords()const; 26 QArray<int> allRecords()const;
27 QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() ); 27 QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() );
28 OTodo find( int uid )const; 28 OTodo find( int uid )const;
29 void clear(); 29 void clear();
30 bool add( const OTodo& ); 30 bool add( const OTodo& );
31 bool remove( int uid ); 31 bool remove( int uid );
32 void removeAllCompleted(); 32 void removeAllCompleted();
33 bool replace( const OTodo& ); 33 bool replace( const OTodo& );
34 34
35 /* our functions */ 35 /* our functions */
36 QArray<int> effectiveToDos( const QDate& start, 36 QArray<int> effectiveToDos( const QDate& start,
37 const QDate& end, 37 const QDate& end,
38 bool includeNoDates ); 38 bool includeNoDates );
39 QArray<int> overDue(); 39 QArray<int> overDue();
40 QArray<int> sorted( bool asc, int sortOrder, 40 QArray<int> sorted( bool asc, int sortOrder,
41 int sortFilter, int cat ); 41 int sortFilter, int cat );
42 QBitArray supports()const;
42private: 43private:
44 static QBitArray sup();
43 void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& ); 45 void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& );
44 QString toString( const OTodo& )const; 46 QString toString( const OTodo& )const;
45 QString toString( const QArray<int>& ints ) const; 47 QString toString( const QArray<int>& ints ) const;
46 QMap<int, OTodo> m_events; 48 QMap<int, OTodo> m_events;
47 QString m_file; 49 QString m_file;
48 QString m_app; 50 QString m_app;
49 bool m_opened : 1; 51 bool m_opened : 1;
50 bool m_changed : 1; 52 bool m_changed : 1;
51 class OTodoAccessXMLPrivate; 53 class OTodoAccessXMLPrivate;
52 OTodoAccessXMLPrivate* d; 54 OTodoAccessXMLPrivate* d;
53 int m_year, m_month, m_day; 55 int m_year, m_month, m_day;
54 56
55}; 57};
56 58
57#endif 59#endif
diff --git a/libopie2/opiepim/backend/otodoaccessbackend.h b/libopie2/opiepim/backend/otodoaccessbackend.h
index 7944a2c..05e8ca9 100644
--- a/libopie2/opiepim/backend/otodoaccessbackend.h
+++ b/libopie2/opiepim/backend/otodoaccessbackend.h
@@ -1,21 +1,24 @@
1#ifndef OPIE_TODO_ACCESS_BACKEND_H 1#ifndef OPIE_TODO_ACCESS_BACKEND_H
2#define OPIE_TODO_ACCESS_BACKEND_H 2#define OPIE_TODO_ACCESS_BACKEND_H
3 3
4#include <qbitarray.h>
5
4#include "otodo.h" 6#include "otodo.h"
5#include "opimaccessbackend.h" 7#include "opimaccessbackend.h"
6 8
7class OTodoAccessBackend : public OPimAccessBackend<OTodo> { 9class OTodoAccessBackend : public OPimAccessBackend<OTodo> {
8public: 10public:
9 OTodoAccessBackend(); 11 OTodoAccessBackend();
10 ~OTodoAccessBackend(); 12 ~OTodoAccessBackend();
11 virtual QArray<int> effectiveToDos( const QDate& start, 13 virtual QArray<int> effectiveToDos( const QDate& start,
12 const QDate& end, 14 const QDate& end,
13 bool includeNoDates ) = 0; 15 bool includeNoDates ) = 0;
14 virtual QArray<int> overDue() = 0; 16 virtual QArray<int> overDue() = 0;
15 virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter, 17 virtual QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
16 int cat ) = 0; 18 int cat ) = 0;
17 virtual void removeAllCompleted() = 0; 19 virtual void removeAllCompleted() = 0;
20 virtual QBitArray supports()const = 0;
18 21
19}; 22};
20 23
21#endif 24#endif
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index 2136283..9bc16c6 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -154,48 +154,68 @@ bool OTodoAccessVCal::add( const OTodo& to ) {
154} 154}
155bool OTodoAccessVCal::remove( int uid ) { 155bool OTodoAccessVCal::remove( int uid ) {
156 m_map.remove( uid ); 156 m_map.remove( uid );
157 m_dirty = true; 157 m_dirty = true;
158 return true; 158 return true;
159} 159}
160void OTodoAccessVCal::removeAllCompleted() { 160void OTodoAccessVCal::removeAllCompleted() {
161 for ( QMap<int, OTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) { 161 for ( QMap<int, OTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) {
162 if ( (*it).isCompleted() ) 162 if ( (*it).isCompleted() )
163 m_map.remove( it ); 163 m_map.remove( it );
164 } 164 }
165} 165}
166bool OTodoAccessVCal::replace( const OTodo& to ) { 166bool OTodoAccessVCal::replace( const OTodo& to ) {
167 m_map.replace( to.uid(), to ); 167 m_map.replace( to.uid(), to );
168 m_dirty = true; 168 m_dirty = true;
169 return true; 169 return true;
170} 170}
171OTodo OTodoAccessVCal::find(int uid )const { 171OTodo OTodoAccessVCal::find(int uid )const {
172 return m_map[uid]; 172 return m_map[uid];
173} 173}
174QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) { 174QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) {
175 QArray<int> ar(0); 175 QArray<int> ar(0);
176 return ar; 176 return ar;
177} 177}
178QArray<int> OTodoAccessVCal::allRecords()const { 178QArray<int> OTodoAccessVCal::allRecords()const {
179 QArray<int> ar( m_map.count() ); 179 QArray<int> ar( m_map.count() );
180 QMap<int, OTodo>::ConstIterator it; 180 QMap<int, OTodo>::ConstIterator it;
181 int i = 0; 181 int i = 0;
182 for ( it = m_map.begin(); it != m_map.end(); ++it ) { 182 for ( it = m_map.begin(); it != m_map.end(); ++it ) {
183 ar[i] = it.key(); 183 ar[i] = it.key();
184 i++; 184 i++;
185 } 185 }
186 return ar; 186 return ar;
187} 187}
188QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { 188QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) {
189 QArray<int> ar(0); 189 QArray<int> ar(0);
190 return ar; 190 return ar;
191} 191}
192QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& , 192QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
193 const QDate& , 193 const QDate& ,
194 bool ) { 194 bool ) {
195 QArray<int> ar(0); 195 QArray<int> ar(0);
196 return ar; 196 return ar;
197} 197}
198QArray<int> OTodoAccessVCal::overDue() { 198QArray<int> OTodoAccessVCal::overDue() {
199 QArray<int> ar(0); 199 QArray<int> ar(0);
200 return ar; 200 return ar;
201} 201}
202QBitArray OTodoAccessVCal::supports()const {
203 static QBitArray ar = sup();
204
205 return ar;
206}
207QBitArray OTodoAccessVCal::sup() {
208 QBitArray ar ( OTodo::CompletedDate +1 );
209 ar.fill( true );
210
211 ar[OTodo::CrossReference] = false;
212 ar[OTodo::State ] = false;
213 ar[OTodo::Reminders] = false;
214 ar[OTodo::Notifiers] = false;
215 ar[OTodo::Maintainer] = false;
216 ar[OTodo::Progress] = false;
217 ar[OTodo::Alarms ] = false;
218 ar[OTodo::Recurrence] = false;
219
220 return ar;
221}
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h
index a90ee9c..489416b 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.h
+++ b/libopie2/opiepim/backend/otodoaccessvcal.h
@@ -1,37 +1,39 @@
1#ifndef OPIE_OTODO_ACCESS_VCAL_H 1#ifndef OPIE_OTODO_ACCESS_VCAL_H
2#define OPIE_OTODO_ACCESS_VCAL_H 2#define OPIE_OTODO_ACCESS_VCAL_H
3 3
4#include "otodoaccessbackend.h" 4#include "otodoaccessbackend.h"
5 5
6class OTodoAccessVCal : public OTodoAccessBackend { 6class OTodoAccessVCal : public OTodoAccessBackend {
7public: 7public:
8 OTodoAccessVCal(const QString& ); 8 OTodoAccessVCal(const QString& );
9 ~OTodoAccessVCal(); 9 ~OTodoAccessVCal();
10 10
11 bool load(); 11 bool load();
12 bool reload(); 12 bool reload();
13 bool save(); 13 bool save();
14 14
15 QArray<int> allRecords()const; 15 QArray<int> allRecords()const;
16 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() ); 16 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() );
17 QArray<int> effectiveToDos( const QDate& start, 17 QArray<int> effectiveToDos( const QDate& start,
18 const QDate& end, 18 const QDate& end,
19 bool includeNoDates ); 19 bool includeNoDates );
20 QArray<int> overDue(); 20 QArray<int> overDue();
21 QArray<int> sorted( bool asc, int sortOrder, int sortFilter, 21 QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
22 int cat ); 22 int cat );
23 OTodo find(int uid)const; 23 OTodo find(int uid)const;
24 void clear(); 24 void clear();
25 bool add( const OTodo& ); 25 bool add( const OTodo& );
26 bool remove( int uid ); 26 bool remove( int uid );
27 bool replace( const OTodo& ); 27 bool replace( const OTodo& );
28 28
29 void removeAllCompleted(); 29 void removeAllCompleted();
30 virtual QBitArray supports()const;
30 31
31private: 32private:
33 static QBitArray sup();
32 bool m_dirty : 1; 34 bool m_dirty : 1;
33 QString m_file; 35 QString m_file;
34 QMap<int, OTodo> m_map; 36 QMap<int, OTodo> m_map;
35}; 37};
36 38
37#endif 39#endif
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 71e8787..55f268b 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -619,57 +619,71 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
619 int sortFilter, int cat ) { 619 int sortFilter, int cat ) {
620 qWarning("sorted! %d cat", cat); 620 qWarning("sorted! %d cat", cat);
621 OTodoXMLVector vector(m_events.count(), asc,sortOrder ); 621 OTodoXMLVector vector(m_events.count(), asc,sortOrder );
622 QMap<int, OTodo>::Iterator it; 622 QMap<int, OTodo>::Iterator it;
623 int item = 0; 623 int item = 0;
624 624
625 bool bCat = sortFilter & 1 ? true : false; 625 bool bCat = sortFilter & 1 ? true : false;
626 bool bOnly = sortFilter & 2 ? true : false; 626 bool bOnly = sortFilter & 2 ? true : false;
627 bool comp = sortFilter & 4 ? true : false; 627 bool comp = sortFilter & 4 ? true : false;
628 for ( it = m_events.begin(); it != m_events.end(); ++it ) { 628 for ( it = m_events.begin(); it != m_events.end(); ++it ) {
629 629
630 /* show category */ 630 /* show category */
631 if ( bCat && cat != 0) 631 if ( bCat && cat != 0)
632 if (!(*it).categories().contains( cat ) ) { 632 if (!(*it).categories().contains( cat ) ) {
633 qWarning("category mis match"); 633 qWarning("category mis match");
634 continue; 634 continue;
635 } 635 }
636 /* isOverdue but we should not show overdue - why?*/ 636 /* isOverdue but we should not show overdue - why?*/
637/* if ( (*it).isOverdue() && !bOnly ) { 637/* if ( (*it).isOverdue() && !bOnly ) {
638 qWarning("item is overdue but !bOnly"); 638 qWarning("item is overdue but !bOnly");
639 continue; 639 continue;
640 } 640 }
641*/ 641*/
642 if ( !(*it).isOverdue() && bOnly ) { 642 if ( !(*it).isOverdue() && bOnly ) {
643 qWarning("item is not overdue but bOnly checked"); 643 qWarning("item is not overdue but bOnly checked");
644 continue; 644 continue;
645 } 645 }
646 646
647 if ((*it).isCompleted() && comp ) { 647 if ((*it).isCompleted() && comp ) {
648 qWarning("completed continue!"); 648 qWarning("completed continue!");
649 continue; 649 continue;
650 } 650 }
651 651
652 652
653 OTodoXMLContainer* con = new OTodoXMLContainer(); 653 OTodoXMLContainer* con = new OTodoXMLContainer();
654 con->todo = (*it); 654 con->todo = (*it);
655 vector.insert(item, con ); 655 vector.insert(item, con );
656 item++; 656 item++;
657 } 657 }
658 qWarning("XXX %d Items added", item); 658 qWarning("XXX %d Items added", item);
659 vector.resize( item ); 659 vector.resize( item );
660 /* sort it now */ 660 /* sort it now */
661 vector.sort(); 661 vector.sort();
662 /* now get the uids */ 662 /* now get the uids */
663 QArray<int> array( vector.count() ); 663 QArray<int> array( vector.count() );
664 for (uint i= 0; i < vector.count(); i++ ) { 664 for (uint i= 0; i < vector.count(); i++ ) {
665 array[i] = ( vector.at(i) )->todo.uid(); 665 array[i] = ( vector.at(i) )->todo.uid();
666 } 666 }
667 qWarning("array count = %d %d", array.count(), vector.count() );
668 return array; 667 return array;
669}; 668};
670void OTodoAccessXML::removeAllCompleted() { 669void OTodoAccessXML::removeAllCompleted() {
671 for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { 670 for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
672 if ( (*it).isCompleted() ) 671 if ( (*it).isCompleted() )
673 m_events.remove( it ); 672 m_events.remove( it );
674 } 673 }
675} 674}
675QBitArray OTodoAccessXML::supports()const {
676 static QBitArray ar = sup();
677 return ar;
678}
679QBitArray OTodoAccessXML::sup() {
680 QBitArray ar( OTodo::CompletedDate +1 );
681 ar.fill( true );
682 ar[OTodo::CrossReference] = false;
683 ar[OTodo::State ] = false;
684 ar[OTodo::Reminders] = false;
685 ar[OTodo::Notifiers] = false;
686 ar[OTodo::Maintainer] = false;
687
688 return ar;
689}
diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h
index 1032c92..cc4a16f 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.h
+++ b/libopie2/opiepim/backend/otodoaccessxml.h
@@ -1,57 +1,59 @@
1#ifndef OPIE_TODO_ACCESS_XML_H 1#ifndef OPIE_TODO_ACCESS_XML_H
2#define OPIE_TODO_ACCESS_XML_H 2#define OPIE_TODO_ACCESS_XML_H
3 3
4#include <qasciidict.h> 4#include <qasciidict.h>
5#include <qmap.h> 5#include <qmap.h>
6 6
7#include "otodoaccessbackend.h" 7#include "otodoaccessbackend.h"
8 8
9namespace Opie { 9namespace Opie {
10 class XMLElement; 10 class XMLElement;
11}; 11};
12 12
13class OTodoAccessXML : public OTodoAccessBackend { 13class OTodoAccessXML : public OTodoAccessBackend {
14public: 14public:
15 /** 15 /**
16 * fileName if Empty we will use the default path 16 * fileName if Empty we will use the default path
17 */ 17 */
18 OTodoAccessXML( const QString& appName, 18 OTodoAccessXML( const QString& appName,
19 const QString& fileName = QString::null ); 19 const QString& fileName = QString::null );
20 ~OTodoAccessXML(); 20 ~OTodoAccessXML();
21 21
22 bool load(); 22 bool load();
23 bool reload(); 23 bool reload();
24 bool save(); 24 bool save();
25 25
26 QArray<int> allRecords()const; 26 QArray<int> allRecords()const;
27 QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() ); 27 QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() );
28 OTodo find( int uid )const; 28 OTodo find( int uid )const;
29 void clear(); 29 void clear();
30 bool add( const OTodo& ); 30 bool add( const OTodo& );
31 bool remove( int uid ); 31 bool remove( int uid );
32 void removeAllCompleted(); 32 void removeAllCompleted();
33 bool replace( const OTodo& ); 33 bool replace( const OTodo& );
34 34
35 /* our functions */ 35 /* our functions */
36 QArray<int> effectiveToDos( const QDate& start, 36 QArray<int> effectiveToDos( const QDate& start,
37 const QDate& end, 37 const QDate& end,
38 bool includeNoDates ); 38 bool includeNoDates );
39 QArray<int> overDue(); 39 QArray<int> overDue();
40 QArray<int> sorted( bool asc, int sortOrder, 40 QArray<int> sorted( bool asc, int sortOrder,
41 int sortFilter, int cat ); 41 int sortFilter, int cat );
42 QBitArray supports()const;
42private: 43private:
44 static QBitArray sup();
43 void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& ); 45 void todo( QAsciiDict<int>*, OTodo&,const QCString&,const QString& );
44 QString toString( const OTodo& )const; 46 QString toString( const OTodo& )const;
45 QString toString( const QArray<int>& ints ) const; 47 QString toString( const QArray<int>& ints ) const;
46 QMap<int, OTodo> m_events; 48 QMap<int, OTodo> m_events;
47 QString m_file; 49 QString m_file;
48 QString m_app; 50 QString m_app;
49 bool m_opened : 1; 51 bool m_opened : 1;
50 bool m_changed : 1; 52 bool m_changed : 1;
51 class OTodoAccessXMLPrivate; 53 class OTodoAccessXMLPrivate;
52 OTodoAccessXMLPrivate* d; 54 OTodoAccessXMLPrivate* d;
53 int m_year, m_month, m_day; 55 int m_year, m_month, m_day;
54 56
55}; 57};
56 58
57#endif 59#endif
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp
index 5e89a1b..37f6fbc 100644
--- a/libopie2/opiepim/core/otodoaccess.cpp
+++ b/libopie2/opiepim/core/otodoaccess.cpp
@@ -9,48 +9,54 @@
9OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access ) 9OTodoAccess::OTodoAccess( OTodoAccessBackend* end, enum Access )
10 : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end ) 10 : QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end )
11{ 11{
12// if (end == 0l ) 12// if (end == 0l )
13// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null); 13// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null);
14 14
15 // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben ! 15 // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben !
16 if (end == 0l ) 16 if (end == 0l )
17 m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null); 17 m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null);
18 18
19 setBackEnd( m_todoBackEnd ); 19 setBackEnd( m_todoBackEnd );
20} 20}
21OTodoAccess::~OTodoAccess() { 21OTodoAccess::~OTodoAccess() {
22// qWarning("~OTodoAccess"); 22// qWarning("~OTodoAccess");
23} 23}
24void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) { 24void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) {
25 QValueList<OTodo>::ConstIterator it; 25 QValueList<OTodo>::ConstIterator it;
26 for ( it = list.begin(); it != list.end(); ++it ) { 26 for ( it = list.begin(); it != list.end(); ++it ) {
27 replace( (*it) ); 27 replace( (*it) );
28 } 28 }
29} 29}
30OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, 30OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
31 const QDate& end, 31 const QDate& end,
32 bool includeNoDates ) { 32 bool includeNoDates ) {
33 QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); 33 QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates );
34 34
35 List lis( ints, this ); 35 List lis( ints, this );
36 return lis; 36 return lis;
37} 37}
38OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start, 38OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
39 bool includeNoDates ) { 39 bool includeNoDates ) {
40 return effectiveToDos( start, QDate::currentDate(), 40 return effectiveToDos( start, QDate::currentDate(),
41 includeNoDates ); 41 includeNoDates );
42} 42}
43OTodoAccess::List OTodoAccess::overDue() { 43OTodoAccess::List OTodoAccess::overDue() {
44 List lis( m_todoBackEnd->overDue(), this ); 44 List lis( m_todoBackEnd->overDue(), this );
45 return lis; 45 return lis;
46} 46}
47/* sort order */ 47/* sort order */
48OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) { 48OTodoAccess::List OTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) {
49 QArray<int> ints = m_todoBackEnd->sorted( ascending, sort, 49 QArray<int> ints = m_todoBackEnd->sorted( ascending, sort,
50 filter, cat ); 50 filter, cat );
51 OTodoAccess::List list( ints, this ); 51 OTodoAccess::List list( ints, this );
52 return list; 52 return list;
53} 53}
54void OTodoAccess::removeAllCompleted() { 54void OTodoAccess::removeAllCompleted() {
55 m_todoBackEnd->removeAllCompleted(); 55 m_todoBackEnd->removeAllCompleted();
56} 56}
57QBitArray OTodoAccess::backendSupport( const QString& ) const{
58 return m_todoBackEnd->supports();
59}
60bool OTodoAccess::backendSupports( int attr, const QString& ar) const{
61 return backendSupport(ar).testBit( attr );
62}
diff --git a/libopie2/opiepim/core/otodoaccess.h b/libopie2/opiepim/core/otodoaccess.h
index a626731..916923f 100644
--- a/libopie2/opiepim/core/otodoaccess.h
+++ b/libopie2/opiepim/core/otodoaccess.h
@@ -27,64 +27,79 @@ public:
27 /** 27 /**
28 * if you use 0l 28 * if you use 0l
29 * the default resource will be 29 * the default resource will be
30 * picked up 30 * picked up
31 */ 31 */
32 OTodoAccess( OTodoAccessBackend* = 0l, enum Access acc = Random ); 32 OTodoAccess( OTodoAccessBackend* = 0l, enum Access acc = Random );
33 ~OTodoAccess(); 33 ~OTodoAccess();
34 34
35 35
36 /* our functions here */ 36 /* our functions here */
37 /** 37 /**
38 * include todos from start to end 38 * include todos from start to end
39 * includeNoDates whether or not to include 39 * includeNoDates whether or not to include
40 * events with no dates 40 * events with no dates
41 */ 41 */
42 List effectiveToDos( const QDate& start, 42 List effectiveToDos( const QDate& start,
43 const QDate& end, 43 const QDate& end,
44 bool includeNoDates = true ); 44 bool includeNoDates = true );
45 45
46 /** 46 /**
47 * start 47 * start
48 * end date taken from the currentDate() 48 * end date taken from the currentDate()
49 */ 49 */
50 List effectiveToDos( const QDate& start, 50 List effectiveToDos( const QDate& start,
51 bool includeNoDates = true ); 51 bool includeNoDates = true );
52 52
53 53
54 /** 54 /**
55 * return overdue OTodos 55 * return overdue OTodos
56 */ 56 */
57 List overDue(); 57 List overDue();
58 58
59 /** 59 /**
60 * 60 *
61 */ 61 */
62 List sorted( bool ascending, int sortOrder, int sortFilter, int cat ); 62 List sorted( bool ascending, int sortOrder, int sortFilter, int cat );
63 63
64 /** 64 /**
65 * merge a list of OTodos into 65 * merge a list of OTodos into
66 * the resource 66 * the resource
67 */ 67 */
68 void mergeWith( const QValueList<OTodo>& ); 68 void mergeWith( const QValueList<OTodo>& );
69 69
70 /** 70 /**
71 * delete all already completed items 71 * delete all already completed items
72 */ 72 */
73 void removeAllCompleted(); 73 void removeAllCompleted();
74 74
75 /**
76 * request information about what a backend supports.
77 * Supports in the sense of beeing able to store.
78 * This is related to the enum in OTodo
79 *
80 * @param backend Will be used in the future when we support multiple backend
81 */
82 QBitArray backendSupport( const QString& backend = QString::null )const;
83
84 /**
85 * see above but for a specefic attribute. This method was added for convience
86 * @param attr The attribute to be queried for
87 * @param backend Will be used in the future when we support multiple backends
88 */
89 bool backendSupports( int attr, const QString& backend = QString::null )const;
75signals: 90signals:
76 /** 91 /**
77 * if the OTodoAccess was changed 92 * if the OTodoAccess was changed
78 */ 93 */
79 void changed( const OTodoAccess* ); 94 void changed( const OTodoAccess* );
80 void changed( const OTodoAccess*, int uid ); 95 void changed( const OTodoAccess*, int uid );
81 void added( const OTodoAccess*, int uid ); 96 void added( const OTodoAccess*, int uid );
82 void removed( const OTodoAccess*, int uid ); 97 void removed( const OTodoAccess*, int uid );
83private: 98private:
84 int m_cat; 99 int m_cat;
85 OTodoAccessBackend* m_todoBackEnd; 100 OTodoAccessBackend* m_todoBackEnd;
86 class OTodoAccessPrivate; 101 class OTodoAccessPrivate;
87 OTodoAccessPrivate* d; 102 OTodoAccessPrivate* d;
88}; 103};
89 104
90#endif 105#endif