33using Files . App . Contexts ;
44using Files . App . Extensions ;
55using Files . App . Helpers ;
6+ using Files . Backend . Helpers ;
67using System . ComponentModel ;
8+ using System . IO ;
79using System . Threading . Tasks ;
810
911namespace 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