Commit 3530b248 authored by Jeremie Boulic's avatar Jeremie Boulic Committed by Commit Bot

[Files app] Move archive error dialog to visual signal

When a mounting operation failed for an archive, we displayed the errors
in a dialog:
- as part of the error message, the raw error code was included, without
translation.
- only one error dialog could be displayed at a time.

We're now using visual signals instead.

Bug: chromium:1058689
Change-Id: I789663d226c5376db0327b809d9e39af1289ca4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2336096
Commit-Queue: Jeremie Boulic <jboulic@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarFrançois Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797069}
parent 3e66276e
...@@ -263,8 +263,8 @@ ...@@ -263,8 +263,8 @@
<ph name="NUMBER_OF_FILES">$1<ex>3</ex></ph> items <ph name="NUMBER_OF_FILES">$1<ex>3</ex></ph> items
</message> </message>
<message name="IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED" desc="Title of the error dialog when file mount operation failed."> <message name="IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED" desc="Error message when an archive mount operation failed.">
Unable to open "<ph name="PATH">$1<ex>/path/to/zipfile.zip</ex></ph>": <ph name="ERROR_MESSAGE">$2<ex>Bad zip file format</ex></ph> Unable to open "<ph name="PATH">$1<ex>zipfile.zip</ex></ph>"
</message> </message>
<message name="IDS_FILE_BROWSER_UNMOUNT_FAILED" desc="Title of the error dialog when device unmount operation failed."> <message name="IDS_FILE_BROWSER_UNMOUNT_FAILED" desc="Title of the error dialog when device unmount operation failed.">
<ph name="BEGIN_BOLD">&lt;b&gt;</ph>Don't remove your device just yet!<ph name="END_BOLD">&lt;/b&gt;</ph> <ph name="BEGIN_BOLD">&lt;b&gt;</ph>Don't remove your device just yet!<ph name="END_BOLD">&lt;/b&gt;</ph>
......
0b5ea4fdc5c10315f7a11baece644b3dc02b1d92
\ No newline at end of file
...@@ -50,7 +50,9 @@ const ProgressItemType = { ...@@ -50,7 +50,9 @@ const ProgressItemType = {
// This is used for the mixed operation of summarized item. // This is used for the mixed operation of summarized item.
TRANSFER: 'transfer', TRANSFER: 'transfer',
// The item is external drive format operation. // The item is external drive format operation.
FORMAT: 'format' FORMAT: 'format',
// The item is archive operation.
MOUNT_ARCHIVE: 'mount_archive'
}; };
Object.freeze(ProgressItemType); Object.freeze(ProgressItemType);
......
...@@ -895,12 +895,17 @@ class FileTasks { ...@@ -895,12 +895,17 @@ class FileTasks {
console.error('Cannot resolve display root after mounting:', error); console.error('Cannot resolve display root after mounting:', error);
} }
} catch (error) { } catch (error) {
const path = util.extractFilePath(url); const filename = util.extractFilePath(url).split('/').pop();
const namePos = path.lastIndexOf('/');
this.ui_.alertDialog.show( const errorItem = new ProgressCenterItem();
strf('ARCHIVE_MOUNT_FAILED', path.substr(namePos + 1), error), errorItem.id = 'cannot-mount-' + url;
null, null); errorItem.type = ProgressItemType.MOUNT_ARCHIVE;
console.error(`Cannot mount '${path}': ${error.stack || error}`); errorItem.message = strf('ARCHIVE_MOUNT_FAILED', filename);
errorItem.state = ProgressItemState.ERROR;
this.progressCenter_.updateItem(errorItem);
console.error(`Cannot mount '${url}':`);
console.error(error);
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment