mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[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:
committed by
GitHub
parent
0d9b797ef0
commit
3e651b8de6
@@ -15,12 +15,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
||||
public bool LaunchAdministrator { get; set; }
|
||||
|
||||
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
||||
public bool LoopbackDuplicates { get; set; }
|
||||
|
||||
public AdditionalLinesPosition AdditionalLinesPosition { get; set; }
|
||||
|
||||
public HostsProperties()
|
||||
{
|
||||
ShowStartupWarning = true;
|
||||
LaunchAdministrator = true;
|
||||
LoopbackDuplicates = false;
|
||||
AdditionalLinesPosition = AdditionalLinesPosition.Top;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
|
||||
@@ -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=}">
|
||||
<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=}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.LoopbackDuplicates}" />
|
||||
</labs:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
Reference in New Issue
Block a user