summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/oevent.cpp14
-rw-r--r--libopie2/opiepim/oevent.cpp14
2 files changed, 26 insertions, 2 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index 28cf873..b731c8a 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -205,97 +205,109 @@ void OEvent::setAllDay( bool allDay ) {
205} 205}
206void OEvent::setTimeZone( const QString& tz ) { 206void OEvent::setTimeZone( const QString& tz ) {
207 changeOrModify(); 207 changeOrModify();
208 data->timezone = tz; 208 data->timezone = tz;
209} 209}
210QString OEvent::timeZone()const { 210QString 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}
214bool OEvent::match( const QRegExp& re )const { 214bool OEvent::match( const QRegExp& re )const {
215 if (data->description.contains( re ) ) 215 if (data->description.contains( re ) )
216 return true; 216 return true;
217 if ( data->note.contains( re ) ) 217 if ( data->note.contains( re ) )
218 return true; 218 return true;
219 if ( data->location.contains( re ) ) 219 if ( data->location.contains( re ) )
220 return true; 220 return true;
221 if ( data->start.toString().contains( re ) ) 221 if ( data->start.toString().contains( re ) )
222 return true; 222 return true;
223 if ( data->end.toString().contains( re ) ) 223 if ( data->end.toString().contains( re ) )
224 return true; 224 return true;
225 return false; 225 return false;
226} 226}
227QString OEvent::toRichText()const { 227QString OEvent::toRichText()const {
228 QString text; 228 QString text;
229 if ( !description().isEmpty() ) { 229 if ( !description().isEmpty() ) {
230 text += "<b>" + QObject::tr( "Description:") + "</b><br>"; 230 text += "<b>" + QObject::tr( "Description:") + "</b><br>";
231 text += Qtopia::escapeString(description() ). 231 text += Qtopia::escapeString(description() ).
232 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 232 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
233 } 233 }
234 if ( startDateTime().isValid() ) { 234 if ( startDateTime().isValid() ) {
235 text += "<b>" + QObject::tr( "Start:") + "</b> "; 235 text += "<b>" + QObject::tr( "Start:") + "</b> ";
236 text += Qtopia::escapeString(startDateTime().toString() ). 236 text += Qtopia::escapeString(startDateTime().toString() ).
237 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 237 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
238 } 238 }
239 if ( endDateTime().isValid() ) { 239 if ( endDateTime().isValid() ) {
240 text += "<b>" + QObject::tr( "End:") + "</b> "; 240 text += "<b>" + QObject::tr( "End:") + "</b> ";
241 text += Qtopia::escapeString(endDateTime().toString() ). 241 text += Qtopia::escapeString(endDateTime().toString() ).
242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
243 } 243 }
244 if ( !note().isEmpty() ) { 244 if ( !note().isEmpty() ) {
245 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 245 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
246 text += note(); 246 text += note();
247// text += Qtopia::escapeString(note() ). 247// text += Qtopia::escapeString(note() ).
248// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 248// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
249 } 249 }
250 return text; 250 return text;
251} 251}
252QString OEvent::toShortText()const { 252QString OEvent::toShortText()const {
253 return description(); 253 QString text;
254 text += QString::number( startDateTime().date().day() );
255 text += ".";
256 text += QString::number( startDateTime().date().month() );
257 text += ".";
258 text += QString::number( startDateTime().date().year() );
259 text += " ";
260 text += QString::number( startDateTime().time().hour() );
261 text += ":";
262 text += QString::number( startDateTime().time().minute() );
263 text += " - ";
264 text += description();
265 return text;
254} 266}
255QString OEvent::type()const { 267QString OEvent::type()const {
256 return QString::fromLatin1("OEvent"); 268 return QString::fromLatin1("OEvent");
257} 269}
258QString OEvent::recordField( int /*id */ )const { 270QString OEvent::recordField( int /*id */ )const {
259 return QString::null; 271 return QString::null;
260} 272}
261int OEvent::rtti() { 273int OEvent::rtti() {
262 return OPimResolver::DateBook; 274 return OPimResolver::DateBook;
263} 275}
264bool OEvent::loadFromStream( QDataStream& ) { 276bool OEvent::loadFromStream( QDataStream& ) {
265 return true; 277 return true;
266} 278}
267bool OEvent::saveToStream( QDataStream& )const { 279bool OEvent::saveToStream( QDataStream& )const {
268 return true; 280 return true;
269} 281}
270void OEvent::changeOrModify() { 282void OEvent::changeOrModify() {
271 if ( data->count != 1 ) { 283 if ( data->count != 1 ) {
272 data->deref(); 284 data->deref();
273 Data* d2 = new Data; 285 Data* d2 = new Data;
274 d2->description = data->description; 286 d2->description = data->description;
275 d2->location = data->location; 287 d2->location = data->location;
276 288
277 if (data->manager ) 289 if (data->manager )
278 d2->manager = new OPimNotifyManager( *data->manager ); 290 d2->manager = new OPimNotifyManager( *data->manager );
279 291
280 if ( data->recur ) 292 if ( data->recur )
281 d2->recur = new ORecur( *data->recur ); 293 d2->recur = new ORecur( *data->recur );
282 294
283 d2->note = data->note; 295 d2->note = data->note;
284 d2->created = data->created; 296 d2->created = data->created;
285 d2->start = data->start; 297 d2->start = data->start;
286 d2->end = data->end; 298 d2->end = data->end;
287 d2->isAllDay = data->isAllDay; 299 d2->isAllDay = data->isAllDay;
288 d2->timezone = data->timezone; 300 d2->timezone = data->timezone;
289 d2->parent = data->parent; 301 d2->parent = data->parent;
290 302
291 if ( data->child ) { 303 if ( data->child ) {
292 d2->child = new QArray<int>( *data->child ); 304 d2->child = new QArray<int>( *data->child );
293 d2->child->detach(); 305 d2->child->detach();
294 } 306 }
295 307
296 data = d2; 308 data = d2;
297 } 309 }
298} 310}
299void OEvent::deref() { 311void OEvent::deref() {
300 if ( data->deref() ) { 312 if ( data->deref() ) {
301 delete data; 313 delete data;
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index 28cf873..b731c8a 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -205,97 +205,109 @@ void OEvent::setAllDay( bool allDay ) {
205} 205}
206void OEvent::setTimeZone( const QString& tz ) { 206void OEvent::setTimeZone( const QString& tz ) {
207 changeOrModify(); 207 changeOrModify();
208 data->timezone = tz; 208 data->timezone = tz;
209} 209}
210QString OEvent::timeZone()const { 210QString 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}
214bool OEvent::match( const QRegExp& re )const { 214bool OEvent::match( const QRegExp& re )const {
215 if (data->description.contains( re ) ) 215 if (data->description.contains( re ) )
216 return true; 216 return true;
217 if ( data->note.contains( re ) ) 217 if ( data->note.contains( re ) )
218 return true; 218 return true;
219 if ( data->location.contains( re ) ) 219 if ( data->location.contains( re ) )
220 return true; 220 return true;
221 if ( data->start.toString().contains( re ) ) 221 if ( data->start.toString().contains( re ) )
222 return true; 222 return true;
223 if ( data->end.toString().contains( re ) ) 223 if ( data->end.toString().contains( re ) )
224 return true; 224 return true;
225 return false; 225 return false;
226} 226}
227QString OEvent::toRichText()const { 227QString OEvent::toRichText()const {
228 QString text; 228 QString text;
229 if ( !description().isEmpty() ) { 229 if ( !description().isEmpty() ) {
230 text += "<b>" + QObject::tr( "Description:") + "</b><br>"; 230 text += "<b>" + QObject::tr( "Description:") + "</b><br>";
231 text += Qtopia::escapeString(description() ). 231 text += Qtopia::escapeString(description() ).
232 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 232 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
233 } 233 }
234 if ( startDateTime().isValid() ) { 234 if ( startDateTime().isValid() ) {
235 text += "<b>" + QObject::tr( "Start:") + "</b> "; 235 text += "<b>" + QObject::tr( "Start:") + "</b> ";
236 text += Qtopia::escapeString(startDateTime().toString() ). 236 text += Qtopia::escapeString(startDateTime().toString() ).
237 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 237 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
238 } 238 }
239 if ( endDateTime().isValid() ) { 239 if ( endDateTime().isValid() ) {
240 text += "<b>" + QObject::tr( "End:") + "</b> "; 240 text += "<b>" + QObject::tr( "End:") + "</b> ";
241 text += Qtopia::escapeString(endDateTime().toString() ). 241 text += Qtopia::escapeString(endDateTime().toString() ).
242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
243 } 243 }
244 if ( !note().isEmpty() ) { 244 if ( !note().isEmpty() ) {
245 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 245 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
246 text += note(); 246 text += note();
247// text += Qtopia::escapeString(note() ). 247// text += Qtopia::escapeString(note() ).
248// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 248// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
249 } 249 }
250 return text; 250 return text;
251} 251}
252QString OEvent::toShortText()const { 252QString OEvent::toShortText()const {
253 return description(); 253 QString text;
254 text += QString::number( startDateTime().date().day() );
255 text += ".";
256 text += QString::number( startDateTime().date().month() );
257 text += ".";
258 text += QString::number( startDateTime().date().year() );
259 text += " ";
260 text += QString::number( startDateTime().time().hour() );
261 text += ":";
262 text += QString::number( startDateTime().time().minute() );
263 text += " - ";
264 text += description();
265 return text;
254} 266}
255QString OEvent::type()const { 267QString OEvent::type()const {
256 return QString::fromLatin1("OEvent"); 268 return QString::fromLatin1("OEvent");
257} 269}
258QString OEvent::recordField( int /*id */ )const { 270QString OEvent::recordField( int /*id */ )const {
259 return QString::null; 271 return QString::null;
260} 272}
261int OEvent::rtti() { 273int OEvent::rtti() {
262 return OPimResolver::DateBook; 274 return OPimResolver::DateBook;
263} 275}
264bool OEvent::loadFromStream( QDataStream& ) { 276bool OEvent::loadFromStream( QDataStream& ) {
265 return true; 277 return true;
266} 278}
267bool OEvent::saveToStream( QDataStream& )const { 279bool OEvent::saveToStream( QDataStream& )const {
268 return true; 280 return true;
269} 281}
270void OEvent::changeOrModify() { 282void OEvent::changeOrModify() {
271 if ( data->count != 1 ) { 283 if ( data->count != 1 ) {
272 data->deref(); 284 data->deref();
273 Data* d2 = new Data; 285 Data* d2 = new Data;
274 d2->description = data->description; 286 d2->description = data->description;
275 d2->location = data->location; 287 d2->location = data->location;
276 288
277 if (data->manager ) 289 if (data->manager )
278 d2->manager = new OPimNotifyManager( *data->manager ); 290 d2->manager = new OPimNotifyManager( *data->manager );
279 291
280 if ( data->recur ) 292 if ( data->recur )
281 d2->recur = new ORecur( *data->recur ); 293 d2->recur = new ORecur( *data->recur );
282 294
283 d2->note = data->note; 295 d2->note = data->note;
284 d2->created = data->created; 296 d2->created = data->created;
285 d2->start = data->start; 297 d2->start = data->start;
286 d2->end = data->end; 298 d2->end = data->end;
287 d2->isAllDay = data->isAllDay; 299 d2->isAllDay = data->isAllDay;
288 d2->timezone = data->timezone; 300 d2->timezone = data->timezone;
289 d2->parent = data->parent; 301 d2->parent = data->parent;
290 302
291 if ( data->child ) { 303 if ( data->child ) {
292 d2->child = new QArray<int>( *data->child ); 304 d2->child = new QArray<int>( *data->child );
293 d2->child->detach(); 305 d2->child->detach();
294 } 306 }
295 307
296 data = d2; 308 data = d2;
297 } 309 }
298} 310}
299void OEvent::deref() { 311void OEvent::deref() {
300 if ( data->deref() ) { 312 if ( data->deref() ) {
301 delete data; 313 delete data;