From c98c1a5932f2cb396fc8c9fb20983895e62e652e Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 14 Jul 2022 11:09:38 +0200 Subject: add necessary config switches to persist "remember" checkbox (no functionality still) --- .../pdfover/gui/composites/MobileBKUEnterNumberComposite.java | 3 +++ .../gui/workflow/config/ConfigurationDataInMemory.java | 2 ++ .../pdfover/gui/workflow/config/ConfigurationManager.java | 11 +++++++++++ .../at/asit/pdfover/gui/workflow/states/MobileBKUState.java | 4 ++++ 4 files changed, 20 insertions(+) (limited to 'pdf-over-gui') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index 7edcd359..db37502a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -143,6 +143,9 @@ public class MobileBKUEnterNumberComposite extends StateComposite { } } + public boolean isRememberPassword() { return this.btn_remember.getSelection(); } + public void setRememberPassword(boolean state) { this.btn_remember.setSelection(state); } + /** * Create the composite. * diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java index c6a50c0b..7fb08602 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java @@ -85,6 +85,8 @@ public class ConfigurationDataInMemory { /** The mobile phone password */ public String mobilePassword = null; + public boolean rememberPassword = false; + /** Holds the proxy host */ public String proxyHost = null; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java index 3d5ebfff..d467178a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java @@ -87,6 +87,7 @@ public class ConfigurationManager { setDefaultEmblemPersistent(diskConfig.getProperty(Constants.CFG_EMBLEM)); setDefaultMobileNumberPersistent(diskConfig.getProperty(Constants.CFG_MOBILE_NUMBER)); + setRememberMobilePasswordPersistent(Constants.TRUE.equals(diskConfig.getProperty(Constants.CFG_MOBILE_PASSWORD_REMEMBER))); setProxyHostPersistent(diskConfig.getProperty(Constants.CFG_PROXY_HOST)); setProxyUserPersistent(diskConfig.getProperty(Constants.CFG_PROXY_USER)); @@ -284,6 +285,8 @@ public class ConfigurationManager { props.setProperty(Constants.CFG_EMBLEM, getDefaultEmblemPersistent()); props.setProperty(Constants.CFG_SIGNATURE_NOTE, getSignatureNote()); props.setProperty(Constants.CFG_MOBILE_NUMBER, getDefaultMobileNumberPersistent()); + if (getRememberMobilePassword()) + props.setProperty(Constants.CFG_MOBILE_PASSWORD_REMEMBER, Constants.TRUE); props.setProperty(Constants.CFG_OUTPUT_FOLDER, getDefaultOutputFolderPersistent()); props.setProperty(Constants.CFG_POSTFIX, getSaveFilePostFix()); props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY, @@ -476,6 +479,14 @@ public class ConfigurationManager { return this.configurationOverlay.mobilePassword; } + public boolean getRememberMobilePassword() { + return this.configuration.rememberPassword; + } + + public void setRememberMobilePasswordPersistent(boolean state) { + this.configuration.rememberPassword = state; + } + public void setDefaultEmblemPersistent(String emblem) { try { if (emblem == null || emblem.trim().isEmpty()) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java index 0d0018dd..d5f5cbe0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java @@ -221,6 +221,9 @@ public class MobileBKUState extends State { // set possible password ui.setMobilePassword(mobileStatus.mobilePassword); } + + ui.setRememberPassword(getStateMachine().configProvider.getRememberMobilePassword()); + ui.enableButton(); getStateMachine().display(ui); @@ -244,6 +247,7 @@ public class MobileBKUState extends State { // get number and password from UI mobileStatus.phoneNumber = ui.getMobileNumber(); mobileStatus.mobilePassword = ui.getMobilePassword(); + getStateMachine().configProvider.setRememberMobilePasswordPersistent(ui.isRememberPassword()); // show waiting composite getStateMachine().display(this.getWaitingComposite()); -- cgit v1.2.3