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 the edit tags menu #11133

Merged
merged 2 commits into from
Feb 2, 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
5 changes: 5 additions & 0 deletions src/Files.App/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ private void AddNewFileTagsToMenu(CommandBarFlyout contextMenu)
var overflowSeparator = contextMenu.SecondaryCommands.FirstOrDefault(x => x is FrameworkElement fe && fe.Tag as string == "OverflowSeparator") as AppBarSeparator;
var index = contextMenu.SecondaryCommands.IndexOf(overflowSeparator);
index = index >= 0 ? index : contextMenu.SecondaryCommands.Count;

// Only show the edit tags flyout if settings is enabled
if (!UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu)
return;

contextMenu.SecondaryCommands.Insert(index, new AppBarSeparator());
contextMenu.SecondaryCommands.Insert(index + 1, new AppBarButton()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ public bool IsSidebarOpen
set => Set(value);
}

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

public bool UseCompactStyles
{
get => Get(false);
Expand Down Expand Up @@ -73,16 +67,29 @@ public String AppThemeFontFamily
set => Set(value);
}

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

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

protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
{
switch (e.SettingName)
{
case nameof(MoveShellExtensionsToSubMenu):
case nameof(UseCompactStyles):
case nameof(AppThemeBackgroundColor):
case nameof(AppThemeAddressBarBackgroundColor):
case nameof(AppThemeSidebarBackgroundColor):
case nameof(AppThemeFileAreaBackgroundColor):
case nameof(MoveShellExtensionsToSubMenu):
case nameof(DisplayEditTagsMenu):
Analytics.TrackEvent($"Set {e.SettingName} to {e.NewValue}");
break;
}
Expand Down
7 changes: 5 additions & 2 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
<value>Language</value>
</data>
<data name="SettingsContextMenuOverflow" xml:space="preserve">
<value>Move overflow items into a sub menu</value>
<value>Move shell extensions into a sub menu</value>
</data>
<data name="ShowConfirmationWhenDeletingItems" xml:space="preserve">
<value>Show confirmation dialog when deleting items</value>
Expand Down Expand Up @@ -2898,4 +2898,7 @@
<data name="BundlesBeingRemovedTitle" xml:space="preserve">
<value>Bundles will be retiring in a future update 📎</value>
</data>
</root>
<data name="DisplayEditTagsMenu" xml:space="preserve">
<value>Display the edit tags flyout</value>
</data>
</root>
13 changes: 13 additions & 0 deletions src/Files.App/ViewModels/SettingsViewModels/AppearanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ public bool MoveShellExtensionsToSubMenu
}
}
}

public bool DisplayEditTagsMenu
{
get => UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu;
set
{
if (value != UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu)
{
UserSettingsService.AppearanceSettingsService.DisplayEditTagsMenu = value;
OnPropertyChanged();
}
}
}

public bool UseCompactStyles
{
Expand Down
11 changes: 11 additions & 0 deletions src/Files.App/Views/SettingsPages/Appearance.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@
FontWeight="Medium"
Text="{helpers:ResourceString Name=SettingsContextMenu/Text}" />

<!-- Edit tags -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=DisplayEditTagsMenu}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
<FontIcon Glyph="&#xE1CB;" />
</local:SettingsBlockControl.Icon>
<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=DisplayEditTagsMenu}"
IsOn="{x:Bind ViewModel.DisplayEditTagsMenu, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Overflow Options -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsContextMenuOverflow}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
Expand Down
15 changes: 10 additions & 5 deletions src/Files.Backend/Services/Settings/IAppearanceSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ namespace Files.Backend.Services.Settings
{
public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPropertyChanged
{
/// <summary>
/// Gets or sets a value indicating whether or not to move shell extensions into a sub menu.
/// </summary>
bool MoveShellExtensionsToSubMenu { get; set; }

#region Internal Settings

/// <summary>
Expand Down Expand Up @@ -53,5 +48,15 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
/// Gets or sets a value for the app theme font family.
/// </summary>
String AppThemeFontFamily { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to move shell extensions into a sub menu.
/// </summary>
bool MoveShellExtensionsToSubMenu { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to show the edit tags menu.
/// </summary>
bool DisplayEditTagsMenu { get; set; }
}
}