From e2a7299543529750623d3e4309ecf2fc0eb1d02a Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Thu, 29 Feb 2024 00:56:25 +0900 Subject: [PATCH 01/11] Initial commit --- .../PinFolderToSidebarAction.cs} | 7 ++----- .../UnpinFolderToSidebarAction.cs} | 9 +++------ src/Files.App/Data/Commands/CommandCodes.cs | 4 ++-- src/Files.App/Data/Commands/Manager/CommandManager.cs | 8 ++++---- src/Files.App/Data/Commands/Manager/ICommandManager.cs | 4 ++-- .../Data/Factories/ContentPageContextFlyoutFactory.cs | 8 ++++---- 6 files changed, 17 insertions(+), 23 deletions(-) rename src/Files.App/Actions/{Favorites/PinItemAction.cs => Sidebar/PinFolderToSidebarAction.cs} (93%) rename src/Files.App/Actions/{Favorites/UnpinItemAction.cs => Sidebar/UnpinFolderToSidebarAction.cs} (89%) diff --git a/src/Files.App/Actions/Favorites/PinItemAction.cs b/src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs similarity index 93% rename from src/Files.App/Actions/Favorites/PinItemAction.cs rename to src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs index 0fa3b8a97c71..f8462cc1236e 100644 --- a/src/Files.App/Actions/Favorites/PinItemAction.cs +++ b/src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs @@ -1,16 +1,13 @@ // Copyright (c) 2023 Files Community // Licensed under the MIT License. See the LICENSE. -using Files.App.Services; -using Files.App.UserControls.Widgets; using Windows.Storage; namespace Files.App.Actions { - internal class PinItemAction : ObservableObject, IAction + internal sealed class PinFolderToSidebarAction : ObservableObject, IAction { private readonly IContentPageContext context; - private readonly IQuickAccessService service; public string Label @@ -25,7 +22,7 @@ public RichGlyph Glyph public bool IsExecutable => GetIsExecutable(); - public PinItemAction() + public PinFolderToSidebarAction() { context = Ioc.Default.GetRequiredService(); service = Ioc.Default.GetRequiredService(); diff --git a/src/Files.App/Actions/Favorites/UnpinItemAction.cs b/src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs similarity index 89% rename from src/Files.App/Actions/Favorites/UnpinItemAction.cs rename to src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs index b76a3b77f5d7..0eaa4bfa4ac7 100644 --- a/src/Files.App/Actions/Favorites/UnpinItemAction.cs +++ b/src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs @@ -1,12 +1,9 @@ // Copyright (c) 2023 Files Community // Licensed under the MIT License. See the LICENSE. -using Files.App.Services; -using Files.App.UserControls.Widgets; - namespace Files.App.Actions { - internal class UnpinItemAction : ObservableObject, IAction + internal sealed class UnpinFolderToSidebarAction : ObservableObject, IAction { private readonly IContentPageContext context; @@ -16,7 +13,7 @@ public string Label => "UnpinFromFavorites".GetLocalizedResource(); public string Description - => "UnpinItemFromFavoritesDescription".GetLocalizedResource(); + => "UnpinFolderToSidebarDescription".GetLocalizedResource(); public RichGlyph Glyph => new(opacityStyle: "ColorIconUnpinFromFavorites"); @@ -24,7 +21,7 @@ public RichGlyph Glyph public bool IsExecutable => GetIsExecutable(); - public UnpinItemAction() + public UnpinFolderToSidebarAction() { context = Ioc.Default.GetRequiredService(); service = Ioc.Default.GetRequiredService(); diff --git a/src/Files.App/Data/Commands/CommandCodes.cs b/src/Files.App/Data/Commands/CommandCodes.cs index b423e4d0730e..9e7b8d560433 100644 --- a/src/Files.App/Data/Commands/CommandCodes.cs +++ b/src/Files.App/Data/Commands/CommandCodes.cs @@ -64,8 +64,8 @@ public enum CommandCodes UnpinFromStart, // Favorites - PinItemToFavorites, - UnpinItemFromFavorites, + PinFolderToSidebar, + UnpinFolderToSidebar, // Backgrounds SetAsWallpaperBackground, diff --git a/src/Files.App/Data/Commands/Manager/CommandManager.cs b/src/Files.App/Data/Commands/Manager/CommandManager.cs index 3d5a98c37963..eca8dae95cb8 100644 --- a/src/Files.App/Data/Commands/Manager/CommandManager.cs +++ b/src/Files.App/Data/Commands/Manager/CommandManager.cs @@ -69,8 +69,8 @@ public IRichCommand this[HotKey hotKey] public IRichCommand AddItem => commands[CommandCodes.AddItem]; public IRichCommand PinToStart => commands[CommandCodes.PinToStart]; public IRichCommand UnpinFromStart => commands[CommandCodes.UnpinFromStart]; - public IRichCommand PinItemToFavorites => commands[CommandCodes.PinItemToFavorites]; - public IRichCommand UnpinItemFromFavorites => commands[CommandCodes.UnpinItemFromFavorites]; + public IRichCommand PinFolderToSidebar => commands[CommandCodes.PinFolderToSidebar]; + public IRichCommand UnpinFolderToSidebar => commands[CommandCodes.UnpinFolderToSidebar]; public IRichCommand SetAsWallpaperBackground => commands[CommandCodes.SetAsWallpaperBackground]; public IRichCommand SetAsSlideshowBackground => commands[CommandCodes.SetAsSlideshowBackground]; public IRichCommand SetAsLockscreenBackground => commands[CommandCodes.SetAsLockscreenBackground]; @@ -238,8 +238,8 @@ public CommandManager() [CommandCodes.AddItem] = new AddItemAction(), [CommandCodes.PinToStart] = new PinToStartAction(), [CommandCodes.UnpinFromStart] = new UnpinFromStartAction(), - [CommandCodes.PinItemToFavorites] = new PinItemAction(), - [CommandCodes.UnpinItemFromFavorites] = new UnpinItemAction(), + [CommandCodes.PinFolderToSidebar] = new PinFolderToSidebarAction(), + [CommandCodes.UnpinFolderToSidebar] = new UnpinFolderToSidebarAction(), [CommandCodes.SetAsWallpaperBackground] = new SetAsWallpaperBackgroundAction(), [CommandCodes.SetAsSlideshowBackground] = new SetAsSlideshowBackgroundAction(), [CommandCodes.SetAsLockscreenBackground] = new SetAsLockscreenBackgroundAction(), diff --git a/src/Files.App/Data/Commands/Manager/ICommandManager.cs b/src/Files.App/Data/Commands/Manager/ICommandManager.cs index 9b1359646aab..b931a7491428 100644 --- a/src/Files.App/Data/Commands/Manager/ICommandManager.cs +++ b/src/Files.App/Data/Commands/Manager/ICommandManager.cs @@ -58,8 +58,8 @@ public interface ICommandManager : IEnumerable IRichCommand PinToStart { get; } IRichCommand UnpinFromStart { get; } - IRichCommand PinItemToFavorites { get; } - IRichCommand UnpinItemFromFavorites { get; } + IRichCommand PinFolderToSidebar { get; } + IRichCommand UnpinFolderToSidebar { get; } IRichCommand SetAsWallpaperBackground { get; } IRichCommand SetAsSlideshowBackground { get; } diff --git a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs index fab303d42ba1..529903060672 100644 --- a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs +++ b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs @@ -484,13 +484,13 @@ public static List GetBaseItemMenuItems( IsVisible = Commands.OpenProperties.IsExecutable }.Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.OpenParentFolder).Build(), - new ContextMenuFlyoutItemViewModelBuilder(Commands.PinItemToFavorites) + new ContextMenuFlyoutItemViewModelBuilder(Commands.PinFolderToSidebar) { - IsVisible = Commands.PinItemToFavorites.IsExecutable && UserSettingsService.GeneralSettingsService.ShowFavoritesSection, + IsVisible = Commands.PinFolderToSidebar.IsExecutable && UserSettingsService.GeneralSettingsService.ShowFavoritesSection, }.Build(), - new ContextMenuFlyoutItemViewModelBuilder(Commands.UnpinItemFromFavorites) + new ContextMenuFlyoutItemViewModelBuilder(Commands.UnpinFolderToSidebar) { - IsVisible = Commands.UnpinItemFromFavorites.IsExecutable && UserSettingsService.GeneralSettingsService.ShowFavoritesSection, + IsVisible = Commands.UnpinFolderToSidebar.IsExecutable && UserSettingsService.GeneralSettingsService.ShowFavoritesSection, }.Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.PinToStart) { From 3faff07d86e390f950f2ecc1d169ddf91a82663f Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Thu, 29 Feb 2024 01:09:44 +0900 Subject: [PATCH 02/11] Renamed 1 --- .../Sidebar/PinFolderToSidebarAction.cs | 4 +-- .../Sidebar/UnpinFolderToSidebarAction.cs | 4 +-- .../Actions/Start/PinToStartAction.cs | 2 +- .../Actions/Start/UnpinFromStartAction.cs | 2 +- .../ResourceDictionaries/PathIcons.xaml | 4 +-- .../Widgets/BaseWidgetViewModel.cs | 8 ++--- .../UserControls/Widgets/DrivesWidget.xaml.cs | 24 +++++++------- .../Widgets/FileTagsWidget.xaml.cs | 16 +++++----- .../Widgets/QuickAccessWidget.xaml.cs | 32 +++++++++---------- .../UserControls/SidebarViewModel.cs | 10 +++--- 10 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs b/src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs index f8462cc1236e..384dec3499a4 100644 --- a/src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs +++ b/src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs @@ -11,13 +11,13 @@ internal sealed class PinFolderToSidebarAction : ObservableObject, IAction private readonly IQuickAccessService service; public string Label - => "PinToFavorites".GetLocalizedResource(); + => "PinToSidebar".GetLocalizedResource(); public string Description => "PinItemToFavoritesDescription".GetLocalizedResource(); public RichGlyph Glyph - => new(opacityStyle: "ColorIconPinToFavorites"); + => new(opacityStyle: "ColorIconPinToSidebar"); public bool IsExecutable => GetIsExecutable(); diff --git a/src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs b/src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs index 0eaa4bfa4ac7..edf98efef405 100644 --- a/src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs +++ b/src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs @@ -10,13 +10,13 @@ internal sealed class UnpinFolderToSidebarAction : ObservableObject, IAction private readonly IQuickAccessService service; public string Label - => "UnpinFromFavorites".GetLocalizedResource(); + => "UnpinFromSidebar".GetLocalizedResource(); public string Description => "UnpinFolderToSidebarDescription".GetLocalizedResource(); public RichGlyph Glyph - => new(opacityStyle: "ColorIconUnpinFromFavorites"); + => new(opacityStyle: "ColorIconUnpinFromSidebar"); public bool IsExecutable => GetIsExecutable(); diff --git a/src/Files.App/Actions/Start/PinToStartAction.cs b/src/Files.App/Actions/Start/PinToStartAction.cs index 8d518a5d450f..8923d488cdf7 100644 --- a/src/Files.App/Actions/Start/PinToStartAction.cs +++ b/src/Files.App/Actions/Start/PinToStartAction.cs @@ -21,7 +21,7 @@ public string Description => "PinToStartDescription".GetLocalizedResource(); public RichGlyph Glyph - => new(opacityStyle: "ColorIconPinToFavorites"); + => new(opacityStyle: "ColorIconPinToSidebar"); public bool IsExecutable => context.ShellPage is not null; diff --git a/src/Files.App/Actions/Start/UnpinFromStartAction.cs b/src/Files.App/Actions/Start/UnpinFromStartAction.cs index 854bcd70ec85..ebc9b6b4c170 100644 --- a/src/Files.App/Actions/Start/UnpinFromStartAction.cs +++ b/src/Files.App/Actions/Start/UnpinFromStartAction.cs @@ -20,7 +20,7 @@ public string Description => "UnpinFromStartDescription".GetLocalizedResource(); public RichGlyph Glyph - => new(opacityStyle: "ColorIconUnpinFromFavorites"); + => new(opacityStyle: "ColorIconUnpinFromSidebar"); public UnpinFromStartAction() { diff --git a/src/Files.App/ResourceDictionaries/PathIcons.xaml b/src/Files.App/ResourceDictionaries/PathIcons.xaml index 425c1eea45ef..975dc888eef4 100644 --- a/src/Files.App/ResourceDictionaries/PathIcons.xaml +++ b/src/Files.App/ResourceDictionaries/PathIcons.xaml @@ -1448,7 +1448,7 @@ - - - - - -