From 351f96fa8b5fa2288c52d52a98eaceeeda6d1713 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 7 Aug 2020 09:30:22 +0200 Subject: [PATCH] switch to light theme if donation key has changed and is invalid --- .../preferences/DonationKeyPreferencesController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/preferences/DonationKeyPreferencesController.java b/main/ui/src/main/java/org/cryptomator/ui/preferences/DonationKeyPreferencesController.java index 476887b26..21a2d3d9a 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/preferences/DonationKeyPreferencesController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/preferences/DonationKeyPreferencesController.java @@ -5,23 +5,27 @@ import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; import javafx.scene.control.TextArea; import org.cryptomator.common.LicenseHolder; +import org.cryptomator.common.settings.Settings; +import org.cryptomator.common.settings.UiTheme; import org.cryptomator.ui.common.FxController; import javax.inject.Inject; @PreferencesScoped public class DonationKeyPreferencesController implements FxController { - + private static final String DONATION_URI = "https://store.cryptomator.org/desktop"; private final Application application; private final LicenseHolder licenseHolder; + private final Settings settings; public TextArea donationKeyField; @Inject - DonationKeyPreferencesController(Application application, LicenseHolder licenseHolder) { + DonationKeyPreferencesController(Application application, LicenseHolder licenseHolder, Settings settings) { this.application = application; this.licenseHolder = licenseHolder; + this.settings = settings; } @FXML @@ -32,6 +36,9 @@ public class DonationKeyPreferencesController implements FxController { private void registrationKeyChanged(@SuppressWarnings("unused") ObservableValue observable, @SuppressWarnings("unused") String oldValue, String newValue) { licenseHolder.validateAndStoreLicense(newValue); + if (!licenseHolder.isValidLicense()) { + settings.theme().set(UiTheme.LIGHT); + } } @FXML