Small refactoring (popup key scope optimization)

This commit is contained in:
RainLoop Team 2014-04-08 02:36:38 +04:00
parent 77cdc4690b
commit a96e1d80c3
22 changed files with 226 additions and 254 deletions

View file

@ -31,6 +31,7 @@ Enums.StateType = {
* @enum {string}
*/
Enums.KeyState = {
'All': 'all',
'None': 'none',
'ContactList': 'contact-list',
'MessageList': 'message-list',

View file

@ -11,6 +11,9 @@ function KnoinAbstractViewModel(sPosition, sTemplate)
this.sPosition = Utils.pString(sPosition);
this.sTemplate = Utils.pString(sTemplate);
this.sDefaultKeyScope = Enums.KeyState.None;
this.sCurrentKeyScope = this.sDefaultKeyScope;
this.viewModelName = '';
this.viewModelVisibility = ko.observable(false);
if ('Popups' === this.sPosition)
@ -61,13 +64,27 @@ KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototyp
{
};
KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
{
this.sCurrentKeyScope = RL.data().keyScope();
RL.data().keyScope(this.sDefaultKeyScope);
};
KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
{
RL.data().keyScope(this.sCurrentKeyScope);
};
KnoinAbstractViewModel.prototype.registerPopupEscapeKey = function ()
{
key('esc', _.bind(function () {
if (this.modalVisibility && this.modalVisibility())
var self = this;
$window.on('keydown', function (oEvent) {
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility && self.modalVisibility())
{
Utils.delegateRun(this, 'cancelCommand');
Utils.delegateRun(self, 'cancelCommand');
return false;
}
}, this));
return true;
});
};

View file

@ -143,6 +143,7 @@ Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
{
ViewModelClassToHide.__vm.modalVisibility(false);
Utils.delegateRun(ViewModelClassToHide.__vm, 'onHide');
ViewModelClassToHide.__vm.restoreKeyScope();
RL.popupVisibilityNames.remove(ViewModelClassToHide.__name);
@ -168,8 +169,10 @@ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
{
ViewModelClassToShow.__dom.show();
ViewModelClassToShow.__vm.modalVisibility(true);
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
ViewModelClassToShow.__vm.storeAndSetKeyScope();
RL.popupVisibilityNames.push(ViewModelClassToShow.__name);
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);

View file

@ -37,13 +37,12 @@ MailBoxScreen.prototype.setNewTitle = function ()
MailBoxScreen.prototype.onShow = function ()
{
this.setNewTitle();
RL.data().keyScope(Enums.KeyState.MessageList);
};
MailBoxScreen.prototype.onHide = function ()
{
RL.data().keyScope(Enums.KeyState.None);
RL.data().keyScope(Enums.KeyState.All);
};
/**

View file

@ -5,6 +5,22 @@
*/
function AbstractData()
{
this.keyScope = ko.observable(Enums.KeyState.All);
this.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.Compose === sValue)
{
Utils.disableKeyFilter();
}
else
{
Utils.restoreKeyFilter();
}
// window.console.log(sValue);
key.setScope(sValue);
});
Utils.initDataConstructorBySettings(this);
}

View file

@ -42,22 +42,6 @@ function WebMailDataStorage()
this.lastFoldersHash = '';
this.remoteSuggestions = false;
this.keyScope = ko.observable(Enums.KeyState.None);
this.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.Compose === sValue)
{
Utils.disableKeyFilter();
}
else
{
Utils.restoreKeyFilter();
}
// window.console.log(sValue);
key.setScope(sValue);
});
// system folders
this.sentFolder = ko.observable('');
this.draftFolder = ko.observable('');

View file

@ -478,8 +478,13 @@ html.rl-no-preview-pane {
}
}
&.message-focused .b-content {
.opacity(97);
&.message-focused {
.b-message-list-wrapper {
background-color: #000;
}
.b-content {
.opacity(98);
}
}
&.hideMessageListCheckbox {

View file

@ -351,15 +351,11 @@ html.rl-no-preview-pane {
}
}
&.message-focused .messageItemHeader {
background-color: #fafafa !important;
}
&.message-focused .b-content {
z-index: 102;
.box-shadow(0px 2px 8px rgba(0, 0, 0, 0.3));
border-color: darken(@rlMainDarkColor, 5%);
.box-shadow(0px 2px 10px rgba(0, 0, 0, 0.3));
.border-radius(@rlLowBorderRadius);
border-color: darken(@rlMainDarkColor, 5%);
}
}

