mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 07:37:21 -08:00
Merge pull request #41 from Szybet/master
lost code - option to disable automatic updates and showing usb mass dialog
This commit is contained in:
commit
521638eb77
5 changed files with 673 additions and 615 deletions
|
@ -340,40 +340,53 @@ 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 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
|
||||
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;
|
||||
if(!QFile(usbConfigPath).exists()) {
|
||||
writeFile(usbConfigPath, "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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
Loading…
Reference in a new issue