2019-09-17 19:50:42 +02:00
|
|
|
import { Model } from 'framework/model';
|
2019-09-15 14:16:32 +02:00
|
|
|
import { SettingsStore } from 'comp/settings/settings-store';
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-17 19:50:42 +02:00
|
|
|
class AppSettingsModel extends Model {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.on('change', () => this.save());
|
|
|
|
}
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
load() {
|
2017-02-20 23:39:13 +01:00
|
|
|
return SettingsStore.load('app-settings').then(data => {
|
|
|
|
if (data) {
|
|
|
|
this.upgrade(data);
|
2019-08-16 23:05:39 +02:00
|
|
|
this.set(data, { silent: true });
|
2017-02-20 23:39:13 +01:00
|
|
|
}
|
2017-02-05 21:28:43 +01:00
|
|
|
});
|
2019-09-17 19:50:42 +02:00
|
|
|
}
|
2017-02-04 19:31:26 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
upgrade(data) {
|
2017-01-28 23:36:30 +01:00
|
|
|
if (data.rememberKeyFiles === true) {
|
|
|
|
data.rememberKeyFiles = 'data';
|
|
|
|
}
|
2019-09-17 19:50:42 +02:00
|
|
|
}
|
2017-01-28 23:36:30 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
save() {
|
2019-09-17 19:50:42 +02:00
|
|
|
SettingsStore.save('app-settings', this);
|
2015-10-17 23:49:24 +02:00
|
|
|
}
|
2019-09-17 19:50:42 +02:00
|
|
|
}
|
|
|
|
|
2019-09-20 20:31:19 +02:00
|
|
|
AppSettingsModel.defineModelProperties(
|
|
|
|
{
|
|
|
|
theme: 'fb',
|
|
|
|
locale: null,
|
|
|
|
expandGroups: true,
|
|
|
|
listViewWidth: null,
|
|
|
|
menuViewWidth: null,
|
|
|
|
tagsViewHeight: null,
|
|
|
|
autoUpdate: 'install',
|
|
|
|
clipboardSeconds: 0,
|
|
|
|
autoSave: true,
|
|
|
|
autoSaveInterval: 0,
|
|
|
|
rememberKeyFiles: false,
|
|
|
|
idleMinutes: 15,
|
|
|
|
minimizeOnClose: false,
|
|
|
|
tableView: false,
|
|
|
|
colorfulIcons: false,
|
2019-10-17 19:13:11 +02:00
|
|
|
useMarkdown: true,
|
2019-09-20 20:31:19 +02:00
|
|
|
directAutotype: true,
|
|
|
|
titlebarStyle: 'default',
|
|
|
|
lockOnMinimize: true,
|
|
|
|
lockOnCopy: false,
|
|
|
|
lockOnAutoType: false,
|
|
|
|
lockOnOsLock: false,
|
|
|
|
helpTipCopyShown: false,
|
|
|
|
templateHelpShown: false,
|
|
|
|
skipOpenLocalWarn: false,
|
|
|
|
hideEmptyFields: false,
|
|
|
|
skipHttpsWarning: false,
|
|
|
|
demoOpened: false,
|
|
|
|
fontSize: 0,
|
|
|
|
tableViewColumns: null,
|
|
|
|
generatorPresets: null,
|
|
|
|
generatorHidePassword: false,
|
|
|
|
cacheConfigSettings: false,
|
2019-10-06 08:28:59 +02:00
|
|
|
allowIframes: false,
|
2020-03-15 17:22:25 +01:00
|
|
|
useGroupIconForEntries: false,
|
2019-09-17 19:50:42 +02:00
|
|
|
|
2019-09-20 20:31:19 +02:00
|
|
|
canOpen: true,
|
|
|
|
canOpenDemo: true,
|
|
|
|
canOpenSettings: true,
|
|
|
|
canCreate: true,
|
|
|
|
canImportXml: true,
|
2019-09-25 23:24:38 +02:00
|
|
|
canImportCsv: true,
|
2019-09-20 20:31:19 +02:00
|
|
|
canRemoveLatest: true,
|
|
|
|
canExportXml: true,
|
|
|
|
canExportHtml: true,
|
2020-03-14 20:51:42 +01:00
|
|
|
canSaveTo: true,
|
2020-04-17 20:58:47 +02:00
|
|
|
canOpenStorage: true,
|
2020-04-15 17:26:10 +02:00
|
|
|
canOpenGenerator: true,
|
2019-09-17 19:50:42 +02:00
|
|
|
|
2019-09-20 20:31:19 +02:00
|
|
|
dropbox: true,
|
|
|
|
webdav: true,
|
|
|
|
gdrive: true,
|
|
|
|
onedrive: true
|
|
|
|
},
|
|
|
|
{ extensions: true }
|
|
|
|
);
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-17 19:50:42 +02:00
|
|
|
const instance = new AppSettingsModel();
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-17 19:50:42 +02:00
|
|
|
export { instance as AppSettingsModel };
|