| Index: ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
|
| index 54cf35f6743e09bc7700242bdd03fda795f4adff..06f54f2cb0824cf287844f0fdf36c52623f72be8 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
|
| @@ -72,6 +72,22 @@ function FileManagerUI(providersModel, element, launchParam) {
|
| this.deleteConfirmDialog = new FilesConfirmDialog(this.element);
|
| this.deleteConfirmDialog.setOkLabel(str('DELETE_BUTTON_LABEL'));
|
|
|
| + /**
|
| + * Confirm dialog for file move operation.
|
| + * @type {!FilesConfirmDialog}
|
| + * @const
|
| + */
|
| + this.moveConfirmDialog = new FilesConfirmDialog(this.element);
|
| + this.moveConfirmDialog.setOkLabel(str('CONFIRM_MOVE_BUTTON_LABEL'));
|
| +
|
| + /**
|
| + * Confirm dialog for file copy operation.
|
| + * @type {!FilesConfirmDialog}
|
| + * @const
|
| + */
|
| + this.copyConfirmDialog = new FilesConfirmDialog(this.element);
|
| + this.copyConfirmDialog.setOkLabel(str('CONFIRM_COPY_BUTTON_LABEL'));
|
| +
|
| /**
|
| * Share dialog.
|
| * @type {!ShareDialog}
|
| @@ -541,3 +557,29 @@ FileManagerUI.prototype.showOpenInOtherDesktopAlert = function(entries) {
|
| this.alertDialog.showWithTitle(title, message, null, null, null);
|
| }.bind(this));
|
| };
|
| +
|
| +/**
|
| + * Shows confirmation dialog and handles user interaction.
|
| + * @param {boolean} isMove true if the operation is move. false if copy.
|
| + * @param {!Array<string>} messages The messages to show in the dialog.
|
| + * box.
|
| + * @return {!Promise<boolean>}
|
| + */
|
| +FileManagerUI.prototype.showConfirmationDialog = function(isMove, messages) {
|
| + var dialog = null;
|
| + if (isMove) {
|
| + dialog = this.moveConfirmDialog;
|
| + } else {
|
| + dialog = this.copyConfirmDialog;
|
| + }
|
| + return new Promise(function(resolve, reject) {
|
| + dialog.show(
|
| + messages.join(' '),
|
| + function() {
|
| + resolve(true);
|
| + },
|
| + function() {
|
| + resolve(false);
|
| + });
|
| + });
|
| +};
|
|
|