KCal Library
Go to the documentation of this file.
47 class KCal::Alarm::Private
53 mAlarmSnoozeTime( 5 ),
54 mAlarmRepeatCount( 0 ),
57 mAlarmEnabled( false )
59 Private(
const Private &other )
60 : mParent( other.mParent ),
62 mDescription( other.mDescription ),
64 mMailSubject( other.mMailSubject ),
65 mMailAttachFiles( other.mMailAttachFiles ),
66 mMailAddresses( other.mMailAddresses ),
67 mAlarmTime( other.mAlarmTime ),
68 mAlarmSnoozeTime( other.mAlarmSnoozeTime ),
69 mAlarmRepeatCount( other.mAlarmRepeatCount ),
70 mOffset( other.mOffset ),
71 mEndOffset( other.mEndOffset ),
72 mHasTime( other.mHasTime ),
73 mAlarmEnabled( other.mAlarmEnabled )
82 QStringList mMailAttachFiles;
83 QList<Person> mMailAddresses;
88 int mAlarmRepeatCount;
116 d->mParent = a.d->mParent;
117 d->mType = a.d->mType;
118 d->mDescription = a.d->mDescription;
119 d->mFile = a.d->mFile;
120 d->mMailAttachFiles = a.d->mMailAttachFiles;
121 d->mMailAddresses = a.d->mMailAddresses;
122 d->mMailSubject = a.d->mMailSubject;
123 d->mAlarmSnoozeTime = a.d->mAlarmSnoozeTime;
124 d->mAlarmRepeatCount = a.d->mAlarmRepeatCount;
125 d->mAlarmTime = a.d->mAlarmTime;
126 d->mOffset = a.d->mOffset;
127 d->mEndOffset = a.d->mEndOffset;
128 d->mHasTime = a.d->mHasTime;
129 d->mAlarmEnabled = a.d->mAlarmEnabled;
135 if ( d->mType != rhs.d->mType ||
136 d->mAlarmSnoozeTime != rhs.d->mAlarmSnoozeTime ||
137 d->mAlarmRepeatCount != rhs.d->mAlarmRepeatCount ||
138 d->mAlarmEnabled != rhs.d->mAlarmEnabled ||
139 d->mHasTime != rhs.d->mHasTime ) {
144 if ( d->mAlarmTime != rhs.d->mAlarmTime ) {
148 if ( d->mOffset != rhs.d->mOffset || d->mEndOffset != rhs.d->mEndOffset ) {
153 switch ( d->mType ) {
155 return d->mDescription == rhs.d->mDescription;
158 return d->mDescription == rhs.d->mDescription &&
159 d->mMailAttachFiles == rhs.d->mMailAttachFiles &&
160 d->mMailAddresses == rhs.d->mMailAddresses &&
161 d->mMailSubject == rhs.d->mMailSubject;
164 return d->mFile == rhs.d->mFile &&
165 d->mDescription == rhs.d->mDescription;
168 return d->mFile == rhs.d->mFile;
178 if (
type == d->mType ) {
184 d->mDescription =
"";
187 d->mFile = d->mDescription =
"";
193 d->mMailSubject = d->mDescription =
"";
194 d->mMailAddresses.clear();
195 d->mMailAttachFiles.clear();
204 d->mParent->updated();
218 d->mParent->updated();
224 if ( d->mType ==
Audio ) {
227 d->mParent->updated();
234 return ( d->mType ==
Audio ) ? d->mFile : QString();
238 const QString &arguments )
242 d->mDescription = arguments;
244 d->mParent->updated();
253 d->mParent->updated();
260 return ( d->mType ==
Procedure ) ? d->mFile : QString();
266 d->mDescription = arguments;
268 d->mParent->updated();
275 return ( d->mType ==
Procedure ) ? d->mDescription : QString();
279 const QList<Person> &addressees,
280 const QStringList &attachments )
283 d->mMailSubject = subject;
284 d->mDescription =
text;
285 d->mMailAddresses = addressees;
286 d->mMailAttachFiles = attachments;
288 d->mParent->updated();
294 if ( d->mType ==
Email ) {
295 d->mMailAddresses.clear();
296 d->mMailAddresses += mailAddress;
298 d->mParent->updated();
305 if ( d->mType ==
Email ) {
308 d->mParent->updated();
315 if ( d->mType ==
Email ) {
316 d->mMailAddresses += mailAddress;
318 d->mParent->updated();
325 return ( d->mType ==
Email ) ? d->mMailAddresses : QList<Person>();
330 if ( d->mType ==
Email ) {
331 d->mMailSubject = mailAlarmSubject;
333 d->mParent->updated();
340 return ( d->mType ==
Email ) ? d->mMailSubject : QString();
345 if ( d->mType ==
Email ) {
346 d->mMailAttachFiles.clear();
347 d->mMailAttachFiles += mailAttachFile;
349 d->mParent->updated();
356 if ( d->mType ==
Email ) {
357 d->mMailAttachFiles = mailAttachFiles;
359 d->mParent->updated();
366 if ( d->mType ==
Email ) {
367 d->mMailAttachFiles += mailAttachFile;
369 d->mParent->updated();
376 return ( d->mType ==
Email ) ? d->mMailAttachFiles : QStringList();
381 if ( d->mType ==
Email ) {
382 d->mDescription =
text;
384 d->mParent->updated();
391 return ( d->mType ==
Email ) ? d->mDescription : QString();
397 if ( !
text.isNull() ) {
398 d->mDescription =
text;
401 d->mParent->updated();
408 d->mDescription =
text;
410 d->mParent->updated();
417 return ( d->mType ==
Display ) ? d->mDescription : QString();
422 d->mAlarmTime = alarmTime;
426 d->mParent->updated();
433 return d->mAlarmTime;
434 }
else if ( d->mParent ) {
435 if ( d->mEndOffset ) {
436 if ( d->mParent->type() ==
"Todo" ) {
437 Todo *t =
static_cast<Todo*
>( d->mParent );
438 return d->mOffset.end( t->
dtDue() );
440 return d->mOffset.end( d->mParent->dtEnd() );
443 return d->mOffset.end( d->mParent->dtStart() );
456 const KDateTime::Spec &newSpec )
458 d->mAlarmTime = d->mAlarmTime.toTimeSpec( oldSpec );
459 d->mAlarmTime.setTimeSpec( newSpec );
461 d->mParent->updated();
467 if ( alarmSnoozeTime.
value() > 0 ) {
468 d->mAlarmSnoozeTime = alarmSnoozeTime;
470 d->mParent->updated();
477 return d->mAlarmSnoozeTime;
482 d->mAlarmRepeatCount = alarmRepeatCount;
484 d->mParent->updated();
490 return d->mAlarmRepeatCount;
495 return Duration( d->mAlarmSnoozeTime.value() * d->mAlarmRepeatCount,
496 d->mAlarmSnoozeTime.type() );
501 KDateTime at =
time();
502 if ( at > preTime ) {
505 if ( !d->mAlarmRepeatCount ) {
510 int interval = d->mAlarmSnoozeTime.value();
511 bool daily = d->mAlarmSnoozeTime.isDaily();
513 int daysTo = at.daysTo( preTime );
514 if ( !preTime.isDateOnly() && preTime.time() <= at.time() ) {
517 repetition = daysTo / interval + 1;
519 repetition = at.secsTo_long( preTime ) / interval + 1;
521 if ( repetition > d->mAlarmRepeatCount ) {
525 return daily ? at.addDays(
int( repetition * interval ) )
526 : at.addSecs( repetition * interval );
531 KDateTime at =
time();
532 if ( at >= afterTime ) {
536 if ( !d->mAlarmRepeatCount ) {
540 int interval = d->mAlarmSnoozeTime.value();
541 bool daily = d->mAlarmSnoozeTime.isDaily();
543 int daysTo = at.daysTo( afterTime );
544 if ( afterTime.isDateOnly() || afterTime.time() <= at.time() ) {
547 repetition = daysTo / interval;
549 repetition = ( at.secsTo_long( afterTime ) - 1 ) / interval;
551 if ( repetition > d->mAlarmRepeatCount ) {
552 repetition = d->mAlarmRepeatCount;
554 return daily ? at.addDays(
int( repetition * interval ) )
555 : at.addSecs( repetition * interval );
560 if ( !d->mAlarmRepeatCount ) {
563 if ( d->mAlarmSnoozeTime.isDaily() ) {
564 return time().addDays( d->mAlarmRepeatCount * d->mAlarmSnoozeTime.asDays() );
566 return time().addSecs( d->mAlarmRepeatCount * d->mAlarmSnoozeTime.asSeconds() );
572 d->mAlarmEnabled = !d->mAlarmEnabled;
574 d->mParent->updated();
580 d->mAlarmEnabled = enable;
582 d->mParent->updated();
588 return d->mAlarmEnabled;
594 d->mEndOffset =
false;
597 d->mParent->updated();
603 return ( d->mHasTime || d->mEndOffset ) ?
Duration( 0 ) : d->mOffset;
608 return !d->mHasTime && !d->mEndOffset;
613 return !d->mHasTime && d->mEndOffset;
619 d->mEndOffset =
true;
622 d->mParent->updated();
628 return ( d->mHasTime || !d->mEndOffset ) ?
Duration( 0 ) : d->mOffset;
644 d->mParent->updated();
Duration snoozeTime() const
Returns the snooze time interval.
void setMailAttachment(const QString &mailAttachFile)
Sets the filename to attach to a mail message for an Email alarm type.
bool hasEndOffset() const
Returns whether the alarm is defined in terms of an offset relative to the end of the event.
Type type() const
Returns the Type of the alarm.
void setEmailAlarm(const QString &subject, const QString &text, const QList< Person > &addressees, const QStringList &attachments=QStringList())
Sets the Email type for this alarm and the email subject, text, addresses, and attachments that make ...
virtual ~Alarm()
Destroys the alarm.
A class to manage custom calendar properties.
void setMailText(const QString &text)
Sets the body text for an Email alarm type.
void addMailAttachment(const QString &mailAttachFile)
Adds a filename to the list of files to attach to a mail message for an Email alarm type.
Duration duration() const
Returns the interval between the alarm's initial occurrence and its final repetition.
KDateTime endTime() const
Returns the date/time when the last repetition of the alarm goes off.
KDateTime previousRepetition(const KDateTime &afterTime) const
Returns the date/time of the alarm's latest repetition or, if none, its initial occurrence before a g...
void setDisplayAlarm(const QString &text=QString())
Sets the Display type for this alarm.
void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Shift the times of the alarm so that they appear at the same clock time as before but in a new time z...
QString mailText() const
Returns the body text for an Email alarm type.
void setMailAddresses(const QList< Person > &mailAlarmAddresses)
Sets a list of email addresses of an Email type alarm.
Represents a person, by name ane email address.
QString programFile() const
Returns the program file name for a Procedure alarm type.
void setProcedureAlarm(const QString &programFile, const QString &arguments=QString())
Sets the Procedure type for this alarm and the program (with arguments) to execute when the alarm is ...
KDateTime time() const
Returns the alarm trigger date/time.
KDateTime dtDue(bool first=false) const
Returns due date and time.
void setType(Type type)
Sets the Type for this alarm to type.
void setEndOffset(const Duration &offset)
Sets the alarm offset relative to the end of the parent Incidence.
void setTime(const KDateTime &alarmTime)
Sets the trigger time of the alarm.
Alarm & operator=(const Alarm &)
Assignment operator.
Provides a To-do in the sense of RFC2445.
bool hasStartOffset() const
Returns whether the alarm is defined in terms of an offset relative to the start of the parent Incide...
void addMailAddress(const Person &mailAlarmAddress)
Adds an address to the list of email addresses to send mail to when the alarm is triggered.
QList< Person > mailAddresses() const
Returns the list of addresses for an Email alarm type.
Incidence * parent() const
Returns a pointer to the parent incidence of the alarm.
bool enabled() const
Returns the alarm enabled status: true (enabled) or false (disabled).
void setAudioAlarm(const QString &audioFile=QString())
Sets the Audio type for this alarm and the name of the audio file to play when the alarm is triggered...
int repeatCount() const
Returns how many times an alarm may repeats after its initial occurrence.
void setMailAttachments(const QStringList &mailAttachFiles)
Sets a list of filenames to attach to a mail message for an Email alarm type.
void setStartOffset(const Duration &offset)
Sets the alarm offset relative to the start of the parent Incidence.
QString programArguments() const
Returns the program arguments string for a Procedure alarm type.
void setProgramFile(const QString &programFile)
Sets the program file to execute when the alarm is triggered.
void toggleAlarm()
Toggles the alarm status, i.e, an enable alarm becomes disabled and a disabled alarm becomes enabled.
void setRepeatCount(int alarmRepeatCount)
Sets how many times an alarm is to repeat itself after its initial occurrence (w/snoozes).
bool hasTime() const
Returns true if the alarm has a trigger date/time.
void setAudioFile(const QString &audioFile)
Sets the name of the audio file to play when the audio alarm is triggered.
void setMailSubject(const QString &mailAlarmSubject)
Sets the subject line of a mail message for an Email alarm type.
@ Display
Display a dialog box.
Type
The different types of alarms.
QStringList mailAttachments() const
Returns the list of attachment filenames for an Email alarm type.
void setParent(Incidence *parent)
Sets the parent Incidence of the alarm.
Alarm(Incidence *parent)
Constructs an alarm belonging to the parent Incidence.
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
QString audioFile() const
Returns the audio file name for an Audio alarm type.
@ Procedure
Call a script.
Represents an alarm notification.
KDateTime nextRepetition(const KDateTime &preTime) const
Returns the date/time of the alarm's initial occurrence or its next repetition after a given time.
@ Invalid
Invalid, or no alarm.
void setSnoozeTime(const Duration &alarmSnoozeTime)
Sets the snooze time interval for the alarm.
bool operator==(const Alarm &a) const
Compares two alarms for equality.
void setMailAddress(const Person &mailAlarmAddress)
Sets the email address of an Email type alarm.
int value() const
Returns the length of the duration in seconds or days.
@ Audio
Play an audio file.
void setEnabled(bool enable)
Sets the enabled status of the alarm.
Represents a span of time measured in seconds or days.
void setProgramArguments(const QString &arguments)
Sets the program arguments string when the alarm is triggered.
QString text() const
Returns the display text string for a Display alarm type.
Duration endOffset() const
Returns offset of alarm in time relative to the end of the event.
void setText(const QString &text)
Sets the description text to be displayed when the alarm is triggered.
QString mailSubject() const
Returns the subject line string for an Email alarm type.
Duration startOffset() const
Returns offset of alarm in time relative to the start of the parent Incidence.
virtual void customPropertyUpdated()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jan 29 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.