Skip to content

Fix: Fixed issue where multiselect broke open with single click #11131

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
Feb 2, 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
15 changes: 11 additions & 4 deletions src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Globalization;
using System.Linq;
using UWPToWinAppSDKUpgradeHelpers;
using Windows.Foundation;
Expand Down Expand Up @@ -417,28 +418,34 @@ private async void ReloadItemIcons()

private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
{
var clickedItem = e.OriginalSource as FrameworkElement;
var ctrlPressed = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
var shiftPressed = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem;
if (item is null)
return;

// Skip code if the control or shift key is pressed or if the user is using multiselect
if (ctrlPressed || shiftPressed || AppModel.ShowSelectionCheckboxes)
if
(
ctrlPressed ||
shiftPressed ||
AppModel.ShowSelectionCheckboxes && !UserSettingsService.FoldersSettingsService.OpenItemsWithOneClick ||
clickedItem is Microsoft.UI.Xaml.Shapes.Rectangle
)
{
e.Handled = true;
return;
}

// Check if the setting to open items with a single click is turned on
if (item is not null
&& UserSettingsService.FoldersSettingsService.OpenItemsWithOneClick)
if (UserSettingsService.FoldersSettingsService.OpenItemsWithOneClick)
{
ResetRenameDoubleClick();
_ = NavigationHelpers.OpenSelectedItems(ParentShellPageInstance, false);
}
else
{
var clickedItem = e.OriginalSource as FrameworkElement;
if (clickedItem is TextBlock && ((TextBlock)clickedItem).Name == "ItemName")
{
CheckRenameDoubleClick(clickedItem?.DataContext);
Expand Down
16 changes: 12 additions & 4 deletions src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ private async void ReloadSelectedItemsIcon()

private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
{
var clickedItem = e.OriginalSource as FrameworkElement;
var ctrlPressed = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
var shiftPressed = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);

Expand All @@ -386,19 +387,26 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
return;

// Skip code if the control or shift key is pressed or if the user is using multiselect
if (ctrlPressed || shiftPressed || AppModel.ShowSelectionCheckboxes)
if
(
ctrlPressed ||
shiftPressed ||
AppModel.ShowSelectionCheckboxes && !UserSettingsService.FoldersSettingsService.OpenItemsWithOneClick ||
clickedItem is Microsoft.UI.Xaml.Shapes.Rectangle
)
{
e.Handled = true;
return;
}

// Check if the setting to open items with a single click is turned on
if (item is not null
&& UserSettingsService.FoldersSettingsService.OpenItemsWithOneClick)
if (UserSettingsService.FoldersSettingsService.OpenItemsWithOneClick)
{
ResetRenameDoubleClick();
_ = NavigationHelpers.OpenSelectedItems(ParentShellPageInstance, false);
}
else
{
var clickedItem = e.OriginalSource as FrameworkElement;
if (clickedItem is TextBlock textBlock && textBlock.Name == "ItemName")
{
CheckRenameDoubleClick(clickedItem?.DataContext);
Expand Down