Skip to content

Commit ec01106

Browse files
committed
Code Quality: Removed old address bar code
1 parent d7e0e9d commit ec01106

36 files changed

+26
-1442
lines changed

src/Files.App/Actions/Content/PreviewPopup/LaunchPreviewPopupAction.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public HotKey HotKey
2020

2121
public bool IsExecutable =>
2222
context.SelectedItems.Count == 1 &&
23-
(!context.ShellPage?.ToolbarViewModel?.IsEditModeEnabled ?? false) &&
2423
(!context.ShellPage?.SlimContentPage?.IsRenamingItem ?? false);
2524

2625
public LaunchPreviewPopupAction()

src/Files.App/Actions/Content/Selection/ClearSelectionAction.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ public bool IsExecutable
3030
if (page is null)
3131
return false;
3232

33-
bool isCommandPaletteOpen = page.ToolbarViewModel.IsCommandPaletteOpen;
34-
bool isEditing = page.ToolbarViewModel.IsEditModeEnabled;
3533
bool isRenaming = page.SlimContentPage.IsRenamingItem;
3634

37-
return isCommandPaletteOpen || (!isEditing && !isRenaming);
35+
return !isRenaming;
3836
}
3937
}
4038

src/Files.App/Actions/Content/Selection/InvertSelectionAction.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ public bool IsExecutable
3030
if (page is null)
3131
return false;
3232

33-
bool isCommandPaletteOpen = page.ToolbarViewModel.IsCommandPaletteOpen;
34-
bool isEditing = page.ToolbarViewModel.IsEditModeEnabled;
3533
bool isRenaming = page.SlimContentPage.IsRenamingItem;
36-
37-
return isCommandPaletteOpen || (!isEditing && !isRenaming);
34+
return !isRenaming;
3835
}
3936
}
4037

src/Files.App/Actions/Content/Selection/SelectAllAction.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ public bool IsExecutable
3535
if (itemCount == selectedItemCount)
3636
return false;
3737

38-
bool isCommandPaletteOpen = page.ToolbarViewModel.IsCommandPaletteOpen;
39-
bool isEditing = page.ToolbarViewModel.IsEditModeEnabled;
4038
bool isRenaming = page.SlimContentPage?.IsRenamingItem ?? false;
4139

42-
return isCommandPaletteOpen || (!isEditing && !isRenaming);
40+
return !isRenaming;
4341
}
4442
}
4543

src/Files.App/Actions/Global/EditPathAction.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ public EditPathAction()
3131
public Task ExecuteAsync(object? parameter = null)
3232
{
3333
if (context.ShellPage is not null)
34-
{
35-
if (GeneralSettingsService.EnableOmnibarDesign)
36-
context.ShellPage!.ToolbarViewModel.SwitchToPathMode();
37-
else
38-
context.ShellPage.ToolbarViewModel.IsEditModeEnabled = true;
39-
}
34+
context.ShellPage!.ToolbarViewModel.SwitchToPathMode();
4035

4136
return Task.CompletedTask;
4237
}

src/Files.App/Actions/Global/SearchAction.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@ public HotKey SecondHotKey
2222
public RichGlyph Glyph
2323
=> new(themedIconStyle: "App.ThemedIcons.Omnibar.Search");
2424

25-
public bool IsExecutable
26-
=> !context.IsSearchBoxVisible;
27-
2825
public SearchAction()
2926
{
3027
context = Ioc.Default.GetRequiredService<IContentPageContext>();
31-
32-
context.PropertyChanged += Context_PropertyChanged;
3328
}
3429

3530
public Task ExecuteAsync(object? parameter = null)
@@ -38,15 +33,5 @@ public Task ExecuteAsync(object? parameter = null)
3833

3934
return Task.CompletedTask;
4035
}
41-
42-
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
43-
{
44-
switch (e.PropertyName)
45-
{
46-
case nameof(IContentPageContext.IsSearchBoxVisible):
47-
OnPropertyChanged(nameof(IsExecutable));
48-
break;
49-
}
50-
}
5136
}
5237
}

src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ internal sealed partial class ContentPageContext : ObservableObject, IContentPag
3939

4040
public bool CanNavigateToParent => ShellPage is not null && ShellPage.ToolbarViewModel.CanNavigateToParent;
4141

42-
public bool IsSearchBoxVisible => ShellPage is not null && ShellPage.ToolbarViewModel.IsSearchBoxVisible;
43-
4442
public bool CanCreateItem => GetCanCreateItem();
4543

4644
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
167165
case nameof(NavigationToolbarViewModel.CanNavigateToParent):
168166
case nameof(NavigationToolbarViewModel.HasItem):
169167
case nameof(NavigationToolbarViewModel.CanRefresh):
170-
case nameof(NavigationToolbarViewModel.IsSearchBoxVisible):
171168
OnPropertyChanged(e.PropertyName);
172169
break;
173170
case nameof(NavigationToolbarViewModel.SelectedItems):

src/Files.App/Data/Contexts/ContentPage/IContentPageContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public interface IContentPageContext : INotifyPropertyChanged
2323
bool CanGoForward { get; }
2424
bool CanNavigateToParent { get; }
2525

26-
bool IsSearchBoxVisible { get; }
27-
2826
bool CanCreateItem { get; }
2927

3028
bool IsMultiPaneAvailable { get; }

src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ namespace Files.App.Data.Contexts
1010
{
1111
internal sealed partial class MultitaskingContext : ObservableObject, IMultitaskingContext
1212
{
13-
private readonly MainPageViewModel MainPageViewModel = Ioc.Default.GetRequiredService<MainPageViewModel>();
14-
1513
private bool isPopupOpen = false;
1614

1715
private ITabBar? control;
@@ -72,9 +70,6 @@ private void FocusManager_GotFocus(object? sender, FocusManagerGotFocusEventArgs
7270
{
7371
int newSelectedIndex = MainPageViewModel.AppInstances.IndexOf(tabItem);
7472
UpdateSelectedTabIndex(newSelectedIndex);
75-
76-
// Focus the content of the selected tab item (needed for pointer navigation)
77-
(MainPageViewModel.SelectedTabItem?.TabItemContent as Control)?.Focus(FocusState.Programmatic);
7873
}
7974
}
8075

src/Files.App/Data/Contracts/IAddressToolbarViewModel.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ namespace Files.App.Data.Contracts
55
{
66
public interface IAddressToolbarViewModel
77
{
8-
public bool IsSearchBoxVisible { get; set; }
9-
10-
public bool IsEditModeEnabled { get; set; }
11-
12-
/// <summary>
13-
/// Gets or sets the value that indicates whether the command palette is open.
14-
/// </summary>
15-
public bool IsCommandPaletteOpen { get; set; }
16-
178
public bool CanRefresh { get; set; }
189

1910
public bool CanCopyPathInPage { get; set; }
@@ -36,14 +27,11 @@ public interface IAddressToolbarViewModel
3627

3728
public event ToolbarQuerySubmittedEventHandler PathBoxQuerySubmitted;
3829

39-
public event EventHandler EditModeEnabled;
4030

4131
public event ItemDraggedOverPathItemEventHandler ItemDraggedOverPathItem;
4232

4333
public event EventHandler RefreshWidgetsRequested;
4434

4535
public void SwitchToSearchMode();
46-
47-
public ISearchBoxViewModel SearchBox { get; }
4836
}
4937
}

0 commit comments

Comments
 (0)