View file

@ -588,20 +588,6 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
})
;
ko.computed(function () {
var
oData = RL.data(),
bViewModelVisibility = this.viewModelVisibility(),
bPopupVisibility = RL.popupVisibility(),
bUseKeyboardShortcuts = oData.useKeyboardShortcuts(),
bMessageFullScreenMode = oData.messageFullScreenMode()
;
this.selector.useKeyboard(bViewModelVisibility && bUseKeyboardShortcuts && !bMessageFullScreenMode && !bPopupVisibility);
}, this).extend({'notify': 'always'});
this.initUploaderForAppend();
this.initShortcuts();

View file

@ -496,8 +496,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
self.deleteCommand();
if (handler && 'shift+delete' === handler.shortcut)
{
// self.deleteWithoutMoveCommand();
self.deleteCommand();
self.deleteWithoutMoveCommand();
}
else
{
@ -511,7 +510,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
key('tab', Enums.KeyState.MessageView, function () {
if (oData.useKeyboardShortcuts())
{
if (self.message())
if (!self.fullScreenMode() && self.message())
{
self.message.focused(false);
}

View file

@ -19,6 +19,8 @@ function PopupsAskViewModel()
this.fNoAction = null;
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
this.sKeyScope = Enums.KeyState.MessageList;
Knoin.constructorEnd(this);
@ -83,9 +85,6 @@ PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYe
{
this.yesButton(sNoButton);
}
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.PopupAsk);
};
PopupsAskViewModel.prototype.onFocus = function ()
@ -93,27 +92,18 @@ PopupsAskViewModel.prototype.onFocus = function ()
this.yesFocus(true);
};
PopupsAskViewModel.prototype.onHide = function ()
{
RL.data().keyScope(this.sKeyScope);
};
PopupsAskViewModel.prototype.onBuild = function ()
{
key('tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
if (this.modalVisibility())
if (this.yesFocus())
{
if (this.yesFocus())
{
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
}, this));
};

View file

@ -351,7 +351,7 @@ function PopupsComposeViewModel()
// this.driveCallback = _.bind(this.driveCallback, this);
this.bDisabeCloseOnEsc = true;
this.sKeyScope = Enums.KeyState.MessageList;
this.sDefaultKeyScope = Enums.KeyState.Compose;
Knoin.constructorEnd(this);
}
@ -569,8 +569,6 @@ PopupsComposeViewModel.prototype.onHide = function ()
{
this.reset();
kn.routeOn();
RL.data().keyScope(this.sKeyScope);
};
/**
@ -643,9 +641,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
{
kn.routeOff();
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.Compose);
var
self = this,
sFrom = '',
@ -922,7 +917,7 @@ PopupsComposeViewModel.prototype.tryToClosePopup = function ()
PopupsComposeViewModel.prototype.useShortcuts = function ()
{
return this.modalVisibility() && RL.data().useKeyboardShortcuts();
return RL.data().useKeyboardShortcuts();
};
PopupsComposeViewModel.prototype.onBuild = function ()
@ -931,11 +926,12 @@ PopupsComposeViewModel.prototype.onBuild = function ()
var
self = this,
oData = RL.data(),
oScript = null
;
key('ctrl+s, command+s', Enums.KeyState.Compose, function () {
if (self.useShortcuts())
if (oData.useKeyboardShortcuts())
{
self.saveCommand();
return false;
@ -943,7 +939,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
});
key('ctrl+enter, command+enter', Enums.KeyState.Compose, function () {
if (self.useShortcuts())
if (oData.useKeyboardShortcuts())
{
self.sendCommand();
return false;
@ -951,8 +947,11 @@ PopupsComposeViewModel.prototype.onBuild = function ()
});
key('esc', Enums.KeyState.Compose, function () {
self.tryToClosePopup();
return false;
if (oData.useKeyboardShortcuts())
{
self.tryToClosePopup();
return false;
}
});
$window.on('resize', function () {

View file

@ -303,7 +303,7 @@ function PopupsContactsViewModel()
}
}, this);
this.sKeyScope = Enums.KeyState.MessageList;
this.sDefaultKeyScope = Enums.KeyState.ContactList;
Knoin.constructorEnd(this);
}
@ -587,14 +587,6 @@ PopupsContactsViewModel.prototype.onBuild = function (oDom)
}
});
ko.computed(function () {
var
bModalVisibility = this.modalVisibility(),
bUseKeyboardShortcuts = RL.data().useKeyboardShortcuts()
;
this.selector.useKeyboard(bModalVisibility && bUseKeyboardShortcuts);
}, this).extend({'notify': 'always'});
oDom
.on('click', '.e-pagenator .e-page', function () {
var oPage = ko.dataFor(this);
@ -613,9 +605,6 @@ PopupsContactsViewModel.prototype.onShow = function ()
{
kn.routeOff();
this.reloadContactList(true);
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.ContactList);
};
PopupsContactsViewModel.prototype.onHide = function ()
@ -628,6 +617,4 @@ PopupsContactsViewModel.prototype.onHide = function ()
_.each(this.contacts(), function (oItem) {
oItem.checked(false);
});
RL.data().keyScope(this.sKeyScope);
};

View file

@ -8,20 +8,7 @@ function PopupsKeyboardShortcutsHelpViewModel()
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
this.sKeyScope = Enums.KeyState.None;
Knoin.constructorEnd(this);
}
Utils.extendAsViewModel('PopupsKeyboardShortcutsHelpViewModel', PopupsKeyboardShortcutsHelpViewModel);
PopupsKeyboardShortcutsHelpViewModel.prototype.onShow = function ()
{
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.None);
};
PopupsKeyboardShortcutsHelpViewModel.prototype.onHide = function ()
{
RL.data().keyScope(this.sKeyScope);
};

View file

@ -60,6 +60,7 @@ function PopupsPluginViewModel()
}, this.hasConfiguration);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.All;
Knoin.constructorEnd(this);
}
@ -127,11 +128,11 @@ PopupsPluginViewModel.prototype.tryToClosePopup = function ()
PopupsPluginViewModel.prototype.onBuild = function ()
{
key('esc', _.bind(function () {
key('esc', Enums.KeyState.All, _.bind(function () {
if (this.modalVisibility())
{
this.tryToClosePopup();
return false;
}
}));
}, this));
};

View file

@ -30,7 +30,14 @@
No plugins have yet been installed.
<br />
<br />
<strong><a href="#/packages">Click here install new!</a></strong>
<strong><a href="#/packages">Click here to install new!</a></strong>
</div>
<div class="span8" data-bind="visible: 0 < plugins().length">
<blockquote>
<p class="muted">
Click on the name to configure the plugin.
</p>
</blockquote>
</div>
</div>
<div class="row">

View file

@ -7051,9 +7051,12 @@ html.rl-no-preview-pane .messageList.message-selected {
.messageList .b-content .messageListItem.flagged .flagOn {
display: inline-block;
}
.messageList.message-focused .b-message-list-wrapper {
background-color: #000;
}
.messageList.message-focused .b-content {
opacity: 0.97;
filter: alpha(opacity=97);
opacity: 0.98;
filter: alpha(opacity=98);
}
.messageList.hideMessageListCheckbox .checkedParent,
.messageList.hideMessageListCheckbox .checkboxCkeckAll {
@ -7386,18 +7389,15 @@ html.rl-no-preview-pane .messageView.message-selected {
border-left: 2px solid red;
color: red;
}
.messageView.message-focused .messageItemHeader {
background-color: #fafafa !important;
}
.messageView.message-focused .b-content {
z-index: 102;
-webkit-box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.3);
border-color: #9d9d9d;
-webkit-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border-color: #9d9d9d;
}
html.rl-no-preview-pane .messageView .toolbar {
padding-left: 1px;

File diff suppressed because one or more lines are too long

View file

@ -371,6 +371,7 @@ Enums.StateType = {
* @enum {string}
*/
Enums.KeyState = {
'All': 'all',
'None': 'none',
'ContactList': 'contact-list',
'MessageList': 'message-list',
@ -3877,6 +3878,9 @@ function KnoinAbstractViewModel(sPosition, sTemplate)
this.sPosition = Utils.pString(sPosition);
this.sTemplate = Utils.pString(sTemplate);
this.sDefaultKeyScope = Enums.KeyState.None;
this.sCurrentKeyScope = this.sDefaultKeyScope;
this.viewModelName = '';
this.viewModelVisibility = ko.observable(false);
if ('Popups' === this.sPosition)
@ -3927,15 +3931,29 @@ KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototyp
{
};
KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
{
this.sCurrentKeyScope = RL.data().keyScope();
RL.data().keyScope(this.sDefaultKeyScope);
};
KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
{
RL.data().keyScope(this.sCurrentKeyScope);
};
KnoinAbstractViewModel.prototype.registerPopupEscapeKey = function ()
{
key('esc', _.bind(function () {
if (this.modalVisibility && this.modalVisibility())
var self = this;
$window.on('keydown', function (oEvent) {
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility && self.modalVisibility())
{
Utils.delegateRun(this, 'cancelCommand');
Utils.delegateRun(self, 'cancelCommand');
return false;
}
}, this));
return true;
});
};
/**
@ -4157,6 +4175,7 @@ Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
{
ViewModelClassToHide.__vm.modalVisibility(false);
Utils.delegateRun(ViewModelClassToHide.__vm, 'onHide');
ViewModelClassToHide.__vm.restoreKeyScope();
RL.popupVisibilityNames.remove(ViewModelClassToHide.__name);
@ -4182,8 +4201,10 @@ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
{
ViewModelClassToShow.__dom.show();
ViewModelClassToShow.__vm.modalVisibility(true);
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
ViewModelClassToShow.__vm.storeAndSetKeyScope();
RL.popupVisibilityNames.push(ViewModelClassToShow.__name);
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
@ -5042,6 +5063,7 @@ function PopupsPluginViewModel()
}, this.hasConfiguration);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.All;
Knoin.constructorEnd(this);
}
@ -5109,13 +5131,13 @@ PopupsPluginViewModel.prototype.tryToClosePopup = function ()
PopupsPluginViewModel.prototype.onBuild = function ()
{
key('esc', _.bind(function () {
key('esc', Enums.KeyState.All, _.bind(function () {
if (this.modalVisibility())
{
this.tryToClosePopup();
return false;
}
}));
}, this));
};
/**
@ -5313,6 +5335,8 @@ function PopupsAskViewModel()
this.fNoAction = null;
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
this.sKeyScope = Enums.KeyState.MessageList;
Knoin.constructorEnd(this);
@ -5377,9 +5401,6 @@ PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYe
{
this.yesButton(sNoButton);
}
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.PopupAsk);
};
PopupsAskViewModel.prototype.onFocus = function ()
@ -5387,27 +5408,18 @@ PopupsAskViewModel.prototype.onFocus = function ()
this.yesFocus(true);
};
PopupsAskViewModel.prototype.onHide = function ()
{
RL.data().keyScope(this.sKeyScope);
};
PopupsAskViewModel.prototype.onBuild = function ()
{
key('tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
if (this.modalVisibility())
if (this.yesFocus())
{
if (this.yesFocus())
{
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
}, this));
};
@ -6541,6 +6553,22 @@ AdminLicensing.prototype.licenseExpiredMomentValue = function ()
*/
function AbstractData()
{
this.keyScope = ko.observable(Enums.KeyState.All);
this.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.Compose === sValue)
{
Utils.disableKeyFilter();
}
else
{
Utils.restoreKeyFilter();
}
// window.console.log(sValue);
key.setScope(sValue);
});
Utils.initDataConstructorBySettings(this);
}

