summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp9
-rw-r--r--libopie/pim/ocontact.h3
-rw-r--r--libopie/pim/ocontactaccess.cpp13
-rw-r--r--libopie/pim/ocontactaccess.h6
-rw-r--r--libopie/pim/odatebookaccessbackend_xml.cpp18
-rw-r--r--libopie/pim/odatebookaccessbackend_xml.h1
-rw-r--r--libopie/pim/oevent.cpp41
-rw-r--r--libopie/pim/oevent.h2
-rw-r--r--libopie/pim/opimaccessbackend.h6
-rw-r--r--libopie/pim/opimaccesstemplate.h12
-rw-r--r--libopie/pim/opimrecord.h6
-rw-r--r--libopie/pim/otodo.h2
-rw-r--r--libopie/pim/otodoaccessvcal.cpp4
-rw-r--r--libopie/pim/otodoaccessvcal.h1
-rw-r--r--libopie/pim/otodoaccessxml.cpp16
-rw-r--r--libopie/pim/otodoaccessxml.h1
-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
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp13
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h6
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h12
-rw-r--r--libopie2/opiepim/core/opimrecord.h6
-rw-r--r--libopie2/opiepim/ocontact.cpp9
-rw-r--r--libopie2/opiepim/ocontact.h3
-rw-r--r--libopie2/opiepim/oevent.cpp41
-rw-r--r--libopie2/opiepim/oevent.h2
-rw-r--r--libopie2/opiepim/otodo.h2
32 files changed, 228 insertions, 54 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index 96a5f65..a38b62b 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -944,21 +944,12 @@ void OContact::setEmails( const QString &str )
944void OContact::setChildren( const QString &str ) 944void OContact::setChildren( const QString &str )
945{ 945{
946 replace( Qtopia::Children, str ); 946 replace( Qtopia::Children, str );
947} 947}
948 948
949/*! 949/*!
950 Returns TRUE if the contact matches the regular expression \a regexp.
951 Otherwise returns FALSE.
952*/
953bool OContact::match( const QString &regexp ) const
954{
955 return match(QRegExp(regexp));
956}
957
958/*!
959 \overload 950 \overload
960 Returns TRUE if the contact matches the regular expression \a regexp. 951 Returns TRUE if the contact matches the regular expression \a regexp.
961 Otherwise returns FALSE. 952 Otherwise returns FALSE.
962*/ 953*/
963bool OContact::match( const QRegExp &r ) const 954bool OContact::match( const QRegExp &r ) const
964{ 955{
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index 50f6176..0e6cbd2 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -108,14 +108,13 @@ public:
108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
109 void setChildren( const QString &v ); 109 void setChildren( const QString &v );
110 110
111 // other 111 // other
112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
113 113
114 bool match( const QString &regexp ) const; 114 virtual bool match( const QRegExp &regexp ) const;
115 bool match( const QRegExp &regexp ) const;
116 115
117// // custom 116// // custom
118// void setCustomField( const QString &key, const QString &v ) 117// void setCustomField( const QString &key, const QString &v )
119// { replace(Custom- + key, v ); } 118// { replace(Custom- + key, v ); }
120 119
121 // name 120 // name
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp
index 9c9338e..2e3ec1f 100644
--- a/libopie/pim/ocontactaccess.cpp
+++ b/libopie/pim/ocontactaccess.cpp
@@ -18,12 +18,16 @@
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.8 2003/05/08 13:55:09 tille
25 * search stuff
26 * and match, toRichText & toShortText in oevent
27 *
24 * Revision 1.7 2002/11/13 14:14:51 eilers 28 * Revision 1.7 2002/11/13 14:14:51 eilers
25 * Added sorted for Contacts.. 29 * Added sorted for Contacts..
26 * 30 *
27 * Revision 1.6 2002/11/01 15:10:42 eilers 31 * Revision 1.6 2002/11/01 15:10:42 eilers
28 * Added regExp-search in database for all fields in a contact. 32 * Added regExp-search in database for all fields in a contact.
29 * 33 *
@@ -70,23 +74,23 @@
70 74
71 75
72OContactAccess::OContactAccess ( const QString appname, const QString , 76OContactAccess::OContactAccess ( const QString appname, const QString ,
73 OContactAccessBackend* end, bool autosync ): 77 OContactAccessBackend* end, bool autosync ):
74 OPimAccessTemplate<OContact>( end ) 78 OPimAccessTemplate<OContact>( end )
75{ 79{
76 /* take care of the backend. If there is no one defined, we 80 /* take care of the backend. If there is no one defined, we
77 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 81 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
78 */ 82 */
79 if( end == 0 ) { 83 if( end == 0 ) {
80 qWarning ("Using BackendFactory !"); 84 qWarning ("Using BackendFactory !");
81 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); 85 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
82 } 86 }
83 // Set backend locally and in template 87 // Set backend locally and in template
84 m_backEnd = end; 88 m_backEnd = end;
85 OPimAccessTemplate<OContact>::setBackEnd (end); 89 OPimAccessTemplate<OContact>::setBackEnd (end);
86 90
87 91
88 /* Connect signal of external db change to function */ 92 /* Connect signal of external db change to function */
89 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 93 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
90 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), 94 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)),
91 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 95 this, SLOT(copMessage( const QCString &, const QByteArray &)) );
92 if ( autosync ){ 96 if ( autosync ){
@@ -123,17 +127,12 @@ bool OContactAccess::save ()
123 */ 127 */
124 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 128 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
125 129
126 return true; 130 return true;
127} 131}
128 132
129ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{
130 QArray<int> matchingContacts = m_backEnd -> matchRegexp( r );
131 return ( ORecordList<OContact>(matchingContacts, this) );
132}
133
134const uint OContactAccess::querySettings() 133const uint OContactAccess::querySettings()
135{ 134{
136 return ( m_backEnd->querySettings() ); 135 return ( m_backEnd->querySettings() );
137} 136}
138 137
139bool OContactAccess::hasQuerySettings ( int querySettings ) const 138bool OContactAccess::hasQuerySettings ( int querySettings ) const
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
index d7ceaf2..e90db32 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/libopie/pim/ocontactaccess.h
@@ -14,12 +14,16 @@
14 * ToDo: Define enum for query settings 14 * ToDo: Define enum for query settings
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.8 2003/05/08 13:55:09 tille
21 * search stuff
22 * and match, toRichText & toShortText in oevent
23 *
20 * Revision 1.7 2003/04/13 18:07:10 zecke 24 * Revision 1.7 2003/04/13 18:07:10 zecke
21 * More API doc 25 * More API doc
22 * QString -> const QString& 26 * QString -> const QString&
23 * QString = 0l -> QString::null 27 * QString = 0l -> QString::null
24 * 28 *
25 * Revision 1.6 2003/01/02 14:27:12 eilers 29 * Revision 1.6 2003/01/02 14:27:12 eilers
@@ -107,14 +111,12 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
107 DateYear = 0x0040, // The year matches 111 DateYear = 0x0040, // The year matches
108 DateMonth = 0x0080, // The month matches 112 DateMonth = 0x0080, // The month matches
109 DateDay = 0x0100, // The day matches 113 DateDay = 0x0100, // The day matches
110 }; 114 };
111 115
112 116
113 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
114
115 /** Return all Contacts in a sorted manner. 117 /** Return all Contacts in a sorted manner.
116 * @param ascending true: Sorted in acending order. 118 * @param ascending true: Sorted in acending order.
117 * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess 119 * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
118 * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess 120 * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
119 * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess 121 * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
120 */ 122 */
diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/libopie/pim/odatebookaccessbackend_xml.cpp
index a0ae7b7..ab2eea4 100644
--- a/libopie/pim/odatebookaccessbackend_xml.cpp
+++ b/libopie/pim/odatebookaccessbackend_xml.cpp
@@ -583,6 +583,24 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val
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/libopie/pim/odatebookaccessbackend_xml.h b/libopie/pim/odatebookaccessbackend_xml.h
index 7848f7c..a5cc0fc 100644
--- a/libopie/pim/odatebookaccessbackend_xml.h
+++ b/libopie/pim/odatebookaccessbackend_xml.h
@@ -19,12 +19,13 @@ public:
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 );
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index 3ba8a52..28cf873 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -1,10 +1,11 @@
1#include <qshared.h> 1#include <qshared.h>
2 2
3#include <qpe/palmtopuidgen.h> 3#include <qpe/palmtopuidgen.h>
4#include <qpe/categories.h> 4#include <qpe/categories.h>
5#include <qpe/stringutil.h>
5 6
6#include "orecur.h" 7#include "orecur.h"
7#include "opimresolver.h" 8#include "opimresolver.h"
8#include "opimnotifymanager.h" 9#include "opimnotifymanager.h"
9 10
10#include "oevent.h" 11#include "oevent.h"
@@ -207,22 +208,52 @@ void OEvent::setTimeZone( const QString& tz ) {
207 data->timezone = tz; 208 data->timezone = tz;
208} 209}
209QString OEvent::timeZone()const { 210QString OEvent::timeZone()const {
210 if (data->isAllDay ) return QString::fromLatin1("UTC"); 211 if (data->isAllDay ) return QString::fromLatin1("UTC");
211 return data->timezone; 212 return data->timezone;
212} 213}
213bool OEvent::match( const QRegExp& )const { 214bool OEvent::match( const QRegExp& re )const {
214 // FIXME 215 if (data->description.contains( re ) )
216 return true;
217 if ( data->note.contains( re ) )
218 return true;
219 if ( data->location.contains( re ) )
220 return true;
221 if ( data->start.toString().contains( re ) )
222 return true;
223 if ( data->end.toString().contains( re ) )
224 return true;
215 return false; 225 return false;
216} 226}
217QString OEvent::toRichText()const { 227QString OEvent::toRichText()const {
218 // FIXME 228 QString text;
219 return "OEvent test"; 229 if ( !description().isEmpty() ) {
230 text += "<b>" + QObject::tr( "Description:") + "</b><br>";
231 text += Qtopia::escapeString(description() ).
232 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
233 }
234 if ( startDateTime().isValid() ) {
235 text += "<b>" + QObject::tr( "Start:") + "</b> ";
236 text += Qtopia::escapeString(startDateTime().toString() ).
237 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
238 }
239 if ( endDateTime().isValid() ) {
240 text += "<b>" + QObject::tr( "End:") + "</b> ";
241 text += Qtopia::escapeString(endDateTime().toString() ).
242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
243 }
244 if ( !note().isEmpty() ) {
245 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
246 text += note();
247// text += Qtopia::escapeString(note() ).
248// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
249 }
250 return text;
220} 251}
221QString OEvent::toShortText()const { 252QString OEvent::toShortText()const {
222 return "OEvent shotText"; 253 return description();
223} 254}
224QString OEvent::type()const { 255QString OEvent::type()const {
225 return QString::fromLatin1("OEvent"); 256 return QString::fromLatin1("OEvent");
226} 257}
227QString OEvent::recordField( int /*id */ )const { 258QString OEvent::recordField( int /*id */ )const {
228 return QString::null; 259 return QString::null;
diff --git a/libopie/pim/oevent.h b/libopie/pim/oevent.h
index 57d32d0..b696d81 100644
--- a/libopie/pim/oevent.h
+++ b/libopie/pim/oevent.h
@@ -110,13 +110,13 @@ public:
110 110
111 /* pin this event to a timezone! FIXME */ 111 /* pin this event to a timezone! FIXME */
112 void setTimeZone( const QString& timeZone ); 112 void setTimeZone( const QString& timeZone );
113 QString timeZone()const; 113 QString timeZone()const;
114 114
115 115
116 bool match( const QRegExp& )const; 116 virtual bool match( const QRegExp& )const;
117 117
118 /** For exception to recurrence here is a list of children... */ 118 /** For exception to recurrence here is a list of children... */
119 QArray<int> children()const; 119 QArray<int> children()const;
120 void setChildren( const QArray<int>& ); 120 void setChildren( const QArray<int>& );
121 void addChild( int uid ); 121 void addChild( int uid );
122 void removeChild( int uid ); 122 void removeChild( int uid );
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h
index 01a0c86..f4bbe35 100644
--- a/libopie/pim/opimaccessbackend.h
+++ b/libopie/pim/opimaccessbackend.h
@@ -43,12 +43,18 @@ public:
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
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index 6a3a0db..8ff205c 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -66,12 +66,18 @@ public:
66 66
67 /** 67 /**
68 * return a List of records 68 * return a List of records
69 * you can iterate over them 69 * you can iterate over them
70 */ 70 */
71 virtual List allRecords()const; 71 virtual List allRecords()const;
72
73 /**
74 * return a List of records
75 * that match the regex
76 */
77 virtual List matchRegexp( const QRegExp &r ) const;
72 78
73 /** 79 /**
74 * queryByExample. 80 * queryByExample.
75 * @see otodoaccess, ocontactaccess 81 * @see otodoaccess, ocontactaccess
76 */ 82 */
77 virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); 83 virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() );
@@ -178,12 +184,18 @@ template <class T>
178typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { 184typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
179 QArray<int> ints = m_backEnd->allRecords(); 185 QArray<int> ints = m_backEnd->allRecords();
180 List lis(ints, this ); 186 List lis(ints, this );
181 return lis; 187 return lis;
182} 188}
183template <class T> 189template <class T>
190typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const {
191 QArray<int> ints = m_backEnd->matchRegexp( r );
192 List lis(ints, this );
193 return lis;
194}
195template <class T>
184QArray<int> OPimAccessTemplate<T>::records()const { 196QArray<int> OPimAccessTemplate<T>::records()const {
185 return m_backEnd->allRecords(); 197 return m_backEnd->allRecords();
186} 198}
187template <class T> 199template <class T>
188typename OPimAccessTemplate<T>::List 200typename OPimAccessTemplate<T>::List
189OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { 201OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index c7f9460..de2d9f4 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -70,12 +70,18 @@ public:
70 /** 70 /**
71 * the name of the Record 71 * the name of the Record
72 */ 72 */
73 virtual QString type()const = 0; 73 virtual QString type()const = 0;
74 74
75 /** 75 /**
76 * matches the Records the regular expression?
77 */
78 virtual bool match( const QString &regexp ) const {return match(QRegExp(regexp));};
79 virtual bool match( const QRegExp &regexp ) const = 0;
80
81 /**
76 * converts the internal structure to a map 82 * converts the internal structure to a map
77 */ 83 */
78 virtual QMap<int, QString> toMap()const = 0; 84 virtual QMap<int, QString> toMap()const = 0;
79 85
80 /** 86 /**
81 * key value representation of extra items 87 * key value representation of extra items
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index a58d9aa..0e7c73f 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -255,13 +255,13 @@ public:
255 */ 255 */
256 void setMaintainer( const OPimMaintainer& ); 256 void setMaintainer( const OPimMaintainer& );
257 257
258 bool isOverdue(); 258 bool isOverdue();
259 259
260 260
261 bool match( const QRegExp &r )const; 261 virtual bool match( const QRegExp &r )const;
262 262
263 bool operator<(const OTodo &toDoEvent )const; 263 bool operator<(const OTodo &toDoEvent )const;
264 bool operator<=(const OTodo &toDoEvent )const; 264 bool operator<=(const OTodo &toDoEvent )const;
265 bool operator!=(const OTodo &toDoEvent )const; 265 bool operator!=(const OTodo &toDoEvent )const;
266 bool operator>(const OTodo &toDoEvent )const; 266 bool operator>(const OTodo &toDoEvent )const;
267 bool operator>=(const OTodo &toDoEvent)const; 267 bool operator>=(const OTodo &toDoEvent)const;
diff --git a/libopie/pim/otodoaccessvcal.cpp b/libopie/pim/otodoaccessvcal.cpp
index 9bc16c6..3577e14 100644
--- a/libopie/pim/otodoaccessvcal.cpp
+++ b/libopie/pim/otodoaccessvcal.cpp
@@ -182,12 +182,16 @@ QArray<int> OTodoAccessVCal::allRecords()const {
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& ,
diff --git a/libopie/pim/otodoaccessvcal.h b/libopie/pim/otodoaccessvcal.h
index 489416b..2b17147 100644
--- a/libopie/pim/otodoaccessvcal.h
+++ b/libopie/pim/otodoaccessvcal.h
@@ -10,12 +10,13 @@ public:
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,
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 285d2b8..69b7ab4 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -771,6 +771,22 @@ QBitArray OTodoAccessXML::sup() {
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/libopie/pim/otodoaccessxml.h b/libopie/pim/otodoaccessxml.h
index cc4a16f..e4850a1 100644
--- a/libopie/pim/otodoaccessxml.h
+++ b/libopie/pim/otodoaccessxml.h
@@ -21,12 +21,13 @@ public:
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();
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
@@ -583,6 +583,24 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val
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
@@ -19,12 +19,13 @@ public:
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 );
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
@@ -43,12 +43,18 @@ public:
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
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
@@ -182,12 +182,16 @@ QArray<int> OTodoAccessVCal::allRecords()const {
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& ,
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
@@ -10,12 +10,13 @@ public:
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,
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
@@ -771,6 +771,22 @@ QBitArray OTodoAccessXML::sup() {
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
@@ -21,12 +21,13 @@ public:
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();
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 9c9338e..2e3ec1f 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -18,12 +18,16 @@
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.8 2003/05/08 13:55:09 tille
25 * search stuff
26 * and match, toRichText & toShortText in oevent
27 *
24 * Revision 1.7 2002/11/13 14:14:51 eilers 28 * Revision 1.7 2002/11/13 14:14:51 eilers
25 * Added sorted for Contacts.. 29 * Added sorted for Contacts..
26 * 30 *
27 * Revision 1.6 2002/11/01 15:10:42 eilers 31 * Revision 1.6 2002/11/01 15:10:42 eilers
28 * Added regExp-search in database for all fields in a contact. 32 * Added regExp-search in database for all fields in a contact.
29 * 33 *
@@ -70,23 +74,23 @@
70 74
71 75
72OContactAccess::OContactAccess ( const QString appname, const QString , 76OContactAccess::OContactAccess ( const QString appname, const QString ,
73 OContactAccessBackend* end, bool autosync ): 77 OContactAccessBackend* end, bool autosync ):
74 OPimAccessTemplate<OContact>( end ) 78 OPimAccessTemplate<OContact>( end )
75{ 79{
76 /* take care of the backend. If there is no one defined, we 80 /* take care of the backend. If there is no one defined, we
77 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 81 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
78 */ 82 */
79 if( end == 0 ) { 83 if( end == 0 ) {
80 qWarning ("Using BackendFactory !"); 84 qWarning ("Using BackendFactory !");
81 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); 85 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
82 } 86 }
83 // Set backend locally and in template 87 // Set backend locally and in template
84 m_backEnd = end; 88 m_backEnd = end;
85 OPimAccessTemplate<OContact>::setBackEnd (end); 89 OPimAccessTemplate<OContact>::setBackEnd (end);
86 90
87 91
88 /* Connect signal of external db change to function */ 92 /* Connect signal of external db change to function */
89 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 93 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
90 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), 94 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)),
91 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 95 this, SLOT(copMessage( const QCString &, const QByteArray &)) );
92 if ( autosync ){ 96 if ( autosync ){
@@ -123,17 +127,12 @@ bool OContactAccess::save ()
123 */ 127 */
124 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 128 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
125 129
126 return true; 130 return true;
127} 131}
128 132
129ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{
130 QArray<int> matchingContacts = m_backEnd -> matchRegexp( r );
131 return ( ORecordList<OContact>(matchingContacts, this) );
132}
133
134const uint OContactAccess::querySettings() 133const uint OContactAccess::querySettings()
135{ 134{
136 return ( m_backEnd->querySettings() ); 135 return ( m_backEnd->querySettings() );
137} 136}
138 137
139bool OContactAccess::hasQuerySettings ( int querySettings ) const 138bool OContactAccess::hasQuerySettings ( int querySettings ) const
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index d7ceaf2..e90db32 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -14,12 +14,16 @@
14 * ToDo: Define enum for query settings 14 * ToDo: Define enum for query settings
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.8 2003/05/08 13:55:09 tille
21 * search stuff
22 * and match, toRichText & toShortText in oevent
23 *
20 * Revision 1.7 2003/04/13 18:07:10 zecke 24 * Revision 1.7 2003/04/13 18:07:10 zecke
21 * More API doc 25 * More API doc
22 * QString -> const QString& 26 * QString -> const QString&
23 * QString = 0l -> QString::null 27 * QString = 0l -> QString::null
24 * 28 *
25 * Revision 1.6 2003/01/02 14:27:12 eilers 29 * Revision 1.6 2003/01/02 14:27:12 eilers
@@ -107,14 +111,12 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
107 DateYear = 0x0040, // The year matches 111 DateYear = 0x0040, // The year matches
108 DateMonth = 0x0080, // The month matches 112 DateMonth = 0x0080, // The month matches
109 DateDay = 0x0100, // The day matches 113 DateDay = 0x0100, // The day matches
110 }; 114 };
111 115
112 116
113 ORecordList<OContact> matchRegexp( const QRegExp &r )const;
114
115 /** Return all Contacts in a sorted manner. 117 /** Return all Contacts in a sorted manner.
116 * @param ascending true: Sorted in acending order. 118 * @param ascending true: Sorted in acending order.
117 * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess 119 * @param sortOrder Currently not implemented. Just defined to stay compatible to otodoaccess
118 * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess 120 * @param sortFilter Currently not implemented. Just defined to stay compatible to otodoaccess
119 * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess 121 * @param cat Currently not implemented. Just defined to stay compatible to otodoaccess
120 */ 122 */
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 6a3a0db..8ff205c 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -66,12 +66,18 @@ public:
66 66
67 /** 67 /**
68 * return a List of records 68 * return a List of records
69 * you can iterate over them 69 * you can iterate over them
70 */ 70 */
71 virtual List allRecords()const; 71 virtual List allRecords()const;
72
73 /**
74 * return a List of records
75 * that match the regex
76 */
77 virtual List matchRegexp( const QRegExp &r ) const;
72 78
73 /** 79 /**
74 * queryByExample. 80 * queryByExample.
75 * @see otodoaccess, ocontactaccess 81 * @see otodoaccess, ocontactaccess
76 */ 82 */
77 virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); 83 virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() );
@@ -178,12 +184,18 @@ template <class T>
178typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { 184typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
179 QArray<int> ints = m_backEnd->allRecords(); 185 QArray<int> ints = m_backEnd->allRecords();
180 List lis(ints, this ); 186 List lis(ints, this );
181 return lis; 187 return lis;
182} 188}
183template <class T> 189template <class T>
190typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const {
191 QArray<int> ints = m_backEnd->matchRegexp( r );
192 List lis(ints, this );
193 return lis;
194}
195template <class T>
184QArray<int> OPimAccessTemplate<T>::records()const { 196QArray<int> OPimAccessTemplate<T>::records()const {
185 return m_backEnd->allRecords(); 197 return m_backEnd->allRecords();
186} 198}
187template <class T> 199template <class T>
188typename OPimAccessTemplate<T>::List 200typename OPimAccessTemplate<T>::List
189OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { 201OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index c7f9460..de2d9f4 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -70,12 +70,18 @@ public:
70 /** 70 /**
71 * the name of the Record 71 * the name of the Record
72 */ 72 */
73 virtual QString type()const = 0; 73 virtual QString type()const = 0;
74 74
75 /** 75 /**
76 * matches the Records the regular expression?
77 */
78 virtual bool match( const QString &regexp ) const {return match(QRegExp(regexp));};
79 virtual bool match( const QRegExp &regexp ) const = 0;
80
81 /**
76 * converts the internal structure to a map 82 * converts the internal structure to a map
77 */ 83 */
78 virtual QMap<int, QString> toMap()const = 0; 84 virtual QMap<int, QString> toMap()const = 0;
79 85
80 /** 86 /**
81 * key value representation of extra items 87 * key value representation of extra items
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index 96a5f65..a38b62b 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -944,21 +944,12 @@ void OContact::setEmails( const QString &str )
944void OContact::setChildren( const QString &str ) 944void OContact::setChildren( const QString &str )
945{ 945{
946 replace( Qtopia::Children, str ); 946 replace( Qtopia::Children, str );
947} 947}
948 948
949/*! 949/*!
950 Returns TRUE if the contact matches the regular expression \a regexp.
951 Otherwise returns FALSE.
952*/
953bool OContact::match( const QString &regexp ) const
954{
955 return match(QRegExp(regexp));
956}
957
958/*!
959 \overload 950 \overload
960 Returns TRUE if the contact matches the regular expression \a regexp. 951 Returns TRUE if the contact matches the regular expression \a regexp.
961 Otherwise returns FALSE. 952 Otherwise returns FALSE.
962*/ 953*/
963bool OContact::match( const QRegExp &r ) const 954bool OContact::match( const QRegExp &r ) const
964{ 955{
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 50f6176..0e6cbd2 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -108,14 +108,13 @@ public:
108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
109 void setChildren( const QString &v ); 109 void setChildren( const QString &v );
110 110
111 // other 111 // other
112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
113 113
114 bool match( const QString &regexp ) const; 114 virtual bool match( const QRegExp &regexp ) const;
115 bool match( const QRegExp &regexp ) const;
116 115
117// // custom 116// // custom
118// void setCustomField( const QString &key, const QString &v ) 117// void setCustomField( const QString &key, const QString &v )
119// { replace(Custom- + key, v ); } 118// { replace(Custom- + key, v ); }
120 119
121 // name 120 // name
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index 3ba8a52..28cf873 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -1,10 +1,11 @@
1#include <qshared.h> 1#include <qshared.h>
2 2
3#include <qpe/palmtopuidgen.h> 3#include <qpe/palmtopuidgen.h>
4#include <qpe/categories.h> 4#include <qpe/categories.h>
5#include <qpe/stringutil.h>
5 6
6#include "orecur.h" 7#include "orecur.h"
7#include "opimresolver.h" 8#include "opimresolver.h"
8#include "opimnotifymanager.h" 9#include "opimnotifymanager.h"
9 10
10#include "oevent.h" 11#include "oevent.h"
@@ -207,22 +208,52 @@ void OEvent::setTimeZone( const QString& tz ) {
207 data->timezone = tz; 208 data->timezone = tz;
208} 209}
209QString OEvent::timeZone()const { 210QString OEvent::timeZone()const {
210 if (data->isAllDay ) return QString::fromLatin1("UTC"); 211 if (data->isAllDay ) return QString::fromLatin1("UTC");
211 return data->timezone; 212 return data->timezone;
212} 213}
213bool OEvent::match( const QRegExp& )const { 214bool OEvent::match( const QRegExp& re )const {
214 // FIXME 215 if (data->description.contains( re ) )
216 return true;
217 if ( data->note.contains( re ) )
218 return true;
219 if ( data->location.contains( re ) )
220 return true;
221 if ( data->start.toString().contains( re ) )
222 return true;
223 if ( data->end.toString().contains( re ) )
224 return true;
215 return false; 225 return false;
216} 226}
217QString OEvent::toRichText()const { 227QString OEvent::toRichText()const {
218 // FIXME 228 QString text;
219 return "OEvent test"; 229 if ( !description().isEmpty() ) {
230 text += "<b>" + QObject::tr( "Description:") + "</b><br>";
231 text += Qtopia::escapeString(description() ).
232 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
233 }
234 if ( startDateTime().isValid() ) {
235 text += "<b>" + QObject::tr( "Start:") + "</b> ";
236 text += Qtopia::escapeString(startDateTime().toString() ).
237 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
238 }
239 if ( endDateTime().isValid() ) {
240 text += "<b>" + QObject::tr( "End:") + "</b> ";
241 text += Qtopia::escapeString(endDateTime().toString() ).
242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
243 }
244 if ( !note().isEmpty() ) {
245 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
246 text += note();
247// text += Qtopia::escapeString(note() ).
248// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
249 }
250 return text;
220} 251}
221QString OEvent::toShortText()const { 252QString OEvent::toShortText()const {
222 return "OEvent shotText"; 253 return description();
223} 254}
224QString OEvent::type()const { 255QString OEvent::type()const {
225 return QString::fromLatin1("OEvent"); 256 return QString::fromLatin1("OEvent");
226} 257}
227QString OEvent::recordField( int /*id */ )const { 258QString OEvent::recordField( int /*id */ )const {
228 return QString::null; 259 return QString::null;
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h
index 57d32d0..b696d81 100644
--- a/libopie2/opiepim/oevent.h
+++ b/libopie2/opiepim/oevent.h
@@ -110,13 +110,13 @@ public:
110 110
111 /* pin this event to a timezone! FIXME */ 111 /* pin this event to a timezone! FIXME */
112 void setTimeZone( const QString& timeZone ); 112 void setTimeZone( const QString& timeZone );
113 QString timeZone()const; 113 QString timeZone()const;
114 114
115 115
116 bool match( const QRegExp& )const; 116 virtual bool match( const QRegExp& )const;
117 117
118 /** For exception to recurrence here is a list of children... */ 118 /** For exception to recurrence here is a list of children... */
119 QArray<int> children()const; 119 QArray<int> children()const;
120 void setChildren( const QArray<int>& ); 120 void setChildren( const QArray<int>& );
121 void addChild( int uid ); 121 void addChild( int uid );
122 void removeChild( int uid ); 122 void removeChild( int uid );
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index a58d9aa..0e7c73f 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -255,13 +255,13 @@ public:
255 */ 255 */
256 void setMaintainer( const OPimMaintainer& ); 256 void setMaintainer( const OPimMaintainer& );
257 257
258 bool isOverdue(); 258 bool isOverdue();
259 259
260 260
261 bool match( const QRegExp &r )const; 261 virtual bool match( const QRegExp &r )const;
262 262
263 bool operator<(const OTodo &toDoEvent )const; 263 bool operator<(const OTodo &toDoEvent )const;
264 bool operator<=(const OTodo &toDoEvent )const; 264 bool operator<=(const OTodo &toDoEvent )const;
265 bool operator!=(const OTodo &toDoEvent )const; 265 bool operator!=(const OTodo &toDoEvent )const;
266 bool operator>(const OTodo &toDoEvent )const; 266 bool operator>(const OTodo &toDoEvent )const;
267 bool operator>=(const OTodo &toDoEvent)const; 267 bool operator>=(const OTodo &toDoEvent)const;