libkcal

alarm.h
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef KCAL_ALARM_H
24 #define KCAL_ALARM_H
25 
26 #include <tqstring.h>
27 #include <tqstringlist.h>
28 #include <tqvaluelist.h>
29 
30 #include "customproperties.h"
31 #include "duration.h"
32 #include "person.h"
33 #include "listbase.h"
34 #include "libkcal_export.h"
35 
36 #include <tdemacros.h>
37 
38 namespace KCal {
39 
40 class Incidence;
41 
45 class LIBKCAL_EXPORT Alarm : public CustomProperties
46 {
47  public:
48  enum Type { Invalid, Display, Procedure, Email, Audio };
49 
50  typedef ListBase<Alarm> List;
51 
55  explicit Alarm( Incidence *parent );
59  virtual ~Alarm();
60 
65  Alarm *clone();
66 
71  Alarm &operator=( const Alarm & );
72 
76  bool operator==( const Alarm & ) const;
77  bool operator!=( const Alarm &a ) const { return !operator==( a ); }
78 
86  void setType( Type type );
87 
91  Type type() const;
92 
98  void setDisplayAlarm( const TQString &text = TQString() );
99 
104  void setText( const TQString &text );
105 
109  TQString text() const;
110 
116  void setAudioAlarm( const TQString &audioFile = TQString() );
121  void setAudioFile( const TQString &audioFile );
127  TQString audioFile() const;
128 
135  void setProcedureAlarm( const TQString &programFile,
136  const TQString &arguments = TQString() );
141  void setProgramFile( const TQString &programFile );
147  TQString programFile() const;
152  void setProgramArguments( const TQString &arguments );
158  TQString programArguments() const;
159 
168  void setEmailAlarm( const TQString &subject, const TQString &text,
169  const TQValueList<Person> &addressees,
170  const TQStringList &attachments = TQStringList() );
171 
176  void setMailAddress( const Person &mailAlarmAddress );
181  void setMailAddresses( const TQValueList<Person> &mailAlarmAddresses );
186  void addMailAddress( const Person &mailAlarmAddress );
190  TQValueList<Person> mailAddresses() const;
191 
196  void setMailSubject( const TQString &mailAlarmSubject );
200  TQString mailSubject() const;
201 
206  void setMailAttachment( const TQString &mailAttachFile );
211  void setMailAttachments( const TQStringList &mailAttachFiles );
216  void addMailAttachment( const TQString &mailAttachFile );
220  TQStringList mailAttachments() const;
221 
226  void setMailText( const TQString &text );
232  TQString mailText() const;
233 
237  void setTime( const TQDateTime &alarmTime );
241  TQDateTime time() const;
246  TQDateTime endTime() const;
250  bool hasTime() const;
251 
255  void setStartOffset( const Duration & );
261  Duration startOffset() const;
266  bool hasStartOffset() const;
267 
271  void setEndOffset( const Duration & );
277  Duration endOffset() const;
282  bool hasEndOffset() const;
283 
289  void setSnoozeTime( const Duration &alarmSnoozeTime );
290 
296  Duration snoozeTime() const;
297 
302  void setRepeatCount( int alarmRepeatCount );
306  int repeatCount() const;
314  TQDateTime nextRepetition(const TQDateTime& preTime) const;
322  TQDateTime previousRepetition(const TQDateTime& afterTime) const;
327  Duration duration() const;
328 
333  void toggleAlarm();
334 
338  void setEnabled(bool enable);
342  bool enabled() const;
343 
347  void setParent( Incidence * );
351  Incidence *parent() const { return mParent; }
352 
353  protected:
358  virtual void customPropertyUpdated();
359 
360  private:
361  Incidence *mParent; // the incidence which this alarm belongs to
362  Type mType; // type of alarm
363  TQString mDescription; // text to display/email body/procedure arguments
364  TQString mFile; // procedure program to run/optional audio file to play
365  TQStringList mMailAttachFiles; // filenames to attach to email
366  TQValueList<Person> mMailAddresses; // who to mail for reminder
367  TQString mMailSubject; // subject of email
368 
369  Duration mAlarmSnoozeTime; // how long after alarm to snooze before
370  // triggering again
371  int mAlarmRepeatCount; // number of times for alarm to repeat
372  // after the initial time
373 
374  TQDateTime mAlarmTime; // time at which to trigger the alarm
375  Duration mOffset; // time relative to incidence DTSTART to trigger the alarm
376  bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART
377  bool mHasTime; // use mAlarmTime, not mOffset
378  bool mAlarmEnabled;
379 
380  class Private;
381  Private *d;
382 };
383 
384 }
385 
386 #endif
This class represents an alarm notification.
Definition: alarm.h:46
Incidence * parent() const
Get the alarm's parent incidence.
Definition: alarm.h:351
This class represents custom calendar properties.
This class represents a duration.
Definition: duration.h:34
This class provides the base class common to all calendar components.
Definition: incidence.h:48
This class represents a person.
Definition: person.h:35
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38