*
*--------------------------------------------*/
+ executeCallback: function () {
+ this._callback();
+ dialog.hideDialog();
+ },
+
hideDialog: function () {
$('body.dialog_showing').removeClass('dialog_showing');
this._container.hide();
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();
},
/*--------------------------------------------
}
if (o_key || u_key) {
- $('body').addClass('open_showing');
- this.uploadTorrentFile();
- this.updateButtonStates();
+ this.openTorrentClicked(ev);
handled = true;
}
}
}
+ if (slash_key) {
+ this.showHotkeysDialog();
+ handled = true;
+ }
+
if (enter_key) {
- // check if remove dialog
- if ($('.dialog_heading:visible').text().match("Remove") != null) {
- $("#dialog_confirm_button").click();
+ // handle other dialogs
+ if (dialog && dialog.isVisible()) {
+ dialog.executeCallback();
handled = true;
}
- // check if upload torrent dialog
- if ($('.dialog_heading:visible').text() == "Upload Torrent Files") {
+ // handle upload dialog
+ if ($('#upload_container').is(':visible')) {
this.confirmUploadClicked();
handled = true;
}
- // check if location dialog
- if ($('.dialog_heading:visible').text() == "Set Location") {
+ // handle move dialog
+ if ($('#move_container').is(':visible')) {
this.confirmMoveClicked();
handled = true;
}
- }
- if (slash_key) {
- this.showHotkeysDialog();
- handled = true;
+ // handle rename dialog
+ if ($('#rename_container').is(':visible')) {
+ this.confirmRenameClicked();
+ handled = true;
+ }
}
if (esc_key) {
- this.hideMoveDialog();
- this.hideUploadDialog();
- dialog.hideDialog();
- handled = true;
+ // handle other dialogs
+ if (dialog && dialog.isVisible()) {
+ dialog.hideDialog();
+ handled = true;
+ }
+
+ // handle upload dialog
+ if ($('#upload_container').is(':visible')) {
+ this.hideUploadDialog();
+ handled = true;
+ }
+
+ // handle move dialog
+ if ($('#move_container').is(':visible')) {
+ this.hideMoveDialog();
+ handled = true;
+ }
+
+ // handle rename dialog
+ if ($('#rename_container').is(':visible')) {
+ this.hideRenameDialog();
+ handled = true;
+ }
}
if ((up_key || dn_key) && rows.length) {