Ticket #13431: addEnableDisableAutoShutdownToSystemMenu.patch

File addEnableDisableAutoShutdownToSystemMenu.patch, 1.9 KB (added by Britney Fransen, 5 years ago)
  • mythtv/libs/libmythui/myththemedmenu.cpp

    diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp
    index ed2e54c..77aaf73 100644
    a b void MythThemedMenu::ShowMenu() 
    308308        return;
    309309
    310310    int override_menu = GetMythDB()->GetNumSetting("OverrideExitMenu");
     311    int MythShutdownLock = GetMythDB()->GetNumSetting("MythShutdownLock");
     312    int idleTimeoutSecs = GetMythDB()->GetNumSetting("idleTimeoutSecs");
    311313    QString label = tr("System Menu");
    312314    MythScreenStack* mainStack = GetMythMainWindow()->GetMainStack();
    313315    m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
    void MythThemedMenu::ShowMenu() 
    325327    if (override_menu != 7)
    326328        m_menuPopup->AddButton(tr("Exit application"), QVariant("exit"));
    327329
     330    // don't offer to enable/disable auto shutdown if auto shutdown is disabled
     331    if (idleTimeoutSecs != 0)
     332    {
     333        if (MythShutdownLock == 0)
     334        {
     335            m_menuPopup->AddButton(tr("Disable Auto Shutdown"),
     336                                    QVariant("lockShutdown"));
     337        }
     338        else
     339        {
     340            m_menuPopup->AddButton(tr("Enable Auto Shutdown"),
     341                                    QVariant("unlockShutdown"));
     342        }
     343    }
     344
    328345    switch (override_menu)
    329346    {
    330347        case 2:
    void MythThemedMenu::customEvent(QEvent *event) 
    416433                QString arg("exiting_app");
    417434                m_state->m_callback(m_state->m_callbackdata, arg);
    418435            }
     436            else if (action == "lockShutdown")
     437            {
     438                GetMythDB()->SaveSettingOnHost("MythShutdownLock", "1", NULL);
     439            }
     440            else if (action == "unlockShutdown")
     441            {
     442                GetMythDB()->SaveSettingOnHost("MythShutdownLock", "0", NULL);
     443            }
    419444        }
    420445        else if (resultid == "password")
    421446        {