KCal Library
alarm.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcal library. 00003 00004 Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org> 00005 Copyright (c) 2003 David Jarvie <software@astrojar.org.uk> 00006 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00031 #ifndef KCAL_ALARM_H 00032 #define KCAL_ALARM_H 00033 00034 #include <QtCore/QString> 00035 #include <QtCore/QStringList> 00036 #include <QtCore/QList> 00037 00038 #include <kdatetime.h> 00039 00040 #include "customproperties.h" 00041 #include "duration.h" 00042 #include "person.h" 00043 #include "listbase.h" 00044 #include "kcal_export.h" 00045 00046 #include <kpimutils/supertrait.h> 00047 00048 namespace boost { 00049 template <typename T> class shared_ptr; 00050 } 00051 00052 namespace KCal { 00053 00054 class Incidence; 00055 00066 class KCAL_EXPORT_DEPRECATED Alarm : public CustomProperties 00067 { 00068 public: 00072 enum Type { 00073 Invalid, 00074 Display, 00075 Procedure, 00076 Email, 00077 Audio 00078 }; 00079 00083 typedef ListBase<Alarm> List; 00084 00088 typedef boost::shared_ptr<Alarm> Ptr; 00089 00095 explicit Alarm( Incidence *parent ); 00096 00101 Alarm( const Alarm &other ); 00102 00106 virtual ~Alarm(); 00107 00112 Alarm &operator=( const Alarm & ); 00113 00118 bool operator==( const Alarm &a ) const; 00119 00125 bool operator!=( const Alarm &a ) const { return !operator==( a ); } 00126 00134 void setParent( Incidence *parent ); 00135 00141 Incidence *parent() const; 00142 00152 void setType( Type type ); 00153 00159 Type type() const; 00160 00170 void setDisplayAlarm( const QString &text = QString() ); 00171 00180 void setText( const QString &text ); 00181 00188 QString text() const; 00189 00199 void setAudioAlarm( const QString &audioFile = QString() ); 00200 00210 void setAudioFile( const QString &audioFile ); 00211 00218 QString audioFile() const; 00219 00231 void setProcedureAlarm( const QString &programFile, 00232 const QString &arguments = QString() ); 00233 00244 void setProgramFile( const QString &programFile ); 00245 00253 QString programFile() const; 00254 00264 void setProgramArguments( const QString &arguments ); 00265 00273 QString programArguments() const; 00274 00289 void setEmailAlarm( const QString &subject, const QString &text, 00290 const QList<Person> &addressees, 00291 const QStringList &attachments = QStringList() ); 00292 00303 void setMailAddress( const Person &mailAlarmAddress ); 00304 00315 void setMailAddresses( const QList<Person> &mailAlarmAddresses ); 00316 00327 void addMailAddress( const Person &mailAlarmAddress ); 00328 00335 QList<Person> mailAddresses() const; 00336 00347 void setMailSubject( const QString &mailAlarmSubject ); 00348 00355 QString mailSubject() const; 00356 00367 void setMailAttachment( const QString &mailAttachFile ); 00368 00379 void setMailAttachments( const QStringList &mailAttachFiles ); 00380 00390 void addMailAttachment( const QString &mailAttachFile ); 00391 00398 QStringList mailAttachments() const; 00399 00410 void setMailText( const QString &text ); 00411 00418 QString mailText() const; 00419 00427 void setTime( const KDateTime &alarmTime ); 00428 00434 KDateTime time() const; 00435 00442 KDateTime endTime() const; 00443 00447 bool hasTime() const; 00448 00457 void setStartOffset( const Duration &offset ); 00458 00466 Duration startOffset() const; 00467 00474 bool hasStartOffset() const; 00475 00484 void setEndOffset( const Duration &offset ); 00485 00493 Duration endOffset() const; 00494 00501 bool hasEndOffset() const; 00502 00517 void shiftTimes( const KDateTime::Spec &oldSpec, 00518 const KDateTime::Spec &newSpec ); 00519 00527 void setSnoozeTime( const Duration &alarmSnoozeTime ); 00528 00534 Duration snoozeTime() const; 00535 00545 void setRepeatCount( int alarmRepeatCount ); 00546 00552 int repeatCount() const; 00553 00565 KDateTime nextRepetition( const KDateTime &preTime ) const; 00566 00580 KDateTime previousRepetition( const KDateTime &afterTime ) const; 00581 00586 Duration duration() const; 00587 00594 void toggleAlarm(); 00595 00603 void setEnabled( bool enable ); 00604 00610 bool enabled() const; 00611 00612 protected: 00617 virtual void customPropertyUpdated(); 00618 00619 private: 00620 //@cond PRIVATE 00621 class Private; 00622 Private *const d; 00623 //@endcond 00624 }; 00625 00626 } 00627 00628 #endif