diff --git a/functions.h b/functions.h index 091a735..d9f55b2 100644 --- a/functions.h +++ b/functions.h @@ -95,8 +95,8 @@ namespace global { inline bool cancelSetup; inline bool cancelUnlock; inline bool lockdown; + inline bool enableStorageEncryptionDialog; inline bool disableStorageEncryptionDialog; - inline bool disableStorageEncryption; } inline QString systemInfoText; inline bool forbidOpenSearchDialog; diff --git a/generaldialog.cpp b/generaldialog.cpp index d7c3188..25c7f24 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -84,7 +84,7 @@ generalDialog::generalDialog(QWidget *parent) : else if(global::settings::settingsRebootDialog == true) { settingsRebootDialog = true; ui->stackedWidget->setCurrentIndex(1); - if(global::kobox::koboxSettingsRebootDialog == true) { + if(global::kobox::koboxSettingsRebootDialog == true or global::encfs::enableStorageEncryptionDialog) { koboxSettingsRebootDialog = true; ui->bodyLabel->setText("The device will reboot now, since the settings you chose require it to work properly."); } @@ -412,7 +412,7 @@ void generalDialog::on_acceptBtn_clicked() } if(settingsRebootDialog == true) { - if(koboxSettingsRebootDialog == true) { + if(koboxSettingsRebootDialog == true or global::encfs::enableStorageEncryptionDialog) { reboot(true); } else { diff --git a/mainwindow.cpp b/mainwindow.cpp index 82c4f33..5bbd8f7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -365,6 +365,14 @@ MainWindow::MainWindow(QWidget *parent) // We set the brightness level saved in the config file QTimer::singleShot(2000, this, SLOT(setInitialBrightness())); + // If new files are found in /mnt/onboard/onboard/encfs-dropbox, ask if user wants to encrypt them + if(checkconfig(".config/18-encrypted_storage/status") == true) { + QDir encfsDropboxDir("/mnt/onboard/onboard/encfs-dropbox"); + if(encfsDropboxDir.isEmpty()) { + QTimer::singleShot(1000, this, SLOT(openEncfsEncryptDialog())); + } + } + // Display quote if requested; otherwise, display recent books string_checkconfig(".config/05-quote/config"); if(checkconfig_str_val == "") { @@ -1014,3 +1022,7 @@ void MainWindow::checkForUpdate() { } } } + +void MainWindow::openEncfsEncryptDialog() { + +} diff --git a/mainwindow.h b/mainwindow.h index 7185fcd..9039716 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -88,6 +88,7 @@ private slots: void openBookFile(QString book, bool relativePath); void openReaderFramework(); void checkForUpdate(); + void openEncfsEncryptDialog(); private: Ui::MainWindow *ui; diff --git a/settings.cpp b/settings.cpp index c9f309e..2a60686 100644 --- a/settings.cpp +++ b/settings.cpp @@ -290,6 +290,10 @@ settings::settings(QWidget *parent) : if(checkconfig(".config/18-encrypted_storage/status") == true) { ui->enableEncryptedStorageCheckBox->click(); } + else { + // Next interaction will be by the user + enableEncryptedStorageUserChange = true; + } // DPI checkbox string_checkconfig(".config/09-dpi/config"); @@ -892,6 +896,7 @@ void settings::on_enableEncryptedStorageCheckBox_toggled(bool checked) QFile::remove(".config/18-encrypted_storage/storage_list"); } global::settings::settingsRebootDialog = true; + global::encfs::enableStorageEncryptionDialog = true; generalDialogWindow = new generalDialog(this); generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose); generalDialogWindow->show(); @@ -926,7 +931,6 @@ void settings::disableStorageEncryption() { decDir.removeRecursively(); global::settings::settingsRebootDialog = true; - global::encfs::disableStorageEncryption = true; generalDialogWindow = new generalDialog(this); generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose); generalDialogWindow->show();