summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp18
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.h1
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h6
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp4
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.h1
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp16
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.h1
7 files changed, 47 insertions, 0 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
index a0ae7b7..ab2eea4 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
@@ -577,12 +577,30 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val
577 recur()->exceptions().append( date ); 577 recur()->exceptions().append( date );
578 } 578 }
579 } 579 }
580 break; 580 break;
581 case FTimeZone: 581 case FTimeZone:
582 if ( value != "None" ) 582 if ( value != "None" )
583 e.setTimeZone( value ); 583 e.setTimeZone( value );
584 break; 584 break;
585 default: 585 default:
586 break; 586 break;
587 } 587 }
588} 588}
589QArray<int> ODateBookAccessBackend_XML::matchRegexp( const QRegExp &r ) const
590{
591 QArray<int> m_currentQuery( m_raw.count()+ m_rep.count() );
592 uint arraycounter = 0;
593 QMap<int, OEvent>::ConstIterator it;
594
595 for ( it = m_raw.begin(); it != m_raw.end(); ++it )
596 if ( it.data().match( r ) )
597 m_currentQuery[arraycounter++] = it.data().uid();
598 for ( it = m_rep.begin(); it != m_rep.end(); ++it )
599 if ( it.data().match( r ) )
600 m_currentQuery[arraycounter++] = it.data().uid();
601
602 // Shrink to fit..
603 m_currentQuery.resize(arraycounter);
604
605 return m_currentQuery;
606}
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
index 7848f7c..a5cc0fc 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
@@ -13,24 +13,25 @@
13 */ 13 */
14class ODateBookAccessBackend_XML : public ODateBookAccessBackend { 14class ODateBookAccessBackend_XML : public ODateBookAccessBackend {
15public: 15public:
16 ODateBookAccessBackend_XML( const QString& appName, 16 ODateBookAccessBackend_XML( const QString& appName,
17 const QString& fileName = QString::null); 17 const QString& fileName = QString::null);
18 ~ODateBookAccessBackend_XML(); 18 ~ODateBookAccessBackend_XML();
19 19
20 bool load(); 20 bool load();
21 bool reload(); 21 bool reload();
22 bool save(); 22 bool save();
23 23
24 QArray<int> allRecords()const; 24 QArray<int> allRecords()const;
25 QArray<int> matchRegexp(const QRegExp &r) const;
25 QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); 26 QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() );
26 OEvent find( int uid )const; 27 OEvent find( int uid )const;
27 void clear(); 28 void clear();
28 bool add( const OEvent& ev ); 29 bool add( const OEvent& ev );
29 bool remove( int uid ); 30 bool remove( int uid );
30 bool replace( const OEvent& ev ); 31 bool replace( const OEvent& ev );
31 32
32 QArray<UID> rawEvents()const; 33 QArray<UID> rawEvents()const;
33 QArray<UID> rawRepeats()const; 34 QArray<UID> rawRepeats()const;
34 QArray<UID> nonRepeats()const; 35 QArray<UID> nonRepeats()const;
35 36
36 OEvent::ValueList directNonRepeats(); 37 OEvent::ValueList directNonRepeats();
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h
index 01a0c86..f4bbe35 100644
--- a/libopie2/opiepim/backend/opimaccessbackend.h
+++ b/libopie2/opiepim/backend/opimaccessbackend.h
@@ -37,24 +37,30 @@ public:
37 /** 37 /**
38 * save the resource and 38 * save the resource and
39 * all it's changes 39 * all it's changes
40 */ 40 */
41 virtual bool save() = 0; 41 virtual bool save() = 0;
42 42
43 /** 43 /**
44 * return an array of 44 * return an array of
45 * all available uids 45 * all available uids
46 */ 46 */
47 virtual QArray<int> allRecords()const = 0; 47 virtual QArray<int> allRecords()const = 0;
48 48
49 /**
50 * return a List of records
51 * that match the regex
52 */
53 virtual QArray<int> matchRegexp(const QRegExp &r) const = 0;
54
49 /** 55 /**
50 * queryByExample for T with the given Settings 56 * queryByExample for T with the given Settings
51 * 57 *
52 */ 58 */
53 virtual QArray<int> queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() ) = 0; 59 virtual QArray<int> queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() ) = 0;
54 60
55 /** 61 /**
56 * find the OPimRecord with uid @param uid 62 * find the OPimRecord with uid @param uid
57 * returns T and T.isEmpty() if nothing was found 63 * returns T and T.isEmpty() if nothing was found
58 */ 64 */
59 virtual T find(int uid )const = 0; 65 virtual T find(int uid )const = 0;
60 66
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index 9bc16c6..3577e14 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -176,24 +176,28 @@ QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) {
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::matchRegexp(const QRegExp &r)const {
189 QArray<int> ar(0);
190 return ar;
191}
188QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { 192QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) {
189 QArray<int> ar(0); 193 QArray<int> ar(0);
190 return ar; 194 return ar;
191} 195}
192QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& , 196QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
193 const QDate& , 197 const QDate& ,
194 bool ) { 198 bool ) {
195 QArray<int> ar(0); 199 QArray<int> ar(0);
196 return ar; 200 return ar;
197} 201}
198QArray<int> OTodoAccessVCal::overDue() { 202QArray<int> OTodoAccessVCal::overDue() {
199 QArray<int> ar(0); 203 QArray<int> ar(0);
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h
index 489416b..2b17147 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.h
+++ b/libopie2/opiepim/backend/otodoaccessvcal.h
@@ -4,24 +4,25 @@
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> matchRegexp(const QRegExp &r) const;
16 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() ); 17 QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() );
17 QArray<int> effectiveToDos( const QDate& start, 18 QArray<int> effectiveToDos( const QDate& start,
18 const QDate& end, 19 const QDate& end,
19 bool includeNoDates ); 20 bool includeNoDates );
20 QArray<int> overDue(); 21 QArray<int> overDue();
21 QArray<int> sorted( bool asc, int sortOrder, int sortFilter, 22 QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
22 int cat ); 23 int cat );
23 OTodo find(int uid)const; 24 OTodo find(int uid)const;
24 void clear(); 25 void clear();
25 bool add( const OTodo& ); 26 bool add( const OTodo& );
26 bool remove( int uid ); 27 bool remove( int uid );
27 bool replace( const OTodo& ); 28 bool replace( const OTodo& );
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 285d2b8..69b7ab4 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -765,12 +765,28 @@ QBitArray OTodoAccessXML::supports()const {
765} 765}
766QBitArray OTodoAccessXML::sup() { 766QBitArray OTodoAccessXML::sup() {
767 QBitArray ar( OTodo::CompletedDate +1 ); 767 QBitArray ar( OTodo::CompletedDate +1 );
768 ar.fill( true ); 768 ar.fill( true );
769 ar[OTodo::CrossReference] = false; 769 ar[OTodo::CrossReference] = false;
770 ar[OTodo::State ] = false; 770 ar[OTodo::State ] = false;
771 ar[OTodo::Reminders] = false; 771 ar[OTodo::Reminders] = false;
772 ar[OTodo::Notifiers] = false; 772 ar[OTodo::Notifiers] = false;
773 ar[OTodo::Maintainer] = false; 773 ar[OTodo::Maintainer] = false;
774 774
775 return ar; 775 return ar;
776} 776}
777QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const
778{
779 QArray<int> m_currentQuery( m_events.count() );
780 uint arraycounter = 0;
781
782 QMap<int, OTodo>::ConstIterator it;
783 for (it = m_events.begin(); it != m_events.end(); ++it ) {
784 if ( it.data().match( r ) )
785 m_currentQuery[arraycounter++] = it.data().uid();
786
787 }
788 // Shrink to fit..
789 m_currentQuery.resize(arraycounter);
790
791 return m_currentQuery;
792}
diff --git a/libopie2/opiepim/backend/otodoaccessxml.h b/libopie2/opiepim/backend/otodoaccessxml.h
index cc4a16f..e4850a1 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.h
+++ b/libopie2/opiepim/backend/otodoaccessxml.h
@@ -15,24 +15,25 @@ public:
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> matchRegexp(const QRegExp &r) const;
27 QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() ); 28 QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() );
28 OTodo find( int uid )const; 29 OTodo find( int uid )const;
29 void clear(); 30 void clear();
30 bool add( const OTodo& ); 31 bool add( const OTodo& );
31 bool remove( int uid ); 32 bool remove( int uid );
32 void removeAllCompleted(); 33 void removeAllCompleted();
33 bool replace( const OTodo& ); 34 bool replace( const OTodo& );
34 35
35 /* our functions */ 36 /* our functions */
36 QArray<int> effectiveToDos( const QDate& start, 37 QArray<int> effectiveToDos( const QDate& start,
37 const QDate& end, 38 const QDate& end,
38 bool includeNoDates ); 39 bool includeNoDates );