Skip to content

Feature: Added option to turn off double click gesture #11065

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
Jan 24, 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 @@ -250,6 +250,12 @@ public bool SelectFilesOnHover
set => Set(value);
}

public bool DoubleClickToGoUp
{
get => Get(true);
set => Set(value);
}

protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
{
switch (e.SettingName)
Expand Down Expand Up @@ -280,6 +286,7 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged
case nameof(ShowConfirmDeleteDialog):
case nameof(SelectFilesOnHover):
case nameof(ShowSelectionCheckboxes):
case nameof(DoubleClickToGoUp):
Analytics.TrackEvent($"Set {e.SettingName} to {e.NewValue}");
break;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2883,4 +2883,7 @@
<data name="Settings" xml:space="preserve">
<value>Settings</value>
</data>
<data name="DoubleClickBlankSpaceToGoUp" xml:space="preserve">
<value>Double click on a blank space to go up one directory</value>
</data>
</root>
13 changes: 13 additions & 0 deletions src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,19 @@ public bool SelectFilesOnHover
}
}

public bool DoubleClickToGoUp
{
get => UserSettingsService.FoldersSettingsService.DoubleClickToGoUp;
set
{
if (value != UserSettingsService.FoldersSettingsService.DoubleClickToGoUp)
{
UserSettingsService.FoldersSettingsService.DoubleClickToGoUp = value;
OnPropertyChanged();
}
}
}

// Local methods

public void ResetLayoutPreferences()
Expand Down
6 changes: 4 additions & 2 deletions src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,15 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
ItemInvoked?.Invoke(new ColumnParam { NavPathParam = (item is ShortcutItem sht ? sht.TargetPath : item.ItemPath), ListView = FileList }, EventArgs.Empty);
break;
default:
ParentShellPageInstance.Up_Click();
if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp)
ParentShellPageInstance.Up_Click();
break;
}
}
else
{
ParentShellPageInstance.Up_Click();
if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp)
ParentShellPageInstance.Up_Click();
}

ResetRenameDoubleClick();
Expand Down
3 changes: 2 additions & 1 deletion src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
}
else
{
ParentShellPageInstance.Up_Click();
if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp)
ParentShellPageInstance.Up_Click();
}
ResetRenameDoubleClick();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
}
else
{
ParentShellPageInstance.Up_Click();
if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp)
ParentShellPageInstance.Up_Click();
}
ResetRenameDoubleClick();
}
Expand Down
14 changes: 13 additions & 1 deletion src/Files.App/Views/SettingsPages/Folders.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,26 @@
<!-- Select On Hover -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SelectFilesAndFoldersOnHover}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
<FontIcon Glyph="&#xE8B0;" />
<FontIcon Glyph="&#xE14E;" />
</local:SettingsBlockControl.Icon>

<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=SelectFilesAndFoldersOnHover}"
IsOn="{x:Bind ViewModel.SelectFilesOnHover, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Double click to go up -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=DoubleClickBlankSpaceToGoUp}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
<FontIcon Glyph="&#xE8B0;" />
</local:SettingsBlockControl.Icon>

<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=DoubleClickBlankSpaceToGoUp}"
IsOn="{x:Bind ViewModel.DoubleClickToGoUp, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Calculate folder sizes -->
<local:SettingsBlockControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,10 @@ public interface IFoldersSettingsService : IBaseSettingsService, INotifyProperty
/// Gets or sets a value indicating whether or not to select files and folders when hovering them.
/// </summary>
bool SelectFilesOnHover { get; set; }

/// <summary>
/// Gets or sets a value indicating if double clicking a blank space should go up a directory.
/// </summary>
bool DoubleClickToGoUp { get; set; }
}
}