From 9b78781d4221bc00563906f7d972e1370a0ef6b1 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 16 Jan 2018 18:18:09 +0000
Subject: mythtv & mythplugins: update to latest fixes

add Auto Shutdown menu to System Menu
---
 abs/core/mythtv/stable-29/git_src/git_hash         |  2 +-
 abs/core/mythtv/stable-29/mythplugins/PKGBUILD     |  2 +-
 abs/core/mythtv/stable-29/mythtv/PKGBUILD          |  4 +-
 .../addEnableDisableAutoShutdownToSystemMenu.patch | 50 ++++++++++++++++++++++
 4 files changed, 55 insertions(+), 3 deletions(-)
 create mode 100644 abs/core/mythtv/stable-29/mythtv/addEnableDisableAutoShutdownToSystemMenu.patch

diff --git a/abs/core/mythtv/stable-29/git_src/git_hash b/abs/core/mythtv/stable-29/git_src/git_hash
index c3edd34..2ce2a78 100644
--- a/abs/core/mythtv/stable-29/git_src/git_hash
+++ b/abs/core/mythtv/stable-29/git_src/git_hash
@@ -1 +1 @@
-9dbf6706337b72b132f34d6c8e9f305609a44d7e
+771115f47d39095652f8f660d3477008a0cbce12
diff --git a/abs/core/mythtv/stable-29/mythplugins/PKGBUILD b/abs/core/mythtv/stable-29/mythplugins/PKGBUILD
index 13c6da2..a6132b3 100644
--- a/abs/core/mythtv/stable-29/mythplugins/PKGBUILD
+++ b/abs/core/mythtv/stable-29/mythplugins/PKGBUILD
@@ -9,7 +9,7 @@ pkgname=('mytharchive'
          'mythweather'
          'mythzoneminder')
 pkgver=29
-pkgrel=8
+pkgrel=9
 arch=('i686' 'x86_64')
 url="http://www.mythtv.org"
 license=('GPL')
diff --git a/abs/core/mythtv/stable-29/mythtv/PKGBUILD b/abs/core/mythtv/stable-29/mythtv/PKGBUILD
index 3a8faed..cdac547 100644
--- a/abs/core/mythtv/stable-29/mythtv/PKGBUILD
+++ b/abs/core/mythtv/stable-29/mythtv/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythtv
 pkgver=29
-pkgrel=8
+pkgrel=9
 commit_hash=`cat ../git_src/git_hash`
 pkgdesc="A Homebrew PVR project $commit_hash"
 arch=('i686' 'x86_64')
@@ -31,6 +31,7 @@ patches=(
          'searchMetatdataSelectedGrabber.patch'
          'addDamagedToProgDetails.patch'
          'defaultThemeLinHES.patch'
+         'addEnableDisableAutoShutdownToSystemMenu.patch'
          'mythfrontend_en_us.ts_Title_Case.patch'
          '0006-cardutil_show_displayname.patch'
          '0037-pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch'
@@ -130,6 +131,7 @@ md5sums=('fb5a87c52a31168a0c8fdde72f27cc45'
          '0f674b9cad031ba1e03aaf6b5ee1499f'
          '6add9c16bbb988067e82029327e567b2'
          'b0b238320fa78a4928dce2cea7c85071'
+         '8e4492d1777234a021f368bd6ee964ee'
          '1164214d9eb41588f8eb3382565cb003'
          '5f2bd4065b145b7b7ff09dfd6f08276c'
          '2371cf6e680179c067a6ff7756638128'
diff --git a/abs/core/mythtv/stable-29/mythtv/addEnableDisableAutoShutdownToSystemMenu.patch b/abs/core/mythtv/stable-29/mythtv/addEnableDisableAutoShutdownToSystemMenu.patch
new file mode 100644
index 0000000..b14e2e0
--- /dev/null
+++ b/abs/core/mythtv/stable-29/mythtv/addEnableDisableAutoShutdownToSystemMenu.patch
@@ -0,0 +1,50 @@
+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")
+         {
-- 
cgit v0.12

