author | tille <tille> | 2003-05-14 15:24:00 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-14 15:24:00 (UTC) |
commit | dbda71abdc7c13ac0acde21320ee00726d95dec4 (patch) (unidiff) | |
tree | 4049f593592b6d7e8a32d9837819c96c6592ae38 | |
parent | 20509790738fae5e63a081183c8c3be3891a5bdb (diff) | |
download | opie-dbda71abdc7c13ac0acde21320ee00726d95dec4.zip opie-dbda71abdc7c13ac0acde21320ee00726d95dec4.tar.gz opie-dbda71abdc7c13ac0acde21320ee00726d95dec4.tar.bz2 |
lastHitField impl
-rw-r--r-- | libopie/pim/oevent.cpp | 20 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiepim/oevent.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 12 |
4 files changed, 46 insertions, 18 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp index cda12f9..2b138c0 100644 --- a/libopie/pim/oevent.cpp +++ b/libopie/pim/oevent.cpp | |||
@@ -191,58 +191,68 @@ QDateTime OEvent::endDateTimeInZone()const { | |||
191 | void OEvent::setEndDateTime( const QDateTime& dt ) { | 191 | void OEvent::setEndDateTime( const QDateTime& dt ) { |
192 | changeOrModify(); | 192 | changeOrModify(); |
193 | data->end = dt; | 193 | data->end = dt; |
194 | } | 194 | } |
195 | bool OEvent::isMultipleDay()const { | 195 | bool OEvent::isMultipleDay()const { |
196 | return data->end.date().day() - data->start.date().day(); | 196 | return data->end.date().day() - data->start.date().day(); |
197 | } | 197 | } |
198 | bool OEvent::isAllDay()const { | 198 | bool OEvent::isAllDay()const { |
199 | return data->isAllDay; | 199 | return data->isAllDay; |
200 | } | 200 | } |
201 | void OEvent::setAllDay( bool allDay ) { | 201 | void OEvent::setAllDay( bool allDay ) { |
202 | changeOrModify(); | 202 | changeOrModify(); |
203 | data->isAllDay = allDay; | 203 | data->isAllDay = allDay; |
204 | if (allDay ) data->timezone = "UTC"; | 204 | if (allDay ) data->timezone = "UTC"; |
205 | } | 205 | } |
206 | void OEvent::setTimeZone( const QString& tz ) { | 206 | void OEvent::setTimeZone( const QString& tz ) { |
207 | changeOrModify(); | 207 | changeOrModify(); |
208 | data->timezone = tz; | 208 | data->timezone = tz; |
209 | } | 209 | } |
210 | QString OEvent::timeZone()const { | 210 | QString OEvent::timeZone()const { |
211 | if (data->isAllDay ) return QString::fromLatin1("UTC"); | 211 | if (data->isAllDay ) return QString::fromLatin1("UTC"); |
212 | return data->timezone; | 212 | return data->timezone; |
213 | } | 213 | } |
214 | bool OEvent::match( const QRegExp& re )const { | 214 | bool OEvent::match( const QRegExp& re )const { |
215 | if ( re.match( data->description ) != -1 ) | 215 | if ( re.match( data->description ) != -1 ){ |
216 | setLastHitField( DatebookDescription ); | ||
216 | return true; | 217 | return true; |
217 | if ( re.match( data->note ) != -1 ) | 218 | } |
219 | if ( re.match( data->note ) != -1 ){ | ||
220 | setLastHitField( Note ); | ||
218 | return true; | 221 | return true; |
219 | if ( re.match( data->location ) != -1 ) | 222 | } |
223 | if ( re.match( data->location ) != -1 ){ | ||
224 | setLastHitField( Location ); | ||
220 | return true; | 225 | return true; |
221 | if ( re.match( data->start.toString() ) != -1 ) | 226 | } |
227 | if ( re.match( data->start.toString() ) != -1 ){ | ||
228 | setLastHitField( StartDateTime ); | ||
222 | return true; | 229 | return true; |
223 | if ( re.match( data->end.toString() ) != -1 ) | 230 | } |
231 | if ( re.match( data->end.toString() ) != -1 ){ | ||
232 | setLastHitField( EndDateTime ); | ||
224 | return true; | 233 | return true; |
234 | } | ||
225 | return false; | 235 | return false; |
226 | } | 236 | } |
227 | QString OEvent::toRichText()const { | 237 | QString OEvent::toRichText()const { |
228 | QString text; | 238 | QString text; |
229 | if ( !description().isEmpty() ) { | 239 | if ( !description().isEmpty() ) { |
230 | text += "<b>" + QObject::tr( "Description:") + "</b><br>"; | 240 | text += "<b>" + QObject::tr( "Description:") + "</b><br>"; |
231 | text += Qtopia::escapeString(description() ). | 241 | text += Qtopia::escapeString(description() ). |
232 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 242 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
233 | } | 243 | } |
234 | if ( startDateTime().isValid() ) { | 244 | if ( startDateTime().isValid() ) { |
235 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | 245 | text += "<b>" + QObject::tr( "Start:") + "</b> "; |
236 | text += Qtopia::escapeString(startDateTime().toString() ). | 246 | text += Qtopia::escapeString(startDateTime().toString() ). |
237 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 247 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
238 | } | 248 | } |
239 | if ( endDateTime().isValid() ) { | 249 | if ( endDateTime().isValid() ) { |
240 | text += "<b>" + QObject::tr( "End:") + "</b> "; | 250 | text += "<b>" + QObject::tr( "End:") + "</b> "; |
241 | text += Qtopia::escapeString(endDateTime().toString() ). | 251 | text += Qtopia::escapeString(endDateTime().toString() ). |
242 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 252 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
243 | } | 253 | } |
244 | if ( !note().isEmpty() ) { | 254 | if ( !note().isEmpty() ) { |
245 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; | 255 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; |
246 | text += note(); | 256 | text += note(); |
247 | // text += Qtopia::escapeString(note() ). | 257 | // text += Qtopia::escapeString(note() ). |
248 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 258 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index a29d88e..e087a00 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -84,55 +84,59 @@ OTodo::OTodo(bool completed, int priority, | |||
84 | OTodo::OTodo(bool completed, int priority, | 84 | OTodo::OTodo(bool completed, int priority, |
85 | const QStringList &category, | 85 | const QStringList &category, |
86 | const QString& summary, | 86 | const QString& summary, |
87 | const QString &description, | 87 | const QString &description, |
88 | ushort progress, | 88 | ushort progress, |
89 | bool hasDate, QDate date, int uid ) | 89 | bool hasDate, QDate date, int uid ) |
90 | : OPimRecord( uid ) | 90 | : OPimRecord( uid ) |
91 | { | 91 | { |
92 | // qWarning("OTodoData" + summary); | 92 | // qWarning("OTodoData" + summary); |
93 | setCategories( idsFromString( category.join(";") ) ); | 93 | setCategories( idsFromString( category.join(";") ) ); |
94 | 94 | ||
95 | data = new OTodoData; | 95 | data = new OTodoData; |
96 | 96 | ||
97 | data->date = date; | 97 | data->date = date; |
98 | data->isCompleted = completed; | 98 | data->isCompleted = completed; |
99 | data->hasDate = hasDate; | 99 | data->hasDate = hasDate; |
100 | data->priority = priority; | 100 | data->priority = priority; |
101 | data->sum = summary; | 101 | data->sum = summary; |
102 | data->prog = progress; | 102 | data->prog = progress; |
103 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 103 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
104 | } | 104 | } |
105 | bool OTodo::match( const QRegExp ®Exp )const | 105 | bool OTodo::match( const QRegExp ®Exp )const |
106 | { | 106 | { |
107 | if( QString::number( data->priority ).find( regExp ) != -1 ){ | 107 | if( QString::number( data->priority ).find( regExp ) != -1 ){ |
108 | return true; | 108 | setLastHitField( Priority ); |
109 | return true; | ||
109 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ | 110 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ |
110 | return true; | 111 | setLastHitField( HasDate ); |
112 | return true; | ||
111 | }else if(data->desc.find( regExp ) != -1 ){ | 113 | }else if(data->desc.find( regExp ) != -1 ){ |
112 | return true; | 114 | setLastHitField( Description ); |
115 | return true; | ||
113 | }else if(data->sum.find( regExp ) != -1 ) { | 116 | }else if(data->sum.find( regExp ) != -1 ) { |
114 | return true; | 117 | setLastHitField( Summary ); |
118 | return true; | ||
115 | } | 119 | } |
116 | return false; | 120 | return false; |
117 | } | 121 | } |
118 | bool OTodo::isCompleted() const | 122 | bool OTodo::isCompleted() const |
119 | { | 123 | { |
120 | return data->isCompleted; | 124 | return data->isCompleted; |
121 | } | 125 | } |
122 | bool OTodo::hasDueDate() const | 126 | bool OTodo::hasDueDate() const |
123 | { | 127 | { |
124 | return data->hasDate; | 128 | return data->hasDate; |
125 | } | 129 | } |
126 | bool OTodo::hasStartDate()const { | 130 | bool OTodo::hasStartDate()const { |
127 | return data->start.isValid(); | 131 | return data->start.isValid(); |
128 | } | 132 | } |
129 | bool OTodo::hasCompletedDate()const { | 133 | bool OTodo::hasCompletedDate()const { |
130 | return data->completed.isValid(); | 134 | return data->completed.isValid(); |
131 | } | 135 | } |
132 | int OTodo::priority()const | 136 | int OTodo::priority()const |
133 | { | 137 | { |
134 | return data->priority; | 138 | return data->priority; |
135 | } | 139 | } |
136 | QString OTodo::summary() const | 140 | QString OTodo::summary() const |
137 | { | 141 | { |
138 | return data->sum; | 142 | return data->sum; |
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index cda12f9..2b138c0 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/oevent.cpp | |||
@@ -191,58 +191,68 @@ QDateTime OEvent::endDateTimeInZone()const { | |||
191 | void OEvent::setEndDateTime( const QDateTime& dt ) { | 191 | void OEvent::setEndDateTime( const QDateTime& dt ) { |
192 | changeOrModify(); | 192 | changeOrModify(); |
193 | data->end = dt; | 193 | data->end = dt; |
194 | } | 194 | } |
195 | bool OEvent::isMultipleDay()const { | 195 | bool OEvent::isMultipleDay()const { |
196 | return data->end.date().day() - data->start.date().day(); | 196 | return data->end.date().day() - data->start.date().day(); |
197 | } | 197 | } |
198 | bool OEvent::isAllDay()const { | 198 | bool OEvent::isAllDay()const { |
199 | return data->isAllDay; | 199 | return data->isAllDay; |
200 | } | 200 | } |
201 | void OEvent::setAllDay( bool allDay ) { | 201 | void OEvent::setAllDay( bool allDay ) { |
202 | changeOrModify(); | 202 | changeOrModify(); |
203 | data->isAllDay = allDay; | 203 | data->isAllDay = allDay; |
204 | if (allDay ) data->timezone = "UTC"; | 204 | if (allDay ) data->timezone = "UTC"; |
205 | } | 205 | } |
206 | void OEvent::setTimeZone( const QString& tz ) { | 206 | void OEvent::setTimeZone( const QString& tz ) { |
207 | changeOrModify(); | 207 | changeOrModify(); |
208 | data->timezone = tz; | 208 | data->timezone = tz; |
209 | } | 209 | } |
210 | QString OEvent::timeZone()const { | 210 | QString OEvent::timeZone()const { |
211 | if (data->isAllDay ) return QString::fromLatin1("UTC"); | 211 | if (data->isAllDay ) return QString::fromLatin1("UTC"); |
212 | return data->timezone; | 212 | return data->timezone; |
213 | } | 213 | } |
214 | bool OEvent::match( const QRegExp& re )const { | 214 | bool OEvent::match( const QRegExp& re )const { |
215 | if ( re.match( data->description ) != -1 ) | 215 | if ( re.match( data->description ) != -1 ){ |
216 | setLastHitField( DatebookDescription ); | ||
216 | return true; | 217 | return true; |
217 | if ( re.match( data->note ) != -1 ) | 218 | } |
219 | if ( re.match( data->note ) != -1 ){ | ||
220 | setLastHitField( Note ); | ||
218 | return true; | 221 | return true; |
219 | if ( re.match( data->location ) != -1 ) | 222 | } |
223 | if ( re.match( data->location ) != -1 ){ | ||
224 | setLastHitField( Location ); | ||
220 | return true; | 225 | return true; |
221 | if ( re.match( data->start.toString() ) != -1 ) | 226 | } |
227 | if ( re.match( data->start.toString() ) != -1 ){ | ||
228 | setLastHitField( StartDateTime ); | ||
222 | return true; | 229 | return true; |
223 | if ( re.match( data->end.toString() ) != -1 ) | 230 | } |
231 | if ( re.match( data->end.toString() ) != -1 ){ | ||
232 | setLastHitField( EndDateTime ); | ||
224 | return true; | 233 | return true; |
234 | } | ||
225 | return false; | 235 | return false; |
226 | } | 236 | } |
227 | QString OEvent::toRichText()const { | 237 | QString OEvent::toRichText()const { |
228 | QString text; | 238 | QString text; |
229 | if ( !description().isEmpty() ) { | 239 | if ( !description().isEmpty() ) { |
230 | text += "<b>" + QObject::tr( "Description:") + "</b><br>"; | 240 | text += "<b>" + QObject::tr( "Description:") + "</b><br>"; |
231 | text += Qtopia::escapeString(description() ). | 241 | text += Qtopia::escapeString(description() ). |
232 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 242 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
233 | } | 243 | } |
234 | if ( startDateTime().isValid() ) { | 244 | if ( startDateTime().isValid() ) { |
235 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | 245 | text += "<b>" + QObject::tr( "Start:") + "</b> "; |
236 | text += Qtopia::escapeString(startDateTime().toString() ). | 246 | text += Qtopia::escapeString(startDateTime().toString() ). |
237 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 247 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
238 | } | 248 | } |
239 | if ( endDateTime().isValid() ) { | 249 | if ( endDateTime().isValid() ) { |
240 | text += "<b>" + QObject::tr( "End:") + "</b> "; | 250 | text += "<b>" + QObject::tr( "End:") + "</b> "; |
241 | text += Qtopia::escapeString(endDateTime().toString() ). | 251 | text += Qtopia::escapeString(endDateTime().toString() ). |
242 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 252 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
243 | } | 253 | } |
244 | if ( !note().isEmpty() ) { | 254 | if ( !note().isEmpty() ) { |
245 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; | 255 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; |
246 | text += note(); | 256 | text += note(); |
247 | // text += Qtopia::escapeString(note() ). | 257 | // text += Qtopia::escapeString(note() ). |
248 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 258 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index a29d88e..e087a00 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -84,55 +84,59 @@ OTodo::OTodo(bool completed, int priority, | |||
84 | OTodo::OTodo(bool completed, int priority, | 84 | OTodo::OTodo(bool completed, int priority, |
85 | const QStringList &category, | 85 | const QStringList &category, |
86 | const QString& summary, | 86 | const QString& summary, |
87 | const QString &description, | 87 | const QString &description, |
88 | ushort progress, | 88 | ushort progress, |
89 | bool hasDate, QDate date, int uid ) | 89 | bool hasDate, QDate date, int uid ) |
90 | : OPimRecord( uid ) | 90 | : OPimRecord( uid ) |
91 | { | 91 | { |
92 | // qWarning("OTodoData" + summary); | 92 | // qWarning("OTodoData" + summary); |
93 | setCategories( idsFromString( category.join(";") ) ); | 93 | setCategories( idsFromString( category.join(";") ) ); |
94 | 94 | ||
95 | data = new OTodoData; | 95 | data = new OTodoData; |
96 | 96 | ||
97 | data->date = date; | 97 | data->date = date; |
98 | data->isCompleted = completed; | 98 | data->isCompleted = completed; |
99 | data->hasDate = hasDate; | 99 | data->hasDate = hasDate; |
100 | data->priority = priority; | 100 | data->priority = priority; |
101 | data->sum = summary; | 101 | data->sum = summary; |
102 | data->prog = progress; | 102 | data->prog = progress; |
103 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 103 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
104 | } | 104 | } |
105 | bool OTodo::match( const QRegExp ®Exp )const | 105 | bool OTodo::match( const QRegExp ®Exp )const |
106 | { | 106 | { |
107 | if( QString::number( data->priority ).find( regExp ) != -1 ){ | 107 | if( QString::number( data->priority ).find( regExp ) != -1 ){ |
108 | return true; | 108 | setLastHitField( Priority ); |
109 | return true; | ||
109 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ | 110 | }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ |
110 | return true; | 111 | setLastHitField( HasDate ); |
112 | return true; | ||
111 | }else if(data->desc.find( regExp ) != -1 ){ | 113 | }else if(data->desc.find( regExp ) != -1 ){ |
112 | return true; | 114 | setLastHitField( Description ); |
115 | return true; | ||
113 | }else if(data->sum.find( regExp ) != -1 ) { | 116 | }else if(data->sum.find( regExp ) != -1 ) { |
114 | return true; | 117 | setLastHitField( Summary ); |
118 | return true; | ||
115 | } | 119 | } |
116 | return false; | 120 | return false; |
117 | } | 121 | } |
118 | bool OTodo::isCompleted() const | 122 | bool OTodo::isCompleted() const |
119 | { | 123 | { |
120 | return data->isCompleted; | 124 | return data->isCompleted; |
121 | } | 125 | } |
122 | bool OTodo::hasDueDate() const | 126 | bool OTodo::hasDueDate() const |
123 | { | 127 | { |
124 | return data->hasDate; | 128 | return data->hasDate; |
125 | } | 129 | } |
126 | bool OTodo::hasStartDate()const { | 130 | bool OTodo::hasStartDate()const { |
127 | return data->start.isValid(); | 131 | return data->start.isValid(); |
128 | } | 132 | } |
129 | bool OTodo::hasCompletedDate()const { | 133 | bool OTodo::hasCompletedDate()const { |
130 | return data->completed.isValid(); | 134 | return data->completed.isValid(); |
131 | } | 135 | } |
132 | int OTodo::priority()const | 136 | int OTodo::priority()const |
133 | { | 137 | { |
134 | return data->priority; | 138 | return data->priority; |
135 | } | 139 | } |
136 | QString OTodo::summary() const | 140 | QString OTodo::summary() const |
137 | { | 141 | { |
138 | return data->sum; | 142 | return data->sum; |