lost code - option to disable automatic updates and showing usb mass dialog

This commit is contained in:
Szybet 2022-12-29 16:37:47 +01:00
parent 6771966e53
commit 4f104c6ca3
4 changed files with 708 additions and 630 deletions

View file

@ -340,12 +340,26 @@ MainWindow::MainWindow(QWidget *parent)
} }
} }
// OTA updates
QString checkConfigPath = ".config/23-updates/check-updates";
if(QFile(checkConfigPath).exists() == false) {
string_writeconfig(checkConfigPath.toStdString(), "true");
}
if(checkconfig(checkConfigPath) == true) {
// Check for an update and ask if the user wants to install it // Check for an update and ask if the user wants to install it
checkForUpdate(); checkForUpdate();
// Check for an OTA update // Check for an OTA update
QTimer::singleShot(1000, this, SLOT(checkForOtaUpdate())); QTimer::singleShot(1000, this, SLOT(checkForOtaUpdate()));
}
// USB mass storage prompt // USB mass storage prompt
QString usbConfigPath = ".config/22-usb/show-dialog";
if(QFile(usbConfigPath).exists() == false) {
string_writeconfig(usbConfigPath.toStdString(), "true");
}
if(checkconfig(usbConfigPath) == true) {
QTimer *usbmsPrompt = new QTimer(this); QTimer *usbmsPrompt = new QTimer(this);
usbmsPrompt->setInterval(500); usbmsPrompt->setInterval(500);
connect(usbmsPrompt, &QTimer::timeout, [&]() { connect(usbmsPrompt, &QTimer::timeout, [&]() {
@ -374,6 +388,7 @@ MainWindow::MainWindow(QWidget *parent)
} }
} ); } );
usbmsPrompt->start(); usbmsPrompt->start();
}
// If the DEVKEY file is present, install a developer key // If the DEVKEY file is present, install a developer key
if(QFile::exists("/mnt/onboard/onboard/.inkbox/DEVKEY") == true && QFile::exists("/mnt/onboard/onboard/.inkbox/DEVKEY.dgst") == true) { if(QFile::exists("/mnt/onboard/onboard/.inkbox/DEVKEY") == true && QFile::exists("/mnt/onboard/onboard/.inkbox/DEVKEY.dgst") == true) {

View file

@ -60,6 +60,9 @@ settings::settings(QWidget *parent) :
ui->repackBtn->setStyleSheet("font-size: 9pt"); ui->repackBtn->setStyleSheet("font-size: 9pt");
ui->exportHighlightsBtn->setStyleSheet("font-size: 9pt"); ui->exportHighlightsBtn->setStyleSheet("font-size: 9pt");
ui->uiScaleNumberLabel->setStyleSheet("font-size: 9pt; font-weight: bold"); ui->uiScaleNumberLabel->setStyleSheet("font-size: 9pt; font-weight: bold");
ui->autoCheckUpdatesBox->setStyleSheet("font-size: 9pt");
ui->usbMsDialogBox->setStyleSheet("font-size: 9pt");
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") { if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
ui->previousBtn->setStyleSheet("padding: 7.5px;"); ui->previousBtn->setStyleSheet("padding: 7.5px;");
ui->nextBtn->setStyleSheet("padding: 7.5px;"); ui->nextBtn->setStyleSheet("padding: 7.5px;");
@ -343,6 +346,16 @@ settings::settings(QWidget *parent) :
ui->localLibraryShowFoldersCheckBox->click(); ui->localLibraryShowFoldersCheckBox->click();
} }
// USB show dialog
if(checkconfig(".config/22-usb/show-dialog") == true) {
ui->usbMsDialogBox->click();
}
// Automatic updates
if(checkconfig(".config/23-updates/check-updates") == true) {
ui->autoCheckUpdatesBox->click();
}
if(checkconfig("/opt/inkbox_genuine") == true) { if(checkconfig("/opt/inkbox_genuine") == true) {
// Enforcing security policy if the user has not rooted the device // Enforcing security policy if the user has not rooted the device
if(checkconfig("/external_root/opt/root/rooted") == true) { if(checkconfig("/external_root/opt/root/rooted") == true) {
@ -1110,3 +1123,29 @@ void settings::on_localLibraryShowFoldersCheckBox_toggled(bool checked)
} }
} }
void settings::on_usbMsDialogBox_clicked(bool checked)
{
QString settingString = "Show USB Mass storage dialog";
if(checked == true) {
logEnabled(settingString, className);
string_writeconfig(".config/22-usb/show-dialog", "true");
}
else {
logDisabled(settingString, className);
string_writeconfig(".config/22-usb/show-dialog", "false");
}
}
void settings::on_autoCheckUpdatesBox_clicked(bool checked)
{
QString settingString = "Automatically check updates";
if(checked == true) {
logEnabled(settingString, className);
string_writeconfig(".config/23-updates/check-updates", "true");
}
else {
logDisabled(settingString, className);
string_writeconfig(".config/23-updates/check-updates", "false");
}
}

View file

@ -78,6 +78,10 @@ private slots:
void on_localLibraryShowFoldersCheckBox_toggled(bool checked); void on_localLibraryShowFoldersCheckBox_toggled(bool checked);
void on_usbMsDialogBox_clicked(bool checked);
void on_autoCheckUpdatesBox_clicked(bool checked);
signals: signals:
void showToast(QString messageToDisplay); void showToast(QString messageToDisplay);
void closeIndefiniteToast(); void closeIndefiniteToast();

File diff suppressed because it is too large Load diff