Skip to content

Commit c93841e

Browse files
authored
Feature: Added support for hiding the edit tags menu (#11133)
1 parent f079e9f commit c93841e

File tree

6 files changed

+58
-14
lines changed

6 files changed

+58
-14
lines changed

src/Files.App/BaseLayout.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,11 @@ private void AddNewFileTagsToMenu(CommandBarFlyout contextMenu)
623623
var overflowSeparator = contextMenu.SecondaryCommands.FirstOrDefault(x => x is FrameworkElement fe && fe.Tag as string == "OverflowSeparator") as AppBarSeparator;
624624
var index = contextMenu.SecondaryCommands.IndexOf(overflowSeparator);
625625
index = index >= 0 ? index : contextMenu.SecondaryCommands.Count;
626+
627+
// Only show the edit tags flyout if settings is enabled
628+
if (!UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu)
629+
return;
630+
626631
contextMenu.SecondaryCommands.Insert(index, new AppBarSeparator());
627632
contextMenu.SecondaryCommands.Insert(index + 1, new AppBarButton()
628633
{

src/Files.App/ServicesImplementation/Settings/AppearanceSettingsService.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ public bool IsSidebarOpen
2626
set => Set(value);
2727
}
2828

29-
public bool MoveShellExtensionsToSubMenu
30-
{
31-
get => Get(true);
32-
set => Set(value);
33-
}
34-
3529
public bool UseCompactStyles
3630
{
3731
get => Get(false);
@@ -73,16 +67,29 @@ public String AppThemeFontFamily
7367
set => Set(value);
7468
}
7569

70+
public bool MoveShellExtensionsToSubMenu
71+
{
72+
get => Get(true);
73+
set => Set(value);
74+
}
75+
76+
public bool DisplayEditTagsMenu
77+
{
78+
get => Get(true);
79+
set => Set(value);
80+
}
81+
7682
protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
7783
{
7884
switch (e.SettingName)
7985
{
80-
case nameof(MoveShellExtensionsToSubMenu):
8186
case nameof(UseCompactStyles):
8287
case nameof(AppThemeBackgroundColor):
8388
case nameof(AppThemeAddressBarBackgroundColor):
8489
case nameof(AppThemeSidebarBackgroundColor):
8590
case nameof(AppThemeFileAreaBackgroundColor):
91+
case nameof(MoveShellExtensionsToSubMenu):
92+
case nameof(DisplayEditTagsMenu):
8693
Analytics.TrackEvent($"Set {e.SettingName} to {e.NewValue}");
8794
break;
8895
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@
823823
<value>Language</value>
824824
</data>
825825
<data name="SettingsContextMenuOverflow" xml:space="preserve">
826-
<value>Move overflow items into a sub menu</value>
826+
<value>Move shell extensions into a sub menu</value>
827827
</data>
828828
<data name="ShowConfirmationWhenDeletingItems" xml:space="preserve">
829829
<value>Show confirmation dialog when deleting items</value>
@@ -2898,4 +2898,7 @@
28982898
<data name="BundlesBeingRemovedTitle" xml:space="preserve">
28992899
<value>Bundles will be retiring in a future update 📎</value>
29002900
</data>
2901-
</root>
2901+
<data name="DisplayEditTagsMenu" xml:space="preserve">
2902+
<value>Display the edit tags flyout</value>
2903+
</data>
2904+
</root>

src/Files.App/ViewModels/SettingsViewModels/AppearanceViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ public bool MoveShellExtensionsToSubMenu
107107
}
108108
}
109109
}
110+
111+
public bool DisplayEditTagsMenu
112+
{
113+
get => UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu;
114+
set
115+
{
116+
if (value != UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu)
117+
{
118+
UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu = value;
119+
OnPropertyChanged();
120+
}
121+
}
122+
}
110123

111124
public bool UseCompactStyles
112125
{

src/Files.App/Views/SettingsPages/Appearance.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,17 @@
175175
FontWeight="Medium"
176176
Text="{helpers:ResourceString Name=SettingsContextMenu/Text}" />
177177

178+
<!-- Edit tags -->
179+
<local:SettingsBlockControl Title="{helpers:ResourceString Name=DisplayEditTagsMenu}" HorizontalAlignment="Stretch">
180+
<local:SettingsBlockControl.Icon>
181+
<FontIcon Glyph="&#xE1CB;" />
182+
</local:SettingsBlockControl.Icon>
183+
<ToggleSwitch
184+
AutomationProperties.Name="{helpers:ResourceString Name=DisplayEditTagsMenu}"
185+
IsOn="{x:Bind ViewModel.DisplayEditTagsMenu, Mode=TwoWay}"
186+
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
187+
</local:SettingsBlockControl>
188+
178189
<!-- Overflow Options -->
179190
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsContextMenuOverflow}" HorizontalAlignment="Stretch">
180191
<local:SettingsBlockControl.Icon>

src/Files.Backend/Services/Settings/IAppearanceSettingsService.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ namespace Files.Backend.Services.Settings
55
{
66
public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPropertyChanged
77
{
8-
/// <summary>
9-
/// Gets or sets a value indicating whether or not to move shell extensions into a sub menu.
10-
/// </summary>
11-
bool MoveShellExtensionsToSubMenu { get; set; }
12-
138
#region Internal Settings
149

1510
/// <summary>
@@ -53,5 +48,15 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
5348
/// Gets or sets a value for the app theme font family.
5449
/// </summary>
5550
String AppThemeFontFamily { get; set; }
51+
52+
/// <summary>
53+
/// Gets or sets a value indicating whether or not to move shell extensions into a sub menu.
54+
/// </summary>
55+
bool MoveShellExtensionsToSubMenu { get; set; }
56+
57+
/// <summary>
58+
/// Gets or sets a value indicating whether or not to show the edit tags menu.
59+
/// </summary>
60+
bool DisplayEditTagsMenu { get; set; }
5661
}
5762
}

0 commit comments

Comments
 (0)