Skip to content

Feature: Move shell extensions to sub menu by default #11110

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 4 commits into from
Jan 29, 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/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ private void AddNewFileTagsToMenu(CommandBarFlyout contextMenu)
private void AddShellItemsToMenu(List<ContextMenuFlyoutItemViewModel> shellMenuItems, CommandBarFlyout contextMenuFlyout, bool shiftPressed)
{
var openWithSubItems = ItemModelListToContextFlyoutHelper.GetMenuFlyoutItemsFromModel(ShellContextmenuHelper.GetOpenWithItems(shellMenuItems));
var mainShellMenuItems = shellMenuItems.RemoveFrom(!UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu ? int.MaxValue : shiftPressed ? 6 : 4);
var mainShellMenuItems = shellMenuItems.RemoveFrom(!UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu ? int.MaxValue : shiftPressed ? 6 : 0);
var overflowShellMenuItems = shellMenuItems.Except(mainShellMenuItems).ToList();

var overflowItems = ItemModelListToContextFlyoutHelper.GetMenuFlyoutItemsFromModel(overflowShellMenuItems);
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/Helpers/ContextFlyoutItemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static List<ContextMenuFlyoutItemViewModel> Filter(List<ContextMenuFlyout
var overflow = items.Where(x => x.ID == "ItemOverflow").FirstOrDefault();
if (overflow is not null)
{
if (!shiftPressed && userSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu) // items with ShowOnShift to overflow menu
if (!shiftPressed && userSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu) // items with ShowOnShift to overflow menu
{
var overflowItems = items.Where(x => x.ShowOnShift).ToList();

Expand Down Expand Up @@ -609,7 +609,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseLayoutMenuItems(Curren
},
new ContextMenuFlyoutItemViewModel()
{
Text = "ContextMenuMoreItemsLabel".GetLocalizedResource(),
Text = "ShowMoreOptions".GetLocalizedResource(),
Glyph = "\xE712",
Items = new List<ContextMenuFlyoutItemViewModel>(),
ID = "ItemOverflow",
Expand Down Expand Up @@ -1074,7 +1074,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(BaseLayo
},
new ContextMenuFlyoutItemViewModel()
{
Text = "ContextMenuMoreItemsLabel".GetLocalizedResource(),
Text = "ShowMoreOptions".GetLocalizedResource(),
Glyph = "\xE712",
Items = new List<ContextMenuFlyoutItemViewModel>(),
ID = "ItemOverflow",
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Helpers/ShellContextMenuHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void LoadMenuFlyoutItem(IList<ContextMenuFlyoutItemViewModel> menu
{
var menuLayoutSubItem = new ContextMenuFlyoutItemViewModel()
{
Text = "ContextMenuMoreItemsLabel".GetLocalizedResource(),
Text = "ShowMoreOptions".GetLocalizedResource(),
Glyph = "\xE712",
};
LoadMenuFlyoutItem(menuLayoutSubItem.Items, contextMenu, overflowItems, cancellationToken, showIcons);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public bool IsSidebarOpen
set => Set(value);
}

public bool MoveOverflowMenuItemsToSubMenu
public bool MoveShellExtensionsToSubMenu
{
get => Get(true);
set => Set(value);
Expand Down Expand Up @@ -77,7 +77,7 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged
{
switch (e.SettingName)
{
case nameof(MoveOverflowMenuItemsToSubMenu):
case nameof(MoveShellExtensionsToSubMenu):
case nameof(UseCompactStyles):
case nameof(AppThemeBackgroundColor):
case nameof(AppThemeAddressBarBackgroundColor):
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@
<data name="RenameError.TooLong.Title" xml:space="preserve">
<value>Item name was too long</value>
</data>
<data name="ContextMenuMoreItemsLabel" xml:space="preserve">
<value>More</value>
<data name="ShowMoreOptions" xml:space="preserve">
<value>Show more options</value>
</data>
<data name="RestartNotificationText.Text" xml:space="preserve">
<value>The application needs to be restarted in order to apply these settings, would you like to restart the app?</value>
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/UserControls/SidebarControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private List<ContextMenuFlyoutItemViewModel> GetLocationItemMenuItems(INavigatio
},
new ContextMenuFlyoutItemViewModel()
{
Text = "ContextMenuMoreItemsLabel".GetLocalizedResource(),
Text = "ShowMoreOptions".GetLocalizedResource(),
Glyph = "\xE712",
Items = new List<ContextMenuFlyoutItemViewModel>(),
ID = "ItemOverflow",
Expand Down Expand Up @@ -498,7 +498,7 @@ private void NavigationViewItem_RightTapped(object sender, RightTappedRoutedEven
var menuItems = GetLocationItemMenuItems(item, itemContextMenuFlyout);
var (_, secondaryElements) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(menuItems);

if (!UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu)
if (!UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu)
secondaryElements.OfType<FrameworkElement>()
.ForEach(i => i.MinWidth = Constants.UI.ContextMenuItemsMaxWidth); // Set menu min width if the overflow menu setting is disabled

Expand Down Expand Up @@ -1056,7 +1056,7 @@ private async void LoadShellMenuItems(CommandBarFlyout itemContextMenuFlyout, Co
var shiftPressed = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
var shellMenuItems = await ContextFlyoutItemHelper.GetItemContextShellCommandsAsync(currentInstanceViewModel: null, workingDir: null,
new List<ListedItem>() { new ListedItem(null) { ItemPath = rightClickedItem.Path } }, shiftPressed: shiftPressed, showOpenMenu: false, default);
if (!UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu)
if (!UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu)
{
var (_, secondaryElements) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(shellMenuItems);
if (!secondaryElements.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ public ElementTheme SelectedElementTheme
get => (ElementTheme)selectedThemeIndex;
}

public bool MoveOverflowMenuItemsToSubMenu
public bool MoveShellExtensionsToSubMenu
{
get => UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu;
get => UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu;
set
{
if (value != UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu)
if (value != UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu)
{
UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu = value;
UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu = value;
OnPropertyChanged();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Views/SettingsPages/Appearance.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
</local:SettingsBlockControl.Icon>
<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=SettingsContextMenuOverflow}"
IsOn="{x:Bind ViewModel.MoveOverflowMenuItemsToSubMenu, Mode=TwoWay}"
IsOn="{x:Bind ViewModel.MoveShellExtensionsToSubMenu, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Files.Backend.Services.Settings
public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPropertyChanged
{
/// <summary>
/// Gets or sets a value indicating whether or not to move overflow menu items into a sub menu.
/// Gets or sets a value indicating whether or not to move shell extensions into a sub menu.
/// </summary>
bool MoveOverflowMenuItemsToSubMenu { get; set; }
bool MoveShellExtensionsToSubMenu { get; set; }

#region Internal Settings

Expand Down