• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

  • kcalcore
alarm.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  Copyright (c) 1998 Preston Brown <pbrown@kde.org>
5  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
6  Copyright (c) 2003 David Jarvie <software@astrojar.org.uk>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
33 #include "alarm.h"
34 #include "duration.h"
35 #include "incidence.h"
36 
37 using namespace KCalCore;
38 
43 //@cond PRIVATE
44 class KCalCore::Alarm::Private
45 {
46  public:
47  Private()
48  : mParent( 0 ),
49  mType( Alarm::Invalid ),
50  mAlarmSnoozeTime( 5 ),
51  mAlarmRepeatCount( 0 ),
52  mEndOffset( false ),
53  mHasTime( false ),
54  mAlarmEnabled( false ),
55  mHasLocationRadius ( false ),
56  mLocationRadius ( 0 )
57  {}
58  Private( const Private &other )
59  : mParent( other.mParent ),
60  mType( other.mType ),
61  mDescription( other.mDescription ),
62  mFile( other.mFile ),
63  mMailSubject( other.mMailSubject ),
64  mMailAttachFiles( other.mMailAttachFiles ),
65  mMailAddresses( other.mMailAddresses ),
66  mAlarmTime( other.mAlarmTime ),
67  mAlarmSnoozeTime( other.mAlarmSnoozeTime ),
68  mAlarmRepeatCount( other.mAlarmRepeatCount ),
69  mOffset( other.mOffset ),
70  mEndOffset( other.mEndOffset ),
71  mHasTime( other.mHasTime ),
72  mAlarmEnabled( other.mAlarmEnabled ),
73  mHasLocationRadius( other.mHasLocationRadius ),
74  mLocationRadius( other.mLocationRadius )
75  {}
76 
77  Incidence *mParent; // the incidence which this alarm belongs to
78 
79  Type mType; // type of alarm
80  QString mDescription;// text to display/email body/procedure arguments
81  QString mFile; // program to run/optional audio file to play
82  QString mMailSubject;// subject of email
83  QStringList mMailAttachFiles; // filenames to attach to email
84  Person::List mMailAddresses; // who to mail for reminder
85 
86  KDateTime mAlarmTime;// time at which to trigger the alarm
87  Duration mAlarmSnoozeTime; // how long after alarm to snooze before
88  // triggering again
89  int mAlarmRepeatCount;// number of times for alarm to repeat
90  // after the initial time
91 
92  Duration mOffset; // time relative to incidence DTSTART
93  // to trigger the alarm
94  bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART
95  bool mHasTime; // use mAlarmTime, not mOffset
96  bool mAlarmEnabled;
97 
98  bool mHasLocationRadius;
99  int mLocationRadius; // location radius for the alarm
100 };
101 //@endcond
102 
103 Alarm::Alarm( Incidence *parent ) : d( new KCalCore::Alarm::Private )
104 {
105  d->mParent = parent;
106 }
107 
108 Alarm::Alarm( const Alarm &other ) :
109  CustomProperties( other ), d( new KCalCore::Alarm::Private( *other.d ) )
110 {
111 }
112 
113 Alarm::~Alarm()
114 {
115  delete d;
116 }
117 
118 Alarm &Alarm::operator=( const Alarm &a )
119 {
120  if ( &a != this ) {
121  d->mParent = a.d->mParent;
122  d->mType = a.d->mType;
123  d->mDescription = a.d->mDescription;
124  d->mFile = a.d->mFile;
125  d->mMailAttachFiles = a.d->mMailAttachFiles;
126  d->mMailAddresses = a.d->mMailAddresses;
127  d->mMailSubject = a.d->mMailSubject;
128  d->mAlarmSnoozeTime = a.d->mAlarmSnoozeTime;
129  d->mAlarmRepeatCount = a.d->mAlarmRepeatCount;
130  d->mAlarmTime = a.d->mAlarmTime;
131  d->mOffset = a.d->mOffset;
132  d->mEndOffset = a.d->mEndOffset;
133  d->mHasTime = a.d->mHasTime;
134  d->mAlarmEnabled = a.d->mAlarmEnabled;
135  }
136 
137  return *this;
138 }
139 
140 bool Alarm::operator==( const Alarm &rhs ) const
141 {
142  if ( d->mType != rhs.d->mType ||
143  d->mAlarmSnoozeTime != rhs.d->mAlarmSnoozeTime ||
144  d->mAlarmRepeatCount != rhs.d->mAlarmRepeatCount ||
145  d->mAlarmEnabled != rhs.d->mAlarmEnabled ||
146  d->mHasTime != rhs.d->mHasTime ||
147  d->mHasLocationRadius != rhs.d->mHasLocationRadius ||
148  d->mLocationRadius != rhs.d->mLocationRadius ) {
149  return false;
150  }
151 
152  if ( d->mHasTime ) {
153  if ( d->mAlarmTime != rhs.d->mAlarmTime ) {
154  return false;
155  }
156  } else {
157  if ( d->mOffset != rhs.d->mOffset || d->mEndOffset != rhs.d->mEndOffset ) {
158  return false;
159  }
160  }
161 
162  switch ( d->mType ) {
163  case Display:
164  return d->mDescription == rhs.d->mDescription;
165 
166  case Email:
167  return d->mDescription == rhs.d->mDescription &&
168  d->mMailAttachFiles == rhs.d->mMailAttachFiles &&
169  d->mMailAddresses == rhs.d->mMailAddresses &&
170  d->mMailSubject == rhs.d->mMailSubject;
171 
172  case Procedure:
173  return d->mFile == rhs.d->mFile &&
174  d->mDescription == rhs.d->mDescription;
175 
176  case Audio:
177  return d->mFile == rhs.d->mFile;
178 
179  case Invalid:
180  break;
181  }
182  return false;
183 }
184 
185 bool Alarm::operator!=( const Alarm &a ) const
186 {
187  return !operator==( a );
188 }
189 
190 void Alarm::setType( Alarm::Type type )
191 {
192  if ( type == d->mType ) {
193  return;
194  }
195 
196  if ( d->mParent ) {
197  d->mParent->update();
198  }
199  switch ( type ) {
200  case Display:
201  d->mDescription = "";
202  break;
203  case Procedure:
204  d->mFile = d->mDescription = "";
205  break;
206  case Audio:
207  d->mFile = "";
208  break;
209  case Email:
210  d->mMailSubject = d->mDescription = "";
211  d->mMailAddresses.clear();
212  d->mMailAttachFiles.clear();
213  break;
214  case Invalid:
215  break;
216  default:
217  if ( d->mParent ) {
218  d->mParent->updated(); // not really
219  }
220  return;
221  }
222  d->mType = type;
223  if ( d->mParent ) {
224  d->mParent->updated();
225  }
226 }
227 
228 Alarm::Type Alarm::type() const
229 {
230  return d->mType;
231 }
232 
233 void Alarm::setAudioAlarm( const QString &audioFile )
234 {
235  if ( d->mParent ) {
236  d->mParent->update();
237  }
238  d->mType = Audio;
239  d->mFile = audioFile;
240  if ( d->mParent ) {
241  d->mParent->updated();
242  }
243 }
244 
245 void Alarm::setAudioFile( const QString &audioFile )
246 {
247  if ( d->mType == Audio ) {
248  if ( d->mParent ) {
249  d->mParent->update();
250  }
251  d->mFile = audioFile;
252  if ( d->mParent ) {
253  d->mParent->updated();
254  }
255  }
256 }
257 
258 QString Alarm::audioFile() const
259 {
260  return ( d->mType == Audio ) ? d->mFile : QString();
261 }
262 
263 void Alarm::setProcedureAlarm( const QString &programFile,
264  const QString &arguments )
265 {
266  if ( d->mParent ) {
267  d->mParent->update();
268  }
269  d->mType = Procedure;
270  d->mFile = programFile;
271  d->mDescription = arguments;
272  if ( d->mParent ) {
273  d->mParent->updated();
274  }
275 }
276 
277 void Alarm::setProgramFile( const QString &programFile )
278 {
279  if ( d->mType == Procedure ) {
280  if ( d->mParent ) {
281  d->mParent->update();
282  }
283  d->mFile = programFile;
284  if ( d->mParent ) {
285  d->mParent->updated();
286  }
287  }
288 }
289 
290 QString Alarm::programFile() const
291 {
292  return ( d->mType == Procedure ) ? d->mFile : QString();
293 }
294 
295 void Alarm::setProgramArguments( const QString &arguments )
296 {
297  if ( d->mType == Procedure ) {
298  if ( d->mParent ) {
299  d->mParent->update();
300  }
301  d->mDescription = arguments;
302  if ( d->mParent ) {
303  d->mParent->updated();
304  }
305  }
306 }
307 
308 QString Alarm::programArguments() const
309 {
310  return ( d->mType == Procedure ) ? d->mDescription : QString();
311 }
312 
313 void Alarm::setEmailAlarm( const QString &subject, const QString &text,
314  const Person::List &addressees,
315  const QStringList &attachments )
316 {
317  if ( d->mParent ) {
318  d->mParent->update();
319  }
320  d->mType = Email;
321  d->mMailSubject = subject;
322  d->mDescription = text;
323  d->mMailAddresses = addressees;
324  d->mMailAttachFiles = attachments;
325  if ( d->mParent ) {
326  d->mParent->updated();
327  }
328 }
329 
330 void Alarm::setMailAddress( const Person::Ptr &mailAddress )
331 {
332  if ( d->mType == Email ) {
333  if ( d->mParent ) {
334  d->mParent->update();
335  }
336  d->mMailAddresses.clear();
337  d->mMailAddresses.append( mailAddress );
338  if ( d->mParent ) {
339  d->mParent->updated();
340  }
341  }
342 }
343 
344 void Alarm::setMailAddresses( const Person::List &mailAddresses )
345 {
346  if ( d->mType == Email ) {
347  if ( d->mParent ) {
348  d->mParent->update();
349  }
350  d->mMailAddresses += mailAddresses;
351  if ( d->mParent ) {
352  d->mParent->updated();
353  }
354  }
355 }
356 
357 void Alarm::addMailAddress( const Person::Ptr &mailAddress )
358 {
359  if ( d->mType == Email ) {
360  if ( d->mParent ) {
361  d->mParent->update();
362  }
363  d->mMailAddresses.append( mailAddress );
364  if ( d->mParent ) {
365  d->mParent->updated();
366  }
367  }
368 }
369 
370 Person::List Alarm::mailAddresses() const
371 {
372  return ( d->mType == Email ) ? d->mMailAddresses : Person::List();
373 }
374 
375 void Alarm::setMailSubject( const QString &mailAlarmSubject )
376 {
377  if ( d->mType == Email ) {
378  if ( d->mParent ) {
379  d->mParent->update();
380  }
381  d->mMailSubject = mailAlarmSubject;
382  if ( d->mParent ) {
383  d->mParent->updated();
384  }
385  }
386 }
387 
388 QString Alarm::mailSubject() const
389 {
390  return ( d->mType == Email ) ? d->mMailSubject : QString();
391 }
392 
393 void Alarm::setMailAttachment( const QString &mailAttachFile )
394 {
395  if ( d->mType == Email ) {
396  if ( d->mParent ) {
397  d->mParent->update();
398  }
399  d->mMailAttachFiles.clear();
400  d->mMailAttachFiles += mailAttachFile;
401  if ( d->mParent ) {
402  d->mParent->updated();
403  }
404  }
405 }
406 
407 void Alarm::setMailAttachments( const QStringList &mailAttachFiles )
408 {
409  if ( d->mType == Email ) {
410  if ( d->mParent ) {
411  d->mParent->update();
412  }
413  d->mMailAttachFiles = mailAttachFiles;
414  if ( d->mParent ) {
415  d->mParent->updated();
416  }
417  }
418 }
419 
420 void Alarm::addMailAttachment( const QString &mailAttachFile )
421 {
422  if ( d->mType == Email ) {
423  if ( d->mParent ) {
424  d->mParent->update();
425  }
426  d->mMailAttachFiles += mailAttachFile;
427  if ( d->mParent ) {
428  d->mParent->updated();
429  }
430  }
431 }
432 
433 QStringList Alarm::mailAttachments() const
434 {
435  return ( d->mType == Email ) ? d->mMailAttachFiles : QStringList();
436 }
437 
438 void Alarm::setMailText( const QString &text )
439 {
440  if ( d->mType == Email ) {
441  if ( d->mParent ) {
442  d->mParent->update();
443  }
444  d->mDescription = text;
445  if ( d->mParent ) {
446  d->mParent->updated();
447  }
448  }
449 }
450 
451 QString Alarm::mailText() const
452 {
453  return ( d->mType == Email ) ? d->mDescription : QString();
454 }
455 
456 void Alarm::setDisplayAlarm( const QString &text )
457 {
458  if ( d->mParent ) {
459  d->mParent->update();
460  }
461  d->mType = Display;
462  if ( !text.isNull() ) {
463  d->mDescription = text;
464  }
465  if ( d->mParent ) {
466  d->mParent->updated();
467  }
468 }
469 
470 void Alarm::setText( const QString &text )
471 {
472  if ( d->mType == Display ) {
473  if ( d->mParent ) {
474  d->mParent->update();
475  }
476  d->mDescription = text;
477  if ( d->mParent ) {
478  d->mParent->updated();
479  }
480  }
481 }
482 
483 QString Alarm::text() const
484 {
485  return ( d->mType == Display ) ? d->mDescription : QString();
486 }
487 
488 void Alarm::setTime( const KDateTime &alarmTime )
489 {
490  if ( d->mParent ) {
491  d->mParent->update();
492  }
493  d->mAlarmTime = alarmTime;
494  d->mHasTime = true;
495 
496  if ( d->mParent ) {
497  d->mParent->updated();
498  }
499 }
500 
501 KDateTime Alarm::time() const
502 {
503  if ( hasTime() ) {
504  return d->mAlarmTime;
505  } else if ( d->mParent ) {
506  if ( d->mEndOffset ) {
507  KDateTime dt = d->mParent->dateTime( Incidence::RoleAlarmEndOffset );
508  return d->mOffset.end( dt );
509  } else {
510  KDateTime dt = d->mParent->dateTime( Incidence::RoleAlarmStartOffset );
511  return d->mOffset.end( dt );
512  }
513  } else {
514  return KDateTime();
515  }
516 }
517 
518 KDateTime Alarm::nextTime( const KDateTime &preTime, bool ignoreRepetitions ) const
519 {
520  if ( d->mParent && d->mParent->recurs() ) {
521  KDateTime dtEnd = d->mParent->dateTime( Incidence::RoleAlarmEndOffset );
522 
523  KDateTime dtStart = d->mParent->dtStart();
524  // Find the incidence's earliest alarm
525  // Alarm time is defined by an offset from the event start or end time.
526  KDateTime alarmStart = d->mOffset.end( d->mEndOffset ? dtEnd : dtStart );
527  // Find the offset from the event start time, which is also used as the
528  // offset from the recurrence time.
529  Duration alarmOffset( dtStart, alarmStart );
530  /*
531  kDebug() << "dtStart " << dtStart;
532  kDebug() << "dtEnd " << dtEnd;
533  kDebug() << "alarmStart " << alarmStart;
534  kDebug() << "alarmOffset " << alarmOffset.value();
535  kDebug() << "preTime " << preTime;
536  */
537  if ( alarmStart > preTime ) {
538  // No need to go further.
539  return alarmStart;
540  }
541  if ( d->mAlarmRepeatCount && !ignoreRepetitions ) {
542  // The alarm has repetitions, so check whether repetitions of previous
543  // recurrences happen after given time.
544  KDateTime prevRecurrence = d->mParent->recurrence()->getPreviousDateTime( preTime );
545  if ( prevRecurrence.isValid() ) {
546  KDateTime prevLastRepeat = alarmOffset.end( duration().end( prevRecurrence ) );
547  // kDebug() << "prevRecurrence" << prevRecurrence;
548  // kDebug() << "prevLastRepeat" << prevLastRepeat;
549  if ( prevLastRepeat > preTime ) {
550  // Yes they did, return alarm offset to previous recurrence.
551  KDateTime prevAlarm = alarmOffset.end( prevRecurrence );
552  // kDebug() << "prevAlarm " << prevAlarm;
553  return prevAlarm;
554  }
555  }
556  }
557  // Check the next recurrence now.
558  KDateTime nextRecurrence = d->mParent->recurrence()->getNextDateTime( preTime );
559  if ( nextRecurrence.isValid() ) {
560  KDateTime nextAlarm = alarmOffset.end( nextRecurrence );
561  /*
562  kDebug() << "nextRecurrence" << nextRecurrence;
563  kDebug() << "nextAlarm " << nextAlarm;
564  */
565  if ( nextAlarm > preTime ) {
566  // It's first alarm takes place after given time.
567  return nextAlarm;
568  }
569  }
570  } else {
571  // Not recurring.
572  KDateTime alarmTime = time();
573  if ( alarmTime > preTime ) {
574  return alarmTime;
575  }
576  }
577  return KDateTime();
578 }
579 
580 bool Alarm::hasTime() const
581 {
582  return d->mHasTime;
583 }
584 
585 void Alarm::shiftTimes( const KDateTime::Spec &oldSpec,
586  const KDateTime::Spec &newSpec )
587 {
588  if ( d->mParent ) {
589  d->mParent->update();
590  }
591  d->mAlarmTime = d->mAlarmTime.toTimeSpec( oldSpec );
592  d->mAlarmTime.setTimeSpec( newSpec );
593  if ( d->mParent ) {
594  d->mParent->updated();
595  }
596 }
597 
598 void Alarm::setSnoozeTime( const Duration &alarmSnoozeTime )
599 {
600  if ( alarmSnoozeTime.value() > 0 ) {
601  if ( d->mParent ) {
602  d->mParent->update();
603  }
604  d->mAlarmSnoozeTime = alarmSnoozeTime;
605  if ( d->mParent ) {
606  d->mParent->updated();
607  }
608  }
609 }
610 
611 Duration Alarm::snoozeTime() const
612 {
613  return d->mAlarmSnoozeTime;
614 }
615 
616 void Alarm::setRepeatCount( int alarmRepeatCount )
617 {
618  if ( d->mParent ) {
619  d->mParent->update();
620  }
621  d->mAlarmRepeatCount = alarmRepeatCount;
622  if ( d->mParent ) {
623  d->mParent->updated();
624  }
625 }
626 
627 int Alarm::repeatCount() const
628 {
629  return d->mAlarmRepeatCount;
630 }
631 
632 Duration Alarm::duration() const
633 {
634  return Duration( d->mAlarmSnoozeTime.value() * d->mAlarmRepeatCount,
635  d->mAlarmSnoozeTime.type() );
636 }
637 
638 KDateTime Alarm::nextRepetition( const KDateTime &preTime ) const
639 {
640  KDateTime at = nextTime( preTime );
641  if ( at > preTime ) {
642  return at;
643  }
644  if ( !d->mAlarmRepeatCount ) {
645  // there isn't an occurrence after the specified time
646  return KDateTime();
647  }
648  qint64 repetition;
649  int interval = d->mAlarmSnoozeTime.value();
650  bool daily = d->mAlarmSnoozeTime.isDaily();
651  if ( daily ) {
652  int daysTo = at.daysTo( preTime );
653  if ( !preTime.isDateOnly() && preTime.time() <= at.time() ) {
654  --daysTo;
655  }
656  repetition = daysTo / interval + 1;
657  } else {
658  repetition = at.secsTo_long( preTime ) / interval + 1;
659  }
660  if ( repetition > d->mAlarmRepeatCount ) {
661  // all repetitions have finished before the specified time
662  return KDateTime();
663  }
664  return daily ? at.addDays( int( repetition * interval ) )
665  : at.addSecs( repetition * interval );
666 }
667 
668 KDateTime Alarm::previousRepetition( const KDateTime &afterTime ) const
669 {
670  KDateTime at = time();
671  if ( at >= afterTime ) {
672  // alarm's first/only time is at/after the specified time
673  return KDateTime();
674  }
675  if ( !d->mAlarmRepeatCount ) {
676  return at;
677  }
678  qint64 repetition;
679  int interval = d->mAlarmSnoozeTime.value();
680  bool daily = d->mAlarmSnoozeTime.isDaily();
681  if ( daily ) {
682  int daysTo = at.daysTo( afterTime );
683  if ( afterTime.isDateOnly() || afterTime.time() <= at.time() ) {
684  --daysTo;
685  }
686  repetition = daysTo / interval;
687  } else {
688  repetition = ( at.secsTo_long( afterTime ) - 1 ) / interval;
689  }
690  if ( repetition > d->mAlarmRepeatCount ) {
691  repetition = d->mAlarmRepeatCount;
692  }
693  return daily ? at.addDays( int( repetition * interval ) )
694  : at.addSecs( repetition * interval );
695 }
696 
697 KDateTime Alarm::endTime() const
698 {
699  if ( !d->mAlarmRepeatCount ) {
700  return time();
701  }
702  if ( d->mAlarmSnoozeTime.isDaily() ) {
703  return time().addDays( d->mAlarmRepeatCount * d->mAlarmSnoozeTime.asDays() );
704  } else {
705  return time().addSecs( d->mAlarmRepeatCount * d->mAlarmSnoozeTime.asSeconds() );
706  }
707 }
708 
709 void Alarm::toggleAlarm()
710 {
711  if ( d->mParent ) {
712  d->mParent->update();
713  }
714  d->mAlarmEnabled = !d->mAlarmEnabled;
715  if ( d->mParent ) {
716  d->mParent->updated();
717  }
718 }
719 
720 void Alarm::setEnabled( bool enable )
721 {
722  if ( d->mParent ) {
723  d->mParent->update();
724  }
725  d->mAlarmEnabled = enable;
726  if ( d->mParent ) {
727  d->mParent->updated();
728  }
729 }
730 
731 bool Alarm::enabled() const
732 {
733  return d->mAlarmEnabled;
734 }
735 
736 void Alarm::setStartOffset( const Duration &offset )
737 {
738  if ( d->mParent ) {
739  d->mParent->update();
740  }
741  d->mOffset = offset;
742  d->mEndOffset = false;
743  d->mHasTime = false;
744  if ( d->mParent ) {
745  d->mParent->updated();
746  }
747 }
748 
749 Duration Alarm::startOffset() const
750 {
751  return ( d->mHasTime || d->mEndOffset ) ? Duration( 0 ) : d->mOffset;
752 }
753 
754 bool Alarm::hasStartOffset() const
755 {
756  return !d->mHasTime && !d->mEndOffset;
757 }
758 
759 bool Alarm::hasEndOffset() const
760 {
761  return !d->mHasTime && d->mEndOffset;
762 }
763 
764 void Alarm::setEndOffset( const Duration &offset )
765 {
766  if ( d->mParent ) {
767  d->mParent->update();
768  }
769  d->mOffset = offset;
770  d->mEndOffset = true;
771  d->mHasTime = false;
772  if ( d->mParent ) {
773  d->mParent->updated();
774  }
775 }
776 
777 Duration Alarm::endOffset() const
778 {
779  return ( d->mHasTime || !d->mEndOffset ) ? Duration( 0 ) : d->mOffset;
780 }
781 
782 void Alarm::setParent( Incidence *parent )
783 {
784  d->mParent = parent;
785 }
786 
787 QString Alarm::parentUid() const
788 {
789  return d->mParent ? d->mParent->uid() : QString();
790 }
791 
792 void Alarm::customPropertyUpdated()
793 {
794  if ( d->mParent ) {
795  d->mParent->update();
796  d->mParent->updated();
797  }
798 }
799 
800 void Alarm::setHasLocationRadius( bool hasLocationRadius )
801 {
802  if ( d->mParent ) {
803  d->mParent->update();
804  }
805  d->mHasLocationRadius = hasLocationRadius;
806  if ( hasLocationRadius ) {
807  setNonKDECustomProperty( "X-LOCATION-RADIUS", QString::number( d->mLocationRadius ) );
808  } else {
809  removeNonKDECustomProperty( "X-LOCATION-RADIUS" );
810  }
811  if ( d->mParent ) {
812  d->mParent->updated();
813  }
814 }
815 
816 bool Alarm::hasLocationRadius() const
817 {
818  return d->mHasLocationRadius;
819 }
820 
821 void Alarm::setLocationRadius( int locationRadius )
822 {
823  if ( d->mParent ) {
824  d->mParent->update();
825  }
826  d->mLocationRadius = locationRadius;
827  if ( d->mParent ) {
828  d->mParent->updated();
829  }
830 }
831 
832 int Alarm::locationRadius() const
833 {
834  return d->mLocationRadius;
835 }
836 
837 void Alarm::virtual_hook( int id, void *data )
838 {
839  Q_UNUSED( id );
840  Q_UNUSED( data );
841  Q_ASSERT( false );
842 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:24:50 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal