diff --git a/alert.cpp b/alert.cpp index 0bce713..02eb5c9 100644 --- a/alert.cpp +++ b/alert.cpp @@ -62,8 +62,11 @@ alert::alert(QWidget *parent) : ui->warningLabel->setText("Fatal error"); ui->securityLabel->setText("Device lockdown"); + log(global::encfs::lockdownMessage, className); QString message = "Due to multiple incorrect passphrase attempts, this device is locked down until\n" + global::encfs::unlockTime + "\nand won't boot."; ui->messageLabel->setText(message); + poweroff(false); + QTimer::singleShot(1000, this, SLOT(quit())); } if(global::battery::showCriticalBatteryAlert == true) { global::battery::showCriticalBatteryAlert = false; @@ -79,7 +82,7 @@ alert::alert(QWidget *parent) : ui->securityLabel->setText("The battery's charge level is critical."); ui->messageLabel->setText("To prevent damage, your device has been turned off.\nPlease consider charging it."); poweroff(false); - qApp->quit(); + QTimer::singleShot(1000, this, SLOT(quit())); } ui->warningLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 16pt }"); @@ -147,3 +150,7 @@ void alert::updateReset() { string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "false"); string_writeconfig("/mnt/onboard/onboard/.inkbox/can_update", "false"); } + +void alert::quit() { + qApp->quit(); +} diff --git a/alert.h b/alert.h index 251191b..7885aa7 100644 --- a/alert.h +++ b/alert.h @@ -26,6 +26,7 @@ private slots: void on_continueBtn_clicked(); void on_resetBtn_clicked(); void on_continue2Btn_clicked(); + void quit(); private: Ui::alert *ui; diff --git a/encryptionmanager.cpp b/encryptionmanager.cpp index 1b9401b..b1be099 100644 --- a/encryptionmanager.cpp +++ b/encryptionmanager.cpp @@ -254,8 +254,7 @@ void encryptionManager::unlockEncryptedStorage() { currentEpoch += 86400; std::string unlockTime_str = to_string(currentEpoch); global::encfs::unlockTime = QDateTime::fromTime_t(currentEpoch).toString(); - QString message = "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime; - log(message, className); + global::encfs::lockdownMessage = "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime; string_writeconfig("/external_root/boot/flags/ENCRYPT_LOCK", unlockTime_str); global::encfs::lockdown = true; setupMessageBoxRan = true; @@ -263,8 +262,6 @@ void encryptionManager::unlockEncryptedStorage() { alertWindow = new alert(); alertWindow->setAttribute(Qt::WA_DeleteOnClose); alertWindow->showFullScreen(); - poweroff(false); - qApp->quit(); } if(passphraseTries <= 2) { diff --git a/functions.h b/functions.h index 0b7f207..9439466 100644 --- a/functions.h +++ b/functions.h @@ -98,6 +98,7 @@ namespace global { namespace encfs { inline QString passphrase; inline QString unlockTime; + inline QString lockdownMessage; inline bool cancelSetup; inline bool cancelUnlock; inline bool lockdown; diff --git a/generaldialog.cpp b/generaldialog.cpp index 7801a38..3cef154 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -122,7 +122,7 @@ generalDialog::generalDialog(QWidget *parent) : lowBatteryDialog = true; ui->stackedWidget->setCurrentIndex(1); get_battery_level(); - QString message = "The battery's level is low. Please charge your eReader.\nCurrent level: "; + QString message = "The battery's level is low.\nPlease charge your eReader.\nCurrent level: "; message.append(batt_level); ui->bodyLabel->setText(message); ui->headerLabel->setText("Low battery"); diff --git a/virtualkeyboard.cpp b/virtualkeyboard.cpp index 1c80abd..c66cf3c 100644 --- a/virtualkeyboard.cpp +++ b/virtualkeyboard.cpp @@ -191,7 +191,7 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) : } ui->lineEdit->setStyleSheet("border: 3px solid black"); - if(global::keyboard::vncDialog == true or global::keyboard::wifiPassphraseDialog == true) { + if(global::keyboard::vncDialog == true or global::keyboard::wifiPassphraseDialog == true or global::keyboard::encfsDialog == true) { ui->lineEdit->setFont(QFont("Noto Mono")); } else if(global::keyboard::searchDialog == true){