diff --git a/src/Files.App/Actions/Content/Archives/DecompressArchive.cs b/src/Files.App/Actions/Content/Archives/DecompressArchive.cs index dccf81e9fd37..1f8618394420 100644 --- a/src/Files.App/Actions/Content/Archives/DecompressArchive.cs +++ b/src/Files.App/Actions/Content/Archives/DecompressArchive.cs @@ -3,7 +3,9 @@ using Files.App.Contexts; using Files.App.Extensions; using Files.App.Helpers; +using Files.Backend.Helpers; using System.ComponentModel; +using System.IO; using System.Threading.Tasks; namespace Files.App.Actions @@ -19,8 +21,9 @@ internal class DecompressArchive : BaseUIAction, IAction public HotKey HotKey { get; } = new(Keys.E, KeyModifiers.Ctrl); public override bool IsExecutable => - IsContextPageTypeAdaptedToCommand() && - ArchiveHelpers.CanDecompress(context.SelectedItems) && + (IsContextPageTypeAdaptedToCommand() && + ArchiveHelpers.CanDecompress(context.SelectedItems) + || CanDecompressInsideArchive()) && UIHelpers.CanShowDialog; public DecompressArchive() @@ -40,13 +43,20 @@ and not ContentPageTypes.ZipFolder and not ContentPageTypes.None; } + private bool CanDecompressInsideArchive() + { + return context.PageType is ContentPageTypes.ZipFolder && + !context.HasSelection && + context.Folder is not null && + FileExtensionHelpers.IsZipFile(Path.GetExtension(context.Folder.ItemPath)); + } + private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.SelectedItems): - if (IsContextPageTypeAdaptedToCommand()) - OnPropertyChanged(nameof(IsExecutable)); + OnPropertyChanged(nameof(IsExecutable)); break; } }