From 620cb6800d15e6b2b0738b6cdd29080d2685f70b Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Sat, 15 Aug 2009 15:02:41 +0930
Subject: LinHES-config mythinstall: various timezone fixups

---
 abs/core-testing/LinHES-config/PKGBUILD          |   2 +-
 abs/core-testing/LinHES-config/mv_install.py     |   6 ++++--
 abs/core-testing/mythinstall/PKGBUILD            |   2 +-
 abs/core-testing/mythinstall/installdialog.cpp   |   1 -
 abs/core-testing/mythinstall/installsettings.cpp |  12 ++++++++++--
 abs/core-testing/mythinstall/misc_settings.cpp   |  12 ++++++++++--
 abs/core-testing/mythinstall/mv_common.h         |   2 +-
 abs/core-testing/mythinstall/mythinstall         | Bin 1068165 -> 0 bytes
 8 files changed, 27 insertions(+), 10 deletions(-)
 delete mode 100755 abs/core-testing/mythinstall/mythinstall

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 43ed4f8..77b9563 100644
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=85
+pkgrel=86
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted 
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 1ebc2f1..2f2d1c2 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -144,13 +144,15 @@ def timezone_to_db(timefile):
         f.close()
     except:
         logging.debug("Couldn't open /tmp/etc/timezone, will not set the timezone")
+	updatedb("HostTimeZone", "Unknown");
         return
+    update_db("HostTimeZone", timezonecontents);
     tzsplit = timezonecontents.partition('/')
     print tzsplit
     if tzsplit[2]  == '' :
-        update_db("HostTimeZoneRegion",  tzsplit[0])
+        update_db("HostTimeZoneRegion", tzsplit[0])
     else:
-        update_db("HostTimeZoneRegion",  tzsplit[0])
+        update_db("HostTimeZoneRegion", tzsplit[0])
         tztemp="HostTimeZoneRegion_%s" % tzsplit[0]
         update_db(tztemp, tzsplit[2])
 
diff --git a/abs/core-testing/mythinstall/PKGBUILD b/abs/core-testing/mythinstall/PKGBUILD
index 5687032..6fea8ed 100644
--- a/abs/core-testing/mythinstall/PKGBUILD
+++ b/abs/core-testing/mythinstall/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Jams
 pkgname=mythinstall
 pkgver=1
-pkgrel=5
+pkgrel=8
 pkgdesc="LinHES installer/systemconfig GUI."
 arch=i686
 depends=()
diff --git a/abs/core-testing/mythinstall/installdialog.cpp b/abs/core-testing/mythinstall/installdialog.cpp
index 5349453..e5bdfc9 100755
--- a/abs/core-testing/mythinstall/installdialog.cpp
+++ b/abs/core-testing/mythinstall/installdialog.cpp
@@ -364,7 +364,6 @@ void WelcomeDialog::showPopup(void)
     // This is a bad way to lock the buttons but it works for now.
     if ( scheduled_text.length() <= 2  )
     {
-        run_from_installer = TRUE;
         topButton = popup->addButton(tr("Install or Upgrade "), this,
                                 SLOT(Display_2ndpopup()));
         popup->addButton(tr("Run MythFrontend"), this,
diff --git a/abs/core-testing/mythinstall/installsettings.cpp b/abs/core-testing/mythinstall/installsettings.cpp
index 10341db..7315464 100755
--- a/abs/core-testing/mythinstall/installsettings.cpp
+++ b/abs/core-testing/mythinstall/installsettings.cpp
@@ -41,7 +41,7 @@
 #include <qsqlquery.h>
 #include "mv_common.h"
 
-int run_from_installer = FALSE;
+int timezone_unknown = FALSE;
 extern  HostParms hostparm;
 extern DDCinfo ddcinfo;
 
@@ -3403,8 +3403,16 @@ void pre_writesettings ()
                 hostparm.ThisHostName = "You_Fool";
     }
     // piece togther the timezone
+    QString tz;
     QString tregion;
     QString tsubregion;
+
+    tz=gContext->GetSetting("HostTimeZone");
+
+    cout << "tz extracted from database: " << tz << endl;
+    if ( tz.isEmpty() || (tz == "Unknown"))
+      timezone_unknown = TRUE;
+
     tregion=gContext->GetSetting("HostTimeZoneRegion");
     tsubregion=gContext->GetSetting("HostTimeZoneRegion_"+tregion);
     if ( tsubregion.isEmpty() )
@@ -3412,7 +3420,7 @@ void pre_writesettings ()
     else
         hostparm.ThisTimeZone  = tregion + "/" + tsubregion;
 
-    cout << hostparm.ThisTimeZone  << endl;
+    cout << "hostparm.ThisTimeZone " << hostparm.ThisTimeZone  << endl;
     // save some settings  back to the datebase
     gContext->SaveSetting("HostMyhostname" , hostparm.ThisHostName );
     gContext->SaveSetting("HostMysqlserver", hostparm.ThisDBhost );
diff --git a/abs/core-testing/mythinstall/misc_settings.cpp b/abs/core-testing/mythinstall/misc_settings.cpp
index ee09064..7c3eb67 100755
--- a/abs/core-testing/mythinstall/misc_settings.cpp
+++ b/abs/core-testing/mythinstall/misc_settings.cpp
@@ -113,11 +113,18 @@ QString MiscMainFrame::mf_show_tz(QString tz)
     QString GTimezone;
     int rc;
 
-    autoLaunchTimer->stop();
+    if (autoLaunchTimer->isActive())
+    {
+      autoLaunchTimer->stop();
+
+      // This was triggered by the timer. Only launch the timezone gui if the timezone is unknown.
+      if (!timezone_unknown)
+	return NULL;
+    }
 
     cout << "MiscMainFrame::mf_show_tz " << tz << "\n";
 
-    if ((tz == "") || run_from_installer)
+    if ((tz == "") || timezone_unknown)
       tz = "guess";
 
    //launch tzgui and load output into Gtimezone
@@ -152,6 +159,7 @@ QString MiscMainFrame::mf_show_tz(QString tz)
             }
             file.close();
         }
+	timezone_unknown = FALSE;
         emit update_timezone(GTimezone);
     }
 
diff --git a/abs/core-testing/mythinstall/mv_common.h b/abs/core-testing/mythinstall/mv_common.h
index 1190a53..865eb3d 100755
--- a/abs/core-testing/mythinstall/mv_common.h
+++ b/abs/core-testing/mythinstall/mv_common.h
@@ -1,4 +1,4 @@
 //#define __MVAPP__ MythVantage
 #define RELEASEFILE "LinHES-release"
 
-extern int run_from_installer;
+extern int timezone_unknown;
diff --git a/abs/core-testing/mythinstall/mythinstall b/abs/core-testing/mythinstall/mythinstall
deleted file mode 100755
index 5a7d633..0000000
Binary files a/abs/core-testing/mythinstall/mythinstall and /dev/null differ
-- 
cgit v0.12

