• 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*/
30
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
47namespace KCalCore {
48
49class Incidence;
50
61class KCALCORE_EXPORT Alarm : public CustomProperties
62{
63public:
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
655protected:
660 virtual void customPropertyUpdated();
661
666 virtual void virtual_hook(int id, void *data);
667
668private:
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};
676
681KCALCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &);
682
688KCALCORE_EXPORT QDataStream &operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &);
689
690}
691
692//@cond PRIVATE
693Q_DECLARE_TYPEINFO(KCalCore::Alarm::Ptr, Q_MOVABLE_TYPE);
694Q_DECLARE_METATYPE(KCalCore::Alarm::Ptr)
695//@endcond
696
697#endif
KCalCore::Alarm::time
KDateTime time() const
Returns the alarm trigger date/time.
Definition alarm.cpp:517
KCalCore::Alarm::Ptr
QSharedPointer< Alarm > Ptr
A shared pointer to an Alarm object.
Definition alarm.h:78
KCalCore::Alarm::mailAddresses
Person::List mailAddresses() const
Returns the list of addresses for an Email alarm type.
Definition alarm.cpp:386
KCalCore::Alarm::hasStartOffset
bool hasStartOffset() const
Returns whether the alarm is defined in terms of an offset relative to the start of the parent Incide...
Definition alarm.cpp:770
KCalCore::Alarm::programFile
QString programFile() const
Returns the program file name for a Procedure alarm type.
Definition alarm.cpp:306
KCalCore::Alarm::snoozeTime
Duration snoozeTime() const
Returns the snooze time interval.
Definition alarm.cpp:627
KCalCore::Alarm::operator<<
friend KCALCORE_EXPORT QDataStream & operator<<(QDataStream &s, const KCalCore::Alarm::Ptr &)
Alarm serializer.
KCalCore::Alarm::setRepeatCount
void setRepeatCount(int alarmRepeatCount)
Sets how many times an alarm is to repeat itself after its initial occurrence (w/snoozes).
Definition alarm.cpp:632
KCalCore::Alarm::nextTime
KDateTime nextTime(const KDateTime &preTime, bool ignoreRepetitions=false) const
Returns the next alarm trigger date/time after given date/time.
Definition alarm.cpp:534
KCalCore::Alarm::setEnabled
void setEnabled(bool enable)
Sets the enabled status of the alarm.
Definition alarm.cpp:736
KCalCore::Alarm::setDisplayAlarm
void setDisplayAlarm(const QString &text=QString())
Sets the Display type for this alarm.
Definition alarm.cpp:472
KCalCore::Alarm::addMailAddress
void addMailAddress(const Person::Ptr &mailAlarmAddress)
Adds an address to the list of email addresses to send mail to when the alarm is triggered.
Definition alarm.cpp:373
KCalCore::Alarm::setHasLocationRadius
void setHasLocationRadius(bool hasLocationRadius)
Set if the location radius for the alarm has been defined.
Definition alarm.cpp:816
KCalCore::Alarm::setMailAttachment
void setMailAttachment(const QString &mailAttachFile)
Sets the filename to attach to a mail message for an Email alarm type.
Definition alarm.cpp:409
KCalCore::Alarm::endOffset
Duration endOffset() const
Returns offset of alarm in time relative to the end of the event.
Definition alarm.cpp:793
KCalCore::Alarm::hasEndOffset
bool hasEndOffset() const
Returns whether the alarm is defined in terms of an offset relative to the end of the event.
Definition alarm.cpp:775
KCalCore::Alarm::setLocationRadius
void setLocationRadius(int locationRadius)
Set location radius for the alarm.
Definition alarm.cpp:837
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::Audio
@ Audio
Play an audio file.
Definition alarm.h:72
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::programArguments
QString programArguments() const
Returns the program arguments string for a Procedure alarm type.
Definition alarm.cpp:324
KCalCore::Alarm::operator>>
friend KCALCORE_EXPORT QDataStream & operator>>(QDataStream &s, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
KCalCore::Alarm::previousRepetition
KDateTime previousRepetition(const KDateTime &afterTime) const
Returns the date/time of the alarm's latest repetition or, if none, its initial occurrence before a g...
Definition alarm.cpp:684
KCalCore::Alarm::hasLocationRadius
bool hasLocationRadius() const
Returns true if alarm has location radius defined.
Definition alarm.cpp:832
KCalCore::Alarm::setText
void setText(const QString &text)
Sets the description text to be displayed when the alarm is triggered.
Definition alarm.cpp:486
KCalCore::Alarm::startOffset
Duration startOffset() const
Returns offset of alarm in time relative to the start of the parent Incidence.
Definition alarm.cpp:765
KCalCore::Alarm::setSnoozeTime
void setSnoozeTime(const Duration &alarmSnoozeTime)
Sets the snooze time interval for the alarm.
Definition alarm.cpp:614
KCalCore::Alarm::List
QVector< Ptr > List
List of alarms.
Definition alarm.h:83
KCalCore::Alarm::setProgramFile
void setProgramFile(const QString &programFile)
Sets the program file to execute when the alarm is triggered.
Definition alarm.cpp:293
KCalCore::Alarm::mailAttachments
QStringList mailAttachments() const
Returns the list of attachment filenames for an Email alarm type.
Definition alarm.cpp:449
KCalCore::Alarm::setMailSubject
void setMailSubject(const QString &mailAlarmSubject)
Sets the subject line of a mail message for an Email alarm type.
Definition alarm.cpp:391
KCalCore::Alarm::operator==
bool operator==(const Alarm &a) const
Compares two alarms for equality.
Definition alarm.cpp:156
KCalCore::Alarm::audioFile
QString audioFile() const
Returns the audio file name for an Audio alarm type.
Definition alarm.cpp:274
KCalCore::Alarm::setAudioFile
void setAudioFile(const QString &audioFile)
Sets the name of the audio file to play when the audio alarm is triggered.
Definition alarm.cpp:261
KCalCore::Alarm::duration
Duration duration() const
Returns the interval between the alarm's initial occurrence and its final repetition.
Definition alarm.cpp:648
KCalCore::Alarm::mailSubject
QString mailSubject() const
Returns the subject line string for an Email alarm type.
Definition alarm.cpp:404
KCalCore::Alarm::setEmailAlarm
void setEmailAlarm(const QString &subject, const QString &text, const Person::List &addressees, const QStringList &attachments=QStringList())
Sets the Email type for this alarm and the email subject, text, addresses, and attachments that make ...
Definition alarm.cpp:329
KCalCore::Alarm::locationRadius
int locationRadius() const
Returns the location radius in meters.
Definition alarm.cpp:848
KCalCore::Alarm::setAudioAlarm
void setAudioAlarm(const QString &audioFile=QString())
Sets the Audio type for this alarm and the name of the audio file to play when the alarm is triggered...
Definition alarm.cpp:249
KCalCore::Alarm::setProgramArguments
void setProgramArguments(const QString &arguments)
Sets the program arguments string when the alarm is triggered.
Definition alarm.cpp:311
KCalCore::Alarm::Alarm
Alarm(Incidence *parent)
Constructs an alarm belonging to the parent Incidence.
Definition alarm.cpp:105
KCalCore::Alarm::operator!=
bool operator!=(const Alarm &a) const
Compares two alarms for inequality.
Definition alarm.cpp:201
KCalCore::Alarm::parentUid
QString parentUid() const
Returns the parent's incidence UID of the alarm.
Definition alarm.cpp:803
KCalCore::Alarm::enabled
bool enabled() const
Returns the alarm enabled status: true (enabled) or false (disabled).
Definition alarm.cpp:747
KCalCore::Alarm::setParent
void setParent(Incidence *parent)
Sets the parent Incidence of the alarm.
Definition alarm.cpp:798
KCalCore::Alarm::text
QString text() const
Returns the display text string for a Display alarm type.
Definition alarm.cpp:499
KCalCore::Alarm::hasTime
bool hasTime() const
Returns true if the alarm has a trigger date/time.
Definition alarm.cpp:596
KCalCore::Alarm::addMailAttachment
void addMailAttachment(const QString &mailAttachFile)
Adds a filename to the list of files to attach to a mail message for an Email alarm type.
Definition alarm.cpp:436
KCalCore::Alarm::mailText
QString mailText() const
Returns the body text for an Email alarm type.
Definition alarm.cpp:467
KCalCore::Alarm::toggleAlarm
void toggleAlarm()
Toggles the alarm status, i.e, an enable alarm becomes disabled and a disabled alarm becomes enabled.
Definition alarm.cpp:725
KCalCore::Alarm::setStartOffset
void setStartOffset(const Duration &offset)
Sets the alarm offset relative to the start of the parent Incidence.
Definition alarm.cpp:752
KCalCore::Alarm::shiftTimes
void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Shift the times of the alarm so that they appear at the same clock time as before but in a new time z...
Definition alarm.cpp:601
KCalCore::Alarm::type
Type type() const
Returns the Type of the alarm.
Definition alarm.cpp:244
KCalCore::Alarm::setMailAddresses
void setMailAddresses(const Person::List &mailAlarmAddresses)
Sets a list of email addresses of an Email type alarm.
Definition alarm.cpp:360
KCalCore::Alarm::nextRepetition
KDateTime nextRepetition(const KDateTime &preTime) const
Returns the date/time of the alarm's initial occurrence or its next repetition after a given time.
Definition alarm.cpp:654
KCalCore::Alarm::setMailAttachments
void setMailAttachments(const QStringList &mailAttachFiles)
Sets a list of filenames to attach to a mail message for an Email alarm type.
Definition alarm.cpp:423
KCalCore::Alarm::setType
void setType(Type type)
Sets the Type for this alarm to type.
Definition alarm.cpp:206
KCalCore::Alarm::endTime
KDateTime endTime() const
Returns the date/time when the last repetition of the alarm goes off.
Definition alarm.cpp:713
KCalCore::Alarm::setEndOffset
void setEndOffset(const Duration &offset)
Sets the alarm offset relative to the end of the parent Incidence.
Definition alarm.cpp:780
KCalCore::Alarm::repeatCount
int repeatCount() const
Returns how many times an alarm may repeats after its initial occurrence.
Definition alarm.cpp:643
KCalCore::Alarm::setTime
void setTime(const KDateTime &alarmTime)
Sets the trigger time of the alarm.
Definition alarm.cpp:504
KCalCore::Alarm::customPropertyUpdated
virtual void customPropertyUpdated()
Definition alarm.cpp:808
KCalCore::Alarm::setProcedureAlarm
void setProcedureAlarm(const QString &programFile, const QString &arguments=QString())
Sets the Procedure type for this alarm and the program (with arguments) to execute when the alarm is ...
Definition alarm.cpp:279
KCalCore::Alarm::setMailText
void setMailText(const QString &text)
Sets the body text for an Email alarm type.
Definition alarm.cpp:454
KCalCore::Alarm::setMailAddress
void setMailAddress(const Person::Ptr &mailAlarmAddress)
Sets the email address of an Email type alarm.
Definition alarm.cpp:346
KCalCore::Alarm::operator=
Alarm & operator=(const Alarm &)
Copy operator.
Definition alarm.cpp:120
KCalCore::Alarm::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition alarm.cpp:876
KCalCore::CustomProperties::CustomProperties
CustomProperties()
Constructs an empty custom properties instance.
Definition customproperties.cpp:86
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-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 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