Skip to content

Commit ac88489

Browse files
Merge branch 'main' into 16004_shortcut_run_settings
# Conflicts: # src/Files.App/Helpers/UI/UIFilesystemHelpers.cs # src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs
2 parents 7589abe + e9199bd commit ac88489

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+784
-160
lines changed

src/Files.App.Controls/ThemedIcon/Styles/Icons.Misc16.xaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,36 @@
271271
</Setter>
272272
</Style>
273273

274+
275+
<Style
276+
x:Key="App.ThemedIcons.Shelf"
277+
BasedOn="{StaticResource DefaultThemedIconStyle}"
278+
TargetType="local:ThemedIcon">
279+
280+
281+
<Setter Property="IconSize" Value="16" />
282+
283+
<Setter Property="OutlineIconData" Value="m4.15,8.15c-.2.2-.2.51,0,.71l3,3c.2.2.51.2.71,0l3-3c.2-.2.2-.51,0-.71-.2-.2-.51-.2-.71,0l-2.15,2.15V.5C8,.22,7.78,0,7.5,0s-.5.22-.5.5v9.79l-2.15-2.15c-.2-.2-.51-.2-.71,0ZM9,1.15v1.02c2.87.68,5,3.25,5,6.33,0,3.59-2.91,6.5-6.5,6.5S1,12.09,1,8.5c0-3.07,2.13-5.65,5-6.33v-1.02C2.58,1.85,0,4.87,0,8.5c0,4.14,3.36,7.5,7.5,7.5s7.5-3.36,7.5-7.5c0-3.63-2.58-6.66-6-7.35Z" />
284+
<Setter Property="FilledIconData" Value="m4.2,8.25c-.28.31-.26.78.05,1.06l2.75,2.5c.29.26.72.26,1.01,0l2.75-2.5c.31-.28.33-.75.05-1.06-.28-.31-.75-.33-1.06-.05l-1.5,1.36V.75C8.25.34,7.91,0,7.5,0s-.75.34-.75.75v8.8l-1.5-1.36c-.31-.28-.78-.26-1.06.05ZM9.25,1.21v1.55c2.46.75,4.25,3.04,4.25,5.74,0,3.31-2.69,6-6,6S1.5,11.81,1.5,8.5c0-2.7,1.79-4.99,4.25-5.74v-1.55C2.45,1.99,0,4.96,0,8.5c0,4.14,3.36,7.5,7.5,7.5s7.5-3.36,7.5-7.5c0-3.54-2.45-6.51-5.75-7.29Z" />
285+
286+
<Setter Property="Layers">
287+
<Setter.Value>
288+
<local:ThemedIconLayers>
289+
<local:ThemedIconLayer
290+
LayerSize="16"
291+
LayerType="Alt"
292+
PathData="m6,1.66v6.22l-.44-.44c-.59-.59-1.54-.59-2.12,0-.59.59-.59,1.54,0,2.12l3,3c.59.59,1.54.59,2.12,0l3-3c.59-.59.59-1.54,0-2.12-.59-.59-1.54-.59-2.12,0l-.44.44V1.66c3.15.69,5.5,3.49,5.5,6.84,0,3.87-3.13,7-7,7S.5,12.37.5,8.5C.5,5.15,2.85,2.35,6,1.66Z" />
293+
<local:ThemedIconLayer
294+
LayerSize="16"
295+
LayerType="Base"
296+
PathData="m6,1.15C2.58,1.85,0,4.87,0,8.5c0,4.14,3.36,7.5,7.5,7.5s7.5-3.36,7.5-7.5c0-3.63-2.58-6.66-6-7.35v1.02c2.87.68,5,3.25,5,6.33,0,3.59-2.91,6.5-6.5,6.5S1,12.09,1,8.5c0-3.07,2.13-5.65,5-6.33v-1.02Z" />
297+
<local:ThemedIconLayer
298+
LayerSize="16"
299+
LayerType="Accent"
300+
PathData="m7.5,0c.28,0,.5.22.5.5v9.79l2.15-2.15c.2-.2.51-.2.71,0,.2.2.2.51,0,.71l-3,3c-.2.2-.51.2-.71,0l-3-3c-.2-.2-.2-.51,0-.71.2-.2.51-.2.71,0l2.15,2.15V.5c0-.28.22-.5.5-.5Z" />
301+
</local:ThemedIconLayers>
302+
</Setter.Value>
303+
</Setter>
304+
</Style>
305+
274306
</ResourceDictionary>

