From c632d079862aad65d69c72bbbcefc1e1635b62fe Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sun, 4 Apr 2021 20:25:07 -0400 Subject: [PATCH] Added lockscreen and passcode options in Settings --- alert.cpp | 2 +- settings.cpp | 20 ++++++++ settings.h | 4 ++ settings.ui | 130 +++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 125 insertions(+), 31 deletions(-) diff --git a/alert.cpp b/alert.cpp index fbfcb18..f995668 100644 --- a/alert.cpp +++ b/alert.cpp @@ -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."); diff --git a/settings.cpp b/settings.cpp index b4dbb0c..c01bff5 100644 --- a/settings.cpp +++ b/settings.cpp @@ -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="); + } +} diff --git a/settings.h b/settings.h index c16c847..a409f67 100644 --- a/settings.h +++ b/settings.h @@ -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; diff --git a/settings.ui b/settings.ui index 56563c9..3b47bb9 100644 --- a/settings.ui +++ b/settings.ui @@ -163,7 +163,7 @@ OK - 0 + 1 @@ -524,7 +524,7 @@ OK - + 0 @@ -576,7 +576,47 @@ OK - + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + + + + Set + + + + + + + Set a passcode + + + + + + @@ -585,18 +625,54 @@ OK - Software + System - + + + + Qt::Vertical + + + + 20 + 40 + + + + + Enable night mode - + + + + + Chivo + true + + + + Security + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + 0 @@ -642,30 +718,7 @@ OK - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - + 0 @@ -705,6 +758,23 @@ OK + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Enable lock screen and passcode + + +