Permalink
Browse files

Update the pc-dmconf to reflect the ability to add an auto-login dela…

…y timer now
  • Loading branch information...
1 parent 5eaf60c commit 7c53dd29ec684695b03a6d62baa1bfc3d183e3dd Ken Moore committed Feb 27, 2014
Showing with 45 additions and 30 deletions.
  1. +9 −1 src-qt4/pc-dmconf/mainwindow.cpp
  2. +36 −29 src-qt4/pc-dmconf/mainwindow.ui
@@ -78,6 +78,11 @@ void MainWindow::initUI()
}
getUsers();
ui->UsersList->clear();
+ QString autoLogDelay = pcbsd::Utils::getValFromSHFile(DM_CONFIG_FILE, "AUTO_LOGIN_DELAY");
+ if(!autoLogDelay.isEmpty()){
+ ui->spin_autoLogDelay->setValue(autoLogDelay.toInt());
+ }
+
QString autoLogUser = pcbsd::Utils::getValFromSHFile(DM_CONFIG_FILE, "AUTO_LOGIN_USER");
for (int i=0; i<mvUsers.size(); i++)
{
@@ -151,7 +156,7 @@ void MainWindow::on_SaveButton_clicked()
{
bool ok;
system("touch " + DM_CONFIG_FILE.toLatin1());
- if ( ui->AutoLoginEnabledCB->isChecked() ) {
+ if ( ui->AutoLoginEnabledCB->isChecked() && !ui->UsersList->currentText().isEmpty() ) {
// First ask for password
QString pw = QInputDialog::getText(this, tr("Password Request"),
tr("Please enter the login password for this user"),
@@ -162,10 +167,13 @@ void MainWindow::on_SaveButton_clicked()
pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "ENABLE_AUTO_LOGIN", "ENABLE_AUTO_LOGIN=TRUE", -1);
pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "AUTO_LOGIN_USER", "AUTO_LOGIN_USER=" + ui->UsersList->currentText(), -1);
pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "AUTO_LOGIN_PASSWORD", "AUTO_LOGIN_PASSWORD=" + pw, -1);
+ pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "AUTO_LOGIN_DELAY","AUTO_LOGIN_DELAY="+QString::number(ui->spin_autoLogDelay->value()), -1);
} else {
+ ui->AutoLoginEnabledCB->setChecked(false); //make sure this is not checked to reflect file contents
pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "ENABLE_AUTO_LOGIN", "ENABLE_AUTO_LOGIN=FALSE", -1);
pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "AUTO_LOGIN_USER", "", -1);
pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "AUTO_LOGIN_PASSWORD", "", -1);
+ pcbsd::Utils::setConfFileValue(DM_CONFIG_FILE, "AUTO_LOGIN_DELAY","", -1);
}
if ( ui->EnableVNC->isChecked() ) {
@@ -29,38 +29,58 @@
<string>Auto login</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QCheckBox" name="AutoLoginEnabledCB">
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_2">
<property name="text">
- <string>Enable auto login</string>
+ <string>Time Delay</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Auto login user</string>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="spin_autoLogDelay">
+ <property name="suffix">
+ <string> Seconds</string>
+ </property>
+ <property name="maximum">
+ <number>120</number>
+ </property>
+ <property name="value">
+ <number>10</number>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QComboBox" name="UsersList"/>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="AutoLoginEnabledCB">
+ <property name="text">
+ <string>Enable auto login</string>
+ </property>
+ </widget>
</item>
- <item row="2" column="1">
- <spacer name="horizontalSpacer_2">
+ <item row="5" column="0">
+ <spacer name="verticalSpacer">
<property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>123</width>
- <height>20</height>
+ <width>20</width>
+ <height>137</height>
</size>
</property>
</spacer>
</item>
- <item row="3" column="1" rowspan="2">
- <spacer name="horizontalSpacer_3">
+ <item row="3" column="1">
+ <widget class="QComboBox" name="UsersList"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Auto login user</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -72,19 +92,6 @@
</property>
</spacer>
</item>
- <item row="5" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>137</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">

0 comments on commit 7c53dd2

Please sign in to comment.