Changeset 5a1d1a0


Ignore:
Timestamp:
Oct 18, 2013 10:59:01 AM (6 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
a27573b9, 4069c7b
Parents:
688b57d
Message:

On first-boot wizard, add ability to detect users timezone if internet
is connected

Location:
src-qt4/pc-firstbootgui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-firstbootgui/backend.cpp

    r261f12e r5a1d1a0  
    9595    } 
    9696    return _zones; 
     97} 
     98 
     99QString Backend::guessTimezone() 
     100{ 
     101    QString code; 
     102   
     103    Process p(QStringList() << "detect-country"); 
     104   
     105    if (p.waitForFinished()) { 
     106       code = p.readLine().simplified(); 
     107    } 
     108    code = code.section(" ", 1, 1); 
     109    qDebug() << "Found timezone:" << code; 
     110    return code; 
    97111} 
    98112 
  • src-qt4/pc-firstbootgui/backend.h

    r1620346 r5a1d1a0  
    1111#include <QWidget> 
    1212 
    13 #define PCSYSINSTALL    QString("/usr/sbin/pc-sysinstall") 
    14 #define PCSYSINSTALLDIR QString("/usr/share/pc-sysinstall") 
     13#define PCSYSINSTALL    QString("/usr/local/sbin/pc-sysinstall") 
     14#define PCSYSINSTALLDIR QString("/usr/local/share/pc-sysinstall") 
    1515#define PCSYSINSTALLCFG QString("/tmp/sys-install.cfg") 
    1616#define TMPLANGFILE QString("/tmp/.SysInstallLang") 
     
    5151    static QStringList networkDevices(); 
    5252    static QStringList timezones(); 
     53    static QString guessTimezone(); 
    5354    static void changeKbMap(QString model, QString layout, QString variant); 
    5455    static QList<QStringList> hardDrives(); 
  • src-qt4/pc-firstbootgui/firstboot.cpp

    r3890273 r5a1d1a0  
    4949    // Load the timezones 
    5050    comboBoxTimezone->clear(); 
     51    QString curZone = Scripts::Backend::guessTimezone(); 
    5152    comboBoxTimezone->addItems(Scripts::Backend::timezones()); 
    52     // Set America/New_York to default 
    53     int index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith); 
    54     if (index != -1) 
    55        comboBoxTimezone->setCurrentIndex(index); 
     53    if ( ! curZone.isEmpty() ) { 
     54      int index = comboBoxTimezone->findText(curZone, Qt::MatchStartsWith); 
     55      if (index != -1) 
     56         comboBoxTimezone->setCurrentIndex(index); 
     57    } else { 
     58      // Set America/New_York to default 
     59      int index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith); 
     60      if (index != -1) 
     61         comboBoxTimezone->setCurrentIndex(index); 
     62    } 
    5663 
    5764    // Load the hostname 
Note: See TracChangeset for help on using the changeset viewer.