Added lockscreen and passcode options in Settings

This commit is contained in:
Nicolas Mailloux 2021-04-04 20:25:07 -04:00
parent d17531f549
commit c632d07986
4 changed files with 125 additions and 31 deletions

View file

@ -28,7 +28,7 @@ alert::alert(QWidget *parent) :
this->setStyleSheet(stylesheetFile.readAll());
stylesheetFile.close();
// Checking if the update signature was bad
// Checking if the update's signature is untrusted
if(checkconfig("/external_root/boot/flags/ALERT_SIGN") == true) {
ui->securityLabel->setText("Failed to update InkBox.");
ui->messageLabel->setText("The digital signature of the update is untrusted.\nFor security reasons, it cannot be installed.");

View file

@ -503,3 +503,23 @@ void settings::on_resetBtn_clicked()
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
void settings::on_setPasscodeBtn_clicked()
{
string_writeconfig("/tmp/setPasscode", "true");
QProcess process;
process.startDetached("lockscreen", QStringList());
qApp->quit();
}
void settings::on_enableLockscreenCheckBox_toggled(bool checked)
{
if(checked == true) {
checked_box = true;
writeconfig(".config/12-lockscreen/config", "EnableLockScreen=");
}
else {
checked_box = false;
writeconfig(".config/12-lockscreen/config", "EnableLockScreen=");
}
}

View file

@ -100,6 +100,10 @@ private slots:
void on_resetBtn_clicked();
void on_setPasscodeBtn_clicked();
void on_enableLockscreenCheckBox_toggled(bool checked);
private:
Ui::settings *ui;
usbms_splash *usbmsWindow;

View file

@ -163,7 +163,7 @@ OK
<item row="26" column="0">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -524,7 +524,7 @@ OK
</property>
<item>
<layout class="QGridLayout" name="gridLayout_10">
<item row="2" column="0">
<item row="8" column="0">
<layout class="QGridLayout" name="gridLayout_8">
<property name="bottomMargin">
<number>0</number>
@ -576,7 +576,47 @@ OK
</item>
</layout>
</item>
<item row="0" column="0">
<item row="5" column="0">
<layout class="QGridLayout" name="gridLayout_13">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="setPasscodeBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="setPasscodeLabel">
<property name="text">
<string>Set a passcode</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="softwareLabel">
<property name="font">
<font>
@ -585,18 +625,54 @@ OK
</font>
</property>
<property name="text">
<string>Software</string>
<string>System</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="12" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="darkModeCheckBox">
<property name="text">
<string>Enable night mode</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="0" column="0">
<widget class="QLabel" name="securityLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Security</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="Line" name="line_9">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="11" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<property name="bottomMargin">
<number>0</number>
@ -642,30 +718,7 @@ OK
</item>
</layout>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="Line" name="line_9">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="10" column="0">
<layout class="QGridLayout" name="gridLayout_12">
<property name="bottomMargin">
<number>0</number>
@ -705,6 +758,23 @@ OK
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox">
<property name="text">
<string>Enable lock screen and passcode</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>