mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
Add onFocus callback to popups
This commit is contained in:
parent
fd2c2346a8
commit
04932fce63
28 changed files with 412 additions and 336 deletions
|
|
@ -97,7 +97,13 @@ PopupsActivateViewModel.prototype.onShow = function ()
|
|||
this.activateText('');
|
||||
this.activateText.isError(false);
|
||||
this.activationSuccessed(false);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
PopupsActivateViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
if (!this.activateProcess())
|
||||
{
|
||||
this.key.focus(true);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ PopupsAddAccountViewModel.prototype.clearPopup = function ()
|
|||
PopupsAddAccountViewModel.prototype.onShow = function ()
|
||||
{
|
||||
this.clearPopup();
|
||||
};
|
||||
|
||||
PopupsAddAccountViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
this.emailFocus(true);
|
||||
};
|
||||
|
||||
|
|
@ -117,7 +121,7 @@ PopupsAddAccountViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,10 @@ PopupsAdvancedSearchViewModel.prototype.clearPopup = function ()
|
|||
PopupsAdvancedSearchViewModel.prototype.onShow = function ()
|
||||
{
|
||||
this.clearPopup();
|
||||
|
||||
};
|
||||
|
||||
PopupsAdvancedSearchViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
this.fromFocus(true);
|
||||
};
|
||||
|
||||
|
|
@ -134,7 +137,7 @@ PopupsAdvancedSearchViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,10 @@ PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYe
|
|||
{
|
||||
this.yesButton(sNoButton);
|
||||
}
|
||||
};
|
||||
|
||||
PopupsAskViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
this.yesFocus(true);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
|
|||
bResult = true;
|
||||
if (this.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(this, 'closeCommand');
|
||||
Utils.delegateRun(this, 'closeCommand');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -594,7 +594,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
aDownloads = [],
|
||||
aDraftInfo = null,
|
||||
oMessage = null,
|
||||
bFocusOnBody = false,
|
||||
sComposeType = sType || Enums.ComposeType.Empty,
|
||||
fEmailArrayToStringLineHelper = function (aList) {
|
||||
|
||||
|
|
@ -655,7 +654,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
this.aDraftInfo = ['reply', oMessage.uid, oMessage.folderFullNameRaw];
|
||||
this.sInReplyTo = oMessage.sMessageId;
|
||||
this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences);
|
||||
bFocusOnBody = true;
|
||||
break;
|
||||
|
||||
case Enums.ComposeType.ReplyAll:
|
||||
|
|
@ -667,7 +665,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
this.aDraftInfo = ['reply', oMessage.uid, oMessage.folderFullNameRaw];
|
||||
this.sInReplyTo = oMessage.sMessageId;
|
||||
this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.references());
|
||||
bFocusOnBody = true;
|
||||
break;
|
||||
|
||||
case Enums.ComposeType.Forward:
|
||||
|
|
@ -753,11 +750,6 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
});
|
||||
}
|
||||
|
||||
if ('' === this.to())
|
||||
{
|
||||
this.to.focusTrigger(!this.to.focusTrigger());
|
||||
}
|
||||
|
||||
aDownloads = this.getAttachmentsDownloadsForUpload();
|
||||
if (Utils.isNonEmptyArray(aDownloads))
|
||||
{
|
||||
|
|
@ -793,11 +785,20 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
}, aDownloads);
|
||||
}
|
||||
|
||||
if (bFocusOnBody && this.oEditor)
|
||||
this.triggerForResize();
|
||||
};
|
||||
|
||||
PopupsComposeViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
if ('' === this.to())
|
||||
{
|
||||
this.to.focusTrigger(!this.to.focusTrigger());
|
||||
}
|
||||
else if (this.oEditor)
|
||||
{
|
||||
this.oEditor.focus();
|
||||
}
|
||||
|
||||
|
||||
this.triggerForResize();
|
||||
};
|
||||
|
||||
|
|
@ -807,7 +808,7 @@ PopupsComposeViewModel.prototype.tryToClosePopup = function ()
|
|||
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
|
||||
if (self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'closeCommand');
|
||||
Utils.delegateRun(self, 'closeCommand');
|
||||
}
|
||||
}]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ PopupsContactsViewModel.prototype.onBuild = function (oDom)
|
|||
{
|
||||
if (Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
{
|
||||
kn.delegateRun(self, 'closeCommand');
|
||||
Utils.delegateRun(self, 'closeCommand');
|
||||
bResult = false;
|
||||
}
|
||||
else if (oEvent.ctrlKey && Enums.EventKeyCode.S === oEvent.keyCode)
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ PopupsDomainViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ PopupsFolderClearViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function PopupsFolderCreateViewModel()
|
|||
}, this);
|
||||
|
||||
this.folderName = ko.observable('');
|
||||
this.focusTrigger = ko.observable(false);
|
||||
this.folderName.focused = ko.observable(false);
|
||||
|
||||
this.selectedParentValue = ko.observable(Consts.Values.UnuseOptionValue);
|
||||
|
||||
|
|
@ -97,13 +97,17 @@ PopupsFolderCreateViewModel.prototype.clearPopup = function ()
|
|||
{
|
||||
this.folderName('');
|
||||
this.selectedParentValue('');
|
||||
this.focusTrigger(false);
|
||||
this.folderName.focused(false);
|
||||
};
|
||||
|
||||
PopupsFolderCreateViewModel.prototype.onShow = function ()
|
||||
{
|
||||
this.clearPopup();
|
||||
this.focusTrigger(true);
|
||||
};
|
||||
|
||||
PopupsFolderCreateViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
this.folderName.focused(true);
|
||||
};
|
||||
|
||||
PopupsFolderCreateViewModel.prototype.onBuild = function ()
|
||||
|
|
@ -113,7 +117,7 @@ PopupsFolderCreateViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ PopupsFolderSystemViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,10 @@ PopupsIdentityViewModel.prototype.onShow = function (oIdentity)
|
|||
|
||||
this.owner(this.id === RL.data().accountEmail());
|
||||
}
|
||||
};
|
||||
|
||||
PopupsIdentityViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
if (!this.owner())
|
||||
{
|
||||
this.email.focused(true);
|
||||
|
|
@ -152,7 +155,7 @@ PopupsIdentityViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ PopupsLanguagesViewModel.prototype.onBuild = function ()
|
|||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ PopupsPluginViewModel.prototype.tryToClosePopup = function ()
|
|||
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
|
||||
if (self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
}
|
||||
}]);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue