Skip to content

Feature: Apply show checkboxes option to the grid view as well #12087

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 1 commit into from
Apr 17, 2023
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 @@ -274,7 +274,7 @@ public bool ShowFileExtensionWarning
set => Set(value);
}

public bool ShowCheckboxesInDetailsLayout
public bool ShowCheckboxesWhenSelectingItems
{
get => Get(true);
set => Set(value);
Expand Down Expand Up @@ -311,7 +311,7 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged
case nameof(SelectFilesOnHover):
case nameof(DoubleClickToGoUp):
case nameof(ShowFileExtensionWarning):
case nameof(ShowCheckboxesInDetailsLayout):
case nameof(ShowCheckboxesWhenSelectingItems):
Analytics.TrackEvent($"Set {e.SettingName} to {e.NewValue}");
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -3181,7 +3181,7 @@
<data name="MoveFileWithoutProperties" xml:space="preserve">
<value>Are you sure you want to move these files without their properties?</value>
</data>
<data name="ShowCheckboxesInDetailsLayout" xml:space="preserve">
<value>Show checkboxes when selecting items in the details layout</value>
<data name="ShowCheckboxesWhenSelectingItems" xml:space="preserve">
<value>Show checkboxes when selecting items</value>
</data>
</root>
2 changes: 1 addition & 1 deletion src/Files.App/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ private async void UserSettingsService_OnSettingChangedEvent(object? sender, Set
case nameof(UserSettingsService.FoldersSettingsService.ShowDotFiles):
case nameof(UserSettingsService.FoldersSettingsService.CalculateFolderSizes):
case nameof(UserSettingsService.FoldersSettingsService.SelectFilesOnHover):
case nameof(UserSettingsService.FoldersSettingsService.ShowCheckboxesInDetailsLayout):
case nameof(UserSettingsService.FoldersSettingsService.ShowCheckboxesWhenSelectingItems):
await dispatcherQueue.EnqueueAsync(() =>
{
if (WorkingDirectory != "Home")
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/ViewModels/Settings/FoldersViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,14 @@ public bool ShowFileExtensionWarning
}
}

public bool ShowCheckboxesInDetailsLayout
public bool ShowCheckboxesWhenSelectingItems
{
get => UserSettingsService.FoldersSettingsService.ShowCheckboxesInDetailsLayout;
get => UserSettingsService.FoldersSettingsService.ShowCheckboxesWhenSelectingItems;
set
{
if (value != UserSettingsService.FoldersSettingsService.ShowCheckboxesInDetailsLayout)
if (value != UserSettingsService.FoldersSettingsService.ShowCheckboxesWhenSelectingItems)
{
UserSettingsService.FoldersSettingsService.ShowCheckboxesInDetailsLayout = value;
UserSettingsService.FoldersSettingsService.ShowCheckboxesWhenSelectingItems = value;

OnPropertyChanged();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,9 @@ private void UpdateCheckboxVisibility(object sender, bool isPointerOver)
if (sender is ListViewItem control && control.FindDescendant<UserControl>() is UserControl userControl)
{
// Handle visual states
// Show checkboxes when hovering of the thumbnail as long as one item is selected (regardless of the setting to hide them)
// Show checkboxes when items are selected (as long as the setting is enabled)
if (UserSettingsService.FoldersSettingsService.ShowCheckboxesInDetailsLayout && control.IsSelected
// Show checkboxes when hovering of the thumbnail (regardless of the setting to hide them)
if (UserSettingsService.FoldersSettingsService.ShowCheckboxesWhenSelectingItems && control.IsSelected
|| isPointerOver || (control.FindDescendant("SelectionCheckbox") as CheckBox)!.IsPointerOver)
VisualStateManager.GoToState(userControl, "ShowCheckbox", true);
else
Expand Down
5 changes: 4 additions & 1 deletion src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ private void UpdateCheckboxVisibility(object sender, bool? isPointerOver = null)
if (isPointerOver.HasValue)
control.SetValue(IsPointerOverProperty, isPointerOver);
// Handle visual states
if (control.IsSelected || control.GetValue(IsPointerOverProperty) is not false)
// Show checkboxes when items are selected (as long as the setting is enabled)
// Show checkboxes when hovering of the item (regardless of the setting to hide them)
if (UserSettingsService.FoldersSettingsService.ShowCheckboxesWhenSelectingItems && control.IsSelected
|| control.GetValue(IsPointerOverProperty) is not false)
VisualStateManager.GoToState(userControl, "ShowCheckbox", true);
else
VisualStateManager.GoToState(userControl, "HideCheckbox", true);
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Views/Settings/FoldersPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Show Checkboxes in the Details Layout -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ShowCheckboxesInDetailsLayout}" HorizontalAlignment="Stretch">
<!-- Show Checkboxes When Selecting Items -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ShowCheckboxesWhenSelectingItems}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
<FontIcon Glyph="&#xE73A;" />
</local:SettingsBlockControl.Icon>
<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=ShowCheckboxesInDetailsLayout}"
IsOn="{x:Bind ViewModel.ShowCheckboxesInDetailsLayout, Mode=TwoWay}"
AutomationProperties.Name="{helpers:ResourceString Name=ShowCheckboxesWhenSelectingItems}"
IsOn="{x:Bind ViewModel.ShowCheckboxesWhenSelectingItems, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ public interface IFoldersSettingsService : IBaseSettingsService, INotifyProperty
bool ShowFileExtensionWarning { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to show checkboxes when selecting items in the details layout.
/// Gets or sets a value indicating whether or not to show checkboxes when selecting items.
/// </summary>
bool ShowCheckboxesInDetailsLayout { get; set; }
bool ShowCheckboxesWhenSelectingItems { get; set; }
}
}