[Hosts] Improved duplicate hosts finding (#24294)

* improved duplicate hosts finding

* improved filters with AdvancedCollectionView

* cancel FindDuplicates when file is reloaded
This commit is contained in:
Davide Giacometti
2023-02-27 19:11:57 +01:00
committed by GitHub
parent 0d9b797ef0
commit 3e651b8de6
14 changed files with 294 additions and 87 deletions

View File

@@ -2855,8 +2855,8 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="Hosts_AdditionalLinesPosition_Top.Content" xml:space="preserve">
<value>Top</value>
</data>
<data name="Hosts_File_GroupSettings.Header" xml:space="preserve">
<value>File</value>
<data name="Hosts_Behavior_GroupSettings.Header" xml:space="preserve">
<value>Behavior</value>
</data>
<data name="Launch_Hosts.Content" xml:space="preserve">
<value>Launch Hosts File Editor</value>
@@ -3043,4 +3043,11 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="GPO_AutoDownloadUpdatesIsDisabled.Title" xml:space="preserve">
<value>The system administrator has disabled the automatic download of updates.</value>
</data>
<data name="Hosts_Toggle_LoopbackDuplicates.Description" xml:space="preserve">
<value>127.0.0.1, ::1, ...</value>
<comment>"127.0.0.1 and ::1" are well known loopback addresses, do not loc</comment>
</data>
<data name="Hosts_Toggle_LoopbackDuplicates.Header" xml:space="preserve">
<value>Consider loopback addresses as duplicates</value>
</data>
</root>

View File

@@ -76,6 +76,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool LoopbackDuplicates
{
get => Settings.Properties.LoopbackDuplicates;
set
{
if (value != Settings.Properties.LoopbackDuplicates)
{
Settings.Properties.LoopbackDuplicates = value;
NotifyPropertyChanged();
}
}
}
public bool LaunchAdministrator
{
get => Settings.Properties.LaunchAdministrator;

View File

@@ -46,13 +46,20 @@
</labs:SettingsCard>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="Hosts_File_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<controls:SettingsGroup x:Uid="Hosts_Behavior_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<labs:SettingsCard x:Uid="Hosts_AdditionalLinesPosition" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE8A5;}">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.AdditionalLinesPosition, Mode=TwoWay}">
<ComboBoxItem x:Uid="Hosts_AdditionalLinesPosition_Top" />
<ComboBoxItem x:Uid="Hosts_AdditionalLinesPosition_Bottom" />
</ComboBox>
</labs:SettingsCard>
<labs:SettingsCard
x:Uid="Hosts_Toggle_LoopbackDuplicates"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xEC27;}">
<ToggleSwitch
x:Uid="ToggleSwitch"
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.LoopbackDuplicates}" />
</labs:SettingsCard>
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>