From 0cb4111d34d9fe96731f48983e1ff2e67262db02 Mon Sep 17 00:00:00 2001 From: tille Date: Thu, 08 May 2003 13:55:09 +0000 Subject: search stuff and match, toRichText & toShortText in oevent --- (limited to 'libopie/pim/oevent.cpp') 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 @@ -2,6 +2,7 @@ #include #include +#include #include "orecur.h" #include "opimresolver.h" @@ -210,16 +211,46 @@ QString OEvent::timeZone()const { if (data->isAllDay ) return QString::fromLatin1("UTC"); return data->timezone; } -bool OEvent::match( const QRegExp& )const { - // FIXME +bool OEvent::match( const QRegExp& re )const { + if (data->description.contains( re ) ) + return true; + if ( data->note.contains( re ) ) + return true; + if ( data->location.contains( re ) ) + return true; + if ( data->start.toString().contains( re ) ) + return true; + if ( data->end.toString().contains( re ) ) + return true; return false; } QString OEvent::toRichText()const { - // FIXME - return "OEvent test"; + QString text; + if ( !description().isEmpty() ) { + text += "" + QObject::tr( "Description:") + "
"; + text += Qtopia::escapeString(description() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } + if ( startDateTime().isValid() ) { + text += "" + QObject::tr( "Start:") + " "; + text += Qtopia::escapeString(startDateTime().toString() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } + if ( endDateTime().isValid() ) { + text += "" + QObject::tr( "End:") + " "; + text += Qtopia::escapeString(endDateTime().toString() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } + if ( !note().isEmpty() ) { + text += "" + QObject::tr( "Note:") + "
"; + text += note(); +// text += Qtopia::escapeString(note() ). +// replace(QRegExp( "[\n]"), "
" ) + "
"; + } + return text; } QString OEvent::toShortText()const { - return "OEvent shotText"; + return description(); } QString OEvent::type()const { return QString::fromLatin1("OEvent"); -- cgit v0.9.0.2