Commit 473c8c05 authored by David Jarvie's avatar David Jarvie

Add command line option to start KAlarm with alarms disabled.

parent bc5f5b8a
......@@ -49,7 +49,8 @@ CommandOptions::CommandOptions()
mReminderMinutes(0),
mAudioVolume(-1),
mFromID(0),
mFlags(KAEvent::DEFAULT_FONT)
mFlags(KAEvent::DEFAULT_FONT),
mDisableAll(false)
{
mArgs = KCmdLineArgs::parsedArgs();
#ifndef NDEBUG
......@@ -195,6 +196,12 @@ CommandOptions::CommandOptions()
if (mArgs->count())
mText = mArgs->arg(0);
}
if (mArgs->isSet("disable-all"))
{
if (mCommand == TRIGGER_EVENT)
setErrorIncompatible("--disable-all", mCommandName);
mDisableAll = true;
}
// Check that other options are only specified for the
// correct main command options.
......
......@@ -68,6 +68,7 @@ class CommandOptions
QString subject() const { return mSubject; }
uint fromID() const { return mFromID; }
int flags() const { return mFlags; }
bool disableAll() const { return mDisableAll; }
#ifndef NDEBUG
KDateTime simulationTime() const { return mSimulationTime; }
#endif
......@@ -108,6 +109,7 @@ class CommandOptions
QString mSubject; // NEW: email subject
uint mFromID; // NEW: email sender ID
int mFlags; // NEW: event flags
bool mDisableAll; // disable all alarm monitoring
#ifndef NDEBUG
KDateTime mSimulationTime; // system time to be simulated, or invalid if none
#endif
......
......@@ -310,6 +310,8 @@ int KAlarmApp::newInstance()
KAlarm::setSimulatedSystemTime(options.simulationTime());
#endif
CommandOptions::Command command = options.command();
if (options.disableAll())
setAlarmsEnabled(false); // disable alarm monitoring
switch (command)
{
case CommandOptions::TRIGGER_EVENT:
......
......@@ -62,6 +62,7 @@ int main(int argc, char *argv[])
options.add("cancelEvent <eventID>", ki18n("Cancel alarm with the specified event ID"));
options.add("d");
options.add("disable", ki18n("Disable the alarm"));
options.add("disable-all", ki18n("Disable monitoring of all alarms"));
options.add("e");
options.add("!exec <commandline>", ki18n("Execute a shell command line"));
options.add("E");
......
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