Commit ee7c89d1 authored by David Jarvie's avatar David Jarvie
Browse files

Remove common base class for KAEvent and KAAlarm

parent 68c6683a
This diff is collapsed.
...@@ -87,55 +87,25 @@ class KALARM_CAL_EXPORT EmailAddressList : public QList<KCal::Person> ...@@ -87,55 +87,25 @@ class KALARM_CAL_EXPORT EmailAddressList : public QList<KCal::Person>
}; };
// Base class containing data common to KAAlarm and KAEvent::Private
class KALARM_CAL_EXPORT KAAlarmEventBase
{
public:
~KAAlarmEventBase() { }
protected:
enum Type { T_MESSAGE, T_FILE, T_COMMAND, T_EMAIL, T_AUDIO };
KAAlarmEventBase() : mNextRepeat(0), mRepeatAtLogin(false) {}
KAAlarmEventBase(const KAAlarmEventBase& rhs) { copy(rhs); }
KAAlarmEventBase& operator=(const KAAlarmEventBase& rhs) { copy(rhs); return *this; }
void copy(const KAAlarmEventBase&);
void set(int flags);
int baseFlags() const;
#ifdef KDE_NO_DEBUG_OUTPUT
void baseDumpDebug() const { }
#else
void baseDumpDebug() const;
#endif
DateTime mNextMainDateTime; // next time to display the alarm, excluding repetitions
Type mActionType; // alarm action type
Repetition mRepetition; // sub-repetition count and interval
int mNextRepeat; // repetition count of next due sub-repetition
bool mRepeatAtLogin; // whether to repeat the alarm at every login
friend class KAEvent;
friend class AlarmData;
};
// KAAlarm corresponds to a single KCal::Alarm instance. // KAAlarm corresponds to a single KCal::Alarm instance.
// A KAEvent may contain multiple KAAlarm's. // A KAEvent may contain multiple KAAlarm's.
class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase class KALARM_CAL_EXPORT KAAlarm
{ {
public: public:
// Define the basic KAAlarm action types /** The basic KAAlarm action types. */
enum Action enum Action
{ {
MESSAGE = T_MESSAGE, // KCal::Alarm::Display type: display a text message MESSAGE, // KCal::Alarm::Display type: display a text message
FILE = T_FILE, // KCal::Alarm::Display type: display a file (URL given by the alarm text) FILE, // KCal::Alarm::Display type: display a file (URL given by the alarm text)
COMMAND = T_COMMAND, // KCal::Alarm::Procedure type: execute a shell command COMMAND, // KCal::Alarm::Procedure type: execute a shell command
EMAIL = T_EMAIL, // KCal::Alarm::Email type: send an email EMAIL, // KCal::Alarm::Email type: send an email
AUDIO = T_AUDIO // KCal::Alarm::Audio type: play a sound file AUDIO // KCal::Alarm::Audio type: play a sound file
}; };
// Define the KAAlarm types.
// KAAlarm's of different types may be contained in a KAEvent, /** The alarm types.
// each defining a different component of the overall alarm. * KAAlarm's of different types may be contained in a KAEvent,
* each defining a different component of the overall alarm.
*/
enum Type enum Type
{ {
INVALID_ALARM = 0, // not an alarm INVALID_ALARM = 0, // not an alarm
...@@ -153,6 +123,7 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase ...@@ -153,6 +123,7 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase
PRE_ACTION_ALARM = 0x40, // command to execute before displaying the alarm PRE_ACTION_ALARM = 0x40, // command to execute before displaying the alarm
POST_ACTION_ALARM = 0x50 // command to execute after the alarm window is closed POST_ACTION_ALARM = 0x50 // command to execute after the alarm window is closed
}; };
enum SubType enum SubType
{ {
INVALID__ALARM = INVALID_ALARM, INVALID__ALARM = INVALID_ALARM,
...@@ -174,10 +145,10 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase ...@@ -174,10 +145,10 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase
POST_ACTION__ALARM = POST_ACTION_ALARM POST_ACTION__ALARM = POST_ACTION_ALARM
}; };
KAAlarm() : mType(INVALID__ALARM), mDeferred(false) { } KAAlarm() : mType(INVALID__ALARM), mNextRepeat(0), mRepeatAtLogin(false), mDeferred(false) { }
KAAlarm(const KAAlarm&); KAAlarm(const KAAlarm&);
~KAAlarm() { } ~KAAlarm() { }
Action action() const { return (Action)mActionType; } Action action() const { return mActionType; }
bool isValid() const { return mType != INVALID__ALARM; } bool isValid() const { return mType != INVALID__ALARM; }
Type type() const { return static_cast<Type>(mType & ~TIMED_DEFERRAL_FLAG); } Type type() const { return static_cast<Type>(mType & ~TIMED_DEFERRAL_FLAG); }
SubType subType() const { return mType; } SubType subType() const { return mType; }
...@@ -200,7 +171,12 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase ...@@ -200,7 +171,12 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase
#endif #endif
private: private:
Action mActionType; // alarm action type
SubType mType; // alarm type SubType mType; // alarm type
DateTime mNextMainDateTime; // next time to display the alarm, excluding repetitions
Repetition mRepetition; // sub-repetition count and interval
int mNextRepeat; // repetition count of next due sub-repetition
bool mRepeatAtLogin; // whether to repeat the alarm at every login
bool mRecurs; // there is a recurrence rule for the alarm bool mRecurs; // there is a recurrence rule for the alarm
bool mDeferred; // whether the alarm is an extra deferred/deferred-reminder alarm bool mDeferred; // whether the alarm is an extra deferred/deferred-reminder alarm
...@@ -260,11 +236,11 @@ class KALARM_CAL_EXPORT KAEvent ...@@ -260,11 +236,11 @@ class KALARM_CAL_EXPORT KAEvent
/** The sub-action type for the event's main alarm. */ /** The sub-action type for the event's main alarm. */
enum SubAction enum SubAction
{ {
MESSAGE = KAAlarmEventBase::T_MESSAGE, //!< display a message text MESSAGE = KAAlarm::MESSAGE, //!< display a message text
FILE = KAAlarmEventBase::T_FILE, //!< display the contents of a file FILE = KAAlarm::FILE, //!< display the contents of a file
COMMAND = KAAlarmEventBase::T_COMMAND, //!< execute a command COMMAND = KAAlarm::COMMAND, //!< execute a command
EMAIL = KAAlarmEventBase::T_EMAIL, //!< send an email EMAIL = KAAlarm::EMAIL, //!< send an email
AUDIO = KAAlarmEventBase::T_AUDIO //!< play an audio file AUDIO = KAAlarm::AUDIO //!< play an audio file
}; };
/** What type of occurrence is due. */ /** What type of occurrence is due. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment