2019-09-16 22:57:56 +02:00
|
|
|
import { Events } from 'framework/events';
|
2019-09-16 20:42:33 +02:00
|
|
|
import { View } from 'framework/views/view';
|
2019-09-16 20:40:20 +02:00
|
|
|
import { AutoType } from 'auto-type';
|
2019-09-15 14:16:32 +02:00
|
|
|
import { Storage } from 'storage';
|
|
|
|
import { RuntimeInfo } from 'comp/app/runtime-info';
|
|
|
|
import { Updater } from 'comp/app/updater';
|
|
|
|
import { Launcher } from 'comp/launcher';
|
|
|
|
import { SettingsManager } from 'comp/settings/settings-manager';
|
|
|
|
import { Alerts } from 'comp/ui/alerts';
|
|
|
|
import { Links } from 'const/links';
|
|
|
|
import { AppSettingsModel } from 'models/app-settings-model';
|
|
|
|
import { UpdateModel } from 'models/update-model';
|
|
|
|
import { SemVer } from 'util/data/semver';
|
|
|
|
import { Features } from 'util/features';
|
|
|
|
import { DateFormat } from 'util/formatting/date-format';
|
|
|
|
import { Locale } from 'util/locale';
|
|
|
|
import { SettingsLogsView } from 'views/settings/settings-logs-view';
|
|
|
|
import { SettingsPrvView } from 'views/settings/settings-prv-view';
|
2019-09-16 20:40:20 +02:00
|
|
|
import template from 'templates/settings/settings-general.hbs';
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-16 20:40:20 +02:00
|
|
|
class SettingsGeneralView extends View {
|
|
|
|
template = template;
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-16 20:40:20 +02:00
|
|
|
events = {
|
2015-10-23 22:12:12 +02:00
|
|
|
'change .settings__general-theme': 'changeTheme',
|
2016-08-21 23:12:49 +02:00
|
|
|
'change .settings__general-locale': 'changeLocale',
|
2016-05-15 09:57:29 +02:00
|
|
|
'change .settings__general-font-size': 'changeFontSize',
|
2015-11-06 21:42:37 +01:00
|
|
|
'change .settings__general-expand': 'changeExpandGroups',
|
2015-11-11 20:26:04 +01:00
|
|
|
'change .settings__general-auto-update': 'changeAutoUpdate',
|
2015-11-18 19:33:04 +01:00
|
|
|
'change .settings__general-idle-minutes': 'changeIdleMinutes',
|
2015-11-16 21:36:07 +01:00
|
|
|
'change .settings__general-clipboard': 'changeClipboard',
|
2015-11-17 21:57:32 +01:00
|
|
|
'change .settings__general-auto-save': 'changeAutoSave',
|
2019-01-02 15:19:19 +01:00
|
|
|
'change .settings__general-auto-save-interval': 'changeAutoSaveInterval',
|
2016-02-14 12:20:21 +01:00
|
|
|
'change .settings__general-remember-key-files': 'changeRememberKeyFiles',
|
2015-11-21 08:29:49 +01:00
|
|
|
'change .settings__general-minimize': 'changeMinimize',
|
2015-12-02 22:41:53 +01:00
|
|
|
'change .settings__general-lock-on-minimize': 'changeLockOnMinimize',
|
2016-02-14 13:05:31 +01:00
|
|
|
'change .settings__general-lock-on-copy': 'changeLockOnCopy',
|
2017-04-09 00:53:12 +02:00
|
|
|
'change .settings__general-lock-on-auto-type': 'changeLockOnAutoType',
|
2017-06-02 20:16:09 +02:00
|
|
|
'change .settings__general-lock-on-os-lock': 'changeLockOnOsLock',
|
2015-11-21 15:55:42 +01:00
|
|
|
'change .settings__general-table-view': 'changeTableView',
|
2015-12-02 22:12:14 +01:00
|
|
|
'change .settings__general-colorful-icons': 'changeColorfulIcons',
|
2019-03-03 12:53:47 +01:00
|
|
|
'change .settings__general-direct-autotype': 'changeDirectAutotype',
|
2017-03-25 21:31:12 +01:00
|
|
|
'change .settings__general-titlebar-style': 'changeTitlebarStyle',
|
2015-11-14 12:09:36 +01:00
|
|
|
'click .settings__general-update-btn': 'checkUpdate',
|
|
|
|
'click .settings__general-restart-btn': 'restartApp',
|
2015-11-14 16:28:36 +01:00
|
|
|
'click .settings__general-download-update-btn': 'downloadUpdate',
|
2015-11-16 20:04:33 +01:00
|
|
|
'click .settings__general-update-found-btn': 'installFoundUpdate',
|
2016-03-13 18:33:25 +01:00
|
|
|
'change .settings__general-prv-check': 'changeStorageEnabled',
|
2016-06-04 10:31:06 +02:00
|
|
|
'click .settings__general-show-advanced': 'showAdvancedSettings',
|
2016-04-10 10:26:40 +02:00
|
|
|
'click .settings__general-dev-tools-link': 'openDevTools',
|
2016-06-04 10:31:06 +02:00
|
|
|
'click .settings__general-try-beta-link': 'tryBeta',
|
2019-03-31 13:55:00 +02:00
|
|
|
'click .settings__general-show-logs-link': 'showLogs',
|
|
|
|
'click .settings__general-reload-app-link': 'reloadApp'
|
2019-09-16 20:40:20 +02:00
|
|
|
};
|
2016-03-17 22:10:49 +01:00
|
|
|
|
2019-09-16 20:40:20 +02:00
|
|
|
constructor(model, options) {
|
|
|
|
super(model, options);
|
|
|
|
this.listenTo(UpdateModel.instance, 'change:status', this.render);
|
|
|
|
this.listenTo(UpdateModel.instance, 'change:updateStatus', this.render);
|
|
|
|
}
|
2015-10-29 22:20:01 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
render() {
|
2017-01-31 07:50:28 +01:00
|
|
|
const updateReady = UpdateModel.instance.get('updateStatus') === 'ready';
|
|
|
|
const updateFound = UpdateModel.instance.get('updateStatus') === 'found';
|
|
|
|
const updateManual = UpdateModel.instance.get('updateManual');
|
|
|
|
const storageProviders = this.getStorageProviders();
|
2017-03-26 16:36:07 +02:00
|
|
|
|
2019-09-16 20:40:20 +02:00
|
|
|
super.render({
|
2017-02-21 22:05:18 +01:00
|
|
|
themes: _.mapObject(SettingsManager.allThemes, theme => Locale[theme]),
|
2019-09-17 19:50:42 +02:00
|
|
|
activeTheme: AppSettingsModel.theme,
|
2017-02-19 10:29:18 +01:00
|
|
|
locales: SettingsManager.allLocales,
|
2017-01-29 10:04:18 +01:00
|
|
|
activeLocale: SettingsManager.activeLocale,
|
2019-09-17 19:50:42 +02:00
|
|
|
fontSize: AppSettingsModel.fontSize,
|
|
|
|
expandGroups: AppSettingsModel.expandGroups,
|
2015-11-16 21:36:07 +01:00
|
|
|
canClearClipboard: !!Launcher,
|
2019-09-17 19:50:42 +02:00
|
|
|
clipboardSeconds: AppSettingsModel.clipboardSeconds,
|
|
|
|
rememberKeyFiles: AppSettingsModel.rememberKeyFiles,
|
2016-12-11 14:39:59 +01:00
|
|
|
supportFiles: !!Launcher,
|
2019-09-17 19:50:42 +02:00
|
|
|
autoSave: AppSettingsModel.autoSave,
|
|
|
|
autoSaveInterval: AppSettingsModel.autoSaveInterval,
|
|
|
|
idleMinutes: AppSettingsModel.idleMinutes,
|
|
|
|
minimizeOnClose: AppSettingsModel.minimizeOnClose,
|
2015-10-29 22:20:01 +01:00
|
|
|
devTools: Launcher && Launcher.devTools,
|
2016-02-06 12:40:40 +01:00
|
|
|
canAutoUpdate: Updater.enabled,
|
2019-01-02 21:45:53 +01:00
|
|
|
canAutoSaveOnClose: !!Launcher,
|
2015-12-02 22:41:53 +01:00
|
|
|
canMinimize: Launcher && Launcher.canMinimize(),
|
2016-07-17 15:01:06 +02:00
|
|
|
canDetectMinimize: !!Launcher,
|
2017-06-12 21:07:09 +02:00
|
|
|
canDetectOsSleep: Launcher && Launcher.canDetectOsSleep(),
|
2017-04-09 10:31:05 +02:00
|
|
|
canAutoType: AutoType.enabled,
|
2019-09-17 19:50:42 +02:00
|
|
|
lockOnMinimize: Launcher && AppSettingsModel.lockOnMinimize,
|
|
|
|
lockOnCopy: AppSettingsModel.lockOnCopy,
|
|
|
|
lockOnAutoType: AppSettingsModel.lockOnAutoType,
|
|
|
|
lockOnOsLock: AppSettingsModel.lockOnOsLock,
|
|
|
|
tableView: AppSettingsModel.tableView,
|
2019-09-15 08:11:11 +02:00
|
|
|
canSetTableView: !Features.isMobile,
|
2015-11-16 20:04:33 +01:00
|
|
|
autoUpdate: Updater.getAutoUpdateType(),
|
2015-11-14 12:09:36 +01:00
|
|
|
updateInProgress: Updater.updateInProgress(),
|
|
|
|
updateInfo: this.getUpdateInfo(),
|
2015-12-16 22:50:45 +01:00
|
|
|
updateWaitingReload: updateReady && !Launcher,
|
2016-02-06 12:40:40 +01:00
|
|
|
showUpdateBlock: Updater.enabled && !updateManual,
|
2019-08-18 10:17:09 +02:00
|
|
|
updateReady,
|
|
|
|
updateFound,
|
|
|
|
updateManual,
|
2015-12-02 22:12:14 +01:00
|
|
|
releaseNotesLink: Links.ReleaseNotes,
|
2019-09-17 19:50:42 +02:00
|
|
|
colorfulIcons: AppSettingsModel.colorfulIcons,
|
|
|
|
directAutotype: AppSettingsModel.directAutotype,
|
2019-09-15 08:11:11 +02:00
|
|
|
supportsTitleBarStyles: Launcher && Features.supportsTitleBarStyles(),
|
2019-09-17 19:50:42 +02:00
|
|
|
titlebarStyle: AppSettingsModel.titlebarStyle,
|
2019-08-18 10:17:09 +02:00
|
|
|
storageProviders,
|
2019-09-15 08:11:11 +02:00
|
|
|
showReloadApp: Features.isStandalone
|
2015-10-17 23:49:24 +02:00
|
|
|
});
|
2016-03-17 22:10:49 +01:00
|
|
|
this.renderProviderViews(storageProviders);
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-03-17 22:10:49 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
renderProviderViews(storageProviders) {
|
2016-03-17 22:10:49 +01:00
|
|
|
storageProviders.forEach(function(prv) {
|
|
|
|
if (this.views[prv.name]) {
|
|
|
|
this.views[prv.name].remove();
|
|
|
|
}
|
|
|
|
if (prv.hasConfig) {
|
2019-09-16 20:40:20 +02:00
|
|
|
const prvView = new SettingsPrvView(prv, {
|
|
|
|
parent: this.$el.find('.settings__general-' + prv.name)[0]
|
|
|
|
});
|
|
|
|
this.views[prv.name] = prvView;
|
|
|
|
prvView.render();
|
2016-03-17 22:10:49 +01:00
|
|
|
}
|
|
|
|
}, this);
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
getUpdateInfo() {
|
2015-10-29 22:20:01 +01:00
|
|
|
switch (UpdateModel.instance.get('status')) {
|
|
|
|
case 'checking':
|
2015-12-17 19:25:25 +01:00
|
|
|
return Locale.setGenUpdateChecking + '...';
|
2019-08-18 10:17:09 +02:00
|
|
|
case 'error': {
|
2017-01-31 07:50:28 +01:00
|
|
|
let errMsg = Locale.setGenErrorChecking;
|
2015-10-29 22:20:01 +01:00
|
|
|
if (UpdateModel.instance.get('lastError')) {
|
|
|
|
errMsg += ': ' + UpdateModel.instance.get('lastError');
|
|
|
|
}
|
|
|
|
if (UpdateModel.instance.get('lastSuccessCheckDate')) {
|
2019-08-16 23:05:39 +02:00
|
|
|
errMsg +=
|
|
|
|
'. ' +
|
|
|
|
Locale.setGenLastCheckSuccess.replace(
|
|
|
|
'{}',
|
2019-09-15 08:11:11 +02:00
|
|
|
DateFormat.dtStr(UpdateModel.instance.get('lastSuccessCheckDate'))
|
2019-08-16 23:05:39 +02:00
|
|
|
) +
|
|
|
|
': ' +
|
2019-08-18 08:05:38 +02:00
|
|
|
Locale.setGenLastCheckVer.replace(
|
|
|
|
'{}',
|
|
|
|
UpdateModel.instance.get('lastVersion')
|
|
|
|
);
|
2015-10-29 22:20:01 +01:00
|
|
|
}
|
|
|
|
return errMsg;
|
2019-08-18 10:17:09 +02:00
|
|
|
}
|
|
|
|
case 'ok': {
|
2019-08-18 08:05:38 +02:00
|
|
|
let msg =
|
|
|
|
Locale.setGenCheckedAt +
|
|
|
|
' ' +
|
2019-09-15 08:11:11 +02:00
|
|
|
DateFormat.dtStr(UpdateModel.instance.get('lastCheckDate')) +
|
2019-08-18 08:05:38 +02:00
|
|
|
': ';
|
|
|
|
const cmp = SemVer.compareVersions(
|
|
|
|
RuntimeInfo.version,
|
|
|
|
UpdateModel.instance.get('lastVersion')
|
|
|
|
);
|
2016-02-07 12:49:31 +01:00
|
|
|
if (cmp >= 0) {
|
2015-12-17 19:25:25 +01:00
|
|
|
msg += Locale.setGenLatestVer;
|
2015-10-29 22:20:01 +01:00
|
|
|
} else {
|
2019-08-16 23:05:39 +02:00
|
|
|
msg +=
|
|
|
|
Locale.setGenNewVer.replace('{}', UpdateModel.instance.get('lastVersion')) +
|
|
|
|
' ' +
|
2019-09-15 08:11:11 +02:00
|
|
|
DateFormat.dStr(UpdateModel.instance.get('lastVersionReleaseDate'));
|
2015-10-29 22:20:01 +01:00
|
|
|
}
|
2015-11-14 12:09:36 +01:00
|
|
|
switch (UpdateModel.instance.get('updateStatus')) {
|
|
|
|
case 'downloading':
|
2015-12-17 19:25:25 +01:00
|
|
|
return msg + '. ' + Locale.setGenDownloadingUpdate;
|
2015-11-14 12:09:36 +01:00
|
|
|
case 'extracting':
|
2015-12-17 19:25:25 +01:00
|
|
|
return msg + '. ' + Locale.setGenExtractingUpdate;
|
2015-11-14 12:09:36 +01:00
|
|
|
case 'error':
|
2015-12-17 19:25:25 +01:00
|
|
|
return msg + '. ' + Locale.setGenCheckErr;
|
2015-11-14 12:09:36 +01:00
|
|
|
}
|
2015-10-29 22:20:01 +01:00
|
|
|
return msg;
|
2019-08-18 10:17:09 +02:00
|
|
|
}
|
2015-10-29 22:20:01 +01:00
|
|
|
default:
|
2015-12-17 19:25:25 +01:00
|
|
|
return Locale.setGenNeverChecked;
|
2015-10-29 22:20:01 +01:00
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-10-29 22:20:01 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
getStorageProviders() {
|
2017-01-31 07:50:28 +01:00
|
|
|
const storageProviders = [];
|
2016-07-17 13:30:38 +02:00
|
|
|
Object.keys(Storage).forEach(name => {
|
2017-01-31 07:50:28 +01:00
|
|
|
const prv = Storage[name];
|
2016-03-13 18:33:25 +01:00
|
|
|
if (!prv.system) {
|
|
|
|
storageProviders.push(prv);
|
|
|
|
}
|
|
|
|
});
|
2016-07-17 13:30:38 +02:00
|
|
|
storageProviders.sort((x, y) => (x.uipos || Infinity) - (y.uipos || Infinity));
|
|
|
|
return storageProviders.map(sp => ({
|
|
|
|
name: sp.name,
|
|
|
|
enabled: sp.enabled,
|
2019-09-16 20:40:20 +02:00
|
|
|
hasConfig: !!sp.getSettingsConfig
|
2016-07-17 13:30:38 +02:00
|
|
|
}));
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-03-13 18:33:25 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeTheme(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const theme = e.target.value;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.theme = theme;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-10-23 22:12:12 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeLocale(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const locale = e.target.value;
|
2016-08-21 23:12:49 +02:00
|
|
|
if (locale === '...') {
|
2019-09-17 19:50:42 +02:00
|
|
|
e.target.value = AppSettingsModel.locale || 'en';
|
2019-08-18 08:05:38 +02:00
|
|
|
this.appModel.menu.select({
|
|
|
|
item: this.appModel.menu.pluginsSection.get('items').first()
|
|
|
|
});
|
2016-08-21 23:12:49 +02:00
|
|
|
return;
|
|
|
|
}
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.locale = locale;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-08-21 23:12:49 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeFontSize(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const fontSize = +e.target.value;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.fontSize = fontSize;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-05-15 09:57:29 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeTitlebarStyle(e) {
|
2017-03-26 01:57:52 +01:00
|
|
|
const titlebarStyle = e.target.value;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.titlebarStyle = titlebarStyle;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2017-03-25 21:31:12 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeClipboard(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const clipboardSeconds = +e.target.value;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.clipboardSeconds = clipboardSeconds;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-16 21:36:07 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeIdleMinutes(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const idleMinutes = +e.target.value;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.idleMinutes = idleMinutes;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-18 19:33:04 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeAutoUpdate(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const autoUpdate = e.target.value || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.autoUpdate = autoUpdate;
|
2015-10-25 20:26:33 +01:00
|
|
|
if (autoUpdate) {
|
2015-10-29 22:20:01 +01:00
|
|
|
Updater.scheduleNextCheck();
|
2015-10-25 20:26:33 +01:00
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-10-25 20:26:33 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
checkUpdate() {
|
2015-11-14 12:09:36 +01:00
|
|
|
Updater.check(true);
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-14 12:09:36 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeAutoSave(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const autoSave = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.autoSave = autoSave;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-17 21:57:32 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeAutoSaveInterval(e) {
|
2019-01-02 15:19:19 +01:00
|
|
|
const autoSaveInterval = Number(e.target.value) || 0;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.autoSaveInterval = autoSaveInterval;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2019-01-02 15:19:19 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeRememberKeyFiles(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const rememberKeyFiles = e.target.value || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.rememberKeyFiles = rememberKeyFiles;
|
2016-12-11 14:39:59 +01:00
|
|
|
this.appModel.clearStoredKeyFiles();
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-02-14 12:20:21 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeMinimize(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const minimizeOnClose = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.minimizeOnClose = minimizeOnClose;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-21 08:29:49 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeLockOnMinimize(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const lockOnMinimize = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.lockOnMinimize = lockOnMinimize;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-12-02 22:41:53 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeLockOnCopy(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const lockOnCopy = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.lockOnCopy = lockOnCopy;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-02-14 13:05:31 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeLockOnAutoType(e) {
|
2017-04-09 00:53:12 +02:00
|
|
|
const lockOnAutoType = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.lockOnAutoType = lockOnAutoType;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2017-04-09 00:53:12 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeLockOnOsLock(e) {
|
2017-06-02 20:16:09 +02:00
|
|
|
const lockOnOsLock = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.lockOnOsLock = lockOnOsLock;
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2017-06-02 20:16:09 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeTableView(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const tableView = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.tableView = tableView;
|
2019-09-16 22:57:56 +02:00
|
|
|
Events.emit('refresh');
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-21 15:55:42 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeColorfulIcons(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const colorfulIcons = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.colorfulIcons = colorfulIcons;
|
2019-09-16 22:57:56 +02:00
|
|
|
Events.emit('refresh');
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-12-02 22:12:14 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeDirectAutotype(e) {
|
2019-03-03 12:53:47 +01:00
|
|
|
const directAutotype = e.target.checked || false;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.directAutotype = directAutotype;
|
2019-09-16 22:57:56 +02:00
|
|
|
Events.emit('refresh');
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2019-03-03 12:53:47 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
restartApp() {
|
2015-11-14 16:28:36 +01:00
|
|
|
if (Launcher) {
|
|
|
|
Launcher.requestRestart();
|
|
|
|
} else {
|
|
|
|
window.location.reload();
|
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-14 16:28:36 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
downloadUpdate() {
|
2015-11-14 16:28:36 +01:00
|
|
|
Launcher.openLink(Links.Desktop);
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-14 12:09:36 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
installFoundUpdate() {
|
2016-07-17 13:30:38 +02:00
|
|
|
Updater.update(true, () => {
|
2015-11-16 20:04:33 +01:00
|
|
|
Launcher.requestRestart();
|
|
|
|
});
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-16 20:04:33 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeExpandGroups(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const expand = e.target.checked;
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.expandGroups = expand;
|
2019-09-16 22:57:56 +02:00
|
|
|
Events.emit('refresh');
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-11-06 21:42:37 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
changeStorageEnabled(e) {
|
2017-01-31 07:50:28 +01:00
|
|
|
const storage = Storage[$(e.target).data('storage')];
|
2016-03-13 18:33:25 +01:00
|
|
|
if (storage) {
|
2016-06-04 17:08:50 +02:00
|
|
|
storage.setEnabled(e.target.checked);
|
2019-09-17 19:50:42 +02:00
|
|
|
AppSettingsModel.storage.name = storage.enabled;
|
2019-08-18 08:05:38 +02:00
|
|
|
this.$el
|
|
|
|
.find('.settings__general-' + storage.name)
|
|
|
|
.toggleClass('hide', !e.target.checked);
|
2016-03-13 18:33:25 +01:00
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-03-13 18:33:25 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
showAdvancedSettings() {
|
2019-08-18 08:05:38 +02:00
|
|
|
this.$el
|
|
|
|
.find('.settings__general-show-advanced, .settings__general-advanced')
|
|
|
|
.toggleClass('hide');
|
2016-06-04 10:31:06 +02:00
|
|
|
this.scrollToBottom();
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-06-04 10:31:06 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
openDevTools() {
|
2015-10-23 22:12:12 +02:00
|
|
|
if (Launcher) {
|
|
|
|
Launcher.openDevTools();
|
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-04-10 10:26:40 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
tryBeta() {
|
2016-04-10 10:26:40 +02:00
|
|
|
if (this.appModel.files.hasUnsavedFiles()) {
|
|
|
|
Alerts.info({
|
|
|
|
header: Locale.setGenTryBetaWarning,
|
|
|
|
body: Locale.setGenTryBetaWarningBody
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
location.href = Links.BetaWebApp;
|
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-06-04 10:31:06 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
showLogs() {
|
2016-06-04 14:59:03 +02:00
|
|
|
if (this.views.logView) {
|
|
|
|
this.views.logView.remove();
|
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
this.views.logView = new SettingsLogsView();
|
|
|
|
this.views.logView.render();
|
2016-06-04 10:31:06 +02:00
|
|
|
this.scrollToBottom();
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2016-06-04 10:31:06 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
reloadApp() {
|
2019-03-31 13:55:00 +02:00
|
|
|
location.reload();
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2019-03-31 13:55:00 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
scrollToBottom() {
|
2016-06-04 10:31:06 +02:00
|
|
|
this.$el.closest('.scroller').scrollTop(this.$el.height());
|
2015-10-17 23:49:24 +02:00
|
|
|
}
|
2019-09-16 20:40:20 +02:00
|
|
|
}
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-15 14:16:32 +02:00
|
|
|
export { SettingsGeneralView };
|