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,40 +340,55 @@ MainWindow::MainWindow(QWidget *parent)
}
}
// 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()));
// 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
checkForUpdate();
// Check for an OTA update
QTimer::singleShot(1000, this, SLOT(checkForOtaUpdate()));
}
// USB mass storage prompt
QTimer *usbmsPrompt = new QTimer(this);
usbmsPrompt->setInterval(500);
connect(usbmsPrompt, &QTimer::timeout, [&]() {
if(checkconfig("/opt/inkbox_genuine") == true) {
if(global::usbms::showUsbmsDialog != true) {
if(isUsbPluggedIn() != usbmsStatus) {
global::usbms::showUsbmsDialog = true;
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);
usbmsPrompt->setInterval(500);
connect(usbmsPrompt, &QTimer::timeout, [&]() {
if(checkconfig("/opt/inkbox_genuine") == true) {
if(global::usbms::showUsbmsDialog != true) {
if(isUsbPluggedIn() != usbmsStatus) {
global::usbms::showUsbmsDialog = true;
}
}
else {
usbmsStatus = isUsbPluggedIn();
if(usbmsStatus == false) {
// Loop again...
;
}
else {
// An USB cable is connected!
setBatteryIcon();
openUsbmsDialog();
}
}
}
else {
usbmsStatus = isUsbPluggedIn();
if(usbmsStatus == false) {
// Loop again...
;
}
else {
// An USB cable is connected!
setBatteryIcon();
openUsbmsDialog();
}
// Do nothing, we're running along with Nickel & friends...
;
}
}
else {
// Do nothing, we're running along with Nickel & friends...
;
}
} );
usbmsPrompt->start();
} );
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

@ -60,6 +60,9 @@ 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");
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") {
ui->previousBtn->setStyleSheet("padding: 7.5px;");
ui->nextBtn->setStyleSheet("padding: 7.5px;");
@ -343,6 +346,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 +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_usbMsDialogBox_clicked(bool checked);
void on_autoCheckUpdatesBox_clicked(bool checked);
signals:
void showToast(QString messageToDisplay);
void closeIndefiniteToast();

File diff suppressed because it is too large Load diff