Skip to content
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/Actions/Open/OpenSettingsAction.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.Dialogs;

namespace Files.App.Actions
{
internal sealed class OpenSettingsAction : BaseUIAction, IAction
Expand All @@ -21,6 +23,9 @@ public HotKey HotKey
public Task ExecuteAsync(object? parameter = null)
{
var dialog = dialogService.GetDialog(viewModel);
if (parameter is not null && parameter is SettingsNavigationParams navParams)
((SettingsDialog)dialog).NavigateTo(navParams);

return dialog.TryShowAsync();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Files.App/Data/Contracts/INavigationControlItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public sealed class ContextMenuOptions
{
public bool IsLibrariesHeader { get; set; }

public bool IsTagsHeader { get; set; }

public bool ShowHideSection { get; set; }

public bool IsLocationItem { get; set; }
Expand Down
10 changes: 10 additions & 0 deletions src/Files.App/Data/Parameters/SettingsNavigationParams.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Data.Parameters
{
public sealed class SettingsNavigationParams
{
public SettingsPageKind PageKind { get; set; }
}
}
17 changes: 13 additions & 4 deletions src/Files.App/Dialogs/SettingsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
// Licensed under the MIT License. See the LICENSE.

using Files.App.Views.Settings;
using Files.App.ViewModels.Dialogs;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Threading.Tasks;
using Files.App.Data.Enums;
using Microsoft.UI.Xaml.Media.Animation;

namespace Files.App.Dialogs
Expand All @@ -32,6 +28,19 @@ public SettingsDialog()
return (DialogResult)await base.ShowAsync();
}

public void NavigateTo(SettingsNavigationParams navParams)
{
var defaultTag = SettingsPageKind.AppearancePage.ToString();
var oldSelection = MainSettingsNavigationView.MenuItems.FirstOrDefault(item => ((NavigationViewItem)item).IsSelected) as NavigationViewItem;
var targetSection = MainSettingsNavigationView.MenuItems.FirstOrDefault(
item => Enum.Parse<SettingsPageKind>(((NavigationViewItem)item).Tag.ToString() ?? defaultTag) == navParams.PageKind
);
if (oldSelection is not null)
oldSelection.IsSelected = false;

MainSettingsNavigationView.SelectedItem = targetSection;
}

private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
{
UpdateDialogLayout();
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 @@ -4001,4 +4001,7 @@
<data name="DataStreamsAreHiddenDescription" xml:space="preserve">
<value>Would you like to display alternate data streams? You can modify this setting anytime from the files and folders settings page.</value>
</data>
<data name="ManageTags" xml:space="preserve">
<value>Manage tags</value>
</data>
</root>
10 changes: 9 additions & 1 deletion src/Files.App/ViewModels/UserControls/SidebarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ private async Task<LocationItem> CreateSectionAsync(SectionType sectionType)
{
break;
}
section = BuildSection("FileTags".GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false);
section = BuildSection("FileTags".GetLocalizedResource(), sectionType, new ContextMenuOptions { IsTagsHeader = true, ShowHideSection = true }, false);
icon = new BitmapImage(new Uri(Constants.FluentIconsPaths.FileTagsIcon));
section.IsHeader = true;
section.IsExpanded = UserSettingsService.GeneralSettingsService.IsFileTagsSectionExpanded;
Expand Down Expand Up @@ -1070,6 +1070,14 @@ private List<ContextMenuFlyoutItemViewModel> GetLocationItemMenuItems(INavigatio
Tag = "ItemOverflow",
IsEnabled = false,
IsHidden = !options.ShowShellItems,
},
new ContextMenuFlyoutItemViewModel()
{
Text = "ManageTags".GetLocalizedResource(),
Glyph = "\uE8EC",
Command = Commands.OpenSettings,
CommandParameter = new SettingsNavigationParams() { PageKind = SettingsPageKind.TagsPage },
ShowItem = options.IsTagsHeader
}
}.Where(x => x.ShowItem).ToList();
}
Expand Down
Loading