diff --git a/alert.cpp b/alert.cpp index bd87469..3cabcd3 100644 --- a/alert.cpp +++ b/alert.cpp @@ -28,6 +28,13 @@ alert::alert(QWidget *parent) : this->setStyleSheet(stylesheetFile.readAll()); stylesheetFile.close(); + // Checking if the update signature was bad + if(checkconfig("/external_root/boot/flags/ALERT_SIGN") == true) { + ui->securityLabel->setText("Failed to install update."); + ui->messageLabel->setText("The update's digital signature is untrusted. For security reasons, it is not possible to install it."); + ui->stackedWidget->setCurrentIndex(1); + } + ui->warningLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 16pt}"); ui->messageLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 9pt}"); ui->securityLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 11pt}"); @@ -35,6 +42,8 @@ alert::alert(QWidget *parent) : ui->resetBtn->setProperty("type", "borderless"); ui->continueBtn->setStyleSheet("padding: 20px"); ui->resetBtn->setStyleSheet("padding: 20px"); + ui->continue2Btn->setProperty("type", "borderless"); + ui->continue2Btn->setStyleSheet("padding: 20px"); } alert::~alert() @@ -46,6 +55,7 @@ void alert::on_continueBtn_clicked() { // We continue anyway and re-set the ALERT flag string_writeconfig("/external_root/boot/flags/ALERT", "false"); + string_writeconfig("/external_root/boot/flags/ALERT_SIGN", "false"); QProcess process; process.startDetached("inkbox", QStringList()); qApp->quit(); @@ -63,3 +73,13 @@ void alert::on_resetBtn_clicked() reboot_proc->start(reboot_prog, reboot_args); reboot_proc->waitForFinished(); } + +void alert::on_continue2Btn_clicked() +{ + // We continue anyway and re-set the ALERT flag + string_writeconfig("/external_root/boot/flags/ALERT", "false"); + string_writeconfig("/external_root/boot/flags/ALERT_SIGN", "false"); + QProcess process; + process.startDetached("inkbox", QStringList()); + qApp->quit(); +} diff --git a/alert.h b/alert.h index 69ba41a..b299e65 100644 --- a/alert.h +++ b/alert.h @@ -4,6 +4,8 @@ #include #include #include +#include +#include namespace Ui { class alert; @@ -24,12 +26,28 @@ public: fhandler << config_option; fhandler.close(); } + bool checkconfig(QString file) { + QFile config(file); + config.open(QIODevice::ReadOnly); + QTextStream in (&config); + const QString content = in.readAll(); + string contentstr = content.toStdString(); + if(contentstr.find("true") != std::string::npos) { + return true; + } + else { + return false; + } + config.close(); + }; private slots: void on_continueBtn_clicked(); void on_resetBtn_clicked(); + void on_continue2Btn_clicked(); + private: Ui::alert *ui; }; diff --git a/alert.ui b/alert.ui index 027f627..07021cf 100644 --- a/alert.ui +++ b/alert.ui @@ -16,19 +16,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -45,32 +32,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -81,52 +42,6 @@ - - - - 0 - - - - - - 75 - true - - - - Reset - - - - - - - - 75 - true - - - - Continue anyway - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -140,20 +55,44 @@ - - - - This could mean that someone is trying to steal your data or gain root access to the device. - -A factory reset is recommended. + + + + Qt::Vertical - - Qt::AlignCenter + + + 20 + 40 + - - true + + + + + + Qt::Vertical - + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + @@ -171,6 +110,111 @@ A factory reset is recommended. + + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + + 75 + true + + + + Reset + + + + + + + + 75 + true + + + + Continue anyway + + + + + + + + + + + + + + + + 75 + true + + + + Continue + + + + + + + + + + + + + This could mean that someone is trying to steal your data or gain root access to the device. + +A factory reset is recommended. + + + Qt::AlignCenter + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + +