summaryrefslogtreecommitdiff
path: root/libopie/pim/oevent.cpp
Side-by-side diff
Diffstat (limited to 'libopie/pim/oevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/oevent.cpp14
1 files changed, 13 insertions, 1 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 ) {
}
void OEvent::setTimeZone( const QString& tz ) {
changeOrModify();
data->timezone = tz;
}
QString OEvent::timeZone()const {
if (data->isAllDay ) return QString::fromLatin1("UTC");
return data->timezone;
}
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 {
QString text;
if ( !description().isEmpty() ) {
text += "<b>" + QObject::tr( "Description:") + "</b><br>";
text += Qtopia::escapeString(description() ).
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
if ( startDateTime().isValid() ) {
text += "<b>" + QObject::tr( "Start:") + "</b> ";
text += Qtopia::escapeString(startDateTime().toString() ).
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
if ( endDateTime().isValid() ) {
text += "<b>" + QObject::tr( "End:") + "</b> ";
text += Qtopia::escapeString(endDateTime().toString() ).
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
if ( !note().isEmpty() ) {
text += "<b>" + QObject::tr( "Note:") + "</b><br>";
text += note();
// text += Qtopia::escapeString(note() ).
// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
return text;
}
QString OEvent::toShortText()const {
- return description();
+ QString text;
+ text += QString::number( startDateTime().date().day() );
+ text += ".";
+ text += QString::number( startDateTime().date().month() );
+ text += ".";
+ text += QString::number( startDateTime().date().year() );
+ text += " ";
+ text += QString::number( startDateTime().time().hour() );
+ text += ":";
+ text += QString::number( startDateTime().time().minute() );
+ text += " - ";
+ text += description();
+ return text;
}
QString OEvent::type()const {
return QString::fromLatin1("OEvent");
}
QString OEvent::recordField( int /*id */ )const {
return QString::null;
}
int OEvent::rtti() {
return OPimResolver::DateBook;
}
bool OEvent::loadFromStream( QDataStream& ) {
return true;
}
bool OEvent::saveToStream( QDataStream& )const {
return true;
}
void OEvent::changeOrModify() {
if ( data->count != 1 ) {
data->deref();
Data* d2 = new Data;
d2->description = data->description;
d2->location = data->location;
if (data->manager )
d2->manager = new OPimNotifyManager( *data->manager );
if ( data->recur )
d2->recur = new ORecur( *data->recur );
d2->note = data->note;
d2->created = data->created;
d2->start = data->start;
d2->end = data->end;
d2->isAllDay = data->isAllDay;
d2->timezone = data->timezone;
d2->parent = data->parent;
if ( data->child ) {
d2->child = new QArray<int>( *data->child );
d2->child->detach();
}
data = d2;
}
}
void OEvent::deref() {
if ( data->deref() ) {
delete data;