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 | |||
@@ -949,11 +949,2 @@ void OContact::setChildren( const QString &str ) | |||
949 | /*! | 949 | /*! |
950 | Returns TRUE if the contact matches the regular expression \a regexp. | ||
951 | Otherwise returns FALSE. | ||
952 | */ | ||
953 | bool OContact::match( const QString ®exp ) const | ||
954 | { | ||
955 | return match(QRegExp(regexp)); | ||
956 | } | ||
957 | |||
958 | /*! | ||
959 | \overload | 950 | \overload |
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 | |||
@@ -113,4 +113,3 @@ public: | |||
113 | 113 | ||
114 | bool match( const QString ®exp ) const; | 114 | virtual bool match( const QRegExp ®exp ) const; |
115 | bool match( const QRegExp ®exp ) const; | ||
116 | 115 | ||
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 | |||
@@ -23,2 +23,6 @@ | |||
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 |
@@ -75,3 +79,3 @@ OContactAccess::OContactAccess ( const QString appname, const QString , | |||
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..). |
@@ -85,3 +89,3 @@ OContactAccess::OContactAccess ( const QString appname, const QString , | |||
85 | OPimAccessTemplate<OContact>::setBackEnd (end); | 89 | OPimAccessTemplate<OContact>::setBackEnd (end); |
86 | 90 | ||
87 | 91 | ||
@@ -128,7 +132,2 @@ bool OContactAccess::save () | |||
128 | 132 | ||
129 | ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{ | ||
130 | QArray<int> matchingContacts = m_backEnd -> matchRegexp( r ); | ||
131 | return ( ORecordList<OContact>(matchingContacts, this) ); | ||
132 | } | ||
133 | |||
134 | const uint OContactAccess::querySettings() | 133 | const uint OContactAccess::querySettings() |
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 | |||
@@ -19,2 +19,6 @@ | |||
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 |
@@ -112,4 +116,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | |||
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. |
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 | |||
@@ -588 +588,19 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val | |||
588 | } | 588 | } |
589 | QArray<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 | |||
@@ -24,2 +24,3 @@ public: | |||
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() ); |
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 | |||
@@ -4,2 +4,3 @@ | |||
4 | #include <qpe/categories.h> | 4 | #include <qpe/categories.h> |
5 | #include <qpe/stringutil.h> | ||
5 | 6 | ||
@@ -212,4 +213,13 @@ QString OEvent::timeZone()const { | |||
212 | } | 213 | } |
213 | bool OEvent::match( const QRegExp& )const { | 214 | bool 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; |
@@ -217,7 +227,28 @@ bool OEvent::match( const QRegExp& )const { | |||
217 | QString OEvent::toRichText()const { | 227 | QString 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 | } |
221 | QString OEvent::toShortText()const { | 252 | QString OEvent::toShortText()const { |
222 | return "OEvent shotText"; | 253 | return description(); |
223 | } | 254 | } |
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 | |||
@@ -115,3 +115,3 @@ public: | |||
115 | 115 | ||
116 | bool match( const QRegExp& )const; | 116 | virtual bool match( const QRegExp& )const; |
117 | 117 | ||
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 | |||
@@ -48,2 +48,8 @@ public: | |||
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 | /** |
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 | |||
@@ -71,2 +71,8 @@ public: | |||
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 | ||
@@ -183,2 +189,8 @@ typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | |||
183 | template <class T> | 189 | template <class T> |
190 | typename 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 | } | ||
195 | template <class T> | ||
184 | QArray<int> OPimAccessTemplate<T>::records()const { | 196 | QArray<int> OPimAccessTemplate<T>::records()const { |
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 | |||
@@ -75,2 +75,8 @@ public: | |||
75 | /** | 75 | /** |
76 | * matches the Records the regular expression? | ||
77 | */ | ||
78 | virtual bool match( const QString ®exp ) const {return match(QRegExp(regexp));}; | ||
79 | virtual bool match( const QRegExp ®exp ) const = 0; | ||
80 | |||
81 | /** | ||
76 | * converts the internal structure to a map | 82 | * converts the internal structure to a map |
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 | |||
@@ -260,3 +260,3 @@ public: | |||
260 | 260 | ||
261 | bool match( const QRegExp &r )const; | 261 | virtual bool match( const QRegExp &r )const; |
262 | 262 | ||
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 | |||
@@ -187,2 +187,6 @@ QArray<int> OTodoAccessVCal::allRecords()const { | |||
187 | } | 187 | } |
188 | QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp &r)const { | ||
189 | QArray<int> ar(0); | ||
190 | return ar; | ||
191 | } | ||
188 | QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { | 192 | QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { |
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 | |||
@@ -15,2 +15,3 @@ public: | |||
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() ); |
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 | |||
@@ -776 +776,17 @@ QBitArray OTodoAccessXML::sup() { | |||
776 | } | 776 | } |
777 | QArray<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 | |||
@@ -26,2 +26,3 @@ public: | |||
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() ); |
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 | |||
@@ -588 +588,19 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val | |||
588 | } | 588 | } |
589 | QArray<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 | |||
@@ -24,2 +24,3 @@ public: | |||
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() ); |
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 | |||
@@ -48,2 +48,8 @@ public: | |||
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 | /** |
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 | |||
@@ -187,2 +187,6 @@ QArray<int> OTodoAccessVCal::allRecords()const { | |||
187 | } | 187 | } |
188 | QArray<int> OTodoAccessVCal::matchRegexp(const QRegExp &r)const { | ||
189 | QArray<int> ar(0); | ||
190 | return ar; | ||
191 | } | ||
188 | QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { | 192 | QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int, const QDateTime& ) { |
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 | |||
@@ -15,2 +15,3 @@ public: | |||
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() ); |
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 | |||
@@ -776 +776,17 @@ QBitArray OTodoAccessXML::sup() { | |||
776 | } | 776 | } |
777 | QArray<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 | |||
@@ -26,2 +26,3 @@ public: | |||
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() ); |
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 | |||
@@ -23,2 +23,6 @@ | |||
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 |
@@ -75,3 +79,3 @@ OContactAccess::OContactAccess ( const QString appname, const QString , | |||
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..). |
@@ -85,3 +89,3 @@ OContactAccess::OContactAccess ( const QString appname, const QString , | |||
85 | OPimAccessTemplate<OContact>::setBackEnd (end); | 89 | OPimAccessTemplate<OContact>::setBackEnd (end); |
86 | 90 | ||
87 | 91 | ||
@@ -128,7 +132,2 @@ bool OContactAccess::save () | |||
128 | 132 | ||
129 | ORecordList<OContact> OContactAccess::matchRegexp( const QRegExp &r ) const{ | ||
130 | QArray<int> matchingContacts = m_backEnd -> matchRegexp( r ); | ||
131 | return ( ORecordList<OContact>(matchingContacts, this) ); | ||
132 | } | ||
133 | |||
134 | const uint OContactAccess::querySettings() | 133 | const uint OContactAccess::querySettings() |
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 | |||
@@ -19,2 +19,6 @@ | |||
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 |
@@ -112,4 +116,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact> | |||
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. |
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 | |||
@@ -71,2 +71,8 @@ public: | |||
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 | ||
@@ -183,2 +189,8 @@ typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | |||
183 | template <class T> | 189 | template <class T> |
190 | typename 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 | } | ||
195 | template <class T> | ||
184 | QArray<int> OPimAccessTemplate<T>::records()const { | 196 | QArray<int> OPimAccessTemplate<T>::records()const { |
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 | |||
@@ -75,2 +75,8 @@ public: | |||
75 | /** | 75 | /** |
76 | * matches the Records the regular expression? | ||
77 | */ | ||
78 | virtual bool match( const QString ®exp ) const {return match(QRegExp(regexp));}; | ||
79 | virtual bool match( const QRegExp ®exp ) const = 0; | ||
80 | |||
81 | /** | ||
76 | * converts the internal structure to a map | 82 | * converts the internal structure to a map |
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 | |||
@@ -949,11 +949,2 @@ void OContact::setChildren( const QString &str ) | |||
949 | /*! | 949 | /*! |
950 | Returns TRUE if the contact matches the regular expression \a regexp. | ||
951 | Otherwise returns FALSE. | ||
952 | */ | ||
953 | bool OContact::match( const QString ®exp ) const | ||
954 | { | ||
955 | return match(QRegExp(regexp)); | ||
956 | } | ||
957 | |||
958 | /*! | ||
959 | \overload | 950 | \overload |
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 | |||
@@ -113,4 +113,3 @@ public: | |||
113 | 113 | ||
114 | bool match( const QString ®exp ) const; | 114 | virtual bool match( const QRegExp ®exp ) const; |
115 | bool match( const QRegExp ®exp ) const; | ||
116 | 115 | ||
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 | |||
@@ -4,2 +4,3 @@ | |||
4 | #include <qpe/categories.h> | 4 | #include <qpe/categories.h> |
5 | #include <qpe/stringutil.h> | ||
5 | 6 | ||
@@ -212,4 +213,13 @@ QString OEvent::timeZone()const { | |||
212 | } | 213 | } |
213 | bool OEvent::match( const QRegExp& )const { | 214 | bool 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; |
@@ -217,7 +227,28 @@ bool OEvent::match( const QRegExp& )const { | |||
217 | QString OEvent::toRichText()const { | 227 | QString 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 | } |
221 | QString OEvent::toShortText()const { | 252 | QString OEvent::toShortText()const { |
222 | return "OEvent shotText"; | 253 | return description(); |
223 | } | 254 | } |
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 | |||
@@ -115,3 +115,3 @@ public: | |||
115 | 115 | ||
116 | bool match( const QRegExp& )const; | 116 | virtual bool match( const QRegExp& )const; |
117 | 117 | ||
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 | |||
@@ -260,3 +260,3 @@ public: | |||
260 | 260 | ||
261 | bool match( const QRegExp &r )const; | 261 | virtual bool match( const QRegExp &r )const; |
262 | 262 | ||