3
3
using Files . App . Contexts ;
4
4
using Files . App . Extensions ;
5
5
using Files . App . Helpers ;
6
+ using Files . Backend . Helpers ;
6
7
using System . ComponentModel ;
8
+ using System . IO ;
7
9
using System . Threading . Tasks ;
8
10
9
11
namespace Files . App . Actions
@@ -19,8 +21,9 @@ internal class DecompressArchive : BaseUIAction, IAction
19
21
public HotKey HotKey { get ; } = new ( Keys . E , KeyModifiers . Ctrl ) ;
20
22
21
23
public override bool IsExecutable =>
22
- IsContextPageTypeAdaptedToCommand ( ) &&
23
- ArchiveHelpers . CanDecompress ( context . SelectedItems ) &&
24
+ ( IsContextPageTypeAdaptedToCommand ( ) &&
25
+ ArchiveHelpers . CanDecompress ( context . SelectedItems )
26
+ || CanDecompressInsideArchive ( ) ) &&
24
27
UIHelpers . CanShowDialog ;
25
28
26
29
public DecompressArchive ( )
@@ -40,13 +43,20 @@ and not ContentPageTypes.ZipFolder
40
43
and not ContentPageTypes . None ;
41
44
}
42
45
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
+
43
54
private void Context_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
44
55
{
45
56
switch ( e . PropertyName )
46
57
{
47
58
case nameof ( IContentPageContext . SelectedItems ) :
48
- if ( IsContextPageTypeAdaptedToCommand ( ) )
49
- OnPropertyChanged ( nameof ( IsExecutable ) ) ;
59
+ OnPropertyChanged ( nameof ( IsExecutable ) ) ;
50
60
break ;
51
61
}
52
62
}
0 commit comments