alarm.h
00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef KCAL_ALARM_H 00023 #define KCAL_ALARM_H 00024 00025 #include <qstring.h> 00026 #include <qvaluelist.h> 00027 00028 #include "customproperties.h" 00029 #include "duration.h" 00030 #include "person.h" 00031 #include "listbase.h" 00032 00033 namespace KCal { 00034 00035 class Incidence; 00036 00040 class Alarm : public CustomProperties 00041 { 00042 public: 00043 enum Type { Invalid, Display, Procedure, Email, Audio }; 00044 00045 typedef ListBase<Alarm> List; 00046 00050 explicit Alarm( Incidence *parent ); 00054 ~Alarm(); 00055 00059 bool operator==( const Alarm & ) const; 00060 bool operator!=( const Alarm &a ) const { return !operator==( a ); } 00061 00069 void setType( Type type ); 00073 Type type() const; 00074 00080 void setDisplayAlarm( const QString &text ); 00085 void setText( const QString &text ); 00089 QString text() const; 00090 00096 void setAudioAlarm( const QString &audioFile = QString::null ); 00101 void setAudioFile( const QString &audioFile ); 00107 QString audioFile() const; 00108 00115 void setProcedureAlarm( const QString &programFile, 00116 const QString &arguments = QString::null ); 00121 void setProgramFile( const QString &programFile ); 00127 QString programFile() const; 00132 void setProgramArguments( const QString &arguments ); 00138 QString programArguments() const; 00139 00148 void setEmailAlarm( const QString &subject, const QString &text, 00149 const QValueList<Person> &addressees, 00150 const QStringList &attachments = QStringList() ); 00151 00156 void setMailAddress( const Person &mailAlarmAddress ); 00161 void setMailAddresses( const QValueList<Person> &mailAlarmAddresses ); 00166 void addMailAddress( const Person &mailAlarmAddress ); 00170 QValueList<Person> mailAddresses() const; 00171 00176 void setMailSubject( const QString &mailAlarmSubject ); 00180 QString mailSubject() const; 00181 00186 void setMailAttachment( const QString &mailAttachFile ); 00191 void setMailAttachments( const QStringList &mailAttachFiles ); 00196 void addMailAttachment( const QString &mailAttachFile ); 00200 QStringList mailAttachments() const; 00201 00206 void setMailText( const QString &text ); 00212 QString mailText() const; 00213 00217 void setTime( const QDateTime &alarmTime ); 00221 QDateTime time() const; 00225 bool hasTime() const; 00226 00230 void setStartOffset( const Duration & ); 00236 Duration startOffset() const; 00241 bool hasStartOffset() const; 00242 00246 void setEndOffset( const Duration & ); 00252 Duration endOffset() const; 00257 bool hasEndOffset() const; 00258 00264 void setSnoozeTime( int alarmSnoozeTime ); 00265 00271 int snoozeTime() const; 00272 00276 void setRepeatCount( int alarmRepeatCount ); 00280 int repeatCount() const; 00281 00286 void toggleAlarm(); 00287 00291 void setEnabled(bool enable); 00295 bool enabled() const; 00296 00300 void setParent( Incidence * ); 00304 Incidence *parent() const { return mParent; } 00305 00306 private: 00307 Incidence *mParent; // the incidence which this alarm belongs to 00308 Type mType; // type of alarm 00309 QString mDescription; // text to display/email body/procedure arguments 00310 QString mFile; // procedure program to run/optional audio file to play 00311 QStringList mMailAttachFiles; // filenames to attach to email 00312 QValueList<Person> mMailAddresses; // who to mail for reminder 00313 QString mMailSubject; // subject of email 00314 00315 int mAlarmSnoozeTime; // number of minutes after alarm to 00316 // snooze before ringing again 00317 int mAlarmRepeatCount; // number of times for alarm to repeat 00318 // after the initial time 00319 00320 QDateTime mAlarmTime; // time at which to trigger the alarm 00321 Duration mOffset; // time relative to incidence DTSTART to trigger the alarm 00322 bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART 00323 bool mHasTime; // use mAlarmTime, not mOffset 00324 bool mAlarmEnabled; 00325 00326 class Private; 00327 Private *d; 00328 }; 00329 00330 } 00331 00332 #endif