2013-11-16 06:21:12 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function AbstractData()
|
|
|
|
{
|
2014-04-27 08:54:22 +08:00
|
|
|
this.leftPanelDisabled = ko.observable(false);
|
2014-04-13 08:32:07 +08:00
|
|
|
this.useKeyboardShortcuts = ko.observable(true);
|
|
|
|
|
2014-04-12 09:05:57 +08:00
|
|
|
this.keyScopeReal = ko.observable(Enums.KeyState.All);
|
|
|
|
this.keyScopeFake = ko.observable(Enums.KeyState.All);
|
|
|
|
|
|
|
|
this.keyScope = ko.computed({
|
|
|
|
'owner': this,
|
|
|
|
'read': function () {
|
|
|
|
return this.keyScopeFake();
|
|
|
|
},
|
|
|
|
'write': function (sValue) {
|
2014-04-08 06:36:38 +08:00
|
|
|
|
2014-04-12 09:05:57 +08:00
|
|
|
if (Enums.KeyState.Menu !== sValue)
|
|
|
|
{
|
|
|
|
if (Enums.KeyState.Compose === sValue)
|
|
|
|
{
|
|
|
|
Utils.disableKeyFilter();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Utils.restoreKeyFilter();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.keyScopeFake(sValue);
|
|
|
|
if (Globals.dropdownVisibility())
|
|
|
|
{
|
|
|
|
sValue = Enums.KeyState.Menu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.keyScopeReal(sValue);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.keyScopeReal.subscribe(function (sValue) {
|
2014-04-13 08:32:07 +08:00
|
|
|
// window.console.log(sValue);
|
2014-04-12 09:05:57 +08:00
|
|
|
key.setScope(sValue);
|
|
|
|
});
|
|
|
|
|
2014-04-27 08:54:22 +08:00
|
|
|
this.leftPanelDisabled.subscribe(function (bValue) {
|
|
|
|
RL.pub('left-panel.' + (bValue ? 'off' : 'on'));
|
|
|
|
});
|
|
|
|
|
2014-04-12 09:05:57 +08:00
|
|
|
Globals.dropdownVisibility.subscribe(function (bValue) {
|
|
|
|
if (bValue)
|
2014-04-08 06:36:38 +08:00
|
|
|
{
|
2014-04-12 09:05:57 +08:00
|
|
|
this.keyScope(Enums.KeyState.Menu);
|
2014-04-08 06:36:38 +08:00
|
|
|
}
|
2014-04-12 09:05:57 +08:00
|
|
|
else if (Enums.KeyState.Menu === key.getScope())
|
2014-04-08 06:36:38 +08:00
|
|
|
{
|
2014-04-12 09:05:57 +08:00
|
|
|
this.keyScope(this.keyScopeFake());
|
2014-04-08 06:36:38 +08:00
|
|
|
}
|
2014-04-12 09:05:57 +08:00
|
|
|
}, this);
|
2014-04-08 06:36:38 +08:00
|
|
|
|
2013-11-16 06:21:12 +08:00
|
|
|
Utils.initDataConstructorBySettings(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
AbstractData.prototype.populateDataOnStart = function()
|
|
|
|
{
|
|
|
|
var
|
2014-02-04 04:06:35 +08:00
|
|
|
mLayout = Utils.pInt(RL.settingsGet('Layout')),
|
2013-11-16 06:21:12 +08:00
|
|
|
aLanguages = RL.settingsGet('Languages'),
|
|
|
|
aThemes = RL.settingsGet('Themes')
|
|
|
|
;
|
|
|
|
|
|
|
|
if (Utils.isArray(aLanguages))
|
|
|
|
{
|
|
|
|
this.languages(aLanguages);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Utils.isArray(aThemes))
|
|
|
|
{
|
|
|
|
this.themes(aThemes);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.mainLanguage(RL.settingsGet('Language'));
|
|
|
|
this.mainTheme(RL.settingsGet('Theme'));
|
|
|
|
|
|
|
|
this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts'));
|
|
|
|
this.allowIdentities(!!RL.settingsGet('AllowIdentities'));
|
2014-05-05 04:36:48 +08:00
|
|
|
this.allowGravatar(!!RL.settingsGet('AllowGravatar'));
|
2013-11-16 06:21:12 +08:00
|
|
|
this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage'));
|
|
|
|
|
|
|
|
this.allowThemes(!!RL.settingsGet('AllowThemes'));
|
|
|
|
this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin'));
|
|
|
|
this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin'));
|
|
|
|
this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings'));
|
|
|
|
|
|
|
|
this.editorDefaultType(RL.settingsGet('EditorDefaultType'));
|
|
|
|
this.showImages(!!RL.settingsGet('ShowImages'));
|
2013-12-19 08:53:42 +08:00
|
|
|
this.contactsAutosave(!!RL.settingsGet('ContactsAutosave'));
|
2013-11-16 06:21:12 +08:00
|
|
|
this.interfaceAnimation(RL.settingsGet('InterfaceAnimation'));
|
|
|
|
|
|
|
|
this.mainMessagesPerPage(RL.settingsGet('MPP'));
|
|
|
|
|
|
|
|
this.desktopNotifications(!!RL.settingsGet('DesktopNotifications'));
|
|
|
|
this.useThreads(!!RL.settingsGet('UseThreads'));
|
|
|
|
this.replySameFolder(!!RL.settingsGet('ReplySameFolder'));
|
|
|
|
this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList'));
|
2014-02-04 04:06:35 +08:00
|
|
|
|
|
|
|
this.layout(Enums.Layout.SidePreview);
|
|
|
|
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
|
|
|
|
{
|
|
|
|
this.layout(mLayout);
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
|
|
|
this.facebookEnable(!!RL.settingsGet('AllowFacebookSocial'));
|
|
|
|
this.facebookAppID(RL.settingsGet('FacebookAppID'));
|
|
|
|
this.facebookAppSecret(RL.settingsGet('FacebookAppSecret'));
|
|
|
|
|
|
|
|
this.twitterEnable(!!RL.settingsGet('AllowTwitterSocial'));
|
|
|
|
this.twitterConsumerKey(RL.settingsGet('TwitterConsumerKey'));
|
|
|
|
this.twitterConsumerSecret(RL.settingsGet('TwitterConsumerSecret'));
|
|
|
|
|
|
|
|
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
|
|
|
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
|
|
|
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
|
|
|
|
|
|
|
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
|
|
|
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
|
|
|
|
|
|
|
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
|
|
|
|
};
|