snappymail/dev/Storages/AbstractData.js

93 lines
3.3 KiB
JavaScript
Raw Normal View History

/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
2014-08-20 23:03:12 +08:00
(function (module) {
'use strict';
var
2014-08-21 23:08:34 +08:00
Enums = require('../Common/Enums.js'),
2014-08-22 23:08:56 +08:00
Utils = require('../Common/Utils.js'),
AppSettings = require('./AppSettings.js')
2014-08-20 23:03:12 +08:00
;
/**
* @constructor
*/
function AbstractData()
{
Utils.initDataConstructorBySettings(this);
}
AbstractData.prototype.populateDataOnStart = function()
{
var
2014-08-22 23:08:56 +08:00
mLayout = Utils.pInt(AppSettings.settingsGet('Layout')),
aLanguages = AppSettings.settingsGet('Languages'),
aThemes = AppSettings.settingsGet('Themes')
2014-08-20 23:03:12 +08:00
;
if (Utils.isArray(aLanguages))
{
2014-08-20 23:03:12 +08:00
this.languages(aLanguages);
}
2014-08-20 23:03:12 +08:00
if (Utils.isArray(aThemes))
{
2014-08-20 23:03:12 +08:00
this.themes(aThemes);
}
2014-08-22 23:08:56 +08:00
this.mainLanguage(AppSettings.settingsGet('Language'));
this.mainTheme(AppSettings.settingsGet('Theme'));
2014-08-22 23:08:56 +08:00
this.capaAdditionalAccounts(AppSettings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(AppSettings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(AppSettings.capa(Enums.Capa.Gravatar));
this.determineUserLanguage(!!AppSettings.settingsGet('DetermineUserLanguage'));
this.determineUserDomain(!!AppSettings.settingsGet('DetermineUserDomain'));
2014-08-22 23:08:56 +08:00
this.capaThemes(AppSettings.capa(Enums.Capa.Themes));
this.allowLanguagesOnLogin(!!AppSettings.settingsGet('AllowLanguagesOnLogin'));
this.allowLanguagesOnSettings(!!AppSettings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!AppSettings.settingsGet('UseLocalProxyForExternalImages'));
2014-08-22 23:08:56 +08:00
this.editorDefaultType(AppSettings.settingsGet('EditorDefaultType'));
this.showImages(!!AppSettings.settingsGet('ShowImages'));
this.contactsAutosave(!!AppSettings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(AppSettings.settingsGet('InterfaceAnimation'));
2014-08-22 23:08:56 +08:00
this.mainMessagesPerPage(AppSettings.settingsGet('MPP'));
2014-08-22 23:08:56 +08:00
this.desktopNotifications(!!AppSettings.settingsGet('DesktopNotifications'));
this.useThreads(!!AppSettings.settingsGet('UseThreads'));
this.replySameFolder(!!AppSettings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!AppSettings.settingsGet('UseCheckboxesInList'));
2014-08-20 23:03:12 +08:00
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
this.layout(mLayout);
}
2014-08-22 23:08:56 +08:00
this.facebookSupported(!!AppSettings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!AppSettings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(AppSettings.settingsGet('FacebookAppID'));
this.facebookAppSecret(AppSettings.settingsGet('FacebookAppSecret'));
2014-08-22 23:08:56 +08:00
this.twitterEnable(!!AppSettings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(AppSettings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(AppSettings.settingsGet('TwitterConsumerSecret'));
2014-08-22 23:08:56 +08:00
this.googleEnable(!!AppSettings.settingsGet('AllowGoogleSocial'));
this.googleClientID(AppSettings.settingsGet('GoogleClientID'));
this.googleClientSecret(AppSettings.settingsGet('GoogleClientSecret'));
this.googleApiKey(AppSettings.settingsGet('GoogleApiKey'));
2014-08-22 23:08:56 +08:00
this.dropboxEnable(!!AppSettings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(AppSettings.settingsGet('DropboxApiKey'));
2014-08-22 23:08:56 +08:00
this.contactsIsAllowed(!!AppSettings.settingsGet('ContactsIsAllowed'));
2014-08-20 23:03:12 +08:00
};
2014-08-20 23:03:12 +08:00
module.exports = AbstractData;
2014-08-20 23:03:12 +08:00
}(module));