src/Files.App/Actions/Content/Run/RunAsAdminAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ContentPageContext.SelectedItem is not null &&
2323
ContentPageContext.PageType != ContentPageTypes.RecycleBin &&
2424
ContentPageContext.PageType != ContentPageTypes.ZipFolder &&
2525
(FileExtensionHelpers.IsExecutableFile(ContentPageContext.SelectedItem.FileExtension) ||
26-
(ContentPageContext.SelectedItem is ShortcutItem shortcut &&
26+
(ContentPageContext.SelectedItem is IShortcutItem shortcut &&
2727
shortcut.IsExecutable));
2828

2929
public RunAsAdminAction() : base("runas")

src/Files.App/Actions/Content/Run/RunAsAnotherUserAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ContentPageContext.SelectedItem is not null &&
2323
ContentPageContext.PageType != ContentPageTypes.ZipFolder &&
2424
!FileExtensionHelpers.IsAhkFile(ContentPageContext.SelectedItem.FileExtension) &&
2525
(FileExtensionHelpers.IsExecutableFile(ContentPageContext.SelectedItem.FileExtension) ||
26-
(ContentPageContext.SelectedItem is ShortcutItem shortcut &&
26+
(ContentPageContext.SelectedItem is IShortcutItem shortcut &&
2727
shortcut.IsExecutable));
2828

2929
public RunAsAnotherUserAction() : base("runasuser")

src/Files.App/Actions/FileSystem/OpenFileLocationAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public RichGlyph Glyph
2121
public bool IsExecutable =>
2222
context.ShellPage is not null &&
2323
context.HasSelection &&
24-
context.SelectedItem is ShortcutItem;
24+
context.SelectedItem is IShortcutItem;
2525

2626
public OpenFileLocationAction()
2727
{

src/Files.App/Actions/Show/ToggleDetailsPaneAction.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,33 @@
33

44
namespace Files.App.Actions
55
{
6-
internal sealed class ToggleDetailsPaneAction : ObservableObject, IToggleAction
6+
internal sealed class ToggleDetailsPaneAction : ObservableObject, IAction
77
{
8-
private readonly InfoPaneViewModel viewModel;
8+
private readonly InfoPaneViewModel infoPaneViewModel = Ioc.Default.GetRequiredService<InfoPaneViewModel>();
99
private readonly IInfoPaneSettingsService infoPaneSettingsService = Ioc.Default.GetRequiredService<IInfoPaneSettingsService>();
1010

1111
public string Label
12-
=> "ToggleDetailsPane".GetLocalizedResource();
12+
=> Strings.ToggleDetailsPane.GetLocalizedResource();
1313

1414
public string Description
15-
=> "ToggleDetailsPaneDescription".GetLocalizedResource();
15+
=> Strings.ToggleDetailsPaneDescription.GetLocalizedResource();
1616

1717
public RichGlyph Glyph
1818
=> new(themedIconStyle: "App.ThemedIcons.PanelRight");
1919

20-
public HotKey HotKey
21-
=> new(Keys.D, KeyModifiers.CtrlAlt);
20+
public bool IsAccessibleGlobally
21+
=> false;
2222

23-
public bool IsOn
24-
=> viewModel.IsEnabled;
23+
public bool IsExecutable
24+
=> infoPaneViewModel.IsEnabled;
2525

2626
public ToggleDetailsPaneAction()
2727
{
28-
viewModel = Ioc.Default.GetRequiredService<InfoPaneViewModel>();
29-
viewModel.PropertyChanged += ViewModel_PropertyChanged;
28+
infoPaneViewModel.PropertyChanged += ViewModel_PropertyChanged;
3029
}
3130

3231
public Task ExecuteAsync(object? parameter = null)
3332
{
34-
viewModel.IsEnabled = true;
3533
infoPaneSettingsService.SelectedTab = InfoPaneTabs.Details;
3634

3735
return Task.CompletedTask;
@@ -40,7 +38,7 @@ public Task ExecuteAsync(object? parameter = null)
4038
private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
4139
{
4240
if (e.PropertyName is nameof(InfoPaneViewModel.IsEnabled))
43-
OnPropertyChanged(nameof(IsOn));
41+
OnPropertyChanged(nameof(IsExecutable));
4442
}
4543
}
4644
}

src/Files.App/Actions/Show/TogglePreviewPaneAction.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,33 @@
33

44
namespace Files.App.Actions
55
{
6-
internal sealed class TogglePreviewPaneAction : ObservableObject, IToggleAction
6+
internal sealed class TogglePreviewPaneAction : ObservableObject, IAction
77
{
8-
private readonly InfoPaneViewModel viewModel;
8+
private readonly InfoPaneViewModel infoPaneViewModel = Ioc.Default.GetRequiredService<InfoPaneViewModel>();
99
private readonly IInfoPaneSettingsService infoPaneSettingsService = Ioc.Default.GetRequiredService<IInfoPaneSettingsService>();
1010

1111
public string Label
12-
=> "TogglePreviewPane".GetLocalizedResource();
12+
=> Strings.TogglePreviewPane.GetLocalizedResource();
1313

1414
public string Description
15-
=> "TogglePreviewPaneDescription".GetLocalizedResource();
15+
=> Strings.TogglePreviewPaneDescription.GetLocalizedResource();
1616

1717
public RichGlyph Glyph
1818
=> new(themedIconStyle: "App.ThemedIcons.PanelRight");
1919

20-
public HotKey HotKey
21-
=> new(Keys.P, KeyModifiers.CtrlAlt);
20+
public bool IsAccessibleGlobally
21+
=> false;
2222

23-
public bool IsOn
24-
=> viewModel.IsEnabled;
23+
public bool IsExecutable
24+
=> infoPaneViewModel.IsEnabled;
2525

2626
public TogglePreviewPaneAction()
2727
{
28-
viewModel = Ioc.Default.GetRequiredService<InfoPaneViewModel>();
29-
viewModel.PropertyChanged += ViewModel_PropertyChanged;
28+
infoPaneViewModel.PropertyChanged += ViewModel_PropertyChanged;
3029
}
3130

3231
public Task ExecuteAsync(object? parameter = null)
3332
{
34-
viewModel.IsEnabled = true;
3533
infoPaneSettingsService.SelectedTab = InfoPaneTabs.Preview;
3634

3735
return Task.CompletedTask;
@@ -40,7 +38,7 @@ public Task ExecuteAsync(object? parameter = null)
4038
private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
4139
{
4240
if (e.PropertyName is nameof(InfoPaneViewModel.IsEnabled))
43-
OnPropertyChanged(nameof(IsOn));
41+
OnPropertyChanged(nameof(IsExecutable));
4442
}
4543
}
4644
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) Files Community
2+
// Licensed under the MIT License.
3+
4+
namespace Files.App.Actions
5+
{
6+
internal sealed class ToggleShelfPaneAction : ObservableObject, IToggleAction
7+
{
8+
private readonly IGeneralSettingsService generalSettingsService = Ioc.Default.GetRequiredService<IGeneralSettingsService>();
9+
10+
public string Label
11+
=> Strings.ToggleShelfPane.GetLocalizedResource();
12+
13+
public string Description
14+
=> Strings.ToggleShelfPaneDescription.GetLocalizedResource();
15+
16+
public RichGlyph Glyph
17+
=> new(themedIconStyle: "App.ThemedIcons.Shelf");
18+
19+
// TODO Remove IsAccessibleGlobally when shelf feature is ready
20+
public bool IsAccessibleGlobally
21+
=> AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev;
22+
23+
// TODO Remove IsExecutable when shelf feature is ready
24+
public bool IsExecutable
25+
=> AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev;
26+
27+
public bool IsOn
28+
=> generalSettingsService.ShowShelfPane;
29+
30+
public ToggleShelfPaneAction()
31+
{
32+
generalSettingsService.PropertyChanged += GeneralSettingsService_PropertyChanged;
33+
}
34+
35+
public Task ExecuteAsync(object? parameter = null)
36+
{
37+
generalSettingsService.ShowShelfPane = !IsOn;
38+
39+
return Task.CompletedTask;
40+
}
41+
42+
private void GeneralSettingsService_PropertyChanged(object? sender, PropertyChangedEventArgs e)
43+
{
44+
if (e.PropertyName is nameof(GeneralSettingsService.ShowShelfPane))
45+
OnPropertyChanged(nameof(IsOn));
46+
}
47+
}
48+
}

src/Files.App/Data/Commands/Manager/CommandCodes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public enum CommandCodes
2626
ToggleDetailsPane,
2727
ToggleInfoPane,
2828
ToggleToolbar,
29+
ToggleShelfPane,
2930

3031
// File System
3132
CopyItem,

src/Files.App/Data/Commands/Manager/CommandManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public IRichCommand this[HotKey hotKey]
5757
public IRichCommand ToggleDetailsPane => commands[CommandCodes.ToggleDetailsPane];
5858
public IRichCommand ToggleInfoPane => commands[CommandCodes.ToggleInfoPane];
5959
public IRichCommand ToggleToolbar => commands[CommandCodes.ToggleToolbar];
60+
public IRichCommand ToggleShelfPane => commands[CommandCodes.ToggleShelfPane];
6061
public IRichCommand SelectAll => commands[CommandCodes.SelectAll];
6162
public IRichCommand InvertSelection => commands[CommandCodes.InvertSelection];
6263
public IRichCommand ClearSelection => commands[CommandCodes.ClearSelection];
@@ -260,6 +261,7 @@ public IEnumerator<IRichCommand> GetEnumerator() =>
260261
[CommandCodes.ToggleDetailsPane] = new ToggleDetailsPaneAction(),
261262
[CommandCodes.ToggleInfoPane] = new ToggleInfoPaneAction(),
262263
[CommandCodes.ToggleToolbar] = new ToggleToolbarAction(),
264+
[CommandCodes.ToggleShelfPane] = new ToggleShelfPaneAction(),
263265
[CommandCodes.SelectAll] = new SelectAllAction(),
264266
[CommandCodes.InvertSelection] = new InvertSelectionAction(),
265267
[CommandCodes.ClearSelection] = new ClearSelectionAction(),

src/Files.App/Data/Commands/Manager/ICommandManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
3131
IRichCommand ToggleDetailsPane { get; }
3232
IRichCommand ToggleInfoPane { get; }
3333
IRichCommand ToggleToolbar { get; }
34+
IRichCommand ToggleShelfPane { get; }
3435

3536
IRichCommand CopyItem { get; }
3637
IRichCommand CopyItemPath { get; }

0 commit comments

Comments
 (0)