summaryrefslogtreecommitdiffabout
path: root/libkcal/alarm.cpp
authorzautrix <zautrix>2005-07-28 10:38:58 (UTC)
committer zautrix <zautrix>2005-07-28 10:38:58 (UTC)
commitfee4c893fe8fd01af1b55c1ccd40213fc18a36b4 (patch) (unidiff)
tree83a3018d54d60e880d441a6f91ef8fe54254aaff /libkcal/alarm.cpp
parent27ffa2e08ebb38e71f613af3a214750442418e2c (diff)
downloadkdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.zip
kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.tar.gz
kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.tar.bz2
fixxxx
Diffstat (limited to 'libkcal/alarm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 79e0464..3157214 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -225,257 +225,257 @@ void Alarm::setEmailAlarm(const QString &subject, const QString &text,
225void Alarm::setMailAddress(const Person &mailAddress) 225void Alarm::setMailAddress(const Person &mailAddress)
226{ 226{
227 if (mType == Email) { 227 if (mType == Email) {
228 mMailAddresses.clear(); 228 mMailAddresses.clear();
229 mMailAddresses += mailAddress; 229 mMailAddresses += mailAddress;
230 mParent->updated(); 230 mParent->updated();
231 } 231 }
232} 232}
233 233
234void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses) 234void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses)
235{ 235{
236 if (mType == Email) { 236 if (mType == Email) {
237 mMailAddresses = mailAddresses; 237 mMailAddresses = mailAddresses;
238 mParent->updated(); 238 mParent->updated();
239 } 239 }
240} 240}
241 241
242void Alarm::addMailAddress(const Person &mailAddress) 242void Alarm::addMailAddress(const Person &mailAddress)
243{ 243{
244 if (mType == Email) { 244 if (mType == Email) {
245 mMailAddresses += mailAddress; 245 mMailAddresses += mailAddress;
246 mParent->updated(); 246 mParent->updated();
247 } 247 }
248} 248}
249 249
250QValueList<Person> Alarm::mailAddresses() const 250QValueList<Person> Alarm::mailAddresses() const
251{ 251{
252 return (mType == Email) ? mMailAddresses : QValueList<Person>(); 252 return (mType == Email) ? mMailAddresses : QValueList<Person>();
253} 253}
254 254
255void Alarm::setMailSubject(const QString &mailAlarmSubject) 255void Alarm::setMailSubject(const QString &mailAlarmSubject)
256{ 256{
257 if (mType == Email) { 257 if (mType == Email) {
258 mMailSubject = mailAlarmSubject; 258 mMailSubject = mailAlarmSubject;
259 mParent->updated(); 259 mParent->updated();
260 } 260 }
261} 261}
262 262
263QString Alarm::mailSubject() const 263QString Alarm::mailSubject() const
264{ 264{
265 return (mType == Email) ? mMailSubject : QString::null; 265 return (mType == Email) ? mMailSubject : QString::null;
266} 266}
267 267
268void Alarm::setMailAttachment(const QString &mailAttachFile) 268void Alarm::setMailAttachment(const QString &mailAttachFile)
269{ 269{
270 if (mType == Email) { 270 if (mType == Email) {
271 mMailAttachFiles.clear(); 271 mMailAttachFiles.clear();
272 mMailAttachFiles += mailAttachFile; 272 mMailAttachFiles += mailAttachFile;
273 mParent->updated(); 273 mParent->updated();
274 } 274 }
275} 275}
276 276
277void Alarm::setMailAttachments(const QStringList &mailAttachFiles) 277void Alarm::setMailAttachments(const QStringList &mailAttachFiles)
278{ 278{
279 if (mType == Email) { 279 if (mType == Email) {
280 mMailAttachFiles = mailAttachFiles; 280 mMailAttachFiles = mailAttachFiles;
281 mParent->updated(); 281 mParent->updated();
282 } 282 }
283} 283}
284 284
285void Alarm::addMailAttachment(const QString &mailAttachFile) 285void Alarm::addMailAttachment(const QString &mailAttachFile)
286{ 286{
287 if (mType == Email) { 287 if (mType == Email) {
288 mMailAttachFiles += mailAttachFile; 288 mMailAttachFiles += mailAttachFile;
289 mParent->updated(); 289 mParent->updated();
290 } 290 }
291} 291}
292 292
293QStringList Alarm::mailAttachments() const 293QStringList Alarm::mailAttachments() const
294{ 294{
295 return (mType == Email) ? mMailAttachFiles : QStringList(); 295 return (mType == Email) ? mMailAttachFiles : QStringList();
296} 296}
297 297
298void Alarm::setMailText(const QString &text) 298void Alarm::setMailText(const QString &text)
299{ 299{
300 if (mType == Email) { 300 if (mType == Email) {
301 mDescription = text; 301 mDescription = text;
302 mParent->updated(); 302 mParent->updated();
303 } 303 }
304} 304}
305 305
306QString Alarm::mailText() const 306QString Alarm::mailText() const
307{ 307{
308 return (mType == Email) ? mDescription : QString::null; 308 return (mType == Email) ? mDescription : QString::null;
309} 309}
310 310
311void Alarm::setDisplayAlarm(const QString &text) 311void Alarm::setDisplayAlarm(const QString &text)
312{ 312{
313 mType = Display; 313 mType = Display;
314 mDescription = text; 314 mDescription = text;
315 mParent->updated(); 315 mParent->updated();
316} 316}
317 317
318void Alarm::setText(const QString &text) 318void Alarm::setText(const QString &text)
319{ 319{
320 if (mType == Display) { 320 if (mType == Display) {
321 mDescription = text; 321 mDescription = text;
322 mParent->updated(); 322 mParent->updated();
323 } 323 }
324} 324}
325 325
326QString Alarm::text() const 326QString Alarm::text() const
327{ 327{
328 return (mType == Display) ? mDescription : QString::null; 328 return (mType == Display) ? mDescription : QString::null;
329} 329}
330 330
331void Alarm::setTime(const QDateTime &alarmTime) 331void Alarm::setTime(const QDateTime &alarmTime)
332{ 332{
333 mAlarmTime = alarmTime; 333 mAlarmTime = alarmTime;
334 mHasTime = true; 334 mHasTime = true;
335 335
336 mParent->updated(); 336 mParent->updated();
337} 337}
338int Alarm::offset() 338int Alarm::offset()
339{ 339{
340 if ( hasTime() ) { 340 if ( hasTime() ) {
341 if (mParent->typeID() == todoID ) { 341 if (mParent->typeID() == todoID ) {
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 if ( !mParent->alarmEnabled() ) 374 if ( !mParent->alarmEnabled() )
375 return "!"+message + i18n("(disabled)"); 375 return "!"+message + i18n("(disabled)");
376 return message; 376 return message;
377} 377}
378 378
379 379
380QDateTime Alarm::time() const 380QDateTime Alarm::time() const
381{ 381{
382 if ( hasTime() ) 382 if ( hasTime() )
383 return mAlarmTime; 383 return mAlarmTime;
384 else 384 else
385 { 385 {
386 if (mParent->typeID() == todoID ) { 386 if (mParent->typeID() == todoID ) {
387 Todo *t = static_cast<Todo*>(mParent); 387 Todo *t = static_cast<Todo*>(mParent);
388 return mOffset.end( t->dtDue() ); 388 return mOffset.end( t->dtDue() );
389 } else if (mEndOffset) { 389 } else if (mEndOffset) {
390 return mOffset.end( mParent->dtEnd() ); 390 return mOffset.end( mParent->dtEnd() );
391 } else { 391 } else {
392 return mOffset.end( mParent->dtStart() ); 392 return mOffset.end( mParent->dtStart() );
393 } 393 }
394 } 394 }
395} 395}
396 396
397bool Alarm::hasTime() const 397bool Alarm::hasTime() const
398{ 398{
399 return mHasTime; 399 return mHasTime;
400} 400}
401 401
402void Alarm::setSnoozeTime(int alarmSnoozeTime) 402void Alarm::setSnoozeTime(int alarmSnoozeTime)
403{ 403{
404 mAlarmSnoozeTime = alarmSnoozeTime; 404 mAlarmSnoozeTime = alarmSnoozeTime;
405 mParent->updated(); 405 mParent->updated();
406} 406}
407 407
408int Alarm::snoozeTime() const 408int Alarm::snoozeTime() const
409{ 409{
410 return mAlarmSnoozeTime; 410 return mAlarmSnoozeTime;
411} 411}
412 412
413void Alarm::setRepeatCount(int alarmRepeatCount) 413void Alarm::setRepeatCount(int alarmRepeatCount)
414{ 414{
415 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; 415 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl;
416 416
417 mAlarmRepeatCount = alarmRepeatCount; 417 mAlarmRepeatCount = alarmRepeatCount;
418 mParent->updated(); 418 mParent->updated();
419} 419}
420 420
421int Alarm::repeatCount() const 421int Alarm::repeatCount() const
422{ 422{
423 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; 423 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl;
424 return mAlarmRepeatCount; 424 return mAlarmRepeatCount;
425} 425}
426 426
427void Alarm::toggleAlarm() 427void Alarm::toggleAlarm()
428{ 428{
429 mAlarmEnabled = !mAlarmEnabled; 429 mAlarmEnabled = !mAlarmEnabled;
430 mParent->updated(); 430 mParent->updated();
431} 431}
432 432
433void Alarm::setEnabled(bool enable) 433void Alarm::setEnabled(bool enable)
434{ 434{
435 mAlarmEnabled = enable; 435 mAlarmEnabled = enable;
436 mParent->updated(); 436 mParent->updated();
437} 437}
438 438
439bool Alarm::enabled() const 439bool Alarm::enabled() const
440{ 440{
441 return mAlarmEnabled; 441 return mAlarmEnabled;
442} 442}
443 443
444void Alarm::setStartOffset( const Duration &offset ) 444void Alarm::setStartOffset( const Duration &offset )
445{ 445{
446 mOffset = offset; 446 mOffset = offset;
447 mEndOffset = false; 447 mEndOffset = false;
448 mHasTime = false; 448 mHasTime = false;
449 mParent->updated(); 449 mParent->updated();
450} 450}
451 451
452Duration Alarm::startOffset() const 452Duration Alarm::startOffset() const
453{ 453{
454 return (mHasTime || mEndOffset) ? 0 : mOffset; 454 return (mHasTime || mEndOffset) ? 0 : mOffset;
455} 455}
456 456
457bool Alarm::hasStartOffset() const 457bool Alarm::hasStartOffset() const
458{ 458{
459 return !mHasTime && !mEndOffset; 459 return !mHasTime && !mEndOffset;
460} 460}
461 461
462bool Alarm::hasEndOffset() const 462bool Alarm::hasEndOffset() const
463{ 463{
464 return !mHasTime && mEndOffset; 464 return !mHasTime && mEndOffset;
465} 465}
466 466
467void Alarm::setEndOffset( const Duration &offset ) 467void Alarm::setEndOffset( const Duration &offset )
468{ 468{
469 mOffset = offset; 469 mOffset = offset;
470 mEndOffset = true; 470 mEndOffset = true;
471 mHasTime = false; 471 mHasTime = false;
472 mParent->updated(); 472 mParent->updated();
473} 473}
474 474
475Duration Alarm::endOffset() const 475Duration Alarm::endOffset() const
476{ 476{
477 return (mHasTime || !mEndOffset) ? 0 : mOffset; 477 return (mHasTime || !mEndOffset) ? 0 : mOffset;
478} 478}
479 479
480void Alarm::setParent( Incidence *parent ) 480void Alarm::setParent( Incidence *parent )
481{ 481{