From 851fda341cc53b4aa61de6637917741f5508515c Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 3 Nov 2022 17:02:40 +0100 Subject: text w/ dependency info if fido2 unsupported --- .../composites/configuration/AboutComposite.java | 3 +-- .../configuration/Fido2ConfigurationComposite.java | 24 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java index 2dced6ac..09c2fdbc 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java @@ -82,8 +82,7 @@ public class AboutComposite extends ConfigurationCompositeBase { SWTUtils.reanchor(lnkDataProtection).bottom(btnUpdateCheck,-5); SWTUtils.addSelectionListener(btnOpenLogDirectory, (e) -> { - try - { + try { if (Desktop.isDesktopSupported()) Desktop.getDesktop().open(new File(Constants.CONFIG_DIRECTORY + File.separator + "logs")); } catch (Exception ex) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java index 36e2931b..a294569f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java @@ -9,18 +9,21 @@ import org.eclipse.swt.widgets.Link; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.sun.jna.Platform; + import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.gui.workflow.states.State; +import at.asit.webauthn.WebAuthN; public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { private static final Logger log = LoggerFactory.getLogger(Fido2ConfigurationComposite.class); private Link lnkInfoText; - // TODO information about unsupported/installing deps? + private Link unsupportedText; private Group grpFidoSettings; private Button btnFido2ByDefault; @@ -34,13 +37,18 @@ public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setFontHeight(lnkInfoText, Constants.TEXT_SIZE_NORMAL); SWTUtils.addSelectionListener(lnkInfoText, () -> { SWTUtils.openURL(Messages.getString("config.fido2.InfoURL")); }); + this.unsupportedText = new Link(this, SWT.WRAP); + SWTUtils.anchor(unsupportedText).top(lnkInfoText,5).left(0,5).right(100,-5); + SWTUtils.setFontHeight(unsupportedText, Constants.TEXT_SIZE_NORMAL); + SWTUtils.addSelectionListener(unsupportedText, () -> { SWTUtils.openURL("https://developers.yubico.com/libfido2/#_installation"); }); + FormLayout STANDARD_LAYOUT = new FormLayout(); STANDARD_LAYOUT.marginHeight = 10; STANDARD_LAYOUT.marginWidth = 5; this.grpFidoSettings = new Group(this, SWT.NONE); this.grpFidoSettings.setLayout(STANDARD_LAYOUT); - SWTUtils.anchor(grpFidoSettings).top(lnkInfoText,5).left(0,5).right(100,-5); + SWTUtils.anchor(grpFidoSettings).top(lnkInfoText,10).left(0,5).right(100,-5); SWTUtils.setFontHeight(grpFidoSettings, Constants.TEXT_SIZE_NORMAL); this.btnFido2ByDefault = new Button(this.grpFidoSettings, SWT.CHECK); @@ -48,6 +56,11 @@ public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setFontHeight(btnFido2ByDefault, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnFido2ByDefault, () -> { this.configurationContainer.fido2ByDefault = btnFido2ByDefault.getSelection(); }); + if (WebAuthN.isAvailable()) + this.unsupportedText.setVisible(false); + else + this.grpFidoSettings.setVisible(false); + reloadResources(); } @@ -56,6 +69,13 @@ public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setLocalizedText(lnkInfoText, "config.fido2.AboutFIDO"); SWTUtils.setLocalizedText(grpFidoSettings, "config.fido2.Group"); SWTUtils.setLocalizedText(btnFido2ByDefault, "config.fido2.ByDefault"); + + if (Platform.isLinux()) + SWTUtils.setLocalizedText(unsupportedText, "config.fido2.UnsupportedTryLibFido2"); + else { + SWTUtils.setFontStyle(unsupportedText, SWT.BOLD); + SWTUtils.setLocalizedText(unsupportedText, "config.fido2.UnsupportedPlatform"); + } } @Override -- cgit v1.2.3