File diff suppressed because one or more lines are too long

View file

@ -375,6 +375,7 @@ Enums.StateType = {
* @enum {string}
*/
Enums.KeyState = {
'All': 'all',
'None': 'none',
'ContactList': 'contact-list',
'MessageList': 'message-list',
@ -4712,6 +4713,9 @@ function KnoinAbstractViewModel(sPosition, sTemplate)
this.sPosition = Utils.pString(sPosition);
this.sTemplate = Utils.pString(sTemplate);
this.sDefaultKeyScope = Enums.KeyState.None;
this.sCurrentKeyScope = this.sDefaultKeyScope;
this.viewModelName = '';
this.viewModelVisibility = ko.observable(false);
if ('Popups' === this.sPosition)
@ -4762,15 +4766,29 @@ KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototyp
{
};
KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
{
this.sCurrentKeyScope = RL.data().keyScope();
RL.data().keyScope(this.sDefaultKeyScope);
};
KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
{
RL.data().keyScope(this.sCurrentKeyScope);
};
KnoinAbstractViewModel.prototype.registerPopupEscapeKey = function ()
{
key('esc', _.bind(function () {
if (this.modalVisibility && this.modalVisibility())
var self = this;
$window.on('keydown', function (oEvent) {
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility && self.modalVisibility())
{
Utils.delegateRun(this, 'cancelCommand');
Utils.delegateRun(self, 'cancelCommand');
return false;
}
}, this));
return true;
});
};
/**
@ -4992,6 +5010,7 @@ Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
{
ViewModelClassToHide.__vm.modalVisibility(false);
Utils.delegateRun(ViewModelClassToHide.__vm, 'onHide');
ViewModelClassToHide.__vm.restoreKeyScope();
RL.popupVisibilityNames.remove(ViewModelClassToHide.__name);
@ -5017,8 +5036,10 @@ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
{
ViewModelClassToShow.__dom.show();
ViewModelClassToShow.__vm.modalVisibility(true);
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
ViewModelClassToShow.__vm.storeAndSetKeyScope();
RL.popupVisibilityNames.push(ViewModelClassToShow.__name);
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
@ -8328,7 +8349,7 @@ function PopupsComposeViewModel()
// this.driveCallback = _.bind(this.driveCallback, this);
this.bDisabeCloseOnEsc = true;
this.sKeyScope = Enums.KeyState.MessageList;
this.sDefaultKeyScope = Enums.KeyState.Compose;
Knoin.constructorEnd(this);
}
@ -8546,8 +8567,6 @@ PopupsComposeViewModel.prototype.onHide = function ()
{
this.reset();
kn.routeOn();
RL.data().keyScope(this.sKeyScope);
};
/**
@ -8620,9 +8639,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
{
kn.routeOff();
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.Compose);
var
self = this,
sFrom = '',
@ -8899,7 +8915,7 @@ PopupsComposeViewModel.prototype.tryToClosePopup = function ()
PopupsComposeViewModel.prototype.useShortcuts = function ()
{
return this.modalVisibility() && RL.data().useKeyboardShortcuts();
return RL.data().useKeyboardShortcuts();
};
PopupsComposeViewModel.prototype.onBuild = function ()
@ -8908,11 +8924,12 @@ PopupsComposeViewModel.prototype.onBuild = function ()
var
self = this,
oData = RL.data(),
oScript = null
;
key('ctrl+s, command+s', Enums.KeyState.Compose, function () {
if (self.useShortcuts())
if (oData.useKeyboardShortcuts())
{
self.saveCommand();
return false;
@ -8920,7 +8937,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
});
key('ctrl+enter, command+enter', Enums.KeyState.Compose, function () {
if (self.useShortcuts())
if (oData.useKeyboardShortcuts())
{
self.sendCommand();
return false;
@ -8928,8 +8945,11 @@ PopupsComposeViewModel.prototype.onBuild = function ()
});
key('esc', Enums.KeyState.Compose, function () {
self.tryToClosePopup();
return false;
if (oData.useKeyboardShortcuts())
{
self.tryToClosePopup();
return false;
}
});
$window.on('resize', function () {
@ -9774,7 +9794,7 @@ function PopupsContactsViewModel()
}
}, this);
this.sKeyScope = Enums.KeyState.MessageList;
this.sDefaultKeyScope = Enums.KeyState.ContactList;
Knoin.constructorEnd(this);
}
@ -10058,14 +10078,6 @@ PopupsContactsViewModel.prototype.onBuild = function (oDom)
}
});
ko.computed(function () {
var
bModalVisibility = this.modalVisibility(),
bUseKeyboardShortcuts = RL.data().useKeyboardShortcuts()
;
this.selector.useKeyboard(bModalVisibility && bUseKeyboardShortcuts);
}, this).extend({'notify': 'always'});
oDom
.on('click', '.e-pagenator .e-page', function () {
var oPage = ko.dataFor(this);
@ -10084,9 +10096,6 @@ PopupsContactsViewModel.prototype.onShow = function ()
{
kn.routeOff();
this.reloadContactList(true);
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.ContactList);
};
PopupsContactsViewModel.prototype.onHide = function ()
@ -10099,8 +10108,6 @@ PopupsContactsViewModel.prototype.onHide = function ()
_.each(this.contacts(), function (oItem) {
oItem.checked(false);
});
RL.data().keyScope(this.sKeyScope);
};
/**
@ -11020,6 +11027,8 @@ function PopupsAskViewModel()
this.fNoAction = null;
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
this.sKeyScope = Enums.KeyState.MessageList;
Knoin.constructorEnd(this);
@ -11084,9 +11093,6 @@ PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYe
{
this.yesButton(sNoButton);
}
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.PopupAsk);
};
PopupsAskViewModel.prototype.onFocus = function ()
@ -11094,27 +11100,18 @@ PopupsAskViewModel.prototype.onFocus = function ()
this.yesFocus(true);
};
PopupsAskViewModel.prototype.onHide = function ()
{
RL.data().keyScope(this.sKeyScope);
};
PopupsAskViewModel.prototype.onBuild = function ()
{
key('tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
if (this.modalVisibility())
if (this.yesFocus())
{
if (this.yesFocus())
{
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
}, this));
};
@ -11127,24 +11124,11 @@ function PopupsKeyboardShortcutsHelpViewModel()
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
this.sKeyScope = Enums.KeyState.None;
Knoin.constructorEnd(this);
}
Utils.extendAsViewModel('PopupsKeyboardShortcutsHelpViewModel', PopupsKeyboardShortcutsHelpViewModel);
PopupsKeyboardShortcutsHelpViewModel.prototype.onShow = function ()
{
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.None);
};
PopupsKeyboardShortcutsHelpViewModel.prototype.onHide = function ()
{
RL.data().keyScope(this.sKeyScope);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12270,20 +12254,6 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
})
;
ko.computed(function () {
var
oData = RL.data(),
bViewModelVisibility = this.viewModelVisibility(),
bPopupVisibility = RL.popupVisibility(),
bUseKeyboardShortcuts = oData.useKeyboardShortcuts(),
bMessageFullScreenMode = oData.messageFullScreenMode()
;
this.selector.useKeyboard(bViewModelVisibility && bUseKeyboardShortcuts && !bMessageFullScreenMode && !bPopupVisibility);
}, this).extend({'notify': 'always'});
this.initUploaderForAppend();
this.initShortcuts();
@ -13014,8 +12984,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
self.deleteCommand();
if (handler && 'shift+delete' === handler.shortcut)
{
// self.deleteWithoutMoveCommand();
self.deleteCommand();
self.deleteWithoutMoveCommand();
}
else
{
@ -13029,7 +12998,7 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
key('tab', Enums.KeyState.MessageView, function () {
if (oData.useKeyboardShortcuts())
{
if (self.message())
if (!self.fullScreenMode() && self.message())
{
self.message.focused(false);
}
@ -14503,6 +14472,22 @@ SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
*/
function AbstractData()
{
this.keyScope = ko.observable(Enums.KeyState.All);
this.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.Compose === sValue)
{
Utils.disableKeyFilter();
}
else
{
Utils.restoreKeyFilter();
}
// window.console.log(sValue);
key.setScope(sValue);
});
Utils.initDataConstructorBySettings(this);
}
@ -14615,22 +14600,6 @@ function WebMailDataStorage()
this.lastFoldersHash = '';
this.remoteSuggestions = false;
this.keyScope = ko.observable(Enums.KeyState.None);
this.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.Compose === sValue)
{
Utils.disableKeyFilter();
}
else
{
Utils.restoreKeyFilter();
}
// window.console.log(sValue);
key.setScope(sValue);
});
// system folders
this.sentFolder = ko.observable('');
this.draftFolder = ko.observable('');
@ -17464,13 +17433,12 @@ MailBoxScreen.prototype.setNewTitle = function ()
MailBoxScreen.prototype.onShow = function ()
{
this.setNewTitle();
RL.data().keyScope(Enums.KeyState.MessageList);
};
MailBoxScreen.prototype.onHide = function ()
{
RL.data().keyScope(Enums.KeyState.None);
RL.data().keyScope(Enums.KeyState.All);
};
/**

File diff suppressed because one or more lines are too long