fix #37: auto-lock by timer

This commit is contained in:
Antelle 2015-11-18 21:33:04 +03:00
parent 7b4791371e
commit b2e638bb1a
6 changed files with 28 additions and 3 deletions

View File

@ -3,7 +3,7 @@
## v0.4 ## v0.4
Nov Nov
- [x] desktop dropbox - [x] desktop dropbox
- [ ] lock flow, auto-lock - [x] lock flow, auto-lock
- [ ] minimize to tray - [ ] minimize to tray
- [ ] trim history by rules - [ ] trim history by rules
- [ ] custom icons, favicons - [ ] custom icons, favicons

View File

@ -3,6 +3,8 @@
var ModalView = require('../views/modal-view'); var ModalView = require('../views/modal-view');
var Alerts = { var Alerts = {
alertDisplayed: false,
buttons: { buttons: {
ok: {result: 'yes', title: 'OK'}, ok: {result: 'yes', title: 'OK'},
yes: {result: 'yes', title: 'Yes'}, yes: {result: 'yes', title: 'Yes'},
@ -10,9 +12,11 @@ var Alerts = {
}, },
alert: function(config) { alert: function(config) {
Alerts.alertDisplayed = true;
var view = new ModalView({ model: config }); var view = new ModalView({ model: config });
view.render(); view.render();
view.on('result', function(res, check) { view.on('result', function(res, check) {
Alerts.alertDisplayed = false;
if (res && config.success) { if (res && config.success) {
config.success(res, check); config.success(res, check);
} }

View File

@ -259,7 +259,9 @@ var AppView = Backbone.View.extend({
lockWorkspace: function(autoInit) { lockWorkspace: function(autoInit) {
var that = this; var that = this;
// TODO: check if visual lock or any alert is displayed and stop, if any if (Alerts.alertDisplayed) { // TODO: check visual lock as well
return;
}
if (this.model.files.hasUnsavedFiles()) { if (this.model.files.hasUnsavedFiles()) {
if (this.model.settings.get('autoSave')) { if (this.model.settings.get('autoSave')) {
this.saveAndLock(autoInit); this.saveAndLock(autoInit);
@ -300,6 +302,7 @@ var AppView = Backbone.View.extend({
}, },
saveAndLock: function(autoInit) { saveAndLock: function(autoInit) {
// TODO: move to file manager
var pendingCallbacks = 0, var pendingCallbacks = 0,
errorFiles = [], errorFiles = [],
that = this; that = this;

View File

@ -16,6 +16,7 @@ var SettingsGeneralView = Backbone.View.extend({
'change .settings__general-theme': 'changeTheme', 'change .settings__general-theme': 'changeTheme',
'change .settings__general-expand': 'changeExpandGroups', 'change .settings__general-expand': 'changeExpandGroups',
'change .settings__general-auto-update': 'changeAutoUpdate', 'change .settings__general-auto-update': 'changeAutoUpdate',
'change .settings__general-idle-minutes': 'changeIdleMinutes',
'change .settings__general-clipboard': 'changeClipboard', 'change .settings__general-clipboard': 'changeClipboard',
'change .settings__general-auto-save': 'changeAutoSave', 'change .settings__general-auto-save': 'changeAutoSave',
'click .settings__general-update-btn': 'checkUpdate', 'click .settings__general-update-btn': 'checkUpdate',
@ -44,6 +45,7 @@ var SettingsGeneralView = Backbone.View.extend({
canClearClipboard: !!Launcher, canClearClipboard: !!Launcher,
clipboardSeconds: AppSettingsModel.instance.get('clipboardSeconds'), clipboardSeconds: AppSettingsModel.instance.get('clipboardSeconds'),
autoSave: AppSettingsModel.instance.get('autoSave'), autoSave: AppSettingsModel.instance.get('autoSave'),
idleMinutes: AppSettingsModel.instance.get('idleMinutes'),
devTools: Launcher && Launcher.devTools, devTools: Launcher && Launcher.devTools,
canAutoUpdate: !!Launcher, canAutoUpdate: !!Launcher,
autoUpdate: Updater.getAutoUpdateType(), autoUpdate: Updater.getAutoUpdateType(),
@ -102,6 +104,11 @@ var SettingsGeneralView = Backbone.View.extend({
AppSettingsModel.instance.set('clipboardSeconds', clipboardSeconds); AppSettingsModel.instance.set('clipboardSeconds', clipboardSeconds);
}, },
changeIdleMinutes: function(e) {
var idleMinutes = +e.target.value;
AppSettingsModel.instance.set('idleMinutes', idleMinutes);
},
changeAutoUpdate: function(e) { changeAutoUpdate: function(e) {
var autoUpdate = e.target.value || false; var autoUpdate = e.target.value || false;
AppSettingsModel.instance.set('autoUpdate', autoUpdate); AppSettingsModel.instance.set('autoUpdate', autoUpdate);

View File

@ -69,6 +69,16 @@
<%- autoSave ? 'checked' : '' %> /> <%- autoSave ? 'checked' : '' %> />
<label for="settings__general-auto-save">Auto-save on lock</label> <label for="settings__general-auto-save">Auto-save on lock</label>
</div> </div>
<div>
<label for="settings__general-idle-minutes">Auto-lock if the app is inactive:</label>
<select class="settings__general-idle-minutes settings__select input-base" id="settings__general-idle-minutes">
<option value="0" <%= idleMinutes <= 0 ? 'selected' : '' %>>Don't auto-lock</option>
<option value="5" <%= idleMinutes === 5 ? 'selected' : '' %>>In 5 minutes</option>
<option value="10" <%= idleMinutes === 10 ? 'selected' : '' %>>In 10 minutes</option>
<option value="15" <%= idleMinutes === 15 ? 'selected' : '' %>>In 15 minutes</option>
<option value="60" <%= idleMinutes === 60 ? 'selected' : '' %>>In an hour</option>
</select>
</div>
<% if (devTools) { %> <% if (devTools) { %>
<h2>Advanced</h2> <h2>Advanced</h2>

View File

@ -1,7 +1,8 @@
Release notes Release notes
------------- -------------
##### vNext ##### vNext
Bugfixes Locking, better Dropbox, security enhancements, bugfixes
`+` lock flow, auto-lock
`-` fixed tag list scrolling `-` fixed tag list scrolling
`+` desktop Dropbox `+` desktop Dropbox
`+` Dropbox notification in self-hosted apps `+` Dropbox notification in self-hosted apps