25 files changed

+244
-249
lines changed
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
namespace Files.App.Actions
77
{
8-
internal sealed partial class OpenSettingsAction : BaseUIAction, IAction
8+
internal sealed partial class OpenSettingsAction : ObservableObject, IAction
99
{
10-
private readonly IDialogService dialogService = Ioc.Default.GetRequiredService<IDialogService>();
11-
12-
private readonly SettingsDialogViewModel viewModel = new();
10+
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();
1311

1412
public string Label
1513
=> Strings.Settings.GetLocalizedResource();
@@ -22,11 +20,20 @@ public HotKey HotKey
2220

2321
public Task ExecuteAsync(object? parameter = null)
2422
{
25-
var dialog = dialogService.GetDialog(viewModel);
26-
if (parameter is not null && parameter is SettingsNavigationParams navParams)
27-
((SettingsDialog)dialog).NavigateTo(navParams);
28-
29-
return dialog.TryShowAsync();
23+
// Find index of existing Settings tab or open new one
24+
var existingTabIndex = MainPageViewModel.AppInstances
25+
.Select((tabItem, index) => new { TabItem = tabItem, Index = index })
26+
.FirstOrDefault(item =>
27+
item.TabItem.NavigationParameter.NavigationParameter is PaneNavigationArguments paneArgs &&
28+
(paneArgs.LeftPaneNavPathParam == "Settings" || paneArgs.RightPaneNavPathParam == "Settings"))
29+
?.Index ?? -1;
30+
31+
if (existingTabIndex >= 0)
32+
App.AppModel.TabStripSelectedIndex = existingTabIndex;
33+
else
34+
NavigationHelpers.OpenPathInNewTab("Settings", true);
35+
36+
return Task.CompletedTask;
3037
}
3138
}
32-
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public interface IShellPage : ITabBarItemContent, IMultiPaneInfo, IDisposable, I
7070
/// Navigates to the release notes page
7171
/// </summary>
7272
public void NavigateToReleaseNotes();
73+
74+
/// <summary>
75+
/// Navigates to the settings page
76+
/// </summary>
77+
public void NavigateToSettings();
7378

7479
void NavigateWithArguments(Type sourcePageType, NavigationArguments navArgs);
7580

This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static IHost ConfigureHost()
246246
.AddSingleton<NetworkLocationsWidgetViewModel>()
247247
.AddSingleton<FileTagsWidgetViewModel>()
248248
.AddSingleton<RecentFilesWidgetViewModel>()
249-
.AddSingleton<ReleaseNotesViewModel>()
249+
.AddSingleton<SettingsViewModel>()
250250
// Utilities
251251
.AddSingleton<QuickAccessManager>()
252252
.AddSingleton<StorageHistoryWrapper>()
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ private static async Task UpdateTabInfoAsync(TabBarItem tabItem, object navigati
159159
imageSource = new BitmapImage(new Uri(Constants.FluentIconsPaths.HomeIcon));
160160
else if (path == "ReleaseNotes")
161161
imageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath));
162-
// TODO add settings page
163-
//else if (path == "Settings")
164-
// imageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath));
162+
else if (path == "Settings")
163+
imageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath));
165164
else if (WSLDistroManager.TryGetDistro(path, out WslDistroItem? wslDistro) && path.Equals(wslDistro.Path))
166165
imageSource = new BitmapImage(wslDistro.Icon);
167166
else
@@ -202,12 +201,11 @@ private static async Task UpdateTabInfoAsync(TabBarItem tabItem, object navigati
202201
tabLocationHeader = Strings.ReleaseNotes.GetLocalizedResource();
203202
iconSource.ImageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath));
204203
}
205-
// TODO add settings page
206-
//else if (currentPath == "Settings")
207-
//{
208-
// tabLocationHeader = Strings.Settings.GetLocalizedResource();
209-
// iconSource.ImageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath));
210-
//}
204+
else if (currentPath == "Settings")
205+
{
206+
tabLocationHeader = Strings.Settings.GetLocalizedResource();
207+
iconSource.ImageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath));
208+
}
211209
else if (currentPath.Equals(Constants.UserEnvironmentPaths.DesktopPath, StringComparison.OrdinalIgnoreCase))
212210
tabLocationHeader = Strings.Desktop.GetLocalizedResource();
213211
else if (currentPath.Equals(Constants.UserEnvironmentPaths.DownloadsPath, StringComparison.OrdinalIgnoreCase))
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public DialogService()
2828
{ typeof(ElevateConfirmDialogViewModel), () => new ElevateConfirmDialog() },
2929
{ typeof(FileSystemDialogViewModel), () => new FilesystemOperationDialog() },
3030
{ typeof(DecompressArchiveDialogViewModel), () => new DecompressArchiveDialog() },
31-
{ typeof(SettingsDialogViewModel), () => new SettingsDialog() },
3231
{ typeof(CreateShortcutDialogViewModel), () => new CreateShortcutDialog() },
3332
{ typeof(ReorderSidebarItemsDialogViewModel), () => new ReorderSidebarItemsDialog() },
3433
{ typeof(AddBranchDialogViewModel), () => new AddBranchDialog() },
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ public static async Task<List<PatxItem>> GetDirectoryPathComponentsWithDispla
142142
item.Title = Strings.Home.GetLocalizedResource();
143143
if (item.Path == "ReleaseNotes")
144144
item.Title = Strings.ReleaseNotes.GetLocalizedResource();
145-
// TODO add settings page
146-
//if (item.Path == "Settings")
147-
// item.Title = Strings.Settings.GetLocalizedResource();
145+
if (item.Path == "Settings")
146+
item.Title = Strings.Settings.GetLocalizedResource();
148147
else
149148
{
150149
BaseStorageFolder folder = await FilesystemTasks.Wrap(() => DangerousGetFolderFromPathAsync(item.Path));
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) Files Community
2+
// Licensed under the MIT License.
3+
4+
namespace Files.App.ViewModels
5+
{
6+
public sealed partial class SettingsViewModel : ObservableObject
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,11 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.CommandNotExecutable.GetLocali
779779
SavePathToHistory("ReleaseNotes");
780780
shellPage.NavigateToReleaseNotes();
781781
}
782-
// TODO add settings page
783-
//else if (normalizedInput.Equals("Settings", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Settings.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
784-
//{
785-
// SavePathToHistory("Settings");
786-
// shellPage.NavigateToReleaseNotes();
787-
//}
782+
else if (normalizedInput.Equals("Settings", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Settings.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
783+
{
784+
SavePathToHistory("Settings");
785+
shellPage.NavigateToReleaseNotes();
786+
}
788787
else
789788
{
790789
normalizedInput = StorageFileExtensions.GetResolvedPath(normalizedInput, isFtp);
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public sealed partial class ReleaseNotesPage : Page, IDisposable
1414
// Dependency injections
1515
public ReleaseNotesViewModel ViewModel { get; } = Ioc.Default.GetRequiredService<ReleaseNotesViewModel>();
1616

17-
1817
private FrameworkElement RootAppElement
1918
=> (FrameworkElement)MainWindow.Instance.Content;
2019

@@ -43,6 +42,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
4342
AppInstance.InstanceViewModel.GitRepositoryPath = null;
4443
AppInstance.InstanceViewModel.IsGitRepository = false;
4544
AppInstance.InstanceViewModel.IsPageTypeReleaseNotes = true;
45+
AppInstance.InstanceViewModel.IsPageTypeSettings = false;
4646
AppInstance.ToolbarViewModel.CanRefresh = false;
4747
AppInstance.ToolbarViewModel.CanGoBack = AppInstance.CanNavigateBackward;
4848
AppInstance.ToolbarViewModel.CanGoForward = AppInstance.CanNavigateForward;
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222
VerticalAlignment="Stretch"
2323
Spacing="4">
2424

25-
<!-- Title -->
26-
<TextBlock
27-
Padding="0,0,0,12"
28-
FontSize="24"
29-
FontWeight="Medium"
30-
Text="{helpers:ResourceString Name=About}" />
31-
3225
<!-- App Info -->
3326
<wctcontrols:SettingsCard
3427
HorizontalAlignment="Stretch"
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@
6161
VerticalAlignment="Stretch"
6262
Spacing="4">
6363

64-
<!-- Title -->
65-
<TextBlock
66-
Padding="0,0,0,12"
67-
FontSize="24"
68-
FontWeight="Medium"
69-
Text="{helpers:ResourceString Name=Actions}" />
70-
7164
<!-- Subtitle -->
7265
<Grid ColumnSpacing="12">
7366
<Grid.ColumnDefinitions>
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@
2828
VerticalAlignment="Stretch"
2929
Spacing="4">
3030

31-
<!-- Title -->
32-
<TextBlock
33-
Padding="0,0,0,12"
34-
FontSize="24"
35-
FontWeight="Medium"
36-
Text="{helpers:ResourceString Name=Advanced}" />
37-
3831
<!-- Export -->
3932
<wctcontrols:SettingsCard
4033
Command="{x:Bind ViewModel.ExportSettingsCommand}"
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,6 @@
8787
VerticalAlignment="Stretch"
8888
Spacing="4">
8989

90-
<!-- Title -->
91-
<TextBlock
92-
Padding="0,0,0,12"
93-
FontSize="24"
94-
FontWeight="Medium"
95-
Text="{helpers:ResourceString Name=Appearance}" />
96-
9790
<!-- Theme -->
9891
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=SettingsAppearanceTheme}">
9992
<wctcontrols:SettingsCard.HeaderIcon>
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@
3838
VerticalAlignment="Stretch"
3939
Spacing="4">
4040

41-
<!-- Title -->
42-
<TextBlock
43-
Padding="0,0,0,12"
44-
FontSize="24"
45-
FontWeight="Medium"
46-
Text="{helpers:ResourceString Name=DevTools}" />
47-
4841
<!-- Display Open IDE status bar button -->
4942
<wctcontrols:SettingsExpander Header="{helpers:ResourceString Name=DisplayOpenIDE}">
5043
<wctcontrols:SettingsExpander.HeaderIcon>
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
VerticalAlignment="Stretch"
2222
Spacing="4">
2323

24-
<!-- Title -->
25-
<TextBlock
26-
Padding="0,0,0,12"
27-
FontSize="24"
28-
FontWeight="Medium"
29-
Text="{helpers:ResourceString Name=FilesAndFolders}" />
30-
3124
<!-- Display -->
3225
<TextBlock
3326
Padding="0,16,0,4"
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
2323
VerticalAlignment="Stretch"
2424
Spacing="4">
2525

26-
<!-- Title -->
27-
<TextBlock
28-
Padding="0,0,0,12"
29-
FontSize="24"
30-
FontWeight="Medium"
31-
Text="{helpers:ResourceString Name=General}" />
32-
3326
<!-- Language settings -->
3427
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=Language}">
3528
<wctcontrols:SettingsCard.HeaderIcon>
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@
2828
VerticalAlignment="Stretch"
2929
Spacing="4">
3030

31-
<!-- Title -->
32-
<TextBlock
33-
Padding="0,0,0,12"
34-
FontSize="24"
35-
FontWeight="Medium"
36-
Text="{helpers:ResourceString Name=Layout}" />
37-
3831
<!-- Folder Overrides -->
3932
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=SyncFolderPreferencesAcrossDirectories}">
4033
<wctcontrols:SettingsCard.HeaderIcon>

0 commit comments

Comments
 (0)