• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

  • kcalcore
alarm.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (c) 2003 David Jarvie <software@astrojar.org.uk>
6  Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
31 #ifndef KCALCORE_ALARM_H
32 #define KCALCORE_ALARM_H
33 
34 #include "kcalcore_export.h"
35 #include "customproperties.h"
36 #include "duration.h"
37 #include "person.h"
38 
39 #include <KDE/KDateTime>
40 
41 #include <QtCore/QString>
42 #include <QtCore/QStringList>
43 #include <QtCore/QVector>
44 #include <QDataStream>
45 #include <QMetaType>
46 
47 namespace KCalCore {
48 
49 class Incidence;
50 
61 class KCALCORE_EXPORT Alarm : public CustomProperties
62 {
63 public:
67  enum Type {
68  Invalid,
69  Display,
70  Procedure,
71  Email,
72  Audio
73  };
74 
78  typedef QSharedPointer<Alarm> Ptr;
79 
83  typedef QVector<Ptr> List;
84 
90  // Can't find a way to use a shared pointer here.
91  // Inside incidence.cpp, it does alarm->setParent( this )
92  explicit Alarm(Incidence *parent);
93 
98  Alarm(const Alarm &other);
99 
103  virtual ~Alarm();
104 
108  Alarm &operator=(const Alarm &);
109 
114  bool operator==(const Alarm &a) const;
115 
121  bool operator!=(const Alarm &a) const;
122 
130  // Is there a way to use QSharedPointer here?
131  // although it's safe, Incidence's dtor calls setParent( 0 )
132  // se we don't dereference a deleted pointer here.
133  // Also, I renamed "Incidence *parent()" to "QString parentUid()"
134  // So we don't return raw pointers
135  void setParent(Incidence *parent);
136 
142  // We don't have a share pointer to return, so return the UID.
143  QString parentUid() const;
144 
154  void setType(Type type);
155 
161  Type type() const;
162 
172  void setDisplayAlarm(const QString &text = QString());
173 
182  void setText(const QString &text);
183 
190  QString text() const;
191 
201  void setAudioAlarm(const QString &audioFile = QString());
202 
212  void setAudioFile(const QString &audioFile);
213 
220  QString audioFile() const;
221 
233  void setProcedureAlarm(const QString &programFile,
234  const QString &arguments = QString());
235 
246  void setProgramFile(const QString &programFile);
247 
255  QString programFile() const;
256 
266  void setProgramArguments(const QString &arguments);
267 
275  QString programArguments() const;
276 
291  void setEmailAlarm(const QString &subject, const QString &text,
292  const Person::List &addressees,
293  const QStringList &attachments = QStringList());
294 
305  void setMailAddress(const Person::Ptr &mailAlarmAddress);
306 
317  void setMailAddresses(const Person::List &mailAlarmAddresses);
318 
329  void addMailAddress(const Person::Ptr &mailAlarmAddress);
330 
337  Person::List mailAddresses() const;
338 
349  void setMailSubject(const QString &mailAlarmSubject);
350 
357  QString mailSubject() const;
358 
369  void setMailAttachment(const QString &mailAttachFile);
370 
381  void setMailAttachments(const QStringList &mailAttachFiles);
382 
392  void addMailAttachment(const QString &mailAttachFile);
393 
400  QStringList mailAttachments() const;
401 
412  void setMailText(const QString &text);
413 
420  QString mailText() const;
421 
429  void setTime(const KDateTime &alarmTime);
430 
436  KDateTime time() const;
437 
446  KDateTime nextTime(const KDateTime &preTime, bool ignoreRepetitions = false) const;
447 
454  KDateTime endTime() const;
455 
459  bool hasTime() const;
460 
469  void setStartOffset(const Duration &offset);
470 
478  Duration startOffset() const;
479 
486  bool hasStartOffset() const;
487 
496  void setEndOffset(const Duration &offset);
497 
505  Duration endOffset() const;
506 
513  bool hasEndOffset() const;
514 
529  void shiftTimes(const KDateTime::Spec &oldSpec,
530  const KDateTime::Spec &newSpec);
531 
539  void setSnoozeTime(const Duration &alarmSnoozeTime);
540 
546  Duration snoozeTime() const;
547 
557  void setRepeatCount(int alarmRepeatCount);
558 
564  int repeatCount() const;
565 
577  KDateTime nextRepetition(const KDateTime &preTime) const;
578 
592  KDateTime previousRepetition(const KDateTime &afterTime) const;
593 
598  Duration duration() const;
599 
606  void toggleAlarm();
607 
614  void setEnabled(bool enable);
615 
621  bool enabled() const;
622 
629  void setHasLocationRadius(bool hasLocationRadius);
630 
636  bool hasLocationRadius() const;
637 
646  void setLocationRadius(int locationRadius);
647 
653  int locationRadius() const;
654 
655 protected:
660  virtual void customPropertyUpdated();
661 
666  virtual void virtual_hook(int id, void *data);
667 
668 private:
669  //@cond PRIVATE
670  class Private;
671  Private *const d;
672  //@endcond
673  friend KCALCORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalCore::Alarm::Ptr &);
674  friend KCALCORE_EXPORT QDataStream &operator>>(QDataStream &s, const KCalCore::Alarm::Ptr &);
675 };
681 KCALCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &);
682 
688 KCALCORE_EXPORT QDataStream &operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &);
689 
690 }
691 
692 //@cond PRIVATE
693 Q_DECLARE_TYPEINFO(KCalCore::Alarm::Ptr, Q_MOVABLE_TYPE);
694 Q_DECLARE_METATYPE(KCalCore::Alarm::Ptr)
695 //@endcond
696 
697 #endif
KCalCore::Alarm
Represents an alarm notification.
Definition: alarm.h:62
KCalCore::Alarm::Ptr
QSharedPointer< Alarm > Ptr
A shared pointer to an Alarm object.
Definition: alarm.h:78
KCalCore::Alarm::Type
Type
The different types of alarms.
Definition: alarm.h:67
KCalCore::Alarm::Display
@ Display
Display a dialog box.
Definition: alarm.h:69
KCalCore::Alarm::Email
@ Email
Send email.
Definition: alarm.h:71
KCalCore::Alarm::Procedure
@ Procedure
Call a script.
Definition: alarm.h:70
KCalCore::Alarm::Invalid
@ Invalid
Invalid, or no alarm.
Definition: alarm.h:68
KCalCore::Alarm::List
QVector< Ptr > List
List of alarms.
Definition: alarm.h:83
KCalCore::Alarm::operator<<
friend KCALCORE_EXPORT QDataStream & operator<<(QDataStream &s, const KCalCore::Alarm::Ptr &)
Alarm serializer.
KCalCore::Alarm::operator>>
friend KCALCORE_EXPORT QDataStream & operator>>(QDataStream &s, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
KCalCore::CustomProperties
A class to manage custom calendar properties.
Definition: customproperties.h:52
KCalCore::Duration
Represents a span of time measured in seconds or days.
Definition: duration.h:56
KCalCore::Incidence
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:70
KCalCore::Person::List
QVector< Ptr > List
List of persons.
Definition: person.h:61
KCalCore::Person::Ptr
QSharedPointer< Person > Ptr
A shared pointer to a Person object.
Definition: person.h:56
customproperties.h
This file is part of the API for handling calendar data and defines the CustomProperties class.
duration.h
This file is part of the API for handling calendar data and defines the Duration class.
KCalCore
TODO: KDE5:
Definition: alarm.h:47
KCalCore::operator>>
KCALCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:863
KCalCore::operator<<
KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:853
person.h
This file is part of the API for handling calendar data and defines the Person class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jul 22 2021 00:00:00 by doxygen 1.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal