Skip to content

Feature: RichCommands Cut/Copy #11752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Files.App/Actions/FileSystem/CopyItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async Task ExecuteAsync()
await UIFilesystemHelpers.CopyItem(context.ShellPage);
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
OnPropertyChanged(nameof(IsExecutable));
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/FileSystem/CreateFolderAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Task ExecuteAsync()
return Task.CompletedTask;
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
OnPropertyChanged(nameof(IsExecutable));
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Actions/FileSystem/CreateShortcutAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class CreateShortcutAction : ObservableObject, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

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

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

Expand Down Expand Up @@ -45,7 +45,7 @@ public async Task ExecuteAsync()
}
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
OnPropertyChanged(nameof(IsExecutable));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task ExecuteAsync()
await UIFilesystemHelpers.CreateShortcutFromDialogAsync(context.ShellPage);
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
OnPropertyChanged(nameof(IsExecutable));
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Actions/FileSystem/CutItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class CutItemAction : ObservableObject, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

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

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

Expand All @@ -34,7 +34,7 @@ public Task ExecuteAsync()
return Task.CompletedTask;
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
OnPropertyChanged(nameof(IsExecutable));
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/FileSystem/DeleteItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task ExecuteAsync()
await context.ShellPage.FilesystemViewModel.ApplyFilesAndFoldersChangesAsync();
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(IContentPageContext.HasSelection))
OnPropertyChanged(nameof(IsExecutable));
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Helpers/ContextFlyoutItemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,10 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
},
new ContextMenuFlyoutItemViewModelBuilder(commands.CutItem)
{
IsVisible = itemsSelected,
IsPrimary = true,
}.Build(),
new ContextMenuFlyoutItemViewModelBuilder(commands.CopyItem)
{
IsVisible = itemsSelected,
IsPrimary = true,
}.Build(),
new ContextMenuFlyoutItemViewModel()
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
<data name="CopyToFolderCaptionText" xml:space="preserve">
<value>Copy to {0}</value>
</data>
<data name="BaseLayoutItemContextFlyoutShortcut.Text" xml:space="preserve">
<data name="CreateShortcut" xml:space="preserve">
<value>Create shortcut</value>
</data>
<data name="OpenFileLocation" xml:space="preserve">
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/UserControls/InnerNavigationToolbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
MinWidth="40"
AccessKey="C"
AutomationProperties.AutomationId="InnerNavigationToolbarCopyButton"
Command="{x:Bind Commands.CopyItem, Mode=OneWay}"
Label="{x:Bind Commands.CopyItem}"
Command="{x:Bind Commands.CopyItem}"
Label="{x:Bind Commands.CopyItem.Label}"
LabelPosition="Collapsed"
ToolTipService.ToolTip="{x:Bind Commands.CopyItem.LabelWithHotKey, Mode=OneWay}">
<local:OpacityIcon Style="{x:Bind Commands.CopyItem.OpacityStyle}" />
Expand Down
6 changes: 0 additions & 6 deletions src/Files.App/ViewModels/ToolbarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,6 @@ public void SearchRegion_LostFocus(object sender, RoutedEventArgs e)
private void SearchRegion_Escaped(object? sender, ISearchBox searchBox)
=> CloseSearchBox();

public ICommand? SelectAllContentPageItemsCommand { get; set; }

public ICommand? InvertContentPageSelctionCommand { get; set; }

public ICommand? ClearContentPageSelectionCommand { get; set; }

public ICommand? PasteItemsFromClipboardCommand { get; set; }

public IAsyncRelayCommand? OpenNewWindowCommand { get; set; }
Expand Down
3 changes: 0 additions & 3 deletions src/Files.App/Views/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,6 @@ protected virtual void ShellPage_NavigationRequested(object sender, PathNavigati

protected void InitToolbarCommands()
{
ToolbarViewModel.SelectAllContentPageItemsCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.SelectAllItems());
ToolbarViewModel.InvertContentPageSelctionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.InvertSelection());
ToolbarViewModel.ClearContentPageSelectionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.ClearSelection());
ToolbarViewModel.PasteItemsFromClipboardCommand = new RelayCommand(async () => await UIFilesystemHelpers.PasteItemAsync(FilesystemViewModel.WorkingDirectory, this));
ToolbarViewModel.OpenNewWindowCommand = new AsyncRelayCommand(NavigationHelpers.LaunchNewWindowAsync);
ToolbarViewModel.OpenNewPaneCommand = new RelayCommand(() => PaneHolder?.OpenPathInNewPane("Home".GetLocalizedResource()));
Expand Down