mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Code refactoring
Fixed owncloud password encoder/decoder (#291) Fixed ckeditor in ownCloud iframe (Closes #302) Release commit
This commit is contained in:
parent
7a374ebe03
commit
06274c6a7c
112 changed files with 2667 additions and 1862 deletions
212
dev/Screen/AbstractSettings.js
Normal file
212
dev/Screen/AbstractSettings.js
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
LinkBuilder = require('Common/LinkBuilder'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array} aViewModels
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AbstractSettingsScreen(aViewModels)
|
||||
{
|
||||
AbstractScreen.call(this, 'settings', aViewModels);
|
||||
|
||||
this.menu = ko.observableArray([]);
|
||||
|
||||
this.oCurrentSubScreen = null;
|
||||
this.oViewModelPlace = null;
|
||||
|
||||
this.setupSettings();
|
||||
}
|
||||
|
||||
_.extend(AbstractSettingsScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
AbstractSettingsScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onRoute = function (sSubName)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oSettingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
oViewModelPlace = null,
|
||||
oViewModelDom = null
|
||||
;
|
||||
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
|
||||
{
|
||||
oSettingsScreen = RoutedSettingsViewModel.__vm;
|
||||
}
|
||||
else
|
||||
{
|
||||
oViewModelPlace = this.oViewModelPlace;
|
||||
if (oViewModelPlace && 1 === oViewModelPlace.length)
|
||||
{
|
||||
oSettingsScreen = new RoutedSettingsViewModel();
|
||||
|
||||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
oViewModelDom.appendTo(oViewModelPlace);
|
||||
|
||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||
|
||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||
|
||||
RoutedSettingsViewModel.__dom = oViewModelDom;
|
||||
RoutedSettingsViewModel.__builded = true;
|
||||
RoutedSettingsViewModel.__vm = oSettingsScreen;
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'i18nInit': true,
|
||||
'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
|
||||
}, oSettingsScreen);
|
||||
|
||||
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||
}
|
||||
}
|
||||
|
||||
if (oSettingsScreen)
|
||||
{
|
||||
_.defer(function () {
|
||||
// hide
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
|
||||
self.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
// --
|
||||
|
||||
self.oCurrentSubScreen = oSettingsScreen;
|
||||
|
||||
// show
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
self.oCurrentSubScreen.viewModelDom.show();
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onFocus', [], 200);
|
||||
|
||||
_.each(self.menu(), function (oItem) {
|
||||
oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
|
||||
});
|
||||
|
||||
$('#rl-content .b-settings .b-content .content').scrollTop(0);
|
||||
}
|
||||
// --
|
||||
|
||||
Utils.windowResize();
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.setHash(LinkBuilder.settings(), false, true);
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onHide = function ()
|
||||
{
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
{
|
||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onBuild = function ()
|
||||
{
|
||||
_.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
{
|
||||
this.menu.push({
|
||||
'route': SettingsViewModel.__rlSettingsData.Route,
|
||||
'label': SettingsViewModel.__rlSettingsData.Label,
|
||||
'selected': ko.observable(false),
|
||||
'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
|
||||
oRules = {
|
||||
'subname': /^(.*)$/,
|
||||
'normalize_': function (oRequest, oVals) {
|
||||
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
|
||||
return [oVals.subname];
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
return [
|
||||
['{subname}/', oRules],
|
||||
['{subname}', oRules],
|
||||
['', oRules]
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = AbstractSettingsScreen;
|
||||
|
||||
}());
|
||||
32
dev/Screen/Admin/Login.js
Normal file
32
dev/Screen/Admin/Login.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginAdminScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/Admin/Login')
|
||||
]);
|
||||
}
|
||||
|
||||
_.extend(LoginAdminScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
LoginAdminScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/Admin').setTitle('');
|
||||
};
|
||||
|
||||
module.exports = LoginAdminScreen;
|
||||
|
||||
}());
|
||||
79
dev/Screen/Admin/Settings.js
Normal file
79
dev/Screen/Admin/Settings.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
AbstractSettings = require('Screen/AbstractSettings')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function SettingsAdminScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
require('View/Admin/Settings/Menu'),
|
||||
require('View/Admin/Settings/Pane')
|
||||
]);
|
||||
}
|
||||
|
||||
_.extend(SettingsAdminScreen.prototype, AbstractSettings.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsAdminScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/General'),
|
||||
'AdminSettingsGeneral', 'General', 'general', true);
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Login'),
|
||||
'AdminSettingsLogin', 'Login', 'login');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Branding'),
|
||||
'AdminSettingsBranding', 'Branding', 'branding');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Contacts'),
|
||||
'AdminSettingsContacts', 'Contacts', 'contacts');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Domains'),
|
||||
'AdminSettingsDomains', 'Domains', 'domains');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Security'),
|
||||
'AdminSettingsSecurity', 'Security', 'security');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Social'),
|
||||
'AdminSettingsSocial', 'Social', 'social');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Plugins'),
|
||||
'AdminSettingsPlugins', 'Plugins', 'plugins');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Packages'),
|
||||
'AdminSettingsPackages', 'Packages', 'packages');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/Licensing'),
|
||||
'AdminSettingsLicensing', 'Licensing', 'licensing');
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/Admin/About'),
|
||||
'AdminSettingsAbout', 'About', 'about');
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
SettingsAdminScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/Admin').setTitle('');
|
||||
};
|
||||
|
||||
module.exports = SettingsAdminScreen;
|
||||
|
||||
}());
|
||||
32
dev/Screen/App/About.js
Normal file
32
dev/Screen/App/About.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AboutAppScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'about', [
|
||||
require('View/App/About')
|
||||
]);
|
||||
}
|
||||
|
||||
_.extend(AboutAppScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
AboutAppScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/App').setTitle('RainLoop');
|
||||
};
|
||||
|
||||
module.exports = AboutAppScreen;
|
||||
|
||||
}());
|
||||
32
dev/Screen/App/Login.js
Normal file
32
dev/Screen/App/Login.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginAppScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/App/Login')
|
||||
]);
|
||||
}
|
||||
|
||||
_.extend(LoginAppScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
LoginAppScreen.prototype.onShow = function ()
|
||||
{
|
||||
require('App/App').setTitle('');
|
||||
};
|
||||
|
||||
module.exports = LoginAppScreen;
|
||||
|
||||
}());
|
||||
196
dev/Screen/App/MailBox.js
Normal file
196
dev/Screen/App/MailBox.js
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Events = require('Common/Events'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Data = require('Storage/App/Data'),
|
||||
Cache = require('Storage/App/Cache'),
|
||||
Remote = require('Storage/App/Remote'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function MailBoxAppScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'mailbox', [
|
||||
require('View/App/MailBox/SystemDropDown'),
|
||||
require('View/App/MailBox/FolderList'),
|
||||
require('View/App/MailBox/MessageList'),
|
||||
require('View/App/MailBox/MessageView')
|
||||
]);
|
||||
|
||||
this.oLastRoute = {};
|
||||
}
|
||||
|
||||
_.extend(MailBoxAppScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
MailBoxAppScreen.prototype.oLastRoute = {};
|
||||
|
||||
MailBoxAppScreen.prototype.setNewTitle = function ()
|
||||
{
|
||||
var
|
||||
sEmail = Data.accountEmail(),
|
||||
nFoldersInboxUnreadCount = Data.foldersInboxUnreadCount()
|
||||
;
|
||||
|
||||
require('App/App').setTitle(('' === sEmail ? '' :
|
||||
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
|
||||
MailBoxAppScreen.prototype.onShow = function ()
|
||||
{
|
||||
this.setNewTitle();
|
||||
Globals.keyScope(Enums.KeyState.MessageList);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolderHash
|
||||
* @param {number} iPage
|
||||
* @param {string} sSearch
|
||||
* @param {boolean=} bPreview = false
|
||||
*/
|
||||
MailBoxAppScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
|
||||
{
|
||||
if (Utils.isUnd(bPreview) ? false : !!bPreview)
|
||||
{
|
||||
if (Enums.Layout.NoPreview === Data.layout() && !Data.message())
|
||||
{
|
||||
require('App/App').historyBack();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var
|
||||
sFolderFullNameRaw = Cache.getFolderFullNameRaw(sFolderHash),
|
||||
oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw)
|
||||
;
|
||||
|
||||
if (oFolder)
|
||||
{
|
||||
Data
|
||||
.currentFolder(oFolder)
|
||||
.messageListPage(iPage)
|
||||
.messageListSearch(sSearch)
|
||||
;
|
||||
|
||||
if (Enums.Layout.NoPreview === Data.layout() && Data.message())
|
||||
{
|
||||
Data.message(null);
|
||||
}
|
||||
|
||||
require('App/App').reloadMessageList();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MailBoxAppScreen.prototype.onStart = function ()
|
||||
{
|
||||
var
|
||||
fResizeFunction = function () {
|
||||
Utils.windowResize();
|
||||
}
|
||||
;
|
||||
|
||||
if (Settings.capa(Enums.Capa.AdditionalAccounts) || Settings.capa(Enums.Capa.AdditionalIdentities))
|
||||
{
|
||||
require('App/App').accountsAndIdentities();
|
||||
}
|
||||
|
||||
_.delay(function () {
|
||||
if ('INBOX' !== Data.currentFolderFullNameRaw())
|
||||
{
|
||||
require('App/App').folderInformation('INBOX');
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
_.delay(function () {
|
||||
require('App/App').quota();
|
||||
}, 5000);
|
||||
|
||||
_.delay(function () {
|
||||
Remote.appDelayStart(Utils.emptyFunction);
|
||||
}, 35000);
|
||||
|
||||
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === Data.layout());
|
||||
|
||||
Data.folderList.subscribe(fResizeFunction);
|
||||
Data.messageList.subscribe(fResizeFunction);
|
||||
Data.message.subscribe(fResizeFunction);
|
||||
|
||||
Data.layout.subscribe(function (nValue) {
|
||||
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
|
||||
});
|
||||
|
||||
Events.sub('mailbox.inbox-unread-count', function (nCount) {
|
||||
Data.foldersInboxUnreadCount(nCount);
|
||||
});
|
||||
|
||||
Data.foldersInboxUnreadCount.subscribe(function () {
|
||||
this.setNewTitle();
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
*/
|
||||
MailBoxAppScreen.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
fNormP = function () {
|
||||
return ['Inbox', 1, '', true];
|
||||
},
|
||||
fNormS = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pInt(oVals[1]);
|
||||
oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
|
||||
oVals[2] = Utils.pString(oVals[2]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = 'Inbox';
|
||||
oVals[1] = 1;
|
||||
}
|
||||
|
||||
return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2]), false];
|
||||
},
|
||||
fNormD = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pString(oVals[1]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = 'Inbox';
|
||||
}
|
||||
|
||||
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1]), false];
|
||||
}
|
||||
;
|
||||
|
||||
return [
|
||||
[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^message-preview$/, {'normalize_': fNormP}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = MailBoxAppScreen;
|
||||
|
||||
}());
|
||||
132
dev/Screen/App/Settings.js
Normal file
132
dev/Screen/App/Settings.js
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Globals = require('Common/Globals'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
AbstractSettingsScreen = require('Screen/AbstractSettings')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettingsScreen
|
||||
*/
|
||||
function SettingsAppScreen()
|
||||
{
|
||||
AbstractSettingsScreen.call(this, [
|
||||
require('View/App/Settings/SystemDropDown'),
|
||||
require('View/App/Settings/Menu'),
|
||||
require('View/App/Settings/Pane')
|
||||
]);
|
||||
|
||||
Utils.initOnStartOrLangChange(function () {
|
||||
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
|
||||
}, this, function () {
|
||||
this.setSettingsTitle();
|
||||
});
|
||||
}
|
||||
|
||||
_.extend(SettingsAppScreen.prototype, AbstractSettingsScreen.prototype);
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsAppScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/General'),
|
||||
'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
if (Settings.settingsGet('ContactsIsAllowed'))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Contacts'),
|
||||
'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.AdditionalAccounts))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Accounts'),
|
||||
'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.AdditionalIdentities))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Identities'),
|
||||
'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Identity'),
|
||||
'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.Filters))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Filters'),
|
||||
'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.TwoFactor))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Security'),
|
||||
'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('AllowGoogleSocial') ||
|
||||
Settings.settingsGet('AllowFacebookSocial') ||
|
||||
Settings.settingsGet('AllowTwitterSocial'))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Social'),
|
||||
'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('ChangePasswordIsAllowed'))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/ChangePassword'),
|
||||
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(require('Settings/App/Folders'),
|
||||
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
|
||||
if (Settings.capa(Enums.Capa.Themes))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/Themes'),
|
||||
'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
}
|
||||
|
||||
if (Settings.capa(Enums.Capa.OpenPGP))
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/App/OpenPGP'),
|
||||
'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||
}
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
|
||||
SettingsAppScreen.prototype.onShow = function ()
|
||||
{
|
||||
this.setSettingsTitle();
|
||||
Globals.keyScope(Enums.KeyState.Settings);
|
||||
};
|
||||
|
||||
SettingsAppScreen.prototype.setSettingsTitle = function ()
|
||||
{
|
||||
require('App/App').setTitle(this.sSettingsTitle);
|
||||
};
|
||||
|
||||
module.exports = SettingsAppScreen;
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue