Merge remote-tracking branch 'upstream/develop' into feature/fuse-on-win

This commit is contained in:
JaniruTEC
2020-08-19 11:42:55 +02:00
44 changed files with 330 additions and 119 deletions
@@ -1,11 +1,21 @@
package org.cryptomator.common.settings;
public enum UiTheme {
LIGHT("preferences.general.theme.light"),
DARK("preferences.general.theme.dark");
// CUSTOM("Custom (%s)");
import org.apache.commons.lang3.SystemUtils;
private String displayName;
public enum UiTheme {
LIGHT("preferences.general.theme.light"), //
DARK("preferences.general.theme.dark"), //
AUTOMATIC("preferences.general.theme.automatic");
public static UiTheme[] applicableValues() {
if (SystemUtils.IS_OS_MAC) {
return values();
} else {
return new UiTheme[]{LIGHT, DARK};
}
}
private final String displayName;
UiTheme(String displayName) {
this.displayName = displayName;
@@ -38,7 +38,7 @@ public class VaultSettings {
public static final int DEFAULT_FILENAME_LENGTH_LIMIT = -1;
public static final WhenUnlocked DEFAULT_ACTION_AFTER_UNLOCK = WhenUnlocked.ASK;
private static final Random RNG = new Random();
private static final Random RNG = new Random();
private final String id;
private final ObjectProperty<Path> path = new SimpleObjectProperty();
@@ -63,12 +63,18 @@ public class VaultSettings {
return new Observable[]{path, mountName, winDriveLetter, unlockAfterStartup, revealAfterMount, useCustomMountPath, customMountPath, usesReadOnlyMode, mountFlags, filenameLengthLimit, actionAfterUnlock};
}
private void deriveMountNameFromPathOrUseDefault(Path path) {
if (StringUtils.isBlank(mountName.get())) {
if (path != null && path.getFileName() != null) {
mountName.set(normalizeMountName(path.getFileName().toString()));
} else {
mountName.set(DEFAULT_MOUNT_NAME);
private void deriveMountNameFromPathOrUseDefault(Path newPath) {
final boolean mountNameSet = !StringUtils.isBlank(mountName.get());
final boolean dirnameExists = (newPath != null) && (newPath.getFileName() != null);
if (!mountNameSet && dirnameExists) {
mountName.set(normalizeMountName(newPath.getFileName().toString()));
} else if (!mountNameSet && !dirnameExists) {
mountName.set(DEFAULT_MOUNT_NAME + id);
} else if (mountNameSet && dirnameExists) {
if (mountName.get().equals(DEFAULT_MOUNT_NAME + id)) {
//this is okay, since this function is only executed if the path changes (aka, the vault is created or added)
mountName.set(newPath.getFileName().toString());
}
}
}
@@ -159,7 +165,7 @@ public class VaultSettings {
public StringProperty mountFlags() {
return mountFlags;
}
public IntegerProperty filenameLengthLimit() {
return filenameLengthLimit;
}