Commit c4c26cb6 authored by David Jarvie's avatar David Jarvie

Bug 276596: cancel wake-from-suspend when user quits KAlarm

When the user quits KAlarm other than by logging out, cancel any
scheduled wake-from-suspend alarm.
parent 63f1016c
......@@ -118,6 +118,7 @@ KAlarmApp::KAlarmApp()
mPurgeDaysQueued(-1),
mKSpeech(0),
mPendingQuit(false),
mCancelRtcWake(false),
mProcessingQueue(false),
mSessionClosingDown(false),
mAlarmsEnabled(true),
......@@ -574,6 +575,11 @@ bool KAlarmApp::quitIf(int exitCode, bool force)
// This was the last/only running "instance" of the program, so exit completely.
kDebug() << exitCode << ": quitting";
MessageWin::stopAudio(true);
if (mCancelRtcWake)
{
KAlarm::setRtcWakeTime(0, 0);
KAlarm::deleteRtcWakeConfig();
}
delete mAlarmTimer; // prevent checking for alarms after deleting calendars
mAlarmTimer = 0;
mInitialised = false; // prevent processQueue() from running
......@@ -595,6 +601,16 @@ void KAlarmApp::doQuit(QWidget* parent)
QString(), KStandardGuiItem::quit(), Preferences::QUIT_WARN
) != KMessageBox::Yes)
return;
if (!KAlarm::checkRtcWakeConfig(true).isEmpty())
{
// A wake-on-suspend alarm is set
if (KAMessageBox::warningContinueCancel(parent, KMessageBox::Cancel,
i18nc("@info", "Quitting will cancel the scheduled Wake from Suspend."),
QString(), KStandardGuiItem::quit()
) != KMessageBox::Yes)
return;
mCancelRtcWake = true;
}
if (!Preferences::autoStart())
{
int option = KMessageBox::No;
......
......@@ -213,6 +213,7 @@ class KAlarmApp : public KUniqueApplication
mutable OrgKdeKSpeechInterface* mKSpeech;// KSpeech D-Bus interface object
int mPendingQuitCode; // exit code for a pending quit
bool mPendingQuit; // quit once the DCOP command and shell command queues have been processed
bool mCancelRtcWake; // cancel RTC wake on quitting
bool mProcessingQueue; // a mDcopQueue entry is currently being processed
bool mNoSystemTray; // no system tray exists
bool mSessionClosingDown; // session manager is closing the application
......
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