summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend
authortille <tille>2003-05-08 13:55:09 (UTC)
committer tille <tille>2003-05-08 13:55:09 (UTC)
commit0cb4111d34d9fe96731f48983e1ff2e67262db02 (patch) (side-by-side diff)
treece6ec869ae7753ab0261e7ad075a10ad8b0a404b /libopie2/opiepim/backend
parent78c60031b506b85dc20bd555d83486aeb831bf38 (diff)
downloadopie-0cb4111d34d9fe96731f48983e1ff2e67262db02.zip
opie-0cb4111d34d9fe96731f48983e1ff2e67262db02.tar.gz
opie-0cb4111d34d9fe96731f48983e1ff2e67262db02.tar.bz2
search stuff
and match, toRichText & toShortText in oevent
Diffstat (limited to 'libopie2/opiepim/backend') (more/less context) (show 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
recur()->exceptions().append( date );
}
}
break;
case FTimeZone:
if ( value != "None" )
e.setTimeZone( value );
break;
default:
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
@@ -13,24 +13,25 @@
*/
class ODateBookAccessBackend_XML : public ODateBookAccessBackend {
public:
ODateBookAccessBackend_XML( const QString& appName,
const QString& fileName = QString::null);
~ODateBookAccessBackend_XML();
bool load();
bool reload();
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();
bool add( const OEvent& ev );
bool remove( int uid );
bool replace( const OEvent& ev );
QArray<UID> rawEvents()const;
QArray<UID> rawRepeats()const;
QArray<UID> nonRepeats()const;
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
@@ -38,24 +38,30 @@ public:
* save the resource and
* all it's changes
*/
virtual bool save() = 0;
/**
* return an array of
* all available uids
*/
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
*
*/
virtual QArray<int> queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() ) = 0;
/**
* find the OPimRecord with uid @param uid
* returns T and T.isEmpty() if nothing was found
*/
virtual T find(int uid )const = 0;
virtual T find(int uid, const QArray<int>& items,
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 ) {
return ar;
}
QArray<int> OTodoAccessVCal::allRecords()const {
QArray<int> ar( m_map.count() );
QMap<int, OTodo>::ConstIterator it;
int i = 0;
for ( it = m_map.begin(); it != m_map.end(); ++it ) {
ar[i] = it.key();
i++;
}
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;
}
QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
const QDate& ,
bool ) {
QArray<int> ar(0);
return ar;
}
QArray<int> OTodoAccessVCal::overDue() {
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 @@
#include "otodoaccessbackend.h"
class OTodoAccessVCal : public OTodoAccessBackend {
public:
OTodoAccessVCal(const QString& );
~OTodoAccessVCal();
bool load();
bool reload();
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,
bool includeNoDates );
QArray<int> overDue();
QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
int cat );
OTodo find(int uid)const;
void clear();
bool add( const OTodo& );
bool remove( int uid );
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 {
}
QBitArray OTodoAccessXML::sup() {
QBitArray ar( OTodo::CompletedDate +1 );
ar.fill( true );
ar[OTodo::CrossReference] = false;
ar[OTodo::State ] = false;
ar[OTodo::Reminders] = false;
ar[OTodo::Notifiers] = false;
ar[OTodo::Maintainer] = false;
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
@@ -15,24 +15,25 @@ public:
/**
* fileName if Empty we will use the default path
*/
OTodoAccessXML( const QString& appName,
const QString& fileName = QString::null );
~OTodoAccessXML();
bool load();
bool reload();
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();
bool add( const OTodo& );
bool remove( int uid );
void removeAllCompleted();
bool replace( const OTodo& );
/* our functions */
QArray<int> effectiveToDos( const QDate& start,
const QDate& end,
bool includeNoDates );