File tree Expand file tree Collapse file tree 9 files changed +117
-9
lines changed Expand file tree Collapse file tree 9 files changed +117
-9
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2023 Files Community
2
+ // Licensed under the MIT License. See the LICENSE.
3
+
4
+ namespace Files . App . Actions
5
+ {
6
+ internal class ToggleDetailsPaneAction : ObservableObject , IToggleAction
7
+ {
8
+ private readonly PreviewPaneViewModel viewModel ;
9
+ private readonly IPreviewPaneSettingsService previewSettingsService = Ioc . Default . GetRequiredService < IPreviewPaneSettingsService > ( ) ;
10
+
11
+ public string Label
12
+ => "ToggleDetailsPane" . GetLocalizedResource ( ) ;
13
+
14
+ public string Description
15
+ => "ToggleDetailsPaneDescription" . GetLocalizedResource ( ) ;
16
+
17
+ public RichGlyph Glyph
18
+ => new ( opacityStyle : "ColorIconRightPane" ) ;
19
+
20
+ public HotKey HotKey
21
+ => new ( Keys . D , KeyModifiers . MenuCtrl ) ;
22
+
23
+ public bool IsOn
24
+ => viewModel . IsEnabled ;
25
+
26
+ public ToggleDetailsPaneAction ( )
27
+ {
28
+ viewModel = Ioc . Default . GetRequiredService < PreviewPaneViewModel > ( ) ;
29
+ viewModel . PropertyChanged += ViewModel_PropertyChanged ;
30
+ }
31
+
32
+ public Task ExecuteAsync ( )
33
+ {
34
+ viewModel . IsEnabled = true ;
35
+ previewSettingsService . ShowPreviewOnly = false ;
36
+
37
+ return Task . CompletedTask ;
38
+ }
39
+
40
+ private void ViewModel_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
41
+ {
42
+ if ( e . PropertyName is nameof ( PreviewPaneViewModel . IsEnabled ) )
43
+ OnPropertyChanged ( nameof ( IsOn ) ) ;
44
+ }
45
+ }
46
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2023 Files Community
2
+ // Licensed under the MIT License. See the LICENSE.
3
+
4
+ namespace Files . App . Actions
5
+ {
6
+ internal class ToggleInfoPaneAction : ObservableObject , IToggleAction
7
+ {
8
+ private readonly PreviewPaneViewModel viewModel ;
9
+
10
+ public string Label
11
+ => "ToggleInfoPane" . GetLocalizedResource ( ) ;
12
+
13
+ public string Description
14
+ => "ToggleInfoPaneDescription" . GetLocalizedResource ( ) ;
15
+
16
+ public RichGlyph Glyph
17
+ => new ( opacityStyle : "ColorIconRightPane" ) ;
18
+
19
+ public bool IsOn
20
+ => viewModel . IsEnabled ;
21
+
22
+ public ToggleInfoPaneAction ( )
23
+ {
24
+ viewModel = Ioc . Default . GetRequiredService < PreviewPaneViewModel > ( ) ;
25
+ viewModel . PropertyChanged += ViewModel_PropertyChanged ;
26
+ }
27
+
28
+ public Task ExecuteAsync ( )
29
+ {
30
+ viewModel . IsEnabled = ! IsOn ;
31
+
32
+ return Task . CompletedTask ;
33
+ }
34
+
35
+ private void ViewModel_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
36
+ {
37
+ if ( e . PropertyName is nameof ( PreviewPaneViewModel . IsEnabled ) )
38
+ OnPropertyChanged ( nameof ( IsOn ) ) ;
39
+ }
40
+ }
41
+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ namespace Files.App.Actions
6
6
internal class TogglePreviewPaneAction : ObservableObject , IToggleAction
7
7
{
8
8
private readonly PreviewPaneViewModel viewModel ;
9
+ private readonly IPreviewPaneSettingsService previewSettingsService = Ioc . Default . GetRequiredService < IPreviewPaneSettingsService > ( ) ;
9
10
10
11
public string Label
11
12
=> "TogglePreviewPane" . GetLocalizedResource ( ) ;
@@ -17,7 +18,7 @@ public RichGlyph Glyph
17
18
=> new ( opacityStyle : "ColorIconRightPane" ) ;
18
19
19
20
public HotKey HotKey
20
- => new ( Keys . P , KeyModifiers . Ctrl ) ;
21
+ => new ( Keys . P , KeyModifiers . MenuCtrl ) ;
21
22
22
23
public bool IsOn
23
24
=> viewModel . IsEnabled ;
@@ -30,7 +31,8 @@ public TogglePreviewPaneAction()
30
31
31
32
public Task ExecuteAsync ( )
32
33
{
33
- viewModel . IsEnabled = ! IsOn ;
34
+ viewModel . IsEnabled = true ;
35
+ previewSettingsService . ShowPreviewOnly = true ;
34
36
35
37
return Task . CompletedTask ;
36
38
}
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ public enum CommandCodes
23
23
ToggleShowHiddenItems ,
24
24
ToggleShowFileExtensions ,
25
25
TogglePreviewPane ,
26
+ ToggleDetailsPane ,
27
+ ToggleInfoPane ,
26
28
27
29
// File System
28
30
CopyItem ,
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ public IRichCommand this[HotKey hotKey]
51
51
public IRichCommand ToggleShowHiddenItems => commands [ CommandCodes . ToggleShowHiddenItems ] ;
52
52
public IRichCommand ToggleShowFileExtensions => commands [ CommandCodes . ToggleShowFileExtensions ] ;
53
53
public IRichCommand TogglePreviewPane => commands [ CommandCodes . TogglePreviewPane ] ;
54
+ public IRichCommand ToggleDetailsPane => commands [ CommandCodes . ToggleDetailsPane ] ;
55
+ public IRichCommand ToggleInfoPane => commands [ CommandCodes . ToggleInfoPane ] ;
54
56
public IRichCommand SelectAll => commands [ CommandCodes . SelectAll ] ;
55
57
public IRichCommand InvertSelection => commands [ CommandCodes . InvertSelection ] ;
56
58
public IRichCommand ClearSelection => commands [ CommandCodes . ClearSelection ] ;
@@ -212,6 +214,8 @@ public CommandManager()
212
214
[ CommandCodes . ToggleShowHiddenItems ] = new ToggleShowHiddenItemsAction ( ) ,
213
215
[ CommandCodes . ToggleShowFileExtensions ] = new ToggleShowFileExtensionsAction ( ) ,
214
216
[ CommandCodes . TogglePreviewPane ] = new TogglePreviewPaneAction ( ) ,
217
+ [ CommandCodes . ToggleDetailsPane ] = new ToggleDetailsPaneAction ( ) ,
218
+ [ CommandCodes . ToggleInfoPane ] = new ToggleInfoPaneAction ( ) ,
215
219
[ CommandCodes . SelectAll ] = new SelectAllAction ( ) ,
216
220
[ CommandCodes . InvertSelection ] = new InvertSelectionAction ( ) ,
217
221
[ CommandCodes . ClearSelection ] = new ClearSelectionAction ( ) ,
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
25
25
IRichCommand ToggleShowHiddenItems { get ; }
26
26
IRichCommand ToggleShowFileExtensions { get ; }
27
27
IRichCommand TogglePreviewPane { get ; }
28
+ IRichCommand ToggleInfoPane { get ; }
28
29
29
30
IRichCommand CopyItem { get ; }
30
31
IRichCommand CopyPath { get ; }
Original file line number Diff line number Diff line change 1053
1053
<data name =" TogglePreviewPane" xml : space =" preserve" >
1054
1054
<value >Toggle the preview pane</value >
1055
1055
</data >
1056
+ <data name =" ToggleDetailsPane" xml : space =" preserve" >
1057
+ <value >Toggle the details pane</value >
1058
+ </data >
1059
+ <data name =" ToggleInfoPane" xml : space =" preserve" >
1060
+ <value >Toggle the details/preview pane</value >
1061
+ </data >
1062
+ <data name =" ToggleInfoPaneDescription" xml : space =" preserve" >
1063
+ <value >Toggles the details/preview pane</value >
1064
+ </data >
1056
1065
<data name =" DetailsPanePreviewNotAvaliableText" xml : space =" preserve" >
1057
1066
<value >No preview available</value >
1058
1067
</data >
2397
2406
<data name =" TogglePreviewPaneDescription" xml : space =" preserve" >
2398
2407
<value >Toggle whether to show preview pane</value >
2399
2408
</data >
2409
+ <data name =" ToggleDetailsPaneDescription" xml : space =" preserve" >
2410
+ <value >Toggle the details pane</value >
2411
+ </data >
2400
2412
<data name =" ToggleSidebarDescription" xml : space =" preserve" >
2401
2413
<value >Toggle whether to show sidebar</value >
2402
2414
</data >
Original file line number Diff line number Diff line change 16
16
<KeyboardAccelerator
17
17
Key=" Space"
18
18
Invoked=" TogglePlaybackAcceleratorInvoked"
19
- Modifiers=" Control " />
19
+ Modifiers=" Menu " />
20
20
</UserControl .KeyboardAccelerators>
21
21
22
22
<Border CornerRadius =" {StaticResource ControlCornerRadius}" >
Original file line number Diff line number Diff line change 911
911
912
912
</AppBarButton >
913
913
914
- <!-- Toggle Preview Pane -->
914
+ <!-- Toggle Preview\Details Pane -->
915
915
<AppBarToggleButton
916
916
x:Name=" PreviewPane"
917
917
Width=" Auto"
918
918
MinWidth=" 40"
919
919
AccessKey=" P"
920
- AutomationProperties.Name=" {x:Bind Commands.TogglePreviewPane .AutomationName}"
921
- IsChecked=" {x:Bind Commands.TogglePreviewPane .IsOn, Mode=TwoWay}"
922
- Label=" {x:Bind Commands.TogglePreviewPane .Label}"
920
+ AutomationProperties.Name=" {x:Bind Commands.ToggleInfoPane .AutomationName}"
921
+ IsChecked=" {x:Bind Commands.ToggleInfoPane .IsOn, Mode=TwoWay}"
922
+ Label=" {x:Bind Commands.ToggleInfoPane .Label}"
923
923
LabelPosition=" Collapsed"
924
- ToolTipService.ToolTip=" {x:Bind Commands.TogglePreviewPane .LabelWithHotKey, Mode=OneWay}"
924
+ ToolTipService.ToolTip=" {x:Bind Commands.ToggleInfoPane .LabelWithHotKey, Mode=OneWay}"
925
925
Visibility=" {x:Bind ShowPreviewPaneButton, Mode=OneWay}" >
926
- <local : OpacityIcon IsSelected =" {x:Bind Commands.TogglePreviewPane .IsOn, Mode=OneWay}" Style =" {x:Bind Commands.TogglePreviewPane .OpacityStyle}" />
926
+ <local : OpacityIcon IsSelected =" {x:Bind Commands.ToggleInfoPane .IsOn, Mode=OneWay}" Style =" {x:Bind Commands.ToggleInfoPane .OpacityStyle}" />
927
927
</AppBarToggleButton >
928
928
929
929
<!-- 3 Dots Commands -->
You can’t perform that action at this time.
0 commit comments