|
@@ -1,11 +1,13 @@
|
|
|
package org.cryptomator.ui.mainwindow;
|
|
|
|
|
|
import org.apache.commons.lang3.SystemUtils;
|
|
|
+import org.cryptomator.common.EventMap;
|
|
|
import org.cryptomator.common.settings.Settings;
|
|
|
import org.cryptomator.common.vaults.Vault;
|
|
|
import org.cryptomator.common.vaults.VaultListManager;
|
|
|
import org.cryptomator.cryptofs.CryptoFileSystemProvider;
|
|
|
import org.cryptomator.cryptofs.DirStructure;
|
|
|
+import org.cryptomator.event.VaultEvent;
|
|
|
import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
|
|
|
import org.cryptomator.ui.common.FxController;
|
|
|
import org.cryptomator.ui.common.VaultService;
|
|
@@ -23,6 +25,7 @@ import javafx.beans.property.ObjectProperty;
|
|
|
import javafx.beans.property.SimpleBooleanProperty;
|
|
|
import javafx.beans.value.ObservableValue;
|
|
|
import javafx.collections.ListChangeListener;
|
|
|
+import javafx.collections.MapChangeListener;
|
|
|
import javafx.collections.ObservableList;
|
|
|
import javafx.fxml.FXML;
|
|
|
import javafx.geometry.Side;
|
|
@@ -35,7 +38,6 @@ import javafx.scene.input.KeyCode;
|
|
|
import javafx.scene.input.KeyEvent;
|
|
|
import javafx.scene.input.MouseEvent;
|
|
|
import javafx.scene.input.TransferMode;
|
|
|
-import javafx.scene.layout.HBox;
|
|
|
import javafx.scene.layout.StackPane;
|
|
|
import javafx.stage.Stage;
|
|
|
import java.io.File;
|
|
@@ -67,6 +69,8 @@ public class VaultListController implements FxController {
|
|
|
private final VaultListCellFactory cellFactory;
|
|
|
private final AddVaultWizardComponent.Builder addVaultWizard;
|
|
|
private final BooleanBinding emptyVaultList;
|
|
|
+ private final EventMap eventMap;
|
|
|
+ private final BooleanProperty newEventsPresent;
|
|
|
private final VaultListManager vaultListManager;
|
|
|
private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty();
|
|
|
private final ResourceBundle resourceBundle;
|
|
@@ -92,7 +96,8 @@ public class VaultListController implements FxController {
|
|
|
ResourceBundle resourceBundle, //
|
|
|
FxApplicationWindows appWindows, //
|
|
|
Settings settings, //
|
|
|
- Dialogs dialogs) {
|
|
|
+ Dialogs dialogs, //
|
|
|
+ EventMap eventMap) {
|
|
|
this.mainWindow = mainWindow;
|
|
|
this.vaults = vaults;
|
|
|
this.selectedVault = selectedVault;
|
|
@@ -105,6 +110,13 @@ public class VaultListController implements FxController {
|
|
|
this.dialogs = dialogs;
|
|
|
|
|
|
this.emptyVaultList = Bindings.isEmpty(vaults);
|
|
|
+ this.eventMap = eventMap;
|
|
|
+ this.newEventsPresent = new SimpleBooleanProperty(false);
|
|
|
+ eventMap.addListener((MapChangeListener<? super EventMap.EventKey, ? super VaultEvent>) change -> {
|
|
|
+ if (change.wasAdded()) {
|
|
|
+ newEventsPresent.setValue(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
selectedVault.addListener(this::selectedVaultDidChange);
|
|
|
cellSize = settings.compactMode.map(compact -> compact ? 30.0 : 60.0);
|
|
@@ -267,6 +279,7 @@ public class VaultListController implements FxController {
|
|
|
@FXML
|
|
|
public void showEventViewer() {
|
|
|
appWindows.showEventViewer();
|
|
|
+ newEventsPresent.setValue(false);
|
|
|
}
|
|
|
// Getter and Setter
|
|
|
|
|
@@ -294,4 +307,11 @@ public class VaultListController implements FxController {
|
|
|
return cellSize.getValue();
|
|
|
}
|
|
|
|
|
|
+ public ObservableValue<Boolean> newEventsPresentProperty() {
|
|
|
+ return newEventsPresent;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean getNewEventsPresent() {
|
|
|
+ return newEventsPresent.getValue();
|
|
|
+ }
|
|
|
}
|