Skip to content
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

Feature: Added support for hiding compression options from the context menu #14330

Merged
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
4 changes: 2 additions & 2 deletions src/Files.App/Helpers/MenuFlyout/ContextFlyoutItemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
new ContextMenuFlyoutItemViewModelBuilder(commands.CompressIntoZip).Build(),
new ContextMenuFlyoutItemViewModelBuilder(commands.CompressIntoSevenZip).Build(),
},
ShowItem = itemsSelected && CompressHelper.CanCompress(selectedItems)
ShowItem = userSettingsService.GeneralSettingsService.ShowCompressionOptions && itemsSelected && CompressHelper.CanCompress(selectedItems)
},
new ContextMenuFlyoutItemViewModel
{
Expand All @@ -532,7 +532,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
new ContextMenuFlyoutItemViewModelBuilder(commands.DecompressArchiveHere).Build(),
new ContextMenuFlyoutItemViewModelBuilder(commands.DecompressArchiveToChildFolder).Build(),
},
ShowItem = CompressHelper.CanDecompress(selectedItems)
ShowItem = userSettingsService.GeneralSettingsService.ShowCompressionOptions && CompressHelper.CanDecompress(selectedItems)
},
new ContextMenuFlyoutItemViewModel()
{
Expand Down
6 changes: 6 additions & 0 deletions src/Files.App/Services/Settings/GeneralSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ public bool ShowEditTagsMenu
set => Set(value);
}

public bool ShowCompressionOptions
{
get => Get(true);
set => Set(value);
}

public bool ShowSendToMenu
{
get => Get(true);
Expand Down
3 changes: 3 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,9 @@
<data name="ShowEditTagsMenu" xml:space="preserve">
<value>Show edit tags flyout</value>
</data>
<data name="ShowCompressionOptions" xml:space="preserve">
<value>Show compression options</value>
</data>
<data name="ShowSendToMenu" xml:space="preserve">
<value>Show Send To menu</value>
</data>
Expand Down
13 changes: 13 additions & 0 deletions src/Files.App/ViewModels/Settings/GeneralViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,19 @@ public bool ShowOpenInNewTab
}
}

public bool ShowCompressionOptions
{
get => UserSettingsService.GeneralSettingsService.ShowCompressionOptions;
set
{
if (value == UserSettingsService.GeneralSettingsService.ShowCompressionOptions)
return;

UserSettingsService.GeneralSettingsService.ShowCompressionOptions = value;
OnPropertyChanged();
}
}

public bool ShowSendToMenu
{
get => UserSettingsService.GeneralSettingsService.ShowSendToMenu;
Expand Down
8 changes: 8 additions & 0 deletions src/Files.App/Views/Settings/GeneralPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Compression options -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ShowCompressionOptions}" HorizontalAlignment="Stretch">
<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=ShowCompressionOptions}"
IsOn="{x:Bind ViewModel.ShowCompressionOptions, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Send To -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ShowSendToMenu}" HorizontalAlignment="Stretch">
<ToggleSwitch
Expand Down
5 changes: 5 additions & 0 deletions src/Files.Core/Services/Settings/IGeneralSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ public interface IGeneralSettingsService : IBaseSettingsService, INotifyProperty
/// </summary>
bool ShowOpenInNewPane { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to show the compression options e.g. create archive, extract files.
/// </summary>
bool ShowCompressionOptions { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to show the Send To menu.
/// </summary>
Expand Down