Skip to content

Commit 06032a6

Browse files
authored
Feature: RichCommands Cut/Copy (#11752)
1 parent dc40fe1 commit 06032a6

File tree

11 files changed

+11
-22
lines changed

11 files changed

+11
-22
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task ExecuteAsync()
3333
await UIFilesystemHelpers.CopyItem(context.ShellPage);
3434
}
3535

36-
public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
36+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
3737
{
3838
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
3939
OnPropertyChanged(nameof(IsExecutable));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Task ExecuteAsync()
3232
return Task.CompletedTask;
3333
}
3434

35-
public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
35+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
3636
{
3737
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
3838
OnPropertyChanged(nameof(IsExecutable));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class CreateShortcutAction : ObservableObject, IAction
1515
{
1616
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();
1717

18-
public string Label { get; } = "BaseLayoutItemContextFlyoutShortcut/Text".GetLocalizedResource();
18+
public string Label { get; } = "CreateShortcut".GetLocalizedResource();
1919

2020
public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconShortcut");
2121

@@ -45,7 +45,7 @@ public async Task ExecuteAsync()
4545
}
4646
}
4747

48-
public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
48+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
4949
{
5050
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
5151
OnPropertyChanged(nameof(IsExecutable));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async Task ExecuteAsync()
3030
await UIFilesystemHelpers.CreateShortcutFromDialogAsync(context.ShellPage);
3131
}
3232

33-
public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
33+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
3434
{
3535
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
3636
OnPropertyChanged(nameof(IsExecutable));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal class CutItemAction : ObservableObject, IAction
1414
{
1515
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();
1616

17-
public string Label { get; } = "BaseLayoutItemContextFlyoutCut/Text".GetLocalizedResource();
17+
public string Label { get; } = "Cut".GetLocalizedResource();
1818

1919
public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconCut");
2020

@@ -34,7 +34,7 @@ public Task ExecuteAsync()
3434
return Task.CompletedTask;
3535
}
3636

37-
public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
37+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
3838
{
3939
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
4040
OnPropertyChanged(nameof(IsExecutable));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public async Task ExecuteAsync()
4646
await context.ShellPage.FilesystemViewModel.ApplyFilesAndFoldersChangesAsync();
4747
}
4848

49-
public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
49+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
5050
{
5151
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
5252
OnPropertyChanged(nameof(IsExecutable));

src/Files.App/Helpers/ContextFlyoutItemHelper.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,10 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
380380
},
381381
new ContextMenuFlyoutItemViewModelBuilder(commands.CutItem)
382382
{
383-
IsVisible = itemsSelected,
384383
IsPrimary = true,
385384
}.Build(),
386385
new ContextMenuFlyoutItemViewModelBuilder(commands.CopyItem)
387386
{
388-
IsVisible = itemsSelected,
389387
IsPrimary = true,
390388
}.Build(),
391389
new ContextMenuFlyoutItemViewModel()

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@
528528
<data name="CopyToFolderCaptionText" xml:space="preserve">
529529
<value>Copy to {0}</value>
530530
</data>
531-
<data name="BaseLayoutItemContextFlyoutShortcut.Text" xml:space="preserve">
531+
<data name="CreateShortcut" xml:space="preserve">
532532
<value>Create shortcut</value>
533533
</data>
534534
<data name="OpenFileLocation" xml:space="preserve">

src/Files.App/UserControls/InnerNavigationToolbar.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
MinWidth="40"
117117
AccessKey="C"
118118
AutomationProperties.AutomationId="InnerNavigationToolbarCopyButton"
119-
Command="{x:Bind Commands.CopyItem, Mode=OneWay}"
120-
Label="{x:Bind Commands.CopyItem}"
119+
Command="{x:Bind Commands.CopyItem}"
120+
Label="{x:Bind Commands.CopyItem.Label}"
121121
LabelPosition="Collapsed"
122122
ToolTipService.ToolTip="{x:Bind Commands.CopyItem.LabelWithHotKey, Mode=OneWay}">
123123
<local:OpacityIcon Style="{x:Bind Commands.CopyItem.OpacityStyle}" />

src/Files.App/ViewModels/ToolbarViewModel.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,6 @@ public void SearchRegion_LostFocus(object sender, RoutedEventArgs e)
572572
private void SearchRegion_Escaped(object? sender, ISearchBox searchBox)
573573
=> CloseSearchBox();
574574

575-
public ICommand? SelectAllContentPageItemsCommand { get; set; }
576-
577-
public ICommand? InvertContentPageSelctionCommand { get; set; }
578-
579-
public ICommand? ClearContentPageSelectionCommand { get; set; }
580-
581575
public ICommand? PasteItemsFromClipboardCommand { get; set; }
582576

583577
public IAsyncRelayCommand? OpenNewWindowCommand { get; set; }

src/Files.App/Views/BaseShellPage.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,6 @@ protected virtual void ShellPage_NavigationRequested(object sender, PathNavigati
627627

628628
protected void InitToolbarCommands()
629629
{
630-
ToolbarViewModel.SelectAllContentPageItemsCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.SelectAllItems());
631-
ToolbarViewModel.InvertContentPageSelctionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.InvertSelection());
632-
ToolbarViewModel.ClearContentPageSelectionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.ClearSelection());
633630
ToolbarViewModel.PasteItemsFromClipboardCommand = new RelayCommand(async () => await UIFilesystemHelpers.PasteItemAsync(FilesystemViewModel.WorkingDirectory, this));
634631
ToolbarViewModel.OpenNewWindowCommand = new AsyncRelayCommand(NavigationHelpers.LaunchNewWindowAsync);
635632
ToolbarViewModel.OpenNewPaneCommand = new RelayCommand(() => PaneHolder?.OpenPathInNewPane("Home".GetLocalizedResource()));

0 commit comments

Comments
 (0)