Commit 1947b38a authored by David Jarvie's avatar David Jarvie
Browse files

Minor fixes

parent 7fde8be1
......@@ -780,7 +780,7 @@ void KAEventPrivate::set(const Event::Ptr &event)
flag = flags.at(++i);
if (flag == KAEventPrivate::REMINDER_ONCE_FLAG) {
mReminderOnceOnly = true;
++i;
flag = flags.at(++i);
}
const int len = flag.length() - 1;
mReminderMinutes = -flag.leftRef(len).toInt(); // -> 0 if conversion fails
......@@ -874,7 +874,7 @@ void KAEventPrivate::set(const Event::Ptr &event)
mRepeatAtLogin = false;
mDisplaying = false;
mCommandScript = false;
mExtraActionOptions = nullptr;
mExtraActionOptions = 0;
mDeferral = NO_DEFERRAL;
mSoundVolume = -1;
mFadeVolume = -1;
......@@ -1122,7 +1122,8 @@ void KAEventPrivate::set(const KDateTime &dateTime, const QString &text, const Q
{
clearRecur();
mStartDateTime = dateTime;
mStartDateTime.setDateOnly(flags & KAEvent::ANY_TIME);
if (flags & KAEvent::ANY_TIME)
mStartDateTime.setDateOnly(true);
mNextMainDateTime = mStartDateTime;
switch (action) {
case KAEvent::MESSAGE:
......@@ -1157,7 +1158,6 @@ void KAEventPrivate::set(const KDateTime &dateTime, const QString &text, const Q
mLateCancel = lateCancel; // do this before setting flags
mDeferral = NO_DEFERRAL; // do this before setting flags
mStartDateTime.setDateOnly(flags & KAEvent::ANY_TIME);
set_deferral((flags & DEFERRAL) ? NORMAL_DEFERRAL : NO_DEFERRAL);
mRepeatAtLogin = flags & KAEvent::REPEAT_AT_LOGIN;
mConfirmAck = flags & KAEvent::CONFIRM_ACK;
......@@ -1193,7 +1193,7 @@ void KAEventPrivate::set(const KDateTime &dateTime, const QString &text, const Q
mDisplayingEdit = false;
mArchive = false;
mReminderAfterTime = DateTime();
mExtraActionOptions = nullptr;
mExtraActionOptions = 0;
mCompatibility = KACalendar::Current;
mReadOnly = false;
mCommandError = KAEvent::CMD_NO_ERROR;
......@@ -1587,11 +1587,10 @@ Alarm::Ptr KAEventPrivate::initKCalAlarm(const Event::Ptr &event, int startOffse
break;
case KAEvent::AUDIO:
setAudioAlarm(alarm);
if (mRepeatSoundPause >= 0) {
alltypes += SOUND_REPEAT_TYPE;
if (type == MAIN_ALARM) {
alltypes += QString::number(mRepeatSoundPause);
}
if (mRepeatSoundPause >= 0 && type == MAIN_ALARM) {
// Indicate repeating sound in the main alarm by a non-standard
// method, since it might have a sub-repetition too.
alltypes << SOUND_REPEAT_TYPE << QString::number(mRepeatSoundPause);
}
break;
}
......@@ -1668,7 +1667,7 @@ KAEvent::Flags KAEvent::flags() const
KAEvent::Flags KAEventPrivate::flags() const
{
KAEvent::Flags result(nullptr);
KAEvent::Flags result(0);
if (mBeep) {
result |= KAEvent::BEEP;
}
......@@ -3955,7 +3954,7 @@ void KAEventPrivate::readAlarm(const Alarm::Ptr &alarm, AlarmData &data, bool au
}
data.cleanText += alarm->programArguments();
}
data.extraActionOptions = nullptr;
data.extraActionOptions = 0;
if (flags.contains(KAEventPrivate::EXEC_ON_DEFERRAL_FLAG)) {
data.extraActionOptions |= KAEvent::ExecPreActOnDeferral;
}
......@@ -4776,7 +4775,7 @@ void KAEventPrivate::setAudioAlarm(const Alarm::Ptr &alarm) const
alarm->setAudioAlarm(mAudioFile); // empty for a beep or for speaking
if (mSoundVolume >= 0)
alarm->setCustomProperty(KACalendar::APPNAME, VOLUME_PROPERTY,
QStringLiteral("%1;%2;%3;%4").arg(QString::number(mSoundVolume, 'f', 2), QString::number(mFadeVolume, 'f', 2), QString::number(mFadeSeconds)));
QStringLiteral("%1;%2;%3").arg(QString::number(mSoundVolume, 'f', 2), QString::number(mFadeVolume, 'f', 2), QString::number(mFadeSeconds)));
}
/******************************************************************************
......@@ -5840,6 +5839,7 @@ QString EmailAddressList::pureAddresses(const QString &separator) const
*/
static void setProcedureAlarm(const Alarm::Ptr &alarm, const QString &commandLine)
{
//TODO: cater for environment variables prefixed to command
QString command;
QString arguments;
QChar quoteChar;
......
......@@ -208,7 +208,7 @@ public:
ANY_TIME = 0x08, //!< only a date is specified for the alarm, not a time
CONFIRM_ACK = 0x10, //!< closing the alarm message window requires a confirmation prompt
EMAIL_BCC = 0x20, //!< blind copy the email to the user
DEFAULT_FONT = 0x40, //!< use the default alarm message font
DEFAULT_FONT = 0x40, //!< use the default alarm message font. Overrides any specified font.
REPEAT_SOUND = 0x80, //!< repeat the sound file while the alarm is displayed
DISABLED = 0x100, //!< the alarm is currently disabled
AUTO_CLOSE = 0x200, //!< auto-close the alarm window after the late-cancel period
......@@ -316,7 +316,8 @@ public:
KAEvent();
/** Construct an event and initialise with the specified parameters.
* @param dt start date/time.
* @param dt start date/time. If @dt is date-only, or if #ANY_TIME flag
* is specified, the event will be date-only.
* @param text alarm message (@p action = #MESSAGE);
* file to display (@p action = #FILE);
* command to execute (@p action = #COMMAND);
......@@ -324,7 +325,8 @@ public:
* audio file (@p action = #AUDIO).
* @param bg background color (for display alarms, ignored otherwise).
* @param fg foreground color (for display alarms, ignored otherwise).
* @param font font (for display alarms, ignored otherwise).
* @param font font (for display alarms, ignored otherwise). Ignored if
* #DEFAULT_FONT flag is specified.
* @param action alarm action type.
* @param lateCancel late-cancellation period (minutes), else 0.
* @param flags OR of #Flag enum values.
......@@ -333,12 +335,29 @@ public:
* to the instance; call endChanges() when changes
* are complete.
*/
KAEvent(const KDateTime &, const QString &text, const QColor &bg, const QColor &fg,
const QFont &f, SubAction, int lateCancel, Flags flags, bool changesPending = false);
/** Construct an event and initialise it from a KCalCore::Event. */
KAEvent(const KDateTime &dt, const QString &text, const QColor &bg, const QColor &fg,
const QFont &font, SubAction action, int lateCancel, Flags flags, bool changesPending = false);
/** Construct an event and initialise it from a KCalCore::Event.
*
* The initialisation is identical to that performed by set().
*/
explicit KAEvent(const KCalCore::Event::Ptr &);
/** Initialise the instance from a KCalCore::Event. */
/** Initialise the instance from a KCalCore::Event.
*
* It uses the following properties from KCalCore::Event:
* - Unique ID.
* - Summary.
* - Creation date/time.
* - Start date/time.
* - Recurrence rule.
* - Alarms.
* - Read only.
* - Custom properties. X-KDE-KALARM- properties are interpreted and used to
* set numerous KAEvent properties; non-KAlarm properties are simply stored.
* - Custom status if equal to "DISABLED".
* - Revision number.
*/
void set(const KCalCore::Event::Ptr &);
KAEvent(const KAEvent &other);
......@@ -725,11 +744,11 @@ public:
/** Set the pre-alarm and post-alarm actions, and their options.
* @param pre shell command to execute before the alarm is displayed
* @param post shell command to execute after the alarm is acknowledged
* @param options options for pre- or post-alarm actions
* @param preOptions options for pre-alarm actions
* @see preAction(), postAction(), extraActionOptions()
* @since 4.9
*/
void setActions(const QString &pre, const QString &post, ExtraActionOptions options);
void setActions(const QString &pre, const QString &post, ExtraActionOptions preOptions);
/** Return the shell command to execute before the alarm is displayed. */
QString preAction() const;
......@@ -739,8 +758,8 @@ public:
*/
QString postAction() const;
/** Return the pre- and post-alarm action options.
* @see preAction(), postAction(), setActions()
/** Return the pre-alarm action options.
* @see preAction(), setActions()
* @since 4.9
*/
ExtraActionOptions extraActionOptions() const;
......@@ -833,7 +852,8 @@ public:
bool deferDefaultDateOnly() const;
/** Return the start time for the event. If the event recurs, this is the
* time of the first recurrence.
* time of the first recurrence. If the event is date-only, this returns a
* date-only value.
* @see mainDateTime()
*/
DateTime startDateTime() const;
......@@ -913,6 +933,7 @@ public:
void setExcludeHolidays(bool exclude);
/** Return whether the alarm is disabled on holiday dates.
* If no holiday region has been set by setHolidays(), this returns false;
* @see setExcludeHolidays()
*/
bool holidaysExcluded() const;
......
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