Commit 28562603 authored by David Jarvie's avatar David Jarvie

Move some KAEvent specific stuff from base class into KAEvent

parent fc8da3c4
......@@ -290,6 +290,7 @@ void KAEvent::Private::copy(const KAEvent::Private& event)
mAllWorkTrigger = event.mAllWorkTrigger;
mMainWorkTrigger = event.mMainWorkTrigger;
mCommandError = event.mCommandError;
mEventID = event.mEventID;
mTemplateName = event.mTemplateName;
#ifdef USE_AKONADI
mCustomProperties = event.mCustomProperties;
......@@ -317,6 +318,9 @@ void KAEvent::Private::copy(const KAEvent::Private& event)
mDeferral = event.mDeferral;
mKMailSerialNumber = event.mKMailSerialNumber;
mTemplateAfterTime = event.mTemplateAfterTime;
mBgColour = event.mBgColour;
mFgColour = event.mFgColour;
mFont = event.mFont;
mEmailFromIdentity = event.mEmailFromIdentity;
mEmailAddresses = event.mEmailAddresses;
mEmailSubject = event.mEmailSubject;
......@@ -335,6 +339,7 @@ void KAEvent::Private::copy(const KAEvent::Private& event)
mCancelOnPreActErr = event.mCancelOnPreActErr;
mDontShowPreActErr = event.mDontShowPreActErr;
mConfirmAck = event.mConfirmAck;
mUseDefaultFont = event.mUseDefaultFont;
mCommandXterm = event.mCommandXterm;
mCommandDisplay = event.mCommandDisplay;
mEmailBcc = event.mEmailBcc;
......@@ -1156,6 +1161,7 @@ void KAEvent::Private::set(const KDateTime& dateTime, const QString& text, const
mStartDateTime.setDateOnly(flags & ANY_TIME);
set_deferral((flags & DEFERRAL) ? NORMAL_DEFERRAL : NO_DEFERRAL);
mConfirmAck = flags & CONFIRM_ACK;
mUseDefaultFont = flags & DEFAULT_FONT;
mCommandXterm = flags & EXEC_IN_XTERM;
mCommandDisplay = flags & DISPLAY_COMMAND;
mCopyToKOrganizer = flags & COPY_KORGANIZER;
......@@ -2039,6 +2045,7 @@ int KAEvent::Private::flags() const
| (mDeferral != NO_DEFERRAL ? DEFERRAL : 0)
| (mSpeak ? SPEAK : 0)
| (mConfirmAck ? CONFIRM_ACK : 0)
| (mUseDefaultFont ? DEFAULT_FONT : 0)
| (mCommandXterm ? EXEC_IN_XTERM : 0)
| (mCommandDisplay ? DISPLAY_COMMAND : 0)
| (mCopyToKOrganizer ? COPY_KORGANIZER : 0)
......@@ -2544,13 +2551,8 @@ KAAlarm KAEvent::Private::alarm(KAAlarm::Type type) const
KAAlarm al; // this sets type to INVALID_ALARM
if (mAlarmCount)
{
al.mEventID = mEventID;
al.mActionType = mActionType;
al.mText = mText;
al.mBgColour = mBgColour;
al.mFgColour = mFgColour;
al.mFont = mFont;
al.mUseDefaultFont = mUseDefaultFont;
al.mRepeatAtLogin = false;
al.mDeferred = false;
al.mLateCancel = mLateCancel;
......@@ -4780,6 +4782,7 @@ void KAEvent::Private::dumpDebug() const
#ifndef USE_AKONADI
if (mResource) { kDebug() << "-- mResource:" << mResource->resourceName(); }
#endif
kDebug() << "-- mEventID:" << mEventID;
kDebug() << "-- mCommandError:" << mCommandError;
kDebug() << "-- mAllTrigger:" << mAllTrigger.toString();
kDebug() << "-- mMainTrigger:" << mMainTrigger.toString();
......@@ -4794,6 +4797,11 @@ void KAEvent::Private::dumpDebug() const
}
if (mActionType == T_MESSAGE || mActionType == T_FILE)
{
kDebug() << "-- mBgColour:" << mBgColour.name();
kDebug() << "-- mFgColour:" << mFgColour.name();
kDebug() << "-- mUseDefaultFont:" << mUseDefaultFont;
if (!mUseDefaultFont)
kDebug() << "-- mFont:" << mFont.toString();
kDebug() << "-- mSpeak:" << mSpeak;
kDebug() << "-- mAudioFile:" << mAudioFile;
kDebug() << "-- mPreAction:" << mPreAction;
......@@ -4946,12 +4954,8 @@ const char* KAAlarm::debugType(Type type)
void KAAlarmEventBase::copy(const KAAlarmEventBase& rhs)
{
mEventID = rhs.mEventID;
mText = rhs.mText;
mNextMainDateTime = rhs.mNextMainDateTime;
mBgColour = rhs.mBgColour;
mFgColour = rhs.mFgColour;
mFont = rhs.mFont;
mActionType = rhs.mActionType;
mCommandScript = rhs.mCommandScript;
mRepetition = rhs.mRepetition;
......@@ -4959,14 +4963,12 @@ void KAAlarmEventBase::copy(const KAAlarmEventBase& rhs)
mRepeatAtLogin = rhs.mRepeatAtLogin;
mLateCancel = rhs.mLateCancel;
mAutoClose = rhs.mAutoClose;
mUseDefaultFont = rhs.mUseDefaultFont;
}
void KAAlarmEventBase::set(int flags)
{
mRepeatAtLogin = flags & KAEvent::REPEAT_AT_LOGIN;
mAutoClose = (flags & KAEvent::AUTO_CLOSE) && mLateCancel;
mUseDefaultFont = flags & KAEvent::DEFAULT_FONT;
mCommandScript = flags & KAEvent::SCRIPT;
}
......@@ -4974,24 +4976,17 @@ int KAAlarmEventBase::baseFlags() const
{
return (mRepeatAtLogin ? KAEvent::REPEAT_AT_LOGIN : 0)
| (mAutoClose ? KAEvent::AUTO_CLOSE : 0)
| (mUseDefaultFont ? KAEvent::DEFAULT_FONT : 0)
| (mCommandScript ? KAEvent::SCRIPT : 0);
}
#ifndef KDE_NO_DEBUG_OUTPUT
void KAAlarmEventBase::baseDumpDebug() const
{
kDebug() << "-- mEventID:" << mEventID;
kDebug() << "-- mActionType:" << (mActionType == T_MESSAGE ? "MESSAGE" : mActionType == T_FILE ? "FILE" : mActionType == T_COMMAND ? "COMMAND" : mActionType == T_EMAIL ? "EMAIL" : mActionType == T_AUDIO ? "AUDIO" : "??");
kDebug() << "-- mText:" << mText;
if (mActionType == T_COMMAND)
kDebug() << "-- mCommandScript:" << mCommandScript;
kDebug() << "-- mNextMainDateTime:" << mNextMainDateTime.toString();
kDebug() << "-- mBgColour:" << mBgColour.name();
kDebug() << "-- mFgColour:" << mFgColour.name();
kDebug() << "-- mUseDefaultFont:" << mUseDefaultFont;
if (!mUseDefaultFont)
kDebug() << "-- mFont:" << mFont.toString();
kDebug() << "-- mRepeatAtLogin:" << mRepeatAtLogin;
if (!mRepetition)
kDebug() << "-- mRepetition: 0";
......
......@@ -105,12 +105,8 @@ class KALARM_CAL_EXPORT KAAlarmEventBase
void baseDumpDebug() const;
#endif
QString mEventID; // UID: KCal::Event unique ID
DateTime mNextMainDateTime; // next time to display the alarm, excluding repetitions
QString mText; // message text, file URL, command, email body [or audio file for KAAlarm]
QColor mBgColour; // background colour of alarm message
QColor mFgColour; // foreground colour of alarm message, or invalid for default
QFont mFont; // font of alarm message (ignored if mUseDefaultFont true)
Type mActionType; // alarm action type
Repetition mRepetition; // sub-repetition count and interval
int mNextRepeat; // repetition count of next due sub-repetition
......@@ -118,7 +114,6 @@ class KALARM_CAL_EXPORT KAAlarmEventBase
bool mAutoClose; // whether to close the alarm window after the late-cancel period
bool mCommandScript; // the command text is a script, not a shell command line
bool mRepeatAtLogin; // whether to repeat the alarm at every login
bool mUseDefaultFont; // use default message font, not mFont
friend class KAEvent;
friend class AlarmData;
......@@ -187,7 +182,6 @@ class KALARM_CAL_EXPORT KAAlarm : public KAAlarmEventBase
bool isValid() const { return mType != INVALID__ALARM; }
Type type() const { return static_cast<Type>(mType & ~TIMED_DEFERRAL_FLAG); }
SubType subType() const { return mType; }
const QString& eventId() const { return mEventID; }
DateTime dateTime(bool withRepeats = false) const
{ return (withRepeats && mNextRepeat && mRepetition)
? mRepetition.duration(mNextRepeat).end(mNextMainDateTime.kDateTime()) : mNextMainDateTime; }
......@@ -693,6 +687,7 @@ class KALARM_CAL_EXPORT KAEvent
mutable DateTime mMainWorkTrigger; // next trigger time, ignoring reminders but taking account of working hours
mutable CmdErrType mCommandError; // command execution error last time the alarm triggered
QString mEventID; // UID: KCal::Event unique ID
QString mTemplateName; // alarm template's name, or null if normal event
#ifdef USE_AKONADI
QMap<QByteArray, QString> mCustomProperties; // KCal::Event's non-KAlarm custom properties
......@@ -721,6 +716,9 @@ class KALARM_CAL_EXPORT KAEvent
DeferType mDeferral; // whether the alarm is an extra deferred/deferred-reminder alarm
unsigned long mKMailSerialNumber; // if email text, message's KMail serial number
int mTemplateAfterTime; // time not specified: use n minutes after default time, or -1 (applies to templates only)
QColor mBgColour; // background colour of alarm message
QColor mFgColour; // foreground colour of alarm message, or invalid for default
QFont mFont; // font of alarm message (ignored if mUseDefaultFont true)
uint mEmailFromIdentity; // standard email identity uoid for 'From' field, or empty
EmailAddressList mEmailAddresses; // ATTENDEE: addresses to send email to
QString mEmailSubject; // SUMMARY: subject line of email
......@@ -742,6 +740,7 @@ class KALARM_CAL_EXPORT KAEvent
bool mCancelOnPreActErr; // cancel alarm if pre-alarm action fails
bool mDontShowPreActErr; // don't notify error if pre-alarm action fails
bool mConfirmAck; // alarm acknowledgement requires confirmation by user
bool mUseDefaultFont; // use default message font, not mFont
bool mCommandXterm; // command alarm is to be executed in a terminal window
bool mCommandDisplay; // command output is to be displayed in an alarm window
bool mEmailBcc; // blind copy the email to the user
......
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