diff --git a/src/Files.App/BaseLayout.cs b/src/Files.App/BaseLayout.cs index 8cbbcf330c56..51e3a31e6155 100644 --- a/src/Files.App/BaseLayout.cs +++ b/src/Files.App/BaseLayout.cs @@ -918,7 +918,7 @@ private void RefreshContainer(SelectorItem container, bool inRecycleQueue) { container.PointerPressed += FileListItem_PointerPressed; container.RightTapped += FileListItem_RightTapped; - if (UserSettingsService.PreferencesSettingsService.SelectFilesOnHover) + if (UserSettingsService.FoldersSettingsService.SelectFilesOnHover) { container.PointerEntered += FileListItem_PointerEntered; container.PointerExited += FileListItem_PointerExited; @@ -971,7 +971,7 @@ protected static void FileListItem_PointerPressed(object sender, PointerRoutedEv protected internal void FileListItem_PointerEntered(object sender, PointerRoutedEventArgs e) { - if (!UserSettingsService.PreferencesSettingsService.SelectFilesOnHover) + if (!UserSettingsService.FoldersSettingsService.SelectFilesOnHover) return; var hovered = GetItemFromElement(sender); @@ -1015,7 +1015,7 @@ selectedItems is not null && protected internal void FileListItem_PointerExited(object sender, PointerRoutedEventArgs e) { - if (!UserSettingsService.PreferencesSettingsService.SelectFilesOnHover) + if (!UserSettingsService.FoldersSettingsService.SelectFilesOnHover) return; hoverTimer.Stop(); diff --git a/src/Files.App/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs b/src/Files.App/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs index 21b0998aa1f1..56cb1642d262 100644 --- a/src/Files.App/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs +++ b/src/Files.App/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs @@ -120,7 +120,7 @@ public async Task DeleteItemsAsync(IEnumerable item.Path).Any(path => recycleBinHelpers.IsPathUnderRecycleBin(path)); var canBeSentToBin = !deleteFromRecycleBin && await recycleBinHelpers.HasRecycleBin(source.FirstOrDefault()?.Path); - if (showDialog && UserSettingsService.PreferencesSettingsService.ShowConfirmDeleteDialog) // Check if the setting to show a confirmation dialog is on + if (showDialog && UserSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog) // Check if the setting to show a confirmation dialog is on { var incomingItems = new List(); List? binItems = null; @@ -253,7 +253,7 @@ public async Task PerformOperationTypeAsync(DataPackageOperation o } if (destination.StartsWith(CommonPaths.RecycleBinPath, StringComparison.Ordinal)) { - showDialog |= UserSettingsService.PreferencesSettingsService.ShowConfirmDeleteDialog; + showDialog |= UserSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog; return await RecycleItemsFromClipboard(packageView, destination, showDialog, registerHistory); } else if (operation.HasFlag(DataPackageOperation.Copy)) diff --git a/src/Files.App/Filesystem/ListedItem.cs b/src/Files.App/Filesystem/ListedItem.cs index fb10ec157352..a2a31d958be9 100644 --- a/src/Files.App/Filesystem/ListedItem.cs +++ b/src/Files.App/Filesystem/ListedItem.cs @@ -270,7 +270,7 @@ public virtual string Name if (PrimaryItemAttribute == StorageItemTypes.File) { var nameWithoutExtension = Path.GetFileNameWithoutExtension(itemNameRaw); - if (!string.IsNullOrEmpty(nameWithoutExtension) && !UserSettingsService.PreferencesSettingsService.ShowFileExtensions) + if (!string.IsNullOrEmpty(nameWithoutExtension) && !UserSettingsService.FoldersSettingsService.ShowFileExtensions) { return nameWithoutExtension; } @@ -537,7 +537,7 @@ public override string Name get { var nameWithoutExtension = Path.GetFileNameWithoutExtension(ItemNameRaw); - if (!string.IsNullOrEmpty(nameWithoutExtension) && !UserSettingsService.PreferencesSettingsService.ShowFileExtensions) + if (!string.IsNullOrEmpty(nameWithoutExtension) && !UserSettingsService.FoldersSettingsService.ShowFileExtensions) { return nameWithoutExtension; } @@ -588,7 +588,7 @@ public override string Name { var nameWithoutExtension = Path.GetFileNameWithoutExtension(ItemNameRaw); var mainStreamNameWithoutExtension = Path.GetFileNameWithoutExtension(MainStreamName); - if (!UserSettingsService.PreferencesSettingsService.ShowFileExtensions) + if (!UserSettingsService.FoldersSettingsService.ShowFileExtensions) { return $"{(string.IsNullOrEmpty(mainStreamNameWithoutExtension) ? MainStreamName : mainStreamNameWithoutExtension)}:{(string.IsNullOrEmpty(nameWithoutExtension) ? ItemNameRaw : nameWithoutExtension)}"; } diff --git a/src/Files.App/ServicesImplementation/Settings/FoldersSettingsService.cs b/src/Files.App/ServicesImplementation/Settings/FoldersSettingsService.cs index 0f0b107f8b4d..cfeb7301f8a7 100644 --- a/src/Files.App/ServicesImplementation/Settings/FoldersSettingsService.cs +++ b/src/Files.App/ServicesImplementation/Settings/FoldersSettingsService.cs @@ -220,6 +220,30 @@ public GroupOption DefaultGroupOption set => Set((long)value); } + public bool ShowFileExtensions + { + get => Get(true); + set => Set(value); + } + + public bool ShowThumbnails + { + get => Get(true); + set => Set(value); + } + + public bool ShowConfirmDeleteDialog + { + get => Get(true); + set => Set(value); + } + + public bool SelectFilesOnHover + { + get => Get(false); + set => Set(value); + } + protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e) { switch (e.SettingName) @@ -245,6 +269,10 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged case nameof(ColumnLayoutOpenFoldersWithOneClick): case nameof(OpenFoldersInNewTab): case nameof(CalculateFolderSizes): + case nameof(ShowFileExtensions): + case nameof(ShowThumbnails): + case nameof(ShowConfirmDeleteDialog): + case nameof(SelectFilesOnHover): Analytics.TrackEvent($"Set {e.SettingName} to {e.NewValue}"); break; } diff --git a/src/Files.App/ServicesImplementation/Settings/PreferencesSettingsService.cs b/src/Files.App/ServicesImplementation/Settings/PreferencesSettingsService.cs index 08093628be48..1e00890b1f70 100644 --- a/src/Files.App/ServicesImplementation/Settings/PreferencesSettingsService.cs +++ b/src/Files.App/ServicesImplementation/Settings/PreferencesSettingsService.cs @@ -15,30 +15,6 @@ public PreferencesSettingsService(ISettingsSharingContext settingsSharingContext RegisterSettingsContext(settingsSharingContext); } - public bool ShowConfirmDeleteDialog - { - get => Get(true); - set => Set(value); - } - - public bool ShowFileExtensions - { - get => Get(true); - set => Set(value); - } - - public bool ShowThumbnails - { - get => Get(true); - set => Set(value); - } - - public bool SelectFilesOnHover - { - get => Get(false); - set => Set(value); - } - public bool SearchUnindexedItems { get => Get(false); @@ -199,9 +175,6 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged { switch (e.SettingName) { - case nameof(ShowConfirmDeleteDialog): - case nameof(ShowFileExtensions): - case nameof(SelectFilesOnHover): case nameof(SearchUnindexedItems): case nameof(OpenSpecificPageOnStartup): case nameof(ContinueLastSessionOnStartUp): diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index d5a5308f3592..62c909507acd 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -345,6 +345,9 @@ File + + Display + Enter an item name @@ -696,6 +699,9 @@ Invalid item + + Version + Version: @@ -741,6 +747,12 @@ Sponsor us on GitHub + + Personalization + + + Layout and sorting + We weren't able to create this item @@ -807,8 +819,8 @@ Move overflow items into a sub menu - - Show a confirmation dialog when deleting files or folders + + Show confirmation dialog when deleting items There was an issue saving some properties. @@ -2328,9 +2340,6 @@ Language - - Show a confirmation dialog when deleting files or folders - Ongoing Tasks @@ -2409,9 +2418,6 @@ Restore default - - Files and folders - Open new instance when opening directories from the taskbar jumplist @@ -2653,7 +2659,10 @@ Ctrl+Shift+7 - Show Alternate Data Streams + Show alternate data streams + + + Behaviors Review Files diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml b/src/Files.App/UserControls/InnerNavigationToolbar.xaml index 5a469ae4a535..c0202e3778a3 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml @@ -809,7 +809,7 @@ Grid.Column="1" HorizontalAlignment="Right" AutomationProperties.Name="{helpers:ResourceString Name=NavToolbarShowFileExtensions/AutomationProperties/Name}" - IsOn="{x:Bind UserSettingsService.PreferencesSettingsService.ShowFileExtensions, Mode=TwoWay}" + IsOn="{x:Bind UserSettingsService.FoldersSettingsService.ShowFileExtensions, Mode=TwoWay}" Rotation="1" Style="{StaticResource RightAlignedToggleSwitchStyle}" /> diff --git a/src/Files.App/ViewModels/ItemViewModel.cs b/src/Files.App/ViewModels/ItemViewModel.cs index 0fff237a6f89..7f5ca6c029ea 100644 --- a/src/Files.App/ViewModels/ItemViewModel.cs +++ b/src/Files.App/ViewModels/ItemViewModel.cs @@ -483,14 +483,14 @@ private async void UserSettingsService_OnSettingChangedEvent(object sender, Sett { switch (e.SettingName) { - case nameof(UserSettingsService.PreferencesSettingsService.ShowFileExtensions): - case nameof(UserSettingsService.PreferencesSettingsService.ShowThumbnails): + case nameof(UserSettingsService.FoldersSettingsService.ShowFileExtensions): + case nameof(UserSettingsService.FoldersSettingsService.ShowThumbnails): case nameof(UserSettingsService.FoldersSettingsService.ShowHiddenItems): case nameof(UserSettingsService.FoldersSettingsService.ShowProtectedSystemFiles): case nameof(UserSettingsService.FoldersSettingsService.AreAlternateStreamsVisible): case nameof(UserSettingsService.FoldersSettingsService.ShowDotFiles): case nameof(UserSettingsService.FoldersSettingsService.CalculateFolderSizes): - case nameof(UserSettingsService.PreferencesSettingsService.SelectFilesOnHover): + case nameof(UserSettingsService.FoldersSettingsService.SelectFilesOnHover): await dispatcherQueue.EnqueueAsync(() => { if (WorkingDirectory != "Home".GetLocalizedResource()) @@ -858,7 +858,7 @@ private async Task LoadItemThumbnail(ListedItem item, uint thumbnailSize = 96, I var wasIconLoaded = false; if (item.IsLibrary || item.PrimaryItemAttribute == StorageItemTypes.File || item.IsArchive) { - if (UserSettingsService.PreferencesSettingsService.ShowThumbnails && + if (UserSettingsService.FoldersSettingsService.ShowThumbnails && !item.IsShortcut && !item.IsHiddenItem && !FtpHelpers.IsFtpPath(item.ItemPath)) { var matchingStorageFile = matchingStorageItem.AsBaseStorageFile() ?? await GetFileFromPathAsync(item.ItemPath); diff --git a/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs b/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs index 936e7a513e6f..e3ae4ddc2f8a 100644 --- a/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs +++ b/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs @@ -233,6 +233,19 @@ public bool OpenFoldersNewTab } } + public bool ListAndSortDirectoriesAlongsideFiles + { + get => UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles; + set + { + if (value != UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles) + { + UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles = value; + OnPropertyChanged(); + } + } + } + public bool CalculateFolderSizes { get => UserSettingsService.FoldersSettingsService.CalculateFolderSizes; @@ -273,7 +286,59 @@ public int SelectedDefaultGroupingIndex } } } - + + public bool ShowFileExtensions + { + get => UserSettingsService.FoldersSettingsService.ShowFileExtensions; + set + { + if (value != UserSettingsService.FoldersSettingsService.ShowFileExtensions) + { + UserSettingsService.FoldersSettingsService.ShowFileExtensions = value; + OnPropertyChanged(); + } + } + } + + public bool ShowThumbnails + { + get => UserSettingsService.FoldersSettingsService.ShowThumbnails; + set + { + if (value != UserSettingsService.FoldersSettingsService.ShowThumbnails) + { + UserSettingsService.FoldersSettingsService.ShowThumbnails = value; + OnPropertyChanged(); + } + } + } + + public bool ShowConfirmDeleteDialog + { + get => UserSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog; + set + { + if (value != UserSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog) + { + UserSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog = value; + OnPropertyChanged(); + } + } + } + + public bool SelectFilesOnHover + { + get => UserSettingsService.FoldersSettingsService.SelectFilesOnHover; + set + { + if (value != UserSettingsService.FoldersSettingsService.SelectFilesOnHover) + { + UserSettingsService.FoldersSettingsService.SelectFilesOnHover = value; + OnPropertyChanged(); + } + } + } + // Local methods public void ResetLayoutPreferences() diff --git a/src/Files.App/ViewModels/SettingsViewModels/PreferencesViewModel.cs b/src/Files.App/ViewModels/SettingsViewModels/PreferencesViewModel.cs index 104255877d7a..cdf5562314e2 100644 --- a/src/Files.App/ViewModels/SettingsViewModels/PreferencesViewModel.cs +++ b/src/Files.App/ViewModels/SettingsViewModels/PreferencesViewModel.cs @@ -348,19 +348,6 @@ public string DateFormatSample private DispatcherQueue dispatcherQueue; - public bool ShowConfirmDeleteDialog - { - get => UserSettingsService.PreferencesSettingsService.ShowConfirmDeleteDialog; - set - { - if (value != UserSettingsService.PreferencesSettingsService.ShowConfirmDeleteDialog) - { - UserSettingsService.PreferencesSettingsService.ShowConfirmDeleteDialog = value; - OnPropertyChanged(); - } - } - } - public DateTimeFormats DateTimeFormat { get => UserSettingsService.PreferencesSettingsService.DateTimeFormat; @@ -449,58 +436,6 @@ public async Task ReadState() return state.State; } - public bool ShowFileExtensions - { - get => UserSettingsService.PreferencesSettingsService.ShowFileExtensions; - set - { - if (value != UserSettingsService.PreferencesSettingsService.ShowFileExtensions) - { - UserSettingsService.PreferencesSettingsService.ShowFileExtensions = value; - OnPropertyChanged(); - } - } - } - - public bool ShowThumbnails - { - get => UserSettingsService.PreferencesSettingsService.ShowThumbnails; - set - { - if (value != UserSettingsService.PreferencesSettingsService.ShowThumbnails) - { - UserSettingsService.PreferencesSettingsService.ShowThumbnails = value; - OnPropertyChanged(); - } - } - } - - public bool SelectFilesOnHover - { - get => UserSettingsService.PreferencesSettingsService.SelectFilesOnHover; - set - { - if (value != UserSettingsService.PreferencesSettingsService.SelectFilesOnHover) - { - UserSettingsService.PreferencesSettingsService.SelectFilesOnHover = value; - OnPropertyChanged(); - } - } - } - - public bool ListAndSortDirectoriesAlongsideFiles - { - get => UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles; - set - { - if (value != UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles) - { - UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles = value; - OnPropertyChanged(); - } - } - } - public bool SearchUnindexedItems { get => UserSettingsService.PreferencesSettingsService.SearchUnindexedItems; diff --git a/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs b/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs index 6d1bf87b15f8..8ed9489980b5 100644 --- a/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs +++ b/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs @@ -242,7 +242,7 @@ override public void StartRenameItem() textBox.KeyDown += RenameTextBox_KeyDown; int selectedTextLength = SelectedItem.Name.Length; - if (!SelectedItem.IsShortcut && UserSettingsService.PreferencesSettingsService.ShowFileExtensions) + if (!SelectedItem.IsShortcut && UserSettingsService.FoldersSettingsService.ShowFileExtensions) selectedTextLength -= extensionLength; textBox.Select(0, selectedTextLength); IsRenamingItem = true; diff --git a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs index 23ddace38f5e..460d72987a05 100644 --- a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs @@ -335,7 +335,7 @@ override public void StartRenameItem() textBox.KeyDown += RenameTextBox_KeyDown; int selectedTextLength = SelectedItem.Name.Length; - if (!SelectedItem.IsShortcut && UserSettingsService.PreferencesSettingsService.ShowFileExtensions) + if (!SelectedItem.IsShortcut && UserSettingsService.FoldersSettingsService.ShowFileExtensions) selectedTextLength -= extensionLength; textBox.Select(0, selectedTextLength); IsRenamingItem = true; diff --git a/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs index 5e8099b8fbff..46c8058e164a 100644 --- a/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs @@ -288,7 +288,7 @@ override public void StartRenameItem() textBox.KeyDown += RenameTextBox_KeyDown; int selectedTextLength = SelectedItem.Name.Length; - if (!SelectedItem.IsShortcut && UserSettingsService.PreferencesSettingsService.ShowFileExtensions) + if (!SelectedItem.IsShortcut && UserSettingsService.FoldersSettingsService.ShowFileExtensions) selectedTextLength -= extensionLength; textBox.Select(0, selectedTextLength); IsRenamingItem = true; diff --git a/src/Files.App/Views/SettingsPages/About.xaml b/src/Files.App/Views/SettingsPages/About.xaml index 561616b36944..0d281e767a94 100644 --- a/src/Files.App/Views/SettingsPages/About.xaml +++ b/src/Files.App/Views/SettingsPages/About.xaml @@ -22,7 +22,14 @@ - + + + + - + + + + @@ -69,6 +76,7 @@ SelectedIndex="{x:Bind ViewModel.SelectedThemeIndex, Mode=TwoWay}" /> + - + + @@ -118,12 +127,15 @@ Style="{StaticResource RightAlignedToggleSwitchStyle}" /> + + + diff --git a/src/Files.App/Views/SettingsPages/Folders.xaml b/src/Files.App/Views/SettingsPages/Folders.xaml index 9e175450eab9..fb9001f0a286 100644 --- a/src/Files.App/Views/SettingsPages/Folders.xaml +++ b/src/Files.App/Views/SettingsPages/Folders.xaml @@ -33,6 +33,13 @@ + + + - + @@ -139,7 +146,7 @@ - + @@ -151,6 +158,14 @@ + + + + + @@ -170,13 +185,22 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -240,6 +297,31 @@ + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs b/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs index 5319e8f85d58..c8e2cdb2b318 100644 --- a/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs +++ b/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs @@ -149,5 +149,25 @@ public interface IFoldersSettingsService : IBaseSettingsService, INotifyProperty /// Gets or sets a value indicating the default grouping option. /// GroupOption DefaultGroupOption { get; set; } + + /// + /// Gets or sets a value indicating if file extensions should be displayed. + /// + bool ShowFileExtensions { get; set; } + + /// + /// Gets or sets a value indicating if media thumbnails should be displayed. + /// + bool ShowThumbnails { get; set; } + + /// + /// Gets or sets a value indicating whether or not to show the delete confirmation dialog when deleting items. + /// + bool ShowConfirmDeleteDialog { get; set; } + + /// + /// Gets or sets a value indicating whether or not to select files and folders when hovering them. + /// + bool SelectFilesOnHover { get; set; } } } diff --git a/src/Files.Backend/Services/Settings/IPreferencesSettingsService.cs b/src/Files.Backend/Services/Settings/IPreferencesSettingsService.cs index 416f3aef453b..69ebcd66849a 100644 --- a/src/Files.Backend/Services/Settings/IPreferencesSettingsService.cs +++ b/src/Files.Backend/Services/Settings/IPreferencesSettingsService.cs @@ -6,26 +6,6 @@ namespace Files.Backend.Services.Settings { public interface IPreferencesSettingsService : IBaseSettingsService, INotifyPropertyChanged { - /// - /// Gets or sets a value indicating whether or not to show the delete confirmation dialog when deleting items. - /// - bool ShowConfirmDeleteDialog { get; set; } - - /// - /// Gets or sets a value indicating whether or not media thumbnails should be visible. - /// - bool ShowThumbnails { get; set; } - - /// - /// Gets or sets a value indicating whether or not to select files and folders when hovering them. - /// - bool SelectFilesOnHover { get; set; } - - /// - /// Gets or sets a value indicating whether or not file extensions should be visible. - /// - bool ShowFileExtensions { get; set; } - /// /// Gets or sets a value indicating whether or not to search unindexed items. ///