mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Added auto logout option
This commit is contained in:
parent
76f319a07f
commit
bb551e4ec8
18 changed files with 171 additions and 33 deletions
|
|
@ -4,6 +4,7 @@
|
|||
'use strict';
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
ko = require('ko'),
|
||||
|
||||
Consts = require('Common/Consts'),
|
||||
|
|
@ -20,6 +21,8 @@
|
|||
*/
|
||||
function SettingsUserStore()
|
||||
{
|
||||
this.iAutoLogoutTimer = 0;
|
||||
|
||||
this.layout = ko.observable(Enums.Layout.SidePreview)
|
||||
.extend({'limitedList': [
|
||||
Enums.Layout.SidePreview, Enums.Layout.BottomPreview, Enums.Layout.NoPreview
|
||||
|
|
@ -39,24 +42,27 @@
|
|||
this.useThreads = ko.observable(false);
|
||||
this.replySameFolder = ko.observable(false);
|
||||
|
||||
this.computedProperies();
|
||||
this.subscribes();
|
||||
this.autoLogout = ko.observable(30);
|
||||
|
||||
this.computers();
|
||||
this.subscribers();
|
||||
}
|
||||
|
||||
SettingsUserStore.prototype.computedProperies = function ()
|
||||
SettingsUserStore.prototype.computers = function ()
|
||||
{
|
||||
this.usePreviewPane = ko.computed(function () {
|
||||
return Enums.Layout.NoPreview !== this.layout();
|
||||
}, this);
|
||||
};
|
||||
|
||||
SettingsUserStore.prototype.subscribes = function ()
|
||||
SettingsUserStore.prototype.subscribers = function ()
|
||||
{
|
||||
this.layout.subscribe(function (nValue) {
|
||||
|
||||
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
|
||||
Globals.$html.toggleClass('rl-side-preview-pane', Enums.Layout.SidePreview === nValue);
|
||||
Globals.$html.toggleClass('rl-bottom-preview-pane', Enums.Layout.BottomPreview === nValue);
|
||||
Globals.$html.toggleClass('rl-mobile-layout', Enums.Layout.Mobile === nValue);
|
||||
|
||||
Events.pub('layout', [nValue]);
|
||||
});
|
||||
|
|
@ -67,12 +73,27 @@
|
|||
this.layout(Utils.pInt(Settings.settingsGet('Layout')));
|
||||
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
|
||||
|
||||
this.autoLogout(Utils.pInt(Settings.settingsGet('AutoLogout')));
|
||||
this.messagesPerPage(Settings.settingsGet('MPP'));
|
||||
|
||||
this.showImages(!!Settings.settingsGet('ShowImages'));
|
||||
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
|
||||
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||
|
||||
var self = this;
|
||||
|
||||
Events.sub('rl.auto-logout-refresh', function () {
|
||||
window.clearTimeout(self.iAutoLogoutTimer);
|
||||
if (0 < self.autoLogout())
|
||||
{
|
||||
self.iAutoLogoutTimer = window.setTimeout(function () {
|
||||
Events.pub('rl.auto-logout');
|
||||
}, self.autoLogout() * 1000 * 60);
|
||||
}
|
||||
});
|
||||
|
||||
Events.pub('rl.auto-logout-refresh');
|
||||
};
|
||||
|
||||
module.exports = new SettingsUserStore();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue