52 return new Alarm( *
this );
59 mDescription = a.mDescription;
61 mMailAttachFiles = a.mMailAttachFiles;
62 mMailAddresses = a.mMailAddresses;
63 mMailSubject = a.mMailSubject;
64 mAlarmSnoozeTime = a.mAlarmSnoozeTime;
65 mAlarmRepeatCount = a.mAlarmRepeatCount;
66 mAlarmTime = a.mAlarmTime;
68 mEndOffset = a.mEndOffset;
69 mHasTime = a.mHasTime;
70 mAlarmEnabled = a.mAlarmEnabled;
76 if ( mType != rhs.mType ||
77 mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ||
78 mAlarmRepeatCount != rhs.mAlarmRepeatCount ||
79 mAlarmEnabled != rhs.mAlarmEnabled ||
80 mHasTime != rhs.mHasTime)
84 if (mAlarmTime != rhs.mAlarmTime)
87 if (mOffset != rhs.mOffset ||
88 mEndOffset != rhs.mEndOffset)
94 return mDescription == rhs.mDescription;
97 return mDescription == rhs.mDescription &&
98 mMailAttachFiles == rhs.mMailAttachFiles &&
99 mMailAddresses == rhs.mMailAddresses &&
100 mMailSubject == rhs.mMailSubject;
103 return mFile == rhs.mFile &&
104 mDescription == rhs.mDescription;
107 return mFile == rhs.mFile;
125 mFile = mDescription =
"";
131 mMailSubject = mDescription =
"";
132 mMailAddresses.clear();
133 mMailAttachFiles.clear();
141 if ( mParent ) mParent->
updated();
153 if ( mParent ) mParent->
updated();
158 if (mType == Audio) {
160 if ( mParent ) mParent->
updated();
166 return (mType == Audio) ? mFile : TQString();
173 mDescription = arguments;
174 if ( mParent ) mParent->
updated();
179 if (mType == Procedure) {
181 if ( mParent ) mParent->
updated();
187 return (mType == Procedure) ? mFile : TQString();
192 if (mType == Procedure) {
193 mDescription = arguments;
194 if ( mParent ) mParent->
updated();
200 return (mType == Procedure) ? mDescription : TQString();
204 const TQValueList<Person> &addressees,
const TQStringList &attachments)
207 mMailSubject = subject;
209 mMailAddresses = addressees;
210 mMailAttachFiles = attachments;
211 if ( mParent ) mParent->
updated();
216 if (mType == Email) {
217 mMailAddresses.clear();
218 mMailAddresses += mailAddress;
219 if ( mParent ) mParent->
updated();
225 if (mType == Email) {
227 if ( mParent ) mParent->
updated();
233 if (mType == Email) {
234 mMailAddresses += mailAddress;
235 if ( mParent ) mParent->
updated();
241 return (mType == Email) ? mMailAddresses : TQValueList<Person>();
246 if (mType == Email) {
247 mMailSubject = mailAlarmSubject;
248 if ( mParent ) mParent->
updated();
254 return (mType == Email) ? mMailSubject : TQString();
259 if (mType == Email) {
260 mMailAttachFiles.clear();
261 mMailAttachFiles += mailAttachFile;
262 if ( mParent ) mParent->
updated();
268 if (mType == Email) {
269 mMailAttachFiles = mailAttachFiles;
270 if ( mParent ) mParent->
updated();
276 if (mType == Email) {
277 mMailAttachFiles += mailAttachFile;
278 if ( mParent ) mParent->
updated();
284 return (mType == Email) ? mMailAttachFiles : TQStringList();
289 if (mType == Email) {
291 if ( mParent ) mParent->
updated();
297 return (mType == Email) ? mDescription : TQString();
303 if ( !
text.isNull() )
305 if ( mParent ) mParent->
updated();
310 if (mType == Display) {
312 if ( mParent ) mParent->
updated();
318 return (mType == Display) ? mDescription : TQString();
323 mAlarmTime = alarmTime;
326 if ( mParent ) mParent->
updated();
333 }
else if ( mParent ) {
335 if ( mParent->type() ==
"Todo" ) {
336 Todo *t =
static_cast<Todo*
>( mParent );
339 return mOffset.
end( mParent->
dtEnd() );
356 if (alarmSnoozeTime.
value() > 0) {
357 mAlarmSnoozeTime = alarmSnoozeTime;
358 if ( mParent ) mParent->
updated();
364 return mAlarmSnoozeTime;
369 mAlarmRepeatCount = alarmRepeatCount;
370 if ( mParent ) mParent->
updated();
375 return mAlarmRepeatCount;
380 return Duration( mAlarmSnoozeTime.
value() * mAlarmRepeatCount,
381 mAlarmSnoozeTime.
type() );
388 TQDateTime at =
time();
391 if (!mAlarmRepeatCount)
393 int snoozeSecs = mAlarmSnoozeTime * 60;
394 TQDateTime lastRepetition = at.addSecs(mAlarmRepeatCount * snoozeSecs);
395 if (lastRepetition <= preTime)
397 int repetition = (at.secsTo(preTime) + snoozeSecs) / snoozeSecs;
398 return at.addSecs(repetition * snoozeSecs);
405 TQDateTime at =
time();
408 if (!mAlarmRepeatCount)
410 int snoozeSecs = mAlarmSnoozeTime * 60;
411 TQDateTime lastRepetition = at.addSecs(mAlarmRepeatCount * snoozeSecs);
412 if (lastRepetition < afterTime)
413 return lastRepetition;
414 int repetition = (at.secsTo(afterTime) - 1) / snoozeSecs;
415 return at.addSecs(repetition * snoozeSecs);
420 if (mAlarmRepeatCount)
421 return time().addSecs(mAlarmRepeatCount * mAlarmSnoozeTime * 60);
428 mAlarmEnabled = !mAlarmEnabled;
429 if ( mParent ) mParent->
updated();
434 mAlarmEnabled = enable;
435 if ( mParent ) mParent->
updated();
440 return mAlarmEnabled;
448 if ( mParent ) mParent->
updated();
453 return (mHasTime || mEndOffset) ?
Duration( 0 ) : mOffset;
458 return !mHasTime && !mEndOffset;
463 return !mHasTime && mEndOffset;
471 if ( mParent ) mParent->
updated();
476 return (mHasTime || !mEndOffset) ?
Duration( 0 ) : mOffset;
486 if ( mParent ) mParent->
updated();
This class represents an alarm notification.
void setAudioAlarm(const TQString &audioFile=TQString())
Set the alarm to be an audio alarm.
bool hasStartOffset() const
Return whether the alarm is defined in terms of an offset relative to the start of the event.
TQString audioFile() const
Return the name of the audio file for the alarm.
Duration snoozeTime() const
Get how long the alarm snooze interval is.
void setMailSubject(const TQString &mailAlarmSubject)
Set the subject line of the mail.
void setMailAddress(const Person &mailAlarmAddress)
Send mail to this address when the alarm is triggered.
TQString programFile() const
Return the name of the program file to execute when the alarm is triggered.
void setMailAttachments(const TQStringList &mailAttachFiles)
Attach these filenames to the email.
void addMailAttachment(const TQString &mailAttachFile)
Add this filename to the list of files to attach to the email.
void setRepeatCount(int alarmRepeatCount)
Set how many times an alarm is to repeat itself after its initial occurrence (w/snoozes).
TQString mailSubject() const
Return the subject line of the mail.
TQDateTime time() const
Return the date/time when an alarm goes off.
TQString text() const
Return the text string that displays when the alarm is triggered.
void setEnabled(bool enable)
Set the alarm enabled status.
void addMailAddress(const Person &mailAlarmAddress)
Add this address to the list of addresses to send mail to when the alarm is triggered.
Alarm * clone()
Returns an exact copy of this alarm.
Duration endOffset() const
Return offset of alarm in time relative to the end of the event.
TQDateTime nextRepetition(const TQDateTime &preTime) const
Get the time of the alarm's initial occurrence or its next repetition, after a given time.
bool hasEndOffset() const
Return whether the alarm is defined in terms of an offset relative to the end of the event.
void setDisplayAlarm(const TQString &text=TQString())
Set the alarm to be a display alarm.
TQDateTime previousRepetition(const TQDateTime &afterTime) const
Get the time of the alarm's latest repetition, or its initial occurrence if none, before a given time...
Duration startOffset() const
Return offset of alarm in time relative to the start of the event.
void setSnoozeTime(const Duration &alarmSnoozeTime)
Set the interval between snoozes for the alarm.
TQString programArguments() const
Return the arguments to the program to run when the alarm is triggered.
void setEndOffset(const Duration &)
Set offset of alarm in time relative to the end of the event.
void setEmailAlarm(const TQString &subject, const TQString &text, const TQValueList< Person > &addressees, const TQStringList &attachments=TQStringList())
Set the alarm to be an email alarm.
void setText(const TQString &text)
Set the text to be displayed when the alarm is triggered.
Duration duration() const
Get how long between the alarm's initial occurrence and its final repetition.
void setProgramArguments(const TQString &arguments)
Set the arguments to the program to execute when the alarm is triggered.
Alarm(Incidence *parent)
Construct a new alarm with variables initialized to "sane" values.
void setMailAttachment(const TQString &mailAttachFile)
Attach this filename to the email.
bool enabled() const
Get the alarm enabled status.
TQString mailText() const
Return the email body text.
bool hasTime() const
Return true, if the alarm has an explicit date/time.
void setStartOffset(const Duration &)
Set offset of alarm in time relative to the start of the event.
void setMailAddresses(const TQValueList< Person > &mailAlarmAddresses)
Send mail to these addresses when the alarm is triggered.
void toggleAlarm()
Toggles the value of alarm to be either on or off.
TQValueList< Person > mailAddresses() const
Return the addresses to send mail to when an alarm goes off.
void setTime(const TQDateTime &alarmTime)
Set the time to trigger an alarm.
Type type() const
Return the type of the alarm.
void setAudioFile(const TQString &audioFile)
Set the file to play when the audio alarm is triggered.
void setMailText(const TQString &text)
Set the email body text.
void setType(Type type)
Set the type of the alarm.
void setProgramFile(const TQString &programFile)
Set the program file to execute when the alarm is triggered.
bool operator==(const Alarm &) const
Compare this alarm with another one.
virtual ~Alarm()
Destruct Alarm object.
void setParent(Incidence *)
Set the alarm's parent incidence.
TQDateTime endTime() const
Return the date/time when the last repetition of the alarm goes off.
void setProcedureAlarm(const TQString &programFile, const TQString &arguments=TQString())
Set the alarm to be a procedure alarm.
int repeatCount() const
Get how many times an alarm repeats, after its initial occurrence.
TQStringList mailAttachments() const
Return the filenames to attach to the email.
Incidence * parent() const
Get the alarm's parent incidence.
virtual void customPropertyUpdated()
Alarm & operator=(const Alarm &)
Copy operator.
This class represents a duration.
TQDateTime end(const TQDateTime &start) const
Computes a duration end time by adding the number of seconds or days in the duration to the specified...
int value() const
Returns the length of the duration in seconds or days.
Type type() const
Returns the time units (seconds or days) used to specify the duration.
void updated()
Call this to notify the observers after the IncidenceBas object has changed.
virtual TQDateTime dtStart() const
returns an event's starting date/time as a TQDateTime.
This class provides the base class common to all calendar components.
virtual TQDateTime dtEnd() const
Return the incidence's ending date/time as a TQDateTime.
This class represents a person.
This class provides a Todo in the sense of RFC2445.
TQDateTime dtDue(bool first=false) const
Returns due date and time.
Namespace KCal is for global classes, objects and/or functions in libkcal.