summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-08 14:37:52 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-08 14:38:08 +0200
commit4d0eef628cedbcac69f41fd92cdbeb4c25189a34 (patch)
tree3df2769f0c78c6a8be32ff71b411a9bec4fef096 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration
parent3a419fea87c3ccebd5d437a151d1dd66df82c5bf (diff)
downloadpdf-over-4d0eef628cedbcac69f41fd92cdbeb4c25189a34.tar.gz
pdf-over-4d0eef628cedbcac69f41fd92cdbeb4c25189a34.tar.bz2
pdf-over-4d0eef628cedbcac69f41fd92cdbeb4c25189a34.zip
config cleanup
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java40
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java25
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java10
3 files changed, 39 insertions, 36 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
index ea84abce..31a10b01 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
@@ -349,7 +349,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.locale;
+ Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.interfaceLocale;
Locale selectedLocale = Constants.SUPPORTED_LOCALES[AdvancedConfigurationComposite.this.cmbLocaleAuswahl
.getSelectionIndex()];
if (!currentLocale.equals(selectedLocale)) {
@@ -528,7 +528,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
void performLocaleSelectionChanged(Locale selected) {
log.debug("Selected Locale: {}", selected);
- this.configurationContainer.locale = selected;
+ this.configurationContainer.interfaceLocale = selected;
this.cmbLocaleAuswahl.select(this.getLocaleElementIndex(selected));
}
@@ -662,7 +662,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
this.configurationContainer.outputFolder = provider.getDefaultOutputFolderPersistent();
this.configurationContainer.saveFilePostFix = provider.getSaveFilePostFix();
- this.configurationContainer.locale = provider.getLocale();
+ this.configurationContainer.interfaceLocale = provider.getInterfaceLocale();
this.configurationContainer.updateCheck = provider.getUpdateCheck();
@@ -702,7 +702,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
performUseSignatureFieldsSelection(this.configurationContainer.getUseSignatureFields());
performEnableUsePlaceholder(this.configurationContainer.enabledPlaceholderUsage);
this.sclTransparenz.setSelection(this.configurationContainer.placeholderTransparency);
- performLocaleSelectionChanged(this.configurationContainer.locale);
+ performLocaleSelectionChanged(this.configurationContainer.interfaceLocale);
performPdfACompatSelection(this.configurationContainer.signaturePDFACompat);
performKeystoreEnabledSelection(this.configurationContainer.keystoreEnabled);
performUpdateCheckSelection(this.configurationContainer.updateCheck);
@@ -740,23 +740,23 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
@Override
public void storeConfiguration(ConfigurationManager store) {
- store.setAutoPositionSignature(this.configurationContainer.autoPositionSignature);
- store.setUseMarker(this.configurationContainer.getUseMarker());
- store.setUseSignatureFields(this.configurationContainer.getUseSignatureFields());
- store.setEnablePlaceholderUsage(this.configurationContainer.enabledPlaceholderUsage);
- store.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat);
+ store.setAutoPositionSignaturePersistent(this.configurationContainer.autoPositionSignature);
+ store.setUseMarkerPersistent(this.configurationContainer.getUseMarker());
+ store.setUseSignatureFieldsPersistent(this.configurationContainer.getUseSignatureFields());
+ store.setEnablePlaceholderUsagePersistent(this.configurationContainer.enabledPlaceholderUsage);
+ store.setSignaturePdfACompatPersistent(this.configurationContainer.signaturePDFACompat);
store.setPlaceholderTransparency(this.configurationContainer.placeholderTransparency);
- store.setDefaultBKU(this.configurationContainer.defaultBKU);
- store.setKeyStoreEnabled(this.configurationContainer.keystoreEnabled);
+ store.setDefaultBKUPersistent(this.configurationContainer.defaultBKU);
+ store.setKeyStoreEnabledPersistent(this.configurationContainer.keystoreEnabled);
- store.setDefaultOutputFolder(this.configurationContainer.outputFolder);
- store.setSaveFilePostFix(this.configurationContainer.saveFilePostFix);
- store.setLocale(this.configurationContainer.locale);
+ store.setDefaultOutputFolderPersistent(this.configurationContainer.outputFolder);
+ store.setSaveFilePostFixPersistent(this.configurationContainer.saveFilePostFix);
+ store.setInterfaceLocalePersistent(this.configurationContainer.interfaceLocale);
- store.setUpdateCheck(this.configurationContainer.updateCheck);
+ store.setUpdateCheckPersistent(this.configurationContainer.updateCheck);
- store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name());
+ store.setSignatureProfilePersistent(this.configurationContainer.getSignatureProfile().name());
String hostOld = store.getProxyHostPersistent();
String hostNew = this.configurationContainer.proxyHost;
@@ -766,7 +766,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
System.clearProperty("http.proxyHost");
System.clearProperty("https.proxyHost");
}
- store.setProxyHost(hostNew);
+ store.setProxyHostPersistent(hostNew);
int portOld = store.getProxyPortPersistent();
int portNew = this.configurationContainer.getProxyPort();
@@ -775,7 +775,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyPort");
}
- store.setProxyPort(portNew);
+ store.setProxyPortPersistent(portNew);
String userOld = store.getProxyUserPersistent();
String userNew = this.configurationContainer.proxyUser;
@@ -784,7 +784,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
System.clearProperty("http.proxyUser");
System.clearProperty("https.proxyUser");
}
- store.setProxyUser(userNew);
+ store.setProxyUserPersistent(userNew);
String passOld = store.getProxyPassPersistent();
String passNew = this.configurationContainer.proxyPass;
@@ -793,7 +793,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
System.clearProperty("http.proxyPassword");
System.clearProperty("https.proxyPassword");
}
- store.setProxyPass(passNew);
+ store.setProxyPassPersistent(passNew);
}
/*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
index 45626d77..4b2499e6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
@@ -235,7 +235,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
File f = new File(KeystoreConfigurationComposite.this
.configurationContainer.keystoreFile);
try {
- loadKeystore(true);
+ loadKeystore();
} catch (KeyStoreException ex) {
log.error("Error loading keystore", ex);
showErrorDialog(Messages.getString("error.KeyStore"));
@@ -305,14 +305,12 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
e.open();
}
- void loadKeystore(boolean force) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException {
+ void loadKeystore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException {
this.cmbKeystoreAlias.remove(0, this.cmbKeystoreAlias.getItemCount()-1);
ConfigurationDataInMemory config = this.configurationContainer;
this.ks = null;
String pass = config.keystoreStorePass;
- if (!force && pass == null)
- throw new UnrecoverableKeyException("No password specified");
while (this.ks == null)
{
@@ -392,6 +390,11 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
this.txtKeystoreKeyPass.setVisible(showPasswordFields);
this.lblKeystoreStorePass.setVisible(showPasswordFields);
this.txtKeystoreStorePass.setVisible(showPasswordFields);
+ if (showPasswordFields)
+ { /* get rid of potential nulls */
+ performKeystoreKeyPassChanged(this.txtKeystoreKeyPass.getText());
+ performKeystoreStorePassChanged(this.txtKeystoreStorePass.getText());
+ }
}
/**
@@ -476,8 +479,8 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
performKeystoreStorePassChanged(config.keystoreStorePass);
try {
File ksf = new File(ks);
- if (ksf.exists())
- loadKeystore(false);
+ if (ksf.exists() && config.keystoreStorePass != null)
+ loadKeystore();
} catch (Exception e) {
log.info("Failed to load keystore on init", e);
}
@@ -488,10 +491,10 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
@Override
public void storeConfiguration(ConfigurationManager store) {
ConfigurationDataInMemory config = this.configurationContainer;
- store.setKeyStoreFile(config.keystoreFile);
- store.setKeyStoreType(config.keystoreType);
- store.setKeyStoreAlias(config.keystoreAlias);
- store.setKeyStorePassStorageType(config.keystorePassStorageType);
+ store.setKeyStoreFilePersistent(config.keystoreFile);
+ store.setKeyStoreTypePersistent(config.keystoreType);
+ store.setKeyStoreAliasPersistent(config.keystoreAlias);
+ store.setKeyStorePassStorageTypePersistent(config.keystorePassStorageType);
if (config.keystorePassStorageType == KeyStorePassStorageType.DISK)
{
store.setKeyStoreStorePassPersistent(config.keystoreStorePass);
@@ -527,7 +530,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
// Fall through
case 1:
try {
- loadKeystore(true);
+ loadKeystore();
} catch (Exception e) {
throw new CantLoadKeystoreException(e, 4); //skip next checks
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
index 83c159a0..e4237026 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
@@ -665,11 +665,11 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
@Override
public void storeConfiguration(ConfigurationManager store) {
- store.setDefaultMobileNumber(this.configurationContainer.getMobileNumber());
- store.setDefaultEmblem(this.configurationContainer.getEmblem());
- store.setSignatureLocale(this.configurationContainer.signatureLocale);
- store.setSignatureNote(this.configurationContainer.signatureNote);
- store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name());
+ store.setDefaultMobileNumberPersistent(this.configurationContainer.getMobileNumber());
+ store.setDefaultEmblemPersistent(this.configurationContainer.getEmblem());
+ store.setSignatureLocalePersistent(this.configurationContainer.signatureLocale);
+ store.setSignatureNotePersistent(this.configurationContainer.signatureNote);
+ store.setSignatureProfilePersistent(this.configurationContainer.getSignatureProfile().name());
}
/*