KCalCore Library
alarm.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcalcore 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 KCALCORE_ALARM_H 00032 #define KCALCORE_ALARM_H 00033 00034 #include "kcalcore_export.h" 00035 #include "customproperties.h" 00036 #include "duration.h" 00037 #include "person.h" 00038 00039 #include <KDE/KDateTime> 00040 00041 #include <QtCore/QString> 00042 #include <QtCore/QStringList> 00043 #include <QtCore/QVector> 00044 00045 namespace KCalCore { 00046 00047 class Incidence; 00048 00059 class KCALCORE_EXPORT Alarm : public CustomProperties 00060 { 00061 public: 00065 enum Type { 00066 Invalid, 00067 Display, 00068 Procedure, 00069 Email, 00070 Audio 00071 }; 00072 00076 typedef QSharedPointer<Alarm> Ptr; 00077 00081 typedef QVector<Ptr> List; 00082 00088 // Can't find a way to use a shared pointer here. 00089 // Inside incidence.cpp, it does alarm->setParent( this ) 00090 explicit Alarm( Incidence *parent ); 00091 00096 Alarm( const Alarm &other ); 00097 00101 virtual ~Alarm(); 00102 00106 Alarm &operator=( const Alarm & ); 00107 00112 bool operator==( const Alarm &a ) const; 00113 00119 bool operator!=( const Alarm &a ) const; 00120 00128 // Is there a way to use QSharedPointer here? 00129 // although it's safe, Incidence's dtor calls setParent( 0 ) 00130 // se we don't dereference a deleted pointer here. 00131 // Also, I renamed "Incidence *parent()" to "QString parentUid()" 00132 // So we don't return raw pointers 00133 void setParent( Incidence *parent ); 00134 00140 // We don't have a share pointer to return, so return the UID. 00141 QString parentUid() 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 Person::List &addressees, 00291 const QStringList &attachments = QStringList() ); 00292 00303 void setMailAddress( const Person::Ptr &mailAlarmAddress ); 00304 00315 void setMailAddresses( const Person::List &mailAlarmAddresses ); 00316 00327 void addMailAddress( const Person::Ptr &mailAlarmAddress ); 00328 00335 Person::List 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 00444 KDateTime nextTime( const KDateTime &preTime, bool ignoreRepetitions = false ) const; 00445 00452 KDateTime endTime() const; 00453 00457 bool hasTime() const; 00458 00467 void setStartOffset( const Duration &offset ); 00468 00476 Duration startOffset() const; 00477 00484 bool hasStartOffset() const; 00485 00494 void setEndOffset( const Duration &offset ); 00495 00503 Duration endOffset() const; 00504 00511 bool hasEndOffset() const; 00512 00527 void shiftTimes( const KDateTime::Spec &oldSpec, 00528 const KDateTime::Spec &newSpec ); 00529 00537 void setSnoozeTime( const Duration &alarmSnoozeTime ); 00538 00544 Duration snoozeTime() const; 00545 00555 void setRepeatCount( int alarmRepeatCount ); 00556 00562 int repeatCount() const; 00563 00575 KDateTime nextRepetition( const KDateTime &preTime ) const; 00576 00590 KDateTime previousRepetition( const KDateTime &afterTime ) const; 00591 00596 Duration duration() const; 00597 00604 void toggleAlarm(); 00605 00612 void setEnabled( bool enable ); 00613 00619 bool enabled() const; 00620 00627 void setHasLocationRadius( bool hasLocationRadius ); 00628 00634 bool hasLocationRadius() const; 00635 00644 void setLocationRadius( int locationRadius ); 00645 00651 int locationRadius() const; 00652 00653 protected: 00658 virtual void customPropertyUpdated(); 00659 00664 virtual void virtual_hook( int id, void *data ); 00665 00666 private: 00667 //@cond PRIVATE 00668 class Private; 00669 Private *const d; 00670 //@endcond 00671 }; 00672 00673 } 00674 00675 Q_DECLARE_TYPEINFO( KCalCore::Alarm::Ptr, Q_MOVABLE_TYPE ); 00676 00677 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:48:21 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:48:21 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.