Skip to content

Commit 47700ae

Browse files
authored
Fix: Fixed issue where the extract button on the toolbar was disabled in archives (#12144)
1 parent bdc1b68 commit 47700ae

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Files.App/Actions/Content/Archives/DecompressArchive.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
using Files.App.Contexts;
44
using Files.App.Extensions;
55
using Files.App.Helpers;
6+
using Files.Backend.Helpers;
67
using System.ComponentModel;
8+
using System.IO;
79
using System.Threading.Tasks;
810

911
namespace Files.App.Actions
@@ -19,8 +21,9 @@ internal class DecompressArchive : BaseUIAction, IAction
1921
public HotKey HotKey { get; } = new(Keys.E, KeyModifiers.Ctrl);
2022

2123
public override bool IsExecutable =>
22-
IsContextPageTypeAdaptedToCommand() &&
23-
ArchiveHelpers.CanDecompress(context.SelectedItems) &&
24+
(IsContextPageTypeAdaptedToCommand() &&
25+
ArchiveHelpers.CanDecompress(context.SelectedItems)
26+
|| CanDecompressInsideArchive()) &&
2427
UIHelpers.CanShowDialog;
2528

2629
public DecompressArchive()
@@ -40,13 +43,20 @@ and not ContentPageTypes.ZipFolder
4043
and not ContentPageTypes.None;
4144
}
4245

46+
private bool CanDecompressInsideArchive()
47+
{
48+
return context.PageType is ContentPageTypes.ZipFolder &&
49+
!context.HasSelection &&
50+
context.Folder is not null &&
51+
FileExtensionHelpers.IsZipFile(Path.GetExtension(context.Folder.ItemPath));
52+
}
53+
4354
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
4455
{
4556
switch (e.PropertyName)
4657
{
4758
case nameof(IContentPageContext.SelectedItems):
48-
if (IsContextPageTypeAdaptedToCommand())
49-
OnPropertyChanged(nameof(IsExecutable));
59+
OnPropertyChanged(nameof(IsExecutable));
5060
break;
5161
}
5262
}

0 commit comments

Comments
 (0)