diff --git a/src/Files.App/Actions/Content/PreviewPopup/LaunchPreviewPopupAction.cs b/src/Files.App/Actions/Content/PreviewPopup/LaunchPreviewPopupAction.cs index fbf3b3407874..ece2f77c629f 100644 --- a/src/Files.App/Actions/Content/PreviewPopup/LaunchPreviewPopupAction.cs +++ b/src/Files.App/Actions/Content/PreviewPopup/LaunchPreviewPopupAction.cs @@ -20,7 +20,6 @@ public HotKey HotKey public bool IsExecutable => context.SelectedItems.Count == 1 && - (!context.ShellPage?.ToolbarViewModel?.IsEditModeEnabled ?? false) && (!context.ShellPage?.SlimContentPage?.IsRenamingItem ?? false); public LaunchPreviewPopupAction() diff --git a/src/Files.App/Actions/Content/Selection/ClearSelectionAction.cs b/src/Files.App/Actions/Content/Selection/ClearSelectionAction.cs index a7e44beb059c..30ad883f98f2 100644 --- a/src/Files.App/Actions/Content/Selection/ClearSelectionAction.cs +++ b/src/Files.App/Actions/Content/Selection/ClearSelectionAction.cs @@ -30,11 +30,9 @@ public bool IsExecutable if (page is null) return false; - bool isCommandPaletteOpen = page.ToolbarViewModel.IsCommandPaletteOpen; - bool isEditing = page.ToolbarViewModel.IsEditModeEnabled; bool isRenaming = page.SlimContentPage.IsRenamingItem; - return isCommandPaletteOpen || (!isEditing && !isRenaming); + return !isRenaming; } } diff --git a/src/Files.App/Actions/Content/Selection/InvertSelectionAction.cs b/src/Files.App/Actions/Content/Selection/InvertSelectionAction.cs index 8054e9d0450e..d3bd0c95bfd2 100644 --- a/src/Files.App/Actions/Content/Selection/InvertSelectionAction.cs +++ b/src/Files.App/Actions/Content/Selection/InvertSelectionAction.cs @@ -30,11 +30,8 @@ public bool IsExecutable if (page is null) return false; - bool isCommandPaletteOpen = page.ToolbarViewModel.IsCommandPaletteOpen; - bool isEditing = page.ToolbarViewModel.IsEditModeEnabled; bool isRenaming = page.SlimContentPage.IsRenamingItem; - - return isCommandPaletteOpen || (!isEditing && !isRenaming); + return !isRenaming; } } diff --git a/src/Files.App/Actions/Content/Selection/SelectAllAction.cs b/src/Files.App/Actions/Content/Selection/SelectAllAction.cs index 5f3aae630853..0dac1beab3ad 100644 --- a/src/Files.App/Actions/Content/Selection/SelectAllAction.cs +++ b/src/Files.App/Actions/Content/Selection/SelectAllAction.cs @@ -35,11 +35,9 @@ public bool IsExecutable if (itemCount == selectedItemCount) return false; - bool isCommandPaletteOpen = page.ToolbarViewModel.IsCommandPaletteOpen; - bool isEditing = page.ToolbarViewModel.IsEditModeEnabled; bool isRenaming = page.SlimContentPage?.IsRenamingItem ?? false; - return isCommandPaletteOpen || (!isEditing && !isRenaming); + return !isRenaming; } } diff --git a/src/Files.App/Actions/Global/EditPathAction.cs b/src/Files.App/Actions/Global/EditPathAction.cs index f9ca51490d5e..302c9d0f9b30 100644 --- a/src/Files.App/Actions/Global/EditPathAction.cs +++ b/src/Files.App/Actions/Global/EditPathAction.cs @@ -31,12 +31,7 @@ public EditPathAction() public Task ExecuteAsync(object? parameter = null) { if (context.ShellPage is not null) - { - if (GeneralSettingsService.EnableOmnibarDesign) - context.ShellPage!.ToolbarViewModel.SwitchToPathMode(); - else - context.ShellPage.ToolbarViewModel.IsEditModeEnabled = true; - } + context.ShellPage!.ToolbarViewModel.SwitchToPathMode(); return Task.CompletedTask; } diff --git a/src/Files.App/Actions/Global/SearchAction.cs b/src/Files.App/Actions/Global/SearchAction.cs index 6e4b63a3cdcc..446a301695a4 100644 --- a/src/Files.App/Actions/Global/SearchAction.cs +++ b/src/Files.App/Actions/Global/SearchAction.cs @@ -22,14 +22,9 @@ public HotKey SecondHotKey public RichGlyph Glyph => new(themedIconStyle: "App.ThemedIcons.Omnibar.Search"); - public bool IsExecutable - => !context.IsSearchBoxVisible; - public SearchAction() { context = Ioc.Default.GetRequiredService(); - - context.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) @@ -38,15 +33,5 @@ public Task ExecuteAsync(object? parameter = null) return Task.CompletedTask; } - - private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) - { - switch (e.PropertyName) - { - case nameof(IContentPageContext.IsSearchBoxVisible): - OnPropertyChanged(nameof(IsExecutable)); - break; - } - } } } diff --git a/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs b/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs index d51bb9cd8058..da3cf6dc0b81 100644 --- a/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs +++ b/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs @@ -39,8 +39,6 @@ internal sealed partial class ContentPageContext : ObservableObject, IContentPag public bool CanNavigateToParent => ShellPage is not null && ShellPage.ToolbarViewModel.CanNavigateToParent; - public bool IsSearchBoxVisible => ShellPage is not null && ShellPage.ToolbarViewModel.IsSearchBoxVisible; - public bool CanCreateItem => GetCanCreateItem(); public bool IsMultiPaneAvailable => ShellPage is not null && ShellPage.PaneHolder is not null && ShellPage.PaneHolder.IsMultiPaneAvailable; @@ -167,7 +165,6 @@ private void ToolbarViewModel_PropertyChanged(object? sender, PropertyChangedEve case nameof(NavigationToolbarViewModel.CanNavigateToParent): case nameof(NavigationToolbarViewModel.HasItem): case nameof(NavigationToolbarViewModel.CanRefresh): - case nameof(NavigationToolbarViewModel.IsSearchBoxVisible): OnPropertyChanged(e.PropertyName); break; case nameof(NavigationToolbarViewModel.SelectedItems): diff --git a/src/Files.App/Data/Contexts/ContentPage/IContentPageContext.cs b/src/Files.App/Data/Contexts/ContentPage/IContentPageContext.cs index f4a4a5c8a9aa..7a278b3a86b9 100644 --- a/src/Files.App/Data/Contexts/ContentPage/IContentPageContext.cs +++ b/src/Files.App/Data/Contexts/ContentPage/IContentPageContext.cs @@ -23,8 +23,6 @@ public interface IContentPageContext : INotifyPropertyChanged bool CanGoForward { get; } bool CanNavigateToParent { get; } - bool IsSearchBoxVisible { get; } - bool CanCreateItem { get; } bool IsMultiPaneAvailable { get; } diff --git a/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs b/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs index be9e55cde60c..8219ded4f7ef 100644 --- a/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs +++ b/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs @@ -10,8 +10,6 @@ namespace Files.App.Data.Contexts { internal sealed partial class MultitaskingContext : ObservableObject, IMultitaskingContext { - private readonly MainPageViewModel MainPageViewModel = Ioc.Default.GetRequiredService(); - private bool isPopupOpen = false; private ITabBar? control; @@ -72,9 +70,6 @@ private void FocusManager_GotFocus(object? sender, FocusManagerGotFocusEventArgs { int newSelectedIndex = MainPageViewModel.AppInstances.IndexOf(tabItem); UpdateSelectedTabIndex(newSelectedIndex); - - // Focus the content of the selected tab item (needed for pointer navigation) - (MainPageViewModel.SelectedTabItem?.TabItemContent as Control)?.Focus(FocusState.Programmatic); } } diff --git a/src/Files.App/Data/Contracts/IAddressToolbarViewModel.cs b/src/Files.App/Data/Contracts/IAddressToolbarViewModel.cs index 42a5f0b7637c..f3345d435dc5 100644 --- a/src/Files.App/Data/Contracts/IAddressToolbarViewModel.cs +++ b/src/Files.App/Data/Contracts/IAddressToolbarViewModel.cs @@ -5,15 +5,6 @@ namespace Files.App.Data.Contracts { public interface IAddressToolbarViewModel { - public bool IsSearchBoxVisible { get; set; } - - public bool IsEditModeEnabled { get; set; } - - /// - /// Gets or sets the value that indicates whether the command palette is open. - /// - public bool IsCommandPaletteOpen { get; set; } - public bool CanRefresh { get; set; } public bool CanCopyPathInPage { get; set; } @@ -36,14 +27,11 @@ public interface IAddressToolbarViewModel public event ToolbarQuerySubmittedEventHandler PathBoxQuerySubmitted; - public event EventHandler EditModeEnabled; public event ItemDraggedOverPathItemEventHandler ItemDraggedOverPathItem; public event EventHandler RefreshWidgetsRequested; public void SwitchToSearchMode(); - - public ISearchBoxViewModel SearchBox { get; } } } diff --git a/src/Files.App/Data/Contracts/IGeneralSettingsService.cs b/src/Files.App/Data/Contracts/IGeneralSettingsService.cs index 7b12ba1bbd0e..e473508791fe 100644 --- a/src/Files.App/Data/Contracts/IGeneralSettingsService.cs +++ b/src/Files.App/Data/Contracts/IGeneralSettingsService.cs @@ -304,10 +304,5 @@ public interface IGeneralSettingsService : IBaseSettingsService, INotifyProperty /// Gets or sets a value whether the filter header should be displayed. /// bool ShowFilterHeader { get; set; } - - /// - /// Gets or sets a value indicating whether or not to enable the Omnibar. - /// - bool EnableOmnibarDesign { get; set; } } } diff --git a/src/Files.App/Data/Contracts/ISearchBoxViewModel.cs b/src/Files.App/Data/Contracts/ISearchBoxViewModel.cs deleted file mode 100644 index b04cc5ff18b0..000000000000 --- a/src/Files.App/Data/Contracts/ISearchBoxViewModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using Windows.Foundation; - -namespace Files.App.Data.Contracts -{ - public interface ISearchBoxViewModel - { - event TypedEventHandler TextChanged; - - event TypedEventHandler QuerySubmitted; - - event EventHandler Escaped; - - bool WasQuerySubmitted { get; set; } - - string Query { get; set; } - - void ClearSuggestions(); - - void SetSuggestions(IEnumerable suggestions); - - void AddRecentQueries(); - } -} diff --git a/src/Files.App/Data/EventArguments/AddressBarTextEnteredEventArgs.cs b/src/Files.App/Data/EventArguments/AddressBarTextEnteredEventArgs.cs deleted file mode 100644 index eb0f07fbd446..000000000000 --- a/src/Files.App/Data/EventArguments/AddressBarTextEnteredEventArgs.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using Files.App.Views; -using Microsoft.UI.Xaml.Controls; -using Windows.ApplicationModel.DataTransfer; - -namespace Files.App.Data.EventArguments -{ - public sealed class AddressBarTextEnteredEventArgs - { - public AutoSuggestBox AddressBarTextField { get; set; } - } -} diff --git a/src/Files.App/Data/EventArguments/ToolbarFlyoutOpeningEventArgs.cs b/src/Files.App/Data/EventArguments/ToolbarFlyoutOpeningEventArgs.cs deleted file mode 100644 index 7e3d0f32ccd4..000000000000 --- a/src/Files.App/Data/EventArguments/ToolbarFlyoutOpeningEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using Microsoft.UI.Xaml.Controls; - -namespace Files.App.Data.EventArguments -{ - public sealed class ToolbarFlyoutOpeningEventArgs - { - public MenuFlyout OpeningFlyout { get; } - - public ToolbarFlyoutOpeningEventArgs(MenuFlyout openingFlyout) - { - OpeningFlyout = openingFlyout; - } - } -} diff --git a/src/Files.App/Data/EventArguments/ToolbarPathItemLoadedEventArgs.cs b/src/Files.App/Data/EventArguments/ToolbarPathItemLoadedEventArgs.cs deleted file mode 100644 index 2d359dcbaead..000000000000 --- a/src/Files.App/Data/EventArguments/ToolbarPathItemLoadedEventArgs.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using Files.App.Views; -using Microsoft.UI.Xaml.Controls; -using Windows.ApplicationModel.DataTransfer; - -namespace Files.App.Data.EventArguments -{ - public sealed class ToolbarPathItemLoadedEventArgs - { - public MenuFlyout OpenedFlyout { get; set; } - - public PathBoxItem Item { get; set; } - } -} diff --git a/src/Files.App/Data/TemplateSelectors/PathBreadcrumbItemSelector.cs b/src/Files.App/Data/TemplateSelectors/PathBreadcrumbItemSelector.cs deleted file mode 100644 index a63112ba2723..000000000000 --- a/src/Files.App/Data/TemplateSelectors/PathBreadcrumbItemSelector.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; - -namespace Files.App.Data.TemplateSelectors -{ - /// - /// Provides template selector for Path Breadcrumb template items. - /// - internal sealed partial class PathBreadcrumbItemSelector : DataTemplateSelector - { - public DataTemplate? ParentItems { get; set; } - - public DataTemplate? CurrentItem { get; set; } - - protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) - { - var itemsControl = ItemsControl.ItemsControlFromItemContainer(container); - - if (itemsControl.ItemsSource is ObservableCollection items) - { - return - itemsControl.IndexFromContainer(container) == items.Count - 1 - ? CurrentItem! - : ParentItems!; - } - else - { - throw new ArgumentException($"Type of {nameof(itemsControl.ItemsSource)} doesn't match ObservableCollection<{nameof(PathBoxItem)}>"); - } - } - } -} diff --git a/src/Files.App/Services/Settings/GeneralSettingsService.cs b/src/Files.App/Services/Settings/GeneralSettingsService.cs index 889ac71779bb..addc268ce18a 100644 --- a/src/Files.App/Services/Settings/GeneralSettingsService.cs +++ b/src/Files.App/Services/Settings/GeneralSettingsService.cs @@ -375,12 +375,6 @@ public bool ShowFilterHeader set => Set(value); } - public bool EnableOmnibarDesign - { - get => Get(true); - set => Set(value); - } - protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e) { base.RaiseOnSettingChangedEvent(sender, e); diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index d1eb58490662..42ceb993838a 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -4223,9 +4223,6 @@ Decimal - - Enable Omnibar - You can add sections to the sidebar by right-clicking and selecting the sections you want to add diff --git a/src/Files.App/UserControls/NavigationToolbar.xaml b/src/Files.App/UserControls/NavigationToolbar.xaml index bb76747dc890..23a2969abf7b 100644 --- a/src/Files.App/UserControls/NavigationToolbar.xaml +++ b/src/Files.App/UserControls/NavigationToolbar.xaml @@ -221,126 +221,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.App/UserControls/NavigationToolbar.xaml.cs b/src/Files.App/UserControls/NavigationToolbar.xaml.cs index 7e5a335082e7..1d9228f75b0e 100644 --- a/src/Files.App/UserControls/NavigationToolbar.xaml.cs +++ b/src/Files.App/UserControls/NavigationToolbar.xaml.cs @@ -37,9 +37,6 @@ public sealed partial class NavigationToolbar : UserControl [GeneratedDependencyProperty] public partial bool ShowSettingsButton { get; set; } - [GeneratedDependencyProperty] - public partial bool ShowSearchBox { get; set; } - [GeneratedDependencyProperty] public partial NavigationToolbarViewModel ViewModel { get; set; } @@ -59,87 +56,6 @@ private void NavToolbar_Loading(FrameworkElement _, object e) OngoingTasksViewModel.NewItemAdded += OngoingTasksActions_ProgressBannerPosted; } - [Obsolete("Superseded by Omnibar.")] - private void VisiblePath_Loaded(object _, RoutedEventArgs e) - { - // AutoSuggestBox won't receive focus unless it's fully loaded - VisiblePath.Focus(FocusState.Programmatic); - - if (DependencyObjectHelpers.FindChild(VisiblePath) is TextBox textBox) - { - if (textBox.Text.StartsWith(">")) - textBox.Select(1, textBox.Text.Length - 1); - else - textBox.SelectAll(); - } - } - - [Obsolete("Superseded by Omnibar.")] - private void ManualPathEntryItem_Click(object _, PointerRoutedEventArgs e) - { - if (e.Pointer.PointerDeviceType is PointerDeviceType.Mouse) - { - var ptrPt = e.GetCurrentPoint(NavToolbar); - if (ptrPt.Properties.IsMiddleButtonPressed) - return; - } - ViewModel.IsEditModeEnabled = true; - } - - [Obsolete("Superseded by Omnibar.")] - private async void VisiblePath_KeyDown(object _, KeyRoutedEventArgs e) - { - if (e.Key is VirtualKey.Escape) - ViewModel.IsEditModeEnabled = false; - - if (e.Key is VirtualKey.Tab) - { - ViewModel.IsEditModeEnabled = false; - // Delay to ensure clickable path is ready to be focused - await Task.Delay(10); - ClickablePath.Focus(FocusState.Keyboard); - } - } - [Obsolete("Superseded by Omnibar.")] - private void VisiblePath_LostFocus(object _, RoutedEventArgs e) - { - if (App.AppModel.IsMainWindowClosed) - return; - - var element = Microsoft.UI.Xaml.Input.FocusManager.GetFocusedElement(MainWindow.Instance.Content.XamlRoot); - if (element is FlyoutBase or AppBarButton or Popup) - return; - - if (element is not Control control) - { - if (ViewModel.IsEditModeEnabled) - ViewModel.IsEditModeEnabled = false; - return; - } - - if (control.FocusState is not FocusState.Programmatic and not FocusState.Keyboard) - ViewModel.IsEditModeEnabled = false; - else if (ViewModel.IsEditModeEnabled) - VisiblePath.Focus(FocusState.Programmatic); - } - - [Obsolete("Superseded by Omnibar.")] - private void SearchRegion_OnGotFocus(object sender, RoutedEventArgs e) => ViewModel.SearchRegion_GotFocus(sender, e); - [Obsolete("Superseded by Omnibar.")] - private void SearchRegion_LostFocus(object sender, RoutedEventArgs e) => ViewModel.SearchRegion_LostFocus(sender, e); - [Obsolete("Superseded by Omnibar.")] - private void SearchRegion_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEventArgs args) - { - // Suppress access key invocation if any dialog is open - if (VisualTreeHelper.GetOpenPopupsForXamlRoot(MainWindow.Instance.Content.XamlRoot).Any()) - args.Handled = true; - else - sender.Focus(FocusState.Keyboard); - } - [Obsolete("Superseded by Omnibar.")] - private void VisiblePath_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) - => ViewModel.VisiblePath_QuerySubmitted(sender, args); - private void OngoingTasksActions_ProgressBannerPosted(object? _, StatusCenterItem e) { if (OngoingTasksViewModel is not null) @@ -254,17 +170,6 @@ void HistoryItemClicked(ToolbarHistoryItemModel? itemModel) } } - [Obsolete("Superseded by Omnibar.")] - private void ClickablePath_GettingFocus(UIElement sender, GettingFocusEventArgs args) - { - if (args.InputDevice != FocusInputDeviceKind.Keyboard) - return; - - var previousControl = args.OldFocusedElement as FrameworkElement; - if (previousControl?.Name == nameof(Refresh)) - ViewModel.IsEditModeEnabled = true; - } - private async void Omnibar_QuerySubmitted(Omnibar sender, OmnibarQuerySubmittedEventArgs args) { var mode = Omnibar.CurrentSelectedMode; diff --git a/src/Files.App/UserControls/PathBreadcrumb.xaml b/src/Files.App/UserControls/PathBreadcrumb.xaml deleted file mode 100644 index 9913d9ea4c5d..000000000000 --- a/src/Files.App/UserControls/PathBreadcrumb.xaml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.App/UserControls/PathBreadcrumb.xaml.cs b/src/Files.App/UserControls/PathBreadcrumb.xaml.cs deleted file mode 100644 index 66726ee9e82b..000000000000 --- a/src/Files.App/UserControls/PathBreadcrumb.xaml.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using CommunityToolkit.WinUI; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; - -namespace Files.App.UserControls -{ - public sealed partial class PathBreadcrumb : UserControl - { - [GeneratedDependencyProperty] - public partial NavigationToolbarViewModel ViewModel { get; set; } - - public PathBreadcrumb() - { - InitializeComponent(); - } - - private void PathItemSeparator_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) - { - ViewModel.PathItemSeparator_DataContextChanged(sender, args); - } - - private void PathBoxItemFlyout_Opening(object sender, object e) - { - ViewModel.PathboxItemFlyout_Opening(sender, e); - } - - private void PathBoxItemFlyout_Closed(object sender, object e) - { - ViewModel.PathBoxItemFlyout_Closed(sender, e) ; - } - - private void PathBoxItem_DragLeave(object sender, DragEventArgs e) - { - ViewModel.PathBoxItem_DragLeave(sender, e); - } - - private async void PathBoxItem_DragOver(object sender, DragEventArgs e) - { - await ViewModel.PathBoxItem_DragOver(sender, e); - } - - private async void PathBoxItem_Drop(object sender, DragEventArgs e) - { - await ViewModel.PathBoxItem_Drop(sender, e); - } - - private async void PathBoxItem_Tapped(object sender, TappedRoutedEventArgs e) - { - if (sender is not TextBlock textBlock || - textBlock.DataContext is not PathBoxItem item || - item.Path is not { } path) - return; - - // TODO: Implement middle click retrieving. - await ViewModel.HandleFolderNavigationAsync(path); - - e.Handled = true; - } - - private void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e) - { - ViewModel.PathBoxItem_PointerPressed(sender, e); - } - - private void PathBoxItem_PreviewKeyDown(object sender, KeyRoutedEventArgs e) - { - ViewModel.PathBoxItem_PreviewKeyDown(sender, e); - } - } -} diff --git a/src/Files.App/UserControls/SearchBox.xaml b/src/Files.App/UserControls/SearchBox.xaml deleted file mode 100644 index a3a9f49cc0f6..000000000000 --- a/src/Files.App/UserControls/SearchBox.xaml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.App/UserControls/SearchBox.xaml.cs b/src/Files.App/UserControls/SearchBox.xaml.cs deleted file mode 100644 index 43fb5c13656d..000000000000 --- a/src/Files.App/UserControls/SearchBox.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Files Community -// Licensed under the MIT License. - -using Files.App.ViewModels; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; - -namespace Files.App.UserControls -{ - [Obsolete("Superseded by Omnibar.")] - public sealed partial class SearchBox : UserControl - { - public static readonly DependencyProperty SearchBoxViewModelProperty = - DependencyProperty.Register(nameof(SearchBoxViewModel), typeof(SearchBoxViewModel), typeof(SearchBox), new PropertyMetadata(null)); - - public SearchBoxViewModel SearchBoxViewModel - { - get => (SearchBoxViewModel)GetValue(SearchBoxViewModelProperty); - set => SetValue(SearchBoxViewModelProperty, value); - } - - public SearchBox() => InitializeComponent(); - - private void SearchRegion_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs e) - => SearchBoxViewModel.SearchRegion_TextChanged(sender, e); - - private void SearchRegion_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs e) - => SearchBoxViewModel.SearchRegion_QuerySubmitted(sender, e); - - private void SearchRegion_Escaped(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs e) - => SearchBoxViewModel.SearchRegion_Escaped(sender, e); - - private void SearchRegion_KeyDown(object sender, KeyRoutedEventArgs e) - => SearchBoxViewModel.SearchRegion_KeyDown(sender, e); - } -} diff --git a/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs b/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs index 948d33fc5489..e8dd09d35b09 100644 --- a/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs +++ b/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs @@ -355,21 +355,6 @@ public bool ShowFlattenOptions OnPropertyChanged(); } } - - // TODO remove when feature is marked as stable - public bool EnableOmnibarDesign - { - get => UserSettingsService.GeneralSettingsService.EnableOmnibarDesign; - set - { - if (value == UserSettingsService.GeneralSettingsService.EnableOmnibarDesign) - return; - - UserSettingsService.GeneralSettingsService.EnableOmnibarDesign = value; - OnPropertyChanged(); - } - } - public async Task OpenFilesOnWindowsStartupAsync() { var stateMode = await ReadState(); diff --git a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs index bc245cee978d..e3b7b968c59f 100644 --- a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs @@ -33,7 +33,6 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr private readonly IUserSettingsService UserSettingsService = Ioc.Default.GetRequiredService(); private readonly IAppearanceSettingsService AppearanceSettingsService = Ioc.Default.GetRequiredService(); - private readonly IGeneralSettingsService GeneralSettingsService = Ioc.Default.GetRequiredService(); private readonly DrivesViewModel drivesViewModel = Ioc.Default.GetRequiredService(); private readonly IUpdateService UpdateService = Ioc.Default.GetRequiredService(); private readonly ICommandManager Commands = Ioc.Default.GetRequiredService(); @@ -52,17 +51,11 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr // Events public delegate void ToolbarPathItemInvokedEventHandler(object sender, PathNavigationEventArgs e); - public delegate void ToolbarFlyoutOpeningEventHandler(object sender, ToolbarFlyoutOpeningEventArgs e); - public delegate void ToolbarPathItemLoadedEventHandler(object sender, ToolbarPathItemLoadedEventArgs e); - public delegate void AddressBarTextEnteredEventHandler(object sender, AddressBarTextEnteredEventArgs e); public delegate void PathBoxItemDroppedEventHandler(object sender, PathBoxItemDroppedEventArgs e); public event ToolbarPathItemInvokedEventHandler? ToolbarPathItemInvoked; - public event ToolbarFlyoutOpeningEventHandler? ToolbarFlyoutOpening; - public event ToolbarPathItemLoadedEventHandler? ToolbarPathItemLoaded; public event IAddressToolbarViewModel.ItemDraggedOverPathItemEventHandler? ItemDraggedOverPathItem; - public event EventHandler? EditModeEnabled; public event IAddressToolbarViewModel.ToolbarQuerySubmittedEventHandler? PathBoxQuerySubmitted; - public event AddressBarTextEnteredEventHandler? AddressBarTextEntered; + public event PathBoxItemDroppedEventHandler? PathBoxItemDropped; public event EventHandler? RefreshWidgetsRequested; @@ -82,10 +75,6 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr public bool IsSingleItemOverride { get; set; } - [Obsolete("Superseded by Omnibar.")] - public bool SearchHasFocus { get; private set; } - - public bool EnableOmnibarDesign => GeneralSettingsService.EnableOmnibarDesign; public bool ShowStatusCenterButton => AppearanceSettingsService.StatusCenterVisibility == StatusCenterVisibility.Always || (AppearanceSettingsService.StatusCenterVisibility == StatusCenterVisibility.DuringOngoingFileOperations && OngoingTasksViewModel.HasAnyItem); @@ -94,9 +83,6 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr private NavigationToolbar? AddressToolbar => (MainWindow.Instance.Content as Frame)?.FindDescendant(); - [Obsolete("Superseded by Omnibar.")] - public SearchBoxViewModel SearchBoxViewModel => (SearchBoxViewModel)SearchBox; - public bool HasAdditionalAction => InstanceViewModel.IsPageTypeRecycleBin || Commands.RunWithPowershell.IsExecutable || @@ -157,9 +143,6 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr (IsCardsLayout && UserSettingsService.LayoutSettingsService.CardsViewSize == CardsViewSizeKind.ExtraLarge) || (IsGridLayout && UserSettingsService.LayoutSettingsService.GridViewSize == GridViewSizeKind.ExtraLarge); - private bool _IsCommandPaletteOpen; - public bool IsCommandPaletteOpen { get => _IsCommandPaletteOpen; set => SetProperty(ref _IsCommandPaletteOpen, value); } - private bool _IsDynamicOverflowEnabled; public bool IsDynamicOverflowEnabled { get => _IsDynamicOverflowEnabled; set => SetProperty(ref _IsDynamicOverflowEnabled, value); } @@ -187,18 +170,6 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr private bool _CanRefresh; public bool CanRefresh { get => _CanRefresh; set => SetProperty(ref _CanRefresh, value); } - private string _SearchButtonGlyph = "\uE721"; - [Obsolete("Superseded by Omnibar.")] - public string SearchButtonGlyph { get => _SearchButtonGlyph; set => SetProperty(ref _SearchButtonGlyph, value); } - - private bool _ManualEntryBoxLoaded; - [Obsolete("Superseded by Omnibar.")] - public bool ManualEntryBoxLoaded { get => _ManualEntryBoxLoaded; set => SetProperty(ref _ManualEntryBoxLoaded, value); } - - private bool _ClickablePathLoaded = true; - [Obsolete("Superseded by Omnibar.")] - public bool ClickablePathLoaded { get => _ClickablePathLoaded; set => SetProperty(ref _ClickablePathLoaded, value); } - private string _PathControlDisplayText; [Obsolete("Superseded by Omnibar.")] public string PathControlDisplayText { get => _PathControlDisplayText; set => SetProperty(ref _PathControlDisplayText, value); } @@ -209,21 +180,6 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr private Style _LayoutThemedIcon; public Style LayoutThemedIcon { get => _LayoutThemedIcon; set => SetProperty(ref _LayoutThemedIcon, value); } - private ISearchBoxViewModel _SearchBox = new SearchBoxViewModel(); - public ISearchBoxViewModel SearchBox { get => _SearchBox; set => SetProperty(ref _SearchBox, value); } - - private bool _IsSearchBoxVisible; - [Obsolete("Superseded by Omnibar.")] - public bool IsSearchBoxVisible - { - get => _IsSearchBoxVisible; - set - { - if (SetProperty(ref _IsSearchBoxVisible, value)) - SearchButtonGlyph = value ? "\uE711" : "\uE721"; - } - } - // SetProperty doesn't seem to properly notify the binding in path bar private string? _PathText; public string? PathText @@ -236,6 +192,10 @@ public string? PathText } } + // Workaround to ensure Omnibar is only loaded after the ViewModel is initialized + public bool LoadOmnibar => + true; + private string? _OmnibarCommandPaletteModeText; public string? OmnibarCommandPaletteModeText { get => _OmnibarCommandPaletteModeText; set => SetProperty(ref _OmnibarCommandPaletteModeText, value); } @@ -262,31 +222,6 @@ public CurrentInstanceViewModel InstanceViewModel } } - [Obsolete("Superseded by Omnibar.")] - public bool IsEditModeEnabled - { - get => ManualEntryBoxLoaded; - set - { - if (value) - { - EditModeEnabled?.Invoke(this, EventArgs.Empty); - - var visiblePath = AddressToolbar?.FindDescendant(x => x.Name == "VisiblePath"); - visiblePath?.Focus(FocusState.Programmatic); - visiblePath?.FindDescendant()?.SelectAll(); - - AddressBarTextEntered?.Invoke(this, new AddressBarTextEnteredEventArgs() { AddressBarTextField = visiblePath }); - } - else - { - IsCommandPaletteOpen = false; - ManualEntryBoxLoaded = false; - ClickablePathLoaded = true; - } - } - } - private List? _SelectedItems; public List? SelectedItems { @@ -319,7 +254,6 @@ public NavigationToolbarViewModel() _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); _dragOverTimer = _dispatcherQueue.CreateTimer(); - SearchBox.Escaped += SearchRegion_Escaped; UserSettingsService.OnSettingChangedEvent += UserSettingsService_OnSettingChangedEvent; UpdateService.PropertyChanged += UpdateService_OnPropertyChanged; @@ -359,15 +293,6 @@ public NavigationToolbarViewModel() break; } }; - GeneralSettingsService.PropertyChanged += (s, e) => - { - switch (e.PropertyName) - { - case nameof(GeneralSettingsService.EnableOmnibarDesign): - OnPropertyChanged(nameof(EnableOmnibarDesign)); - break; - } - }; OngoingTasksViewModel.PropertyChanged += (s, e) => { switch (e.PropertyName) @@ -546,32 +471,6 @@ x.Item is ZipStorageFile || deferral.Complete(); } - [Obsolete("Superseded by Omnibar.")] - public void PathItemSeparator_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) - { - var pathSeparatorIcon = sender as FontIcon; - if (pathSeparatorIcon is null || pathSeparatorIcon.DataContext is null) - return; - - ToolbarPathItemLoaded?.Invoke(pathSeparatorIcon, new ToolbarPathItemLoadedEventArgs() - { - Item = (PathBoxItem)pathSeparatorIcon.DataContext, - OpenedFlyout = (MenuFlyout)pathSeparatorIcon.ContextFlyout - }); - } - - [Obsolete("Superseded by Omnibar.")] - public void PathboxItemFlyout_Opening(object sender, object e) - { - ToolbarFlyoutOpening?.Invoke(this, new ToolbarFlyoutOpeningEventArgs((MenuFlyout)sender)); - } - - [Obsolete("Superseded by Omnibar.")] - public void PathBoxItemFlyout_Closed(object sender, object e) - { - ((MenuFlyout)sender).Items.Clear(); - } - [Obsolete("Superseded by Omnibar.")] public void CurrentPathSetTextBox_TextChanged(object sender, TextChangedEventArgs args) { @@ -579,31 +478,6 @@ public void CurrentPathSetTextBox_TextChanged(object sender, TextChangedEventArg PathBoxQuerySubmitted?.Invoke(this, new ToolbarQuerySubmittedEventArgs() { QueryText = textBox.Text }); } - [Obsolete("Superseded by Omnibar.")] - public void VisiblePath_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) - { - if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput) - AddressBarTextEntered?.Invoke(this, new AddressBarTextEnteredEventArgs() { AddressBarTextField = sender }); - } - - [Obsolete("Superseded by Omnibar.")] - public void VisiblePath_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) - { - PathBoxQuerySubmitted?.Invoke(this, new ToolbarQuerySubmittedEventArgs() { QueryText = args.QueryText }); - - (this as IAddressToolbarViewModel).IsEditModeEnabled = false; - } - - [Obsolete("Superseded by Omnibar.")] - public void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e) - { - if (e.Pointer.PointerDeviceType != Microsoft.UI.Input.PointerDeviceType.Mouse) - return; - - var ptrPt = e.GetCurrentPoint(AddressToolbar); - _pointerRoutedEventArgs = ptrPt.Properties.IsMiddleButtonPressed ? e : null; - } - public async Task HandleFolderNavigationAsync(string path, bool openNewTab = false) { openNewTab |= _pointerRoutedEventArgs is not null; @@ -723,75 +597,14 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidItemDialogTitle.GetLoca PathControlDisplayText = ContentPageContext.ShellPage.ShellViewModel.WorkingDirectory; } - [Obsolete("Superseded by Omnibar.")] - public void PathBoxItem_PreviewKeyDown(object sender, KeyRoutedEventArgs e) - { - switch (e.Key) - { - case Windows.System.VirtualKey.Down: - { - var item = e.OriginalSource as ListViewItem; - var button = item?.FindDescendant