snappymail/dev/Storage/AbstractData.js

93 lines
3.2 KiB
JavaScript
Raw Normal View History

/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
2014-09-05 06:49:03 +08:00
(function () {
2014-08-25 23:49:01 +08:00
'use strict';
2014-08-20 23:03:12 +08:00
var
2014-09-05 06:49:03 +08:00
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
2014-08-25 15:10:51 +08:00
Settings = require('Storage/Settings')
2014-08-20 23:03:12 +08:00
;
2014-08-25 15:10:51 +08:00
2014-08-20 23:03:12 +08:00
/**
* @constructor
*/
function AbstractDataStorate()
2014-08-20 23:03:12 +08:00
{
Utils.initDataConstructorBySettings(this);
}
AbstractDataStorate.prototype.populateDataOnStart = function()
2014-08-20 23:03:12 +08:00
{
var
2014-08-27 23:59:44 +08:00
mLayout = Utils.pInt(Settings.settingsGet('Layout')),
aLanguages = Settings.settingsGet('Languages'),
aThemes = Settings.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-27 23:59:44 +08:00
this.mainLanguage(Settings.settingsGet('Language'));
this.mainTheme(Settings.settingsGet('Theme'));
2014-08-27 23:59:44 +08:00
this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
this.determineUserLanguage(!!Settings.settingsGet('DetermineUserLanguage'));
this.determineUserDomain(!!Settings.settingsGet('DetermineUserDomain'));
2014-08-27 23:59:44 +08:00
this.capaThemes(Settings.capa(Enums.Capa.Themes));
this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
2014-08-27 23:59:44 +08:00
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.showImages(!!Settings.settingsGet('ShowImages'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(Settings.settingsGet('InterfaceAnimation'));
2014-08-27 23:59:44 +08:00
this.mainMessagesPerPage(Settings.settingsGet('MPP'));
2014-08-27 23:59:44 +08:00
this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
this.useThreads(!!Settings.settingsGet('UseThreads'));
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!Settings.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-27 23:59:44 +08:00
this.facebookSupported(!!Settings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(Settings.settingsGet('FacebookAppID'));
this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
2014-08-27 23:59:44 +08:00
this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
2014-08-27 23:59:44 +08:00
this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
this.googleClientID(Settings.settingsGet('GoogleClientID'));
this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
2014-08-27 23:59:44 +08:00
this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
2014-08-27 23:59:44 +08:00
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
2014-08-20 23:03:12 +08:00
};
module.exports = AbstractDataStorate;
2014-09-05 06:49:03 +08:00
}());