Use id when handling hotkeys for specific dialogs

Identifying a dialog by it's header title is kinda dirty and now we use
the dialogs id instead. We also check if the dialog is visible before executing
the hotkey action.
This commit is contained in:
Sven Depondt
2017-07-28 22:32:18 +02:00
parent a52ef89161
commit 0978dbf890
2 changed files with 60 additions and 30 deletions

View File

@@ -41,6 +41,11 @@ Dialog.prototype = {
*
*--------------------------------------------*/
executeCallback: function () {
this._callback();
dialog.hideDialog();
},
hideDialog: function () {
$('body.dialog_showing').removeClass('dialog_showing');
this._container.hide();
@@ -48,14 +53,16 @@ Dialog.prototype = {
transmission.updateButtonStates();
},
isVisible: function () {
return this._container.is(':visible');
},
onCancelClicked: function (event) {
event.data.dialog.hideDialog();
},
onConfirmClicked: function (event) {
var dialog = event.data.dialog;
dialog._callback();
dialog.hideDialog();
event.data.dialog.executeCallback();
},
/*--------------------------------------------