summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/oevent.cpp10
-rw-r--r--libopie2/opiepim/oevent.cpp10
2 files changed, 10 insertions, 10 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index b731c8a..cda12f9 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -151,137 +151,137 @@ void OEvent::setNote( const QString& note ) {
151} 151}
152QDateTime OEvent::createdDateTime()const { 152QDateTime OEvent::createdDateTime()const {
153 return data->created; 153 return data->created;
154} 154}
155void OEvent::setCreatedDateTime( const QDateTime& time ) { 155void OEvent::setCreatedDateTime( const QDateTime& time ) {
156 changeOrModify(); 156 changeOrModify();
157 data->created = time; 157 data->created = time;
158} 158}
159QDateTime OEvent::startDateTime()const { 159QDateTime OEvent::startDateTime()const {
160 if ( data->isAllDay ) 160 if ( data->isAllDay )
161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) ); 161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) );
162 return data->start; 162 return data->start;
163} 163}
164QDateTime OEvent::startDateTimeInZone()const { 164QDateTime OEvent::startDateTimeInZone()const {
165 /* if no timezone, or all day event or if the current and this timeZone match... */ 165 /* if no timezone, or all day event or if the current and this timeZone match... */
166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime(); 166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
167 167
168 OTimeZone zone(data->timezone ); 168 OTimeZone zone(data->timezone );
169 return zone.toDateTime( data->start, OTimeZone::current() ); 169 return zone.toDateTime( data->start, OTimeZone::current() );
170} 170}
171void OEvent::setStartDateTime( const QDateTime& dt ) { 171void OEvent::setStartDateTime( const QDateTime& dt ) {
172 changeOrModify(); 172 changeOrModify();
173 data->start = dt; 173 data->start = dt;
174} 174}
175QDateTime OEvent::endDateTime()const { 175QDateTime OEvent::endDateTime()const {
176 /* 176 /*
177 * if all Day event the end time needs 177 * if all Day event the end time needs
178 * to be on the same day as the start 178 * to be on the same day as the start
179 */ 179 */
180 if ( data->isAllDay ) 180 if ( data->isAllDay )
181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) ); 181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) );
182 return data->end; 182 return data->end;
183} 183}
184QDateTime OEvent::endDateTimeInZone()const { 184QDateTime OEvent::endDateTimeInZone()const {
185 /* if no timezone, or all day event or if the current and this timeZone match... */ 185 /* if no timezone, or all day event or if the current and this timeZone match... */
186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); 186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
187 187
188 OTimeZone zone(data->timezone ); 188 OTimeZone zone(data->timezone );
189 return zone.toDateTime( data->end, OTimeZone::current() ); 189 return zone.toDateTime( data->end, OTimeZone::current() );
190} 190}
191void OEvent::setEndDateTime( const QDateTime& dt ) { 191void OEvent::setEndDateTime( const QDateTime& dt ) {
192 changeOrModify(); 192 changeOrModify();
193 data->end = dt; 193 data->end = dt;
194} 194}
195bool OEvent::isMultipleDay()const { 195bool 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}
198bool OEvent::isAllDay()const { 198bool OEvent::isAllDay()const {
199 return data->isAllDay; 199 return data->isAllDay;
200} 200}
201void OEvent::setAllDay( bool allDay ) { 201void 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}
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 ( re.match( data->description ) != -1 )
216 return true; 216 return true;
217 if ( data->note.contains( re ) ) 217 if ( re.match( data->note ) != -1 )
218 return true; 218 return true;
219 if ( data->location.contains( re ) ) 219 if ( re.match( data->location ) != -1 )
220 return true; 220 return true;
221 if ( data->start.toString().contains( re ) ) 221 if ( re.match( data->start.toString() ) != -1 )
222 return true; 222 return true;
223 if ( data->end.toString().contains( re ) ) 223 if ( re.match( data->end.toString() ) != -1 )
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 QString text; 253 QString text;
254 text += QString::number( startDateTime().date().day() ); 254 text += QString::number( startDateTime().date().day() );
255 text += "."; 255 text += ".";
256 text += QString::number( startDateTime().date().month() ); 256 text += QString::number( startDateTime().date().month() );
257 text += "."; 257 text += ".";
258 text += QString::number( startDateTime().date().year() ); 258 text += QString::number( startDateTime().date().year() );
259 text += " "; 259 text += " ";
260 text += QString::number( startDateTime().time().hour() ); 260 text += QString::number( startDateTime().time().hour() );
261 text += ":"; 261 text += ":";
262 text += QString::number( startDateTime().time().minute() ); 262 text += QString::number( startDateTime().time().minute() );
263 text += " - "; 263 text += " - ";
264 text += description(); 264 text += description();
265 return text; 265 return text;
266} 266}
267QString OEvent::type()const { 267QString OEvent::type()const {
268 return QString::fromLatin1("OEvent"); 268 return QString::fromLatin1("OEvent");
269} 269}
270QString OEvent::recordField( int /*id */ )const { 270QString OEvent::recordField( int /*id */ )const {
271 return QString::null; 271 return QString::null;
272} 272}
273int OEvent::rtti() { 273int OEvent::rtti() {
274 return OPimResolver::DateBook; 274 return OPimResolver::DateBook;
275} 275}
276bool OEvent::loadFromStream( QDataStream& ) { 276bool OEvent::loadFromStream( QDataStream& ) {
277 return true; 277 return true;
278} 278}
279bool OEvent::saveToStream( QDataStream& )const { 279bool OEvent::saveToStream( QDataStream& )const {
280 return true; 280 return true;
281} 281}
282void OEvent::changeOrModify() { 282void OEvent::changeOrModify() {
283 if ( data->count != 1 ) { 283 if ( data->count != 1 ) {
284 data->deref(); 284 data->deref();
285 Data* d2 = new Data; 285 Data* d2 = new Data;
286 d2->description = data->description; 286 d2->description = data->description;
287 d2->location = data->location; 287 d2->location = data->location;
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index b731c8a..cda12f9 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -151,137 +151,137 @@ void OEvent::setNote( const QString& note ) {
151} 151}
152QDateTime OEvent::createdDateTime()const { 152QDateTime OEvent::createdDateTime()const {
153 return data->created; 153 return data->created;
154} 154}
155void OEvent::setCreatedDateTime( const QDateTime& time ) { 155void OEvent::setCreatedDateTime( const QDateTime& time ) {
156 changeOrModify(); 156 changeOrModify();
157 data->created = time; 157 data->created = time;
158} 158}
159QDateTime OEvent::startDateTime()const { 159QDateTime OEvent::startDateTime()const {
160 if ( data->isAllDay ) 160 if ( data->isAllDay )
161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) ); 161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) );
162 return data->start; 162 return data->start;
163} 163}
164QDateTime OEvent::startDateTimeInZone()const { 164QDateTime OEvent::startDateTimeInZone()const {
165 /* if no timezone, or all day event or if the current and this timeZone match... */ 165 /* if no timezone, or all day event or if the current and this timeZone match... */
166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime(); 166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
167 167
168 OTimeZone zone(data->timezone ); 168 OTimeZone zone(data->timezone );
169 return zone.toDateTime( data->start, OTimeZone::current() ); 169 return zone.toDateTime( data->start, OTimeZone::current() );
170} 170}
171void OEvent::setStartDateTime( const QDateTime& dt ) { 171void OEvent::setStartDateTime( const QDateTime& dt ) {
172 changeOrModify(); 172 changeOrModify();
173 data->start = dt; 173 data->start = dt;
174} 174}
175QDateTime OEvent::endDateTime()const { 175QDateTime OEvent::endDateTime()const {
176 /* 176 /*
177 * if all Day event the end time needs 177 * if all Day event the end time needs
178 * to be on the same day as the start 178 * to be on the same day as the start
179 */ 179 */
180 if ( data->isAllDay ) 180 if ( data->isAllDay )
181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) ); 181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) );
182 return data->end; 182 return data->end;
183} 183}
184QDateTime OEvent::endDateTimeInZone()const { 184QDateTime OEvent::endDateTimeInZone()const {
185 /* if no timezone, or all day event or if the current and this timeZone match... */ 185 /* if no timezone, or all day event or if the current and this timeZone match... */
186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); 186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
187 187
188 OTimeZone zone(data->timezone ); 188 OTimeZone zone(data->timezone );
189 return zone.toDateTime( data->end, OTimeZone::current() ); 189 return zone.toDateTime( data->end, OTimeZone::current() );
190} 190}
191void OEvent::setEndDateTime( const QDateTime& dt ) { 191void OEvent::setEndDateTime( const QDateTime& dt ) {
192 changeOrModify(); 192 changeOrModify();
193 data->end = dt; 193 data->end = dt;
194} 194}
195bool OEvent::isMultipleDay()const { 195bool 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}
198bool OEvent::isAllDay()const { 198bool OEvent::isAllDay()const {
199 return data->isAllDay; 199 return data->isAllDay;
200} 200}
201void OEvent::setAllDay( bool allDay ) { 201void 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}
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 ( re.match( data->description ) != -1 )
216 return true; 216 return true;
217 if ( data->note.contains( re ) ) 217 if ( re.match( data->note ) != -1 )
218 return true; 218 return true;
219 if ( data->location.contains( re ) ) 219 if ( re.match( data->location ) != -1 )
220 return true; 220 return true;
221 if ( data->start.toString().contains( re ) ) 221 if ( re.match( data->start.toString() ) != -1 )
222 return true; 222 return true;
223 if ( data->end.toString().contains( re ) ) 223 if ( re.match( data->end.toString() ) != -1 )
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 QString text; 253 QString text;
254 text += QString::number( startDateTime().date().day() ); 254 text += QString::number( startDateTime().date().day() );
255 text += "."; 255 text += ".";
256 text += QString::number( startDateTime().date().month() ); 256 text += QString::number( startDateTime().date().month() );
257 text += "."; 257 text += ".";
258 text += QString::number( startDateTime().date().year() ); 258 text += QString::number( startDateTime().date().year() );
259 text += " "; 259 text += " ";
260 text += QString::number( startDateTime().time().hour() ); 260 text += QString::number( startDateTime().time().hour() );
261 text += ":"; 261 text += ":";
262 text += QString::number( startDateTime().time().minute() ); 262 text += QString::number( startDateTime().time().minute() );
263 text += " - "; 263 text += " - ";
264 text += description(); 264 text += description();
265 return text; 265 return text;
266} 266}
267QString OEvent::type()const { 267QString OEvent::type()const {
268 return QString::fromLatin1("OEvent"); 268 return QString::fromLatin1("OEvent");
269} 269}
270QString OEvent::recordField( int /*id */ )const { 270QString OEvent::recordField( int /*id */ )const {
271 return QString::null; 271 return QString::null;
272} 272}
273int OEvent::rtti() { 273int OEvent::rtti() {
274 return OPimResolver::DateBook; 274 return OPimResolver::DateBook;
275} 275}
276bool OEvent::loadFromStream( QDataStream& ) { 276bool OEvent::loadFromStream( QDataStream& ) {
277 return true; 277 return true;
278} 278}
279bool OEvent::saveToStream( QDataStream& )const { 279bool OEvent::saveToStream( QDataStream& )const {
280 return true; 280 return true;
281} 281}
282void OEvent::changeOrModify() { 282void OEvent::changeOrModify() {
283 if ( data->count != 1 ) { 283 if ( data->count != 1 ) {
284 data->deref(); 284 data->deref();
285 Data* d2 = new Data; 285 Data* d2 = new Data;
286 d2->description = data->description; 286 d2->description = data->description;
287 d2->location = data->location; 287 d2->location = data->location;