added FileStateChanged

This commit is contained in:
Oystein 2021-04-07 08:34:03 +02:00
parent 509f5224b5
commit 79e684228f
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import com.google.common.eventbus.Subscribe;
import app.events.CopyEvent; import app.events.CopyEvent;
import app.events.CutEvent; import app.events.CutEvent;
import app.events.ExitApplicationEvent; import app.events.ExitApplicationEvent;
import app.events.FileSaveStateChangedEvent;
import app.events.FileSelectedEvent; import app.events.FileSelectedEvent;
import app.events.LanguageChangedEvent; import app.events.LanguageChangedEvent;
import app.events.OpenLinkInBrowserEvent; import app.events.OpenLinkInBrowserEvent;
@ -136,6 +137,7 @@ public class MenubarController implements Initializable, Controller {
private void handleSaveFile() { private void handleSaveFile() {
if (Model.getActiveFilePath() != null) { if (Model.getActiveFilePath() != null) {
this.eventBus.post(new SaveFile(Model.getActiveFilePath().toString())); this.eventBus.post(new SaveFile(Model.getActiveFilePath().toString()));
this.eventBus.post(new FileSaveStateChangedEvent(true));
} else { } else {
handleSaveAsFile(); handleSaveAsFile();
} }
@ -166,6 +168,7 @@ public class MenubarController implements Initializable, Controller {
this.eventBus.post(new FileSelectedEvent(chosenLocationToString)); this.eventBus.post(new FileSelectedEvent(chosenLocationToString));
Path chosenLocationToPath = Paths.get(chosenLocationToString); Path chosenLocationToPath = Paths.get(chosenLocationToString);
Model.setActiveFilePath(chosenLocationToPath); Model.setActiveFilePath(chosenLocationToPath);
this.eventBus.post(new FileSaveStateChangedEvent(true));
} }
} }