Browse Source

Fix backup/restore functions.

pull/3202/head
TheGoddessInari 6 years ago
parent
commit
55fe946f58
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 20
      app/ux/FileBackup.js
  2. 5
      app/view/main/MainController.js

20
app/ux/FileBackup.js

@ -1,14 +1,16 @@
Ext.define('Rambox.ux.FileBackup', { Ext.define('Rambox.ux.FileBackup', {
singleton: true, singleton: true,
initComponent: () => { constructor() {
this.remote = require('electron').remote; const me = this;
this.path = this.remote.require('path'); me.callParent(arguments);
this.fs = this.remote.require('fs'); me.remote = require('electron').remote;
this.userPath = this.remote.app.getPath('userData'); me.path = me.remote.require('path');
this.defaultFileName = 'rambox-backup.json'; me.fs = me.remote.require('fs');
this.myDefaultPath = this.userPath + this.path.sep + this.defaultFileName; me.userPath = me.remote.app.getPath('userData');
me.defaultFileName = 'rambox-backup.json';
me.myDefaultPath = me.userPath + me.path.sep + me.defaultFileName;
}, },
backupConfiguration: function (callback) { backupConfiguration(callback) {
var me = this; var me = this;
let services = []; let services = [];
Ext.getStore('Services').each(function(service) { Ext.getStore('Services').each(function(service) {
@ -31,7 +33,7 @@ Ext.define('Rambox.ux.FileBackup', {
}); });
if (Ext.isFunction(callback)) callback.bind(me)(); if (Ext.isFunction(callback)) callback.bind(me)();
}, },
restoreConfiguration: function () { restoreConfiguration() {
var me = this; var me = this;
me.remote.dialog.showOpenDialog({ me.remote.dialog.showOpenDialog({
defaultPath: me.myDefaultPath, defaultPath: me.myDefaultPath,

5
app/view/main/MainController.js

@ -215,14 +215,15 @@ Ext.define('Rambox.view.main.MainController', {
})); }));
}); });
Promise.all(promises) Promise.all(promises)
.then(function(value) { .then(function(resolve) {
if ( Ext.isFunction(callback) ) callback(); if ( Ext.isFunction(callback) ) callback();
return resolve;
}) })
.catch(function(err) { .catch(function(err) {
console.error('Error removing services: ' + err); console.error('Error removing services: ' + err);
Ext.Msg.alert('Error!','Error removing services: ' + err); Ext.Msg.alert('Error!','Error removing services: ' + err);
}) })
.then(function() { // Replace when Promise.finally when available. .finally(function() {
store.resumeEvent('childmove'); store.resumeEvent('childmove');
store.resumeEvent('remove'); store.resumeEvent('remove');
document.title = 'Rambox-OS'; document.title = 'Rambox-OS';

Loading…
Cancel
Save