diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp index ed2e54c..77aaf73 100644 --- a/mythtv/libs/libmythui/myththemedmenu.cpp +++ b/mythtv/libs/libmythui/myththemedmenu.cpp @@ -308,6 +308,8 @@ void MythThemedMenu::ShowMenu() return; int override_menu = GetMythDB()->GetNumSetting("OverrideExitMenu"); + int MythShutdownLock = GetMythDB()->GetNumSetting("MythShutdownLock"); + int idleTimeoutSecs = GetMythDB()->GetNumSetting("idleTimeoutSecs"); QString label = tr("System Menu"); MythScreenStack* mainStack = GetMythMainWindow()->GetMainStack(); m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup"); @@ -325,6 +327,21 @@ void MythThemedMenu::ShowMenu() if (override_menu != 7) m_menuPopup->AddButton(tr("Exit application"), QVariant("exit")); + // don't offer to enable/disable auto shutdown if auto shutdown is disabled + if (idleTimeoutSecs != 0) + { + if (MythShutdownLock == 0) + { + m_menuPopup->AddButton(tr("Disable Auto Shutdown"), + QVariant("lockShutdown")); + } + else + { + m_menuPopup->AddButton(tr("Enable Auto Shutdown"), + QVariant("unlockShutdown")); + } + } + switch (override_menu) { case 2: @@ -416,6 +433,14 @@ void MythThemedMenu::customEvent(QEvent *event) QString arg("exiting_app"); m_state->m_callback(m_state->m_callbackdata, arg); } + else if (action == "lockShutdown") + { + GetMythDB()->SaveSettingOnHost("MythShutdownLock", "1", NULL); + } + else if (action == "unlockShutdown") + { + GetMythDB()->SaveSettingOnHost("MythShutdownLock", "0", NULL); + } } else if (resultid == "password") {