PowerRename settings bugfix (#2796)

* PowerRename settings bugfix

* Changed visibility to enability of PowerRename_Toggle_MaxDispListNum

* Added unit tests and changed maximum value
This commit is contained in:
PrzemyslawTusinski
2020-05-11 14:37:29 +02:00
committed by GitHub
parent 1ecedd5566
commit 585c66a4d0
5 changed files with 77 additions and 17 deletions

View File

@@ -383,7 +383,7 @@
<data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Header" xml:space="preserve">
<value>Appear only in extended context menu (Shift + Right-click)</value>
</data>
<data name="PowerRename_Toggle_MaxDispListNum.Text" xml:space="preserve">
<data name="PowerRename_Toggle_MaxDispListNum.Header" xml:space="preserve">
<value>Maximum numbers of items to show in recently used list for autocomplete dropdown</value>
</data>
<data name="PowerRename_Toggle_RestoreFlagsOnLaunch.Header" xml:space="preserve">

View File

@@ -76,6 +76,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_powerRenameEnabled = value;
OnPropertyChanged("IsEnabled");
RaisePropertyChanged("GlobalAndMruEnabled");
}
}
}
@@ -95,10 +96,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_autoComplete = value;
Settings.properties.MRUEnabled.Value = value;
RaisePropertyChanged();
RaisePropertyChanged("GlobalAndMruEnabled");
}
}
}
public bool GlobalAndMruEnabled
{
get
{
return _autoComplete && _powerRenameEnabled;
}
}
public bool EnabledOnContextMenu
{
get

View File

@@ -53,12 +53,6 @@
<TextBlock x:Uid="PowerRename_ShellIntergration"
Style="{StaticResource SettingsGroupTitleStyle}"/>
<ToggleSwitch x:Uid="PowerRename_Toggle_AutoComplete"
Margin="{StaticResource SmallTopMargin}"
IsOn="{Binding Mode=TwoWay, Path=MRUEnabled}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
/>
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnContextMenu"
Margin="{StaticResource SmallTopMargin}"
IsOn="{Binding Mode=TwoWay, Path=EnabledOnContextMenu}"
@@ -80,20 +74,22 @@
IsOn="{Binding Mode=TwoWay, Path=MRUEnabled}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
/>
<muxc:NumberBox x:Uid="PowerRename_Toggle_MaxDispListNum"
SpinButtonPlacementMode="Inline"
HorizontalAlignment="Left"
Margin="{StaticResource SmallTopMargin}"
Value="{Binding Mode=TwoWay, Path=MaxDispListNum}"
Minimum="0"
Maximum="20"
IsEnabled="{ Binding Mode=TwoWay, Path=GlobalAndMruEnabled}"
/>
<ToggleSwitch x:Uid="PowerRename_Toggle_RestoreFlagsOnLaunch"
Margin="{StaticResource SmallTopMargin}"
IsOn="{Binding Mode=TwoWay, Path=RestoreFlagsOnLaunch}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
/>
<muxc:NumberBox x:Name="PowerRename_Toggle_MaxDispListNum"
SpinButtonPlacementMode="Inline"
HorizontalAlignment="Left"
Margin="{StaticResource SmallTopMargin}"
Value="{Binding Mode=TwoWay, Path=MaxDispListNum}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
/>
</StackPanel>