Skip to content

Code Quality: Removed old address bar code #17286

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

Merged
merged 4 commits into from
Jul 21, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/Files.App/Actions/Content/Selection/SelectAllAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/Files.App/Actions/Global/EditPathAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
15 changes: 0 additions & 15 deletions src/Files.App/Actions/Global/SearchAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IContentPageContext>();

context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync(object? parameter = null)
Expand All @@ -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;
}
}
}
}
3 changes: 0 additions & 3 deletions src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public interface IContentPageContext : INotifyPropertyChanged
bool CanGoForward { get; }
bool CanNavigateToParent { get; }

bool IsSearchBoxVisible { get; }

bool CanCreateItem { get; }

bool IsMultiPaneAvailable { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace Files.App.Data.Contexts
{
internal sealed partial class MultitaskingContext : ObservableObject, IMultitaskingContext
{
private readonly MainPageViewModel MainPageViewModel = Ioc.Default.GetRequiredService<MainPageViewModel>();

private bool isPopupOpen = false;

private ITabBar? control;
Expand Down Expand Up @@ -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);
}
}

Expand Down
12 changes: 0 additions & 12 deletions src/Files.App/Data/Contracts/IAddressToolbarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ namespace Files.App.Data.Contracts
{
public interface IAddressToolbarViewModel
{
public bool IsSearchBoxVisible { get; set; }

public bool IsEditModeEnabled { get; set; }

/// <summary>
/// Gets or sets the value that indicates whether the command palette is open.
/// </summary>
public bool IsCommandPaletteOpen { get; set; }

public bool CanRefresh { get; set; }

public bool CanCopyPathInPage { get; set; }
Expand All @@ -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; }
}
}
5 changes: 0 additions & 5 deletions src/Files.App/Data/Contracts/IGeneralSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,5 @@ public interface IGeneralSettingsService : IBaseSettingsService, INotifyProperty
/// Gets or sets a value whether the filter header should be displayed.
/// </summary>
bool ShowFilterHeader { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to enable the Omnibar.
/// </summary>
bool EnableOmnibarDesign { get; set; }
}
}
26 changes: 0 additions & 26 deletions src/Files.App/Data/Contracts/ISearchBoxViewModel.cs

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions src/Files.App/Data/EventArguments/ToolbarFlyoutOpeningEventArgs.cs

This file was deleted.

This file was deleted.

35 changes: 0 additions & 35 deletions src/Files.App/Data/TemplateSelectors/PathBreadcrumbItemSelector.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/Files.App/Services/Settings/GeneralSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -4223,9 +4223,6 @@
<data name="Decimal" xml:space="preserve">
<value>Decimal</value>
</data>
<data name="EnableOmnibar" xml:space="preserve">
<value>Enable Omnibar</value>
</data>
<data name="SectionsHiddenMessage" xml:space="preserve">
<value>You can add sections to the sidebar by right-clicking and selecting the sections you want to add</value>
</data>
Expand Down
Loading
Loading