Fix #19 & #21 (bookconfig_mount issue)

This commit is contained in:
Nicolas Mailloux 2022-03-23 22:09:37 -04:00
parent b1c3fa0924
commit 7c22587370

View file

@ -177,13 +177,16 @@ reader::reader(QWidget *parent) :
stylesheetFile.close(); stylesheetFile.close();
book_file = dialog->getOpenFileName(dialog, tr("Open File"), QDir::currentPath()); book_file = dialog->getOpenFileName(dialog, tr("Open File"), QDir::currentPath());
if(book_file != "") { if(!book_file.isEmpty()) {
setDefaultWorkDir(); setDefaultWorkDir();
} }
else { else {
// User clicked "Cancel" button // User clicked "Cancel" button
// Restarting InkBox
setDefaultWorkDir(); setDefaultWorkDir();
quit_restart(); QProcess process;
process.startDetached("inkbox", QStringList());
qApp->quit();
} }
} }
else { else {
@ -203,13 +206,16 @@ reader::reader(QWidget *parent) :
stylesheetFile.close(); stylesheetFile.close();
book_file = dialog->getOpenFileName(dialog, tr("Open File"), QDir::currentPath()); book_file = dialog->getOpenFileName(dialog, tr("Open File"), QDir::currentPath());
if(book_file != "") { if(!book_file.isEmpty()) {
setDefaultWorkDir(); setDefaultWorkDir();
} }
else { else {
// User clicked "Cancel" button // User clicked "Cancel" button
// Restarting InkBox
setDefaultWorkDir(); setDefaultWorkDir();
quit_restart(); QProcess process;
process.startDetached("inkbox", QStringList());
qApp->quit();
} }
} }
} }
@ -220,20 +226,22 @@ reader::reader(QWidget *parent) :
string_writeconfig("/tmp/inkboxBookPath", book_file_str); string_writeconfig("/tmp/inkboxBookPath", book_file_str);
// Calling InkBox daemon (ibxd) via FIFO interface to run bookconfig_mount // Calling InkBox daemon (ibxd) via FIFO interface to run bookconfig_mount
if(checkconfig(".config/16-global_reading_settings/config") == false) { if(!book_file.isEmpty()) {
global::reader::globalReadingSettings = false; if(checkconfig(".config/16-global_reading_settings/config") == false) {
string_writeconfig("/opt/ibxd", "bookconfig_mount\n"); global::reader::globalReadingSettings = false;
// Callback handler to wait until bookconfig_mount has finished execution string_writeconfig("/opt/ibxd", "bookconfig_mount\n");
while(true) { // Callback handler to wait until bookconfig_mount has finished execution
if(QFile::exists("/inkbox/bookConfigSetUp")) { while(true) {
QFile::remove("/inkbox/bookConfigSetUp"); if(QFile::exists("/inkbox/bookConfigSetUp")) {
setupLocalSettingsEnvironment(); QFile::remove("/inkbox/bookConfigSetUp");
break; setupLocalSettingsEnvironment();
break;
}
} }
} }
} else {
else { global::reader::globalReadingSettings = true;
global::reader::globalReadingSettings = true; }
} }
// Custom settings // Custom settings