fix #389: minimize instead of close, after changes are saved

This commit is contained in:
antelle 2017-01-29 20:19:45 +01:00
parent a862919824
commit 10fde76499
1 changed files with 10 additions and 11 deletions

View File

@ -291,10 +291,17 @@ var AppView = Backbone.View.extend({
return;
}
if (this.model.files.hasDirtyFiles()) {
let exit = () => {
if (this.model.settings.get('minimizeOnClose')) {
Launcher.minimizeApp();
} else {
Launcher.exit();
}
};
if (Launcher && !Launcher.exitRequested) {
if (!this.exitAlertShown) {
if (this.model.settings.get('autoSave')) {
this.saveAndExit();
this.saveAndLock(result => { if (result) { exit(); } });
return Launcher.preventExit(e);
}
this.exitAlertShown = true;
@ -308,9 +315,9 @@ var AppView = Backbone.View.extend({
],
success: result => {
if (result === 'save') {
this.saveAndExit();
this.saveAndLock(result => { if (result) { exit(); } });
} else {
Launcher.exit();
exit();
}
},
cancel: () => {
@ -452,14 +459,6 @@ var AppView = Backbone.View.extend({
}
},
saveAndExit: function() {
this.saveAndLock(result => {
if (result) {
Launcher.exit();
}
});
},
closeAllFilesAndShowFirst: function() {
var fileToShow = this.model.files.find(file => !file.get('demo') && !file.get('created'));
this.model.closeAllFiles();