summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-04-17 17:29:12 (UTC)
committer zautrix <zautrix>2005-04-17 17:29:12 (UTC)
commite3e76014e70643b0828f30f5c5277e212495d37c (patch) (unidiff)
tree6c1b65d08bbecf7f5d83db636cebe3425b1521e8 /libkcal
parent70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (diff)
downloadkdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.zip
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.gz
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.bz2
fixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp2
-rw-r--r--libkcal/kincidenceformatter.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index d8f15b5..6de1566 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -337,49 +337,49 @@ void Alarm::setTime(const QDateTime &alarmTime)
337} 337}
338int Alarm::offset() 338int Alarm::offset()
339{ 339{
340 if ( hasTime() ) { 340 if ( hasTime() ) {
341 if (mParent->type()=="Todo") { 341 if (mParent->type()=="Todo") {
342 Todo *t = static_cast<Todo*>(mParent); 342 Todo *t = static_cast<Todo*>(mParent);
343 return t->dtDue().secsTo( mAlarmTime ) ; 343 return t->dtDue().secsTo( mAlarmTime ) ;
344 } else 344 } else
345 return mParent->dtStart().secsTo( mAlarmTime ) ; 345 return mParent->dtStart().secsTo( mAlarmTime ) ;
346 } 346 }
347 else 347 else
348 { 348 {
349 return mOffset.asSeconds(); 349 return mOffset.asSeconds();
350 } 350 }
351 351
352} 352}
353QString Alarm::offsetText() 353QString Alarm::offsetText()
354{ 354{
355 int min = -offset()/60; 355 int min = -offset()/60;
356 int hours = min /60; 356 int hours = min /60;
357 min = min % 60; 357 min = min % 60;
358 int days = hours /24; 358 int days = hours /24;
359 hours = hours % 24; 359 hours = hours % 24;
360 QString message; 360 QString message;
361 qDebug("%d %d %d ", days, hours, min ); 361 //qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 ) 362 if ( days > 0 )
363 message += i18n("%1d").arg( days ); 363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) { 364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/"; 365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours ); 366 message += i18n("%1h").arg( hours );
367 } 367 }
368 if ( min > 0 ) { 368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/"; 369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min ); 370 message += i18n("%1min").arg( min );
371 } 371 }
372 if ( message.isEmpty() ) 372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 ); 373 message = i18n("%1min").arg( 0 );
374 return message; 374 return message;
375} 375}
376 376
377 377
378QDateTime Alarm::time() const 378QDateTime Alarm::time() const
379{ 379{
380 if ( hasTime() ) 380 if ( hasTime() )
381 return mAlarmTime; 381 return mAlarmTime;
382 else 382 else
383 { 383 {
384 if (mParent->type()=="Todo") { 384 if (mParent->type()=="Todo") {
385 Todo *t = static_cast<Todo*>(mParent); 385 Todo *t = static_cast<Todo*>(mParent);
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 8ae5b46..7d61b7f 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -262,49 +262,49 @@ void KIncidenceFormatter::setTodo(Todo *event )
262#ifdef DESKTOP_VERSION 262#ifdef DESKTOP_VERSION
263 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 263 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
264#else 264#else
265 addTag("p",i18n("<b>Last modified: ") +" </b>"); 265 addTag("p",i18n("<b>Last modified: ") +" </b>");
266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
267#endif 267#endif
268 268
269 } 269 }
270 if ( mDetails ) { 270 if ( mDetails ) {
271 if (!event->description().isEmpty()) { 271 if (!event->description().isEmpty()) {
272 addTag("p",i18n("<b>Details: </b>")); 272 addTag("p",i18n("<b>Details: </b>"));
273 addTag("p",deTag(event->description())); 273 addTag("p",deTag(event->description()));
274 } 274 }
275 } 275 }
276} 276}
277 277
278void KIncidenceFormatter::setJournal(Journal* ) 278void KIncidenceFormatter::setJournal(Journal* )
279{ 279{
280 280
281} 281}
282 282
283void KIncidenceFormatter::formatCategories(Incidence *event) 283void KIncidenceFormatter::formatCategories(Incidence *event)
284{ 284{
285 if (!event->categoriesStr().isEmpty()) { 285 if (!event->categoriesStr().isEmpty()) {
286 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 286 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() );
287 //mText.append(event->categoriesStr()); 287 //mText.append(event->categoriesStr());
288 } 288 }
289} 289}
290void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 290void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
291{ 291{
292 int number=text.contains("\n"); 292 int number=text.contains("\n");
293 QString str = "<" + tag + ">"; 293 QString str = "<" + tag + ">";
294 QString tmpText=text; 294 QString tmpText=text;
295 QString tmpStr=str; 295 QString tmpStr=str;
296 if(number !=-1) 296 if(number !=-1)
297 { 297 {
298 if (number > 0) { 298 if (number > 0) {
299 int pos=0; 299 int pos=0;
300 QString tmp; 300 QString tmp;
301 for(int i=0;i<=number;i++) { 301 for(int i=0;i<=number;i++) {
302 pos=tmpText.find("\n"); 302 pos=tmpText.find("\n");
303 tmp=tmpText.left(pos); 303 tmp=tmpText.left(pos);
304 tmpText=tmpText.right(tmpText.length()-pos-1); 304 tmpText=tmpText.right(tmpText.length()-pos-1);
305 tmpStr+=tmp+"<br>"; 305 tmpStr+=tmp+"<br>";
306 } 306 }
307 } 307 }
308 else tmpStr += tmpText; 308 else tmpStr += tmpText;
309 tmpStr+="</" + tag + ">"; 309 tmpStr+="</" + tag + ">";
310 mText.append(tmpStr); 310 mText.append(tmpStr);