added confirmation checkbox to upgrade screen [ci skip]

This commit is contained in:
Tobias Hagemann
2016-08-17 18:11:27 +02:00
parent fe0a34907f
commit 1f73a08e09
6 changed files with 23 additions and 11 deletions

View File

@@ -15,11 +15,13 @@ import org.cryptomator.ui.settings.Localization;
import org.cryptomator.ui.util.AsyncTaskService;
import org.fxmisc.easybind.EasyBind;
import javafx.beans.binding.BooleanExpression;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
@@ -44,6 +46,9 @@ public class UpgradeController extends LocalizedFXMLViewController {
@FXML
private SecPasswordField passwordField;
@FXML
private CheckBox confirmationCheckbox;
@FXML
private Button upgradeButton;
@@ -59,7 +64,9 @@ public class UpgradeController extends LocalizedFXMLViewController {
return instruction.map(this::upgradeNotification).orElse("");
}).orElse(""));
upgradeButton.disableProperty().bind(passwordField.textProperty().isEmpty().or(passwordField.disabledProperty()));
BooleanExpression passwordProvided = passwordField.textProperty().isNotEmpty().and(passwordField.disabledProperty().not());
BooleanExpression syncFinished = confirmationCheckbox.selectedProperty();
upgradeButton.disableProperty().bind(passwordProvided.not().or(syncFinished.not()));
EasyBind.subscribe(vault, this::vaultDidChange);
}

View File

@@ -305,17 +305,17 @@
****************************************************************************/
.check-box {
-fx-label-padding: 0 0 0 3;
-fx-label-padding: 0 0 0 6px;
-fx-text-fill: COLOR_TEXT;
}
.check-box > .box {
-fx-padding: 3;
-fx-padding: 3px;
-fx-background-color: COLOR_BORDER_DARK, #FFF;
-fx-background-insets: 0, 1;
}
.check-box > .box > .mark {
-fx-background-color: transparent;
-fx-padding: 4;
-fx-padding: 4px;
-fx-shape: "M-1,4, L-1,5.5 L3.5,8.5 L9,0 L9,-1 L7,-1 L3,6 L1,4 Z";
}
.check-box:selected > .box {

View File

@@ -386,7 +386,7 @@
******************************************************************************/
.check-box {
-fx-label-padding: 0 0 0 3px;
-fx-label-padding: 0 0 0 6px;
-fx-text-fill: COLOR_TEXT;
}
.check-box > .box {

View File

@@ -354,7 +354,7 @@
******************************************************************************/
.check-box {
-fx-label-padding: 0 0 0 3px;
-fx-label-padding: 0 0 0 6px;
-fx-text-fill: COLOR_TEXT;
}
.check-box > .box {

View File

@@ -17,6 +17,8 @@
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.CheckBox?>
<GridPane vgap="12.0" hgap="12.0" prefWidth="400.0" xmlns:fx="http://javafx.com/fxml" cacheShape="true" cache="true">
<padding>
@@ -34,15 +36,17 @@
<Pane prefHeight="12.0" GridPane.rowIndex="1" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true">
</Pane>
<Label text="%unlock.label.password" cacheShape="true" cache="true" GridPane.rowIndex="2" GridPane.columnIndex="0" />
<SecPasswordField fx:id="passwordField" cacheShape="true" cache="true" GridPane.rowIndex="2" GridPane.columnIndex="1" />
<Label text="%unlock.label.password" GridPane.rowIndex="2" GridPane.columnIndex="0" cacheShape="true" cache="true" />
<SecPasswordField fx:id="passwordField" GridPane.rowIndex="2" GridPane.columnIndex="1" cacheShape="true" cache="true" />
<CheckBox fx:id="confirmationCheckbox" text="%upgrade.confirmation.label" wrapText="true" GridPane.rowIndex="3" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true" />
<HBox alignment="CENTER_RIGHT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="3" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true">
<HBox alignment="CENTER_RIGHT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true">
<Button fx:id="upgradeButton" text="%upgrade.button" prefWidth="150.0" onAction="#didClickUpgradeButton" cacheShape="true" cache="true" />
</HBox>
<ProgressIndicator progress="-1" fx:id="progressIndicator" visible="false" cacheShape="true" cache="true" cacheHint="SPEED" GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="2" />
<ProgressIndicator progress="-1" fx:id="progressIndicator" visible="false" GridPane.rowIndex="5" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true" cacheHint="SPEED" />
<Label fx:id="errorLabel" wrapText="true" GridPane.rowIndex="5" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true" />
<Label fx:id="errorLabel" wrapText="true" GridPane.rowIndex="6" GridPane.columnIndex="0" GridPane.columnSpan="2" cacheShape="true" cache="true" />
</children>
</GridPane>

View File

@@ -38,6 +38,7 @@ initialize.label.doNotForget=IMPORTANT: If you forget your password, there is no
notfound.label=Vault couldn't be found. Has it been moved?
# upgrade.fxml
upgrade.confirmation.label=Yes, I've made sure that synchronization has finished
upgrade.button=Upgrade vault
upgrade.version3dropBundleExtension.msg=This vault needs to be migrated to a newer format.\n"%1$s" will be renamed to "%2$s".\nPlease make sure synchronization has finished before proceeding.