From f2f945609df22fde9e8f36c13b781b98d2a2ddc1 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Fri, 16 Jun 2023 18:22:38 -0400 Subject: [PATCH] Settings: Lockscreen fixes --- src/settings/settings.cpp | 29 +++++++++++++++++------------ src/settings/settings.h | 1 + 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/settings/settings.cpp b/src/settings/settings.cpp index fc99d20..b375d57 100644 --- a/src/settings/settings.cpp +++ b/src/settings/settings.cpp @@ -430,18 +430,7 @@ settings::~settings() } void settings::on_okBtn_clicked() { - // Save things - writeFile(".config/07-words_number/config", QString::number(wordsNumberSaved)); - log("Set text files words number to " + QString::number(wordsNumberSaved), className); - - writeFile(".config/13-epub_page_size/width", QString::number(pageSizeWidthSaved)); - writeFile(".config/13-epub_page_size/set", "true"); - - writeFile(".config/13-epub_page_size/height", QString::number(pageSizeHeightSaved)); - writeFile(".config/13-epub_page_size/set", "true"); - - // Notify power daemon of a potential configuration update - writeFile("/mnt/onboard/.adds/inkbox/.config/20-sleep_daemon/updateConfig", "true"); + saveDeferredSettings(); // Prevent potential unknown damage launching via shell script this could do if(launch_sh == true) { @@ -464,6 +453,21 @@ void settings::on_okBtn_clicked() { } } +void settings::saveDeferredSettings() { + // Save things + writeFile(".config/07-words_number/config", QString::number(wordsNumberSaved)); + log("Set text files words number to " + QString::number(wordsNumberSaved), className); + + writeFile(".config/13-epub_page_size/width", QString::number(pageSizeWidthSaved)); + writeFile(".config/13-epub_page_size/set", "true"); + + writeFile(".config/13-epub_page_size/height", QString::number(pageSizeHeightSaved)); + writeFile(".config/13-epub_page_size/set", "true"); + + // Notify power daemon of a potential configuration update + writeFile("/mnt/onboard/.adds/inkbox/.config/20-sleep_daemon/updateConfig", "true"); +} + void settings::on_aboutBtn_clicked() { log("Showing About message box", className); @@ -793,6 +797,7 @@ void settings::on_setPasscodeBtn_clicked() { log("'Set passcode' button clicked", className); log("Launching lockscreen binary", className); + saveDeferredSettings(); string_writeconfig("/tmp/setPasscode", "true"); QProcess process; process.startDetached("lockscreen", QStringList()); diff --git a/src/settings/settings.h b/src/settings/settings.h index 05762b7..e6f1138 100644 --- a/src/settings/settings.h +++ b/src/settings/settings.h @@ -78,6 +78,7 @@ private slots: void on_usbmsDialogBox_clicked(bool checked); void on_autoCheckUpdatesBox_clicked(bool checked); void on_lockscreenBackgroundComboBox_currentTextChanged(const QString &arg1); + void saveDeferredSettings(); signals: void showToast(QString messageToDisplay);