Merge pull request #41 from Szybet/master

lost code - option to disable automatic updates and showing usb mass dialog
This commit is contained in:
Nicolas Mailloux 2022-12-30 18:06:03 -05:00 committed by GitHub
commit 521638eb77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 673 additions and 615 deletions

View file

@ -340,12 +340,24 @@ MainWindow::MainWindow(QWidget *parent)
}
}
// OTA update
if(!QFile(updatesCheckConfigPath).exists()) {
writeFile(updatesCheckConfigPath, "true");
}
if(checkconfig(updatesCheckConfigPath) == true) {
// Check for an update and ask if the user wants to install it
checkForUpdate();
// Check for an OTA update
QTimer::singleShot(1000, this, SLOT(checkForOtaUpdate()));
}
// USB mass storage prompt
if(!QFile(usbConfigPath).exists()) {
writeFile(usbConfigPath, "true");
}
if(checkconfig(usbConfigPath) == true) {
QTimer *usbmsPrompt = new QTimer(this);
usbmsPrompt->setInterval(500);
connect(usbmsPrompt, &QTimer::timeout, [&]() {
@ -374,6 +386,7 @@ MainWindow::MainWindow(QWidget *parent)
}
} );
usbmsPrompt->start();
}
// 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) {

View file

@ -66,6 +66,9 @@ public:
void resetIcons();
void setBatteryIcon();
QString updatesCheckConfigPath = ".config/23-updates/check-updates";
QString usbConfigPath = ".config/22-usb/show-dialog";
public slots:
void showToast(QString messageToDisplay);
void closeIndefiniteToast();

View file

@ -60,6 +60,7 @@ settings::settings(QWidget *parent) :
ui->repackBtn->setStyleSheet("font-size: 9pt");
ui->exportHighlightsBtn->setStyleSheet("font-size: 9pt");
ui->uiScaleNumberLabel->setStyleSheet("font-size: 9pt; font-weight: bold");
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
ui->previousBtn->setStyleSheet("padding: 7.5px;");
ui->nextBtn->setStyleSheet("padding: 7.5px;");
@ -343,6 +344,16 @@ settings::settings(QWidget *parent) :
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) {
// Enforcing security policy if the user has not rooted the device
if(checkconfig("/external_root/opt/root/rooted") == true) {
@ -1110,3 +1121,29 @@ void settings::on_localLibraryShowFoldersCheckBox_toggled(bool checked)
}
}
void settings::on_usbmsDialogBox_clicked(bool checked)
{
QString settingString = "USB Mass Storage dialog display";
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 = "automatic updates checking";
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

@ -75,8 +75,9 @@ private slots:
void on_pageSizeHeightIncBtn_clicked();
void on_pageSizeWidthDecBtn_clicked();
void on_pageSizeWidthIncBtn_clicked();
void on_localLibraryShowFoldersCheckBox_toggled(bool checked);
void on_usbmsDialogBox_clicked(bool checked);
void on_autoCheckUpdatesBox_clicked(bool checked);
signals:
void showToast(QString messageToDisplay);

File diff suppressed because it is too large Load diff