-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | 18 | ||||
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_xml.h | 1 | ||||
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 6 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.h | 1 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 16 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.h | 1 |
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 @@ -586,3 +586,21 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val break; } } +QArray<int> ODateBookAccessBackend_XML::matchRegexp( const QRegExp &r ) const +{ + QArray<int> m_currentQuery( m_raw.count()+ m_rep.count() ); + uint arraycounter = 0; + QMap<int, OEvent>::ConstIterator it; + + for ( it = m_raw.begin(); it != m_raw.end(); ++it ) + if ( it.data().match( r ) ) + m_currentQuery[arraycounter++] = it.data().uid(); + for ( it = m_rep.begin(); it != m_rep.end(); ++it ) + if ( it.data().match( r ) ) + m_currentQuery[arraycounter++] = it.data().uid(); + + // Shrink to fit.. + m_currentQuery.resize(arraycounter); + + return m_currentQuery; +} 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 @@ -22,6 +22,7 @@ public: bool save(); QArray<int> allRecords()const; + QArray<int> matchRegexp(const QRegExp &r) const; QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); OEvent find( int uid )const; void clear(); 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 @@ -46,6 +46,12 @@ public: */ virtual QArray<int> allRecords()const = 0; + /** + * return a List of records + * that match the regex + */ + virtual QArray<int> matchRegexp(const QRegExp &r) const = 0; + /** * queryByExample for T with the given Settings * 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 @@ -185,6 +185,10 @@ QArray<int> OTodoAccessVCal::allRecords()const { } return ar; } +QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp &r)const { + QArray<int> ar(0); + return ar; +} QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { QArray<int> ar(0); return ar; 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 @@ -13,6 +13,7 @@ public: bool save(); QArray<int> allRecords()const; + QArray<int> matchRegexp(const QRegExp &r) const; QArray<int> queryByExample( const OTodo& t, int sort, const QDateTime& d = QDateTime() ); QArray<int> effectiveToDos( const QDate& start, const QDate& end, 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 @@ -774,3 +774,19 @@ QBitArray OTodoAccessXML::sup() { return ar; } +QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const +{ + QArray<int> m_currentQuery( m_events.count() ); + uint arraycounter = 0; + + QMap<int, OTodo>::ConstIterator it; + for (it = m_events.begin(); it != m_events.end(); ++it ) { + if ( it.data().match( r ) ) + m_currentQuery[arraycounter++] = it.data().uid(); + + } + // Shrink to fit.. + m_currentQuery.resize(arraycounter); + + return m_currentQuery; +} 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 @@ -24,6 +24,7 @@ public: bool save(); QArray<int> allRecords()const; + QArray<int> matchRegexp(const QRegExp &r) const; QArray<int> queryByExample( const OTodo&, int querysettings, const QDateTime& d = QDateTime() ); OTodo find( int uid )const; void clear(); |