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.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index e4f5d92..7bcf944 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -207,110 +207,110 @@ 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 ( re.match( data->description ) != -1 ){
setLastHitField( Qtopia::DatebookDescription );
return true;
}
if ( re.match( data->note ) != -1 ){
setLastHitField( Qtopia::Note );
return true;
}
if ( re.match( data->location ) != -1 ){
setLastHitField( Qtopia::Location );
return true;
}
if ( re.match( data->start.toString() ) != -1 ){
setLastHitField( Qtopia::StartDateTime );
return true;
}
if ( re.match( data->end.toString() ) != -1 ){
setLastHitField( Qtopia::EndDateTime );
return true;
}
return false;
}
QString OEvent::toRichText()const {
QString text, value;
-
+
// description
text += "<b><h3><img src=\"datebook/DateBook\">";
if ( !description().isEmpty() ) {
text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
}
text += "</h3></b><br><hr><br>";
-
+
// location
if ( !(value = location()).isEmpty() ) {
text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
text += Qtopia::escapeString(value) + "<br>";
}
// all day event
if ( isAllDay() ) {
text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
}
// multiple day event
else if ( isMultipleDay () ) {
text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
}
// start & end times
else {
// start time
if ( startDateTime().isValid() ) {
text += "<b>" + QObject::tr( "Start:") + "</b> ";
text += Qtopia::escapeString(startDateTime().toString() ).
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
// end time
if ( endDateTime().isValid() ) {
text += "<b>" + QObject::tr( "End:") + "</b> ";
text += Qtopia::escapeString(endDateTime().toString() ).
replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
}
-
+
// categories
if ( categoryNames("Calendar").count() ){
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames("Calendar").join(", ");
text += "<br>";
}
-
+
//notes
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 {
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;
@@ -331,67 +331,64 @@ void OEvent::changeOrModify() {
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;
data = 0;
}
}
// FIXME
QMap<int, QString> OEvent::toMap()const {
return QMap<int, QString>();
}
-QMap<QString, QString> OEvent::toExtraMap()const {
- return QMap<QString, QString>();
-}
int OEvent::parent()const {
return data->parent;
}
void OEvent::setParent( int uid ) {
changeOrModify();
data->parent = uid;
}
QArray<int> OEvent::children() const{
if (!data->child) return QArray<int>();
else
return data->child->copy();
}
void OEvent::setChildren( const QArray<int>& arr ) {
changeOrModify();
if (data->child) delete data->child;
data->child = new QArray<int>( arr );
data->child->detach();
}
void OEvent::addChild( int uid ) {
changeOrModify();
if (!data->child ) {
data->child = new QArray<int>(1);
(*data->child)[0] = uid;
}else{
int count = data->child->count();
data->child->resize( count + 1 );
(*data->child)[count] = uid;
}
}
void OEvent::removeChild( int uid ) {
if (!data->child || !data->child->contains( uid ) ) return;