add warning (#25098)

This commit is contained in:
Heiko
2023-03-29 14:57:03 +02:00
committed by GitHub
parent e34fe272a5
commit 44b8a9fe1e
3 changed files with 18 additions and 0 deletions

View File

@@ -3116,4 +3116,7 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="RegistryPreview_LaunchButtonControl.Header" xml:space="preserve">
<value>Launch Registry Preview</value>
</data>
<data name="PastePlain_ShortcutWarning.Title" xml:space="preserve">
<value>Using this shortcut may prevent non-text paste actions (e.g. images, files) or built-in paste plain text actions in other applications from functioning.</value>
</data>
</root>

View File

@@ -128,6 +128,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
_pastePlainSettings.Properties.ActivationShortcut = value;
OnPropertyChanged(nameof(ActivationShortcut));
OnPropertyChanged(nameof(IsConflictingCopyShortcut));
_settingsUtils.SaveSettings(_pastePlainSettings.ToJsonString(), PastePlainSettings.ModuleName);
NotifySettingsChanged();
@@ -135,6 +136,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool IsConflictingCopyShortcut
{
get
{
return ActivationShortcut.ToString() == "Ctrl + V" || ActivationShortcut.ToString() == "Ctrl + Shift + V";
}
}
private void ScheduleSavingOfSettings()
{
lock (_delayedActionLock)

View File

@@ -42,6 +42,12 @@
MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
</labs:SettingsCard>
<InfoBar
x:Uid="PastePlain_ShortcutWarning"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsConflictingCopyShortcut}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsConflictingCopyShortcut}"
Severity="Warning" />
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>