[Settings]Adding AltGr warning info box to Shortcut edit dialog (#29761)
* [Settings] Adding warning info box to Shortcut edit dialog * Fixing case opening dialog with shortcut which needs warning * Add comment * spell checker
This commit is contained in:
Родитель
106f90dc01
Коммит
bde9243d72
|
@ -332,6 +332,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||||
EnableKeys();
|
EnableKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.IsWarningAltGr = internalSettings.Ctrl && internalSettings.Alt && !internalSettings.Win && (internalSettings.Code > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnableKeys()
|
private void EnableKeys()
|
||||||
|
@ -408,6 +410,10 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||||
c.Keys = null;
|
c.Keys = null;
|
||||||
c.Keys = HotkeySettings.GetKeysList();
|
c.Keys = HotkeySettings.GetKeysList();
|
||||||
|
|
||||||
|
// 92 means the Win key. The logic is: warning should be visible if the shortcut contains Alt AND contains Ctrl AND NOT contains Win.
|
||||||
|
// Additional key must be present, as this is a valid, previously used shortcut shown at dialog open. Check for presence of non-modifier-key is not necessary therefore
|
||||||
|
c.IsWarningAltGr = c.Keys.Contains("Ctrl") && c.Keys.Contains("Alt") && !c.Keys.Contains(92);
|
||||||
|
|
||||||
shortcutDialog.XamlRoot = this.XamlRoot;
|
shortcutDialog.XamlRoot = this.XamlRoot;
|
||||||
shortcutDialog.RequestedTheme = this.ActualTheme;
|
shortcutDialog.RequestedTheme = this.ActualTheme;
|
||||||
await shortcutDialog.ShowAsync();
|
await shortcutDialog.ShowAsync();
|
||||||
|
|
|
@ -59,6 +59,12 @@
|
||||||
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
|
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
|
||||||
Severity="Error" />
|
Severity="Error" />
|
||||||
|
|
||||||
|
<InfoBar
|
||||||
|
x:Uid="WarningShortcutAltGr"
|
||||||
|
IsClosable="False"
|
||||||
|
IsOpen="{Binding ElementName=ShortcutContentControl, Path=IsWarningAltGr, Mode=OneWay}"
|
||||||
|
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsWarningAltGr, Mode=OneWay}"
|
||||||
|
Severity="Warning" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<toolkitcontrols:MarkdownTextBlock
|
<toolkitcontrols:MarkdownTextBlock
|
||||||
x:Uid="InvalidShortcutWarningLabel"
|
x:Uid="InvalidShortcutWarningLabel"
|
||||||
|
|
|
@ -30,5 +30,13 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(ShortcutDialogContentControl), new PropertyMetadata(false));
|
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(ShortcutDialogContentControl), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
public bool IsWarningAltGr
|
||||||
|
{
|
||||||
|
get => (bool)GetValue(IsWarningAltGrProperty);
|
||||||
|
set => SetValue(IsWarningAltGrProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IsWarningAltGrProperty = DependencyProperty.Register("IsWarningAltGr", typeof(bool), typeof(ShortcutDialogContentControl), new PropertyMetadata(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2535,6 +2535,14 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||||
<value>Only shortcuts that start with **Windows key**, **Ctrl**, **Alt** or **Shift** are valid.</value>
|
<value>Only shortcuts that start with **Windows key**, **Ctrl**, **Alt** or **Shift** are valid.</value>
|
||||||
<comment>The ** sequences are used for text formatting of the key names. Don't remove them on translation.</comment>
|
<comment>The ** sequences are used for text formatting of the key names. Don't remove them on translation.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="WarningShortcutAltGr.Title" xml:space="preserve">
|
||||||
|
<value>Possible shortcut interference with Alt Gr</value>
|
||||||
|
<comment>Alt Gr refers to the right alt key on some international keyboards</comment>
|
||||||
|
</data>
|
||||||
|
<data name="WarningShortcutAltGr.ToolTipService.ToolTip" xml:space="preserve">
|
||||||
|
<value>Shortcuts with **Ctrl** and **Alt** may remove functionality from some international keyboards, because **Ctrl** + **Alt** = **Alt Gr** in those keyboards.</value>
|
||||||
|
<comment>The ** sequences are used for text formatting of the key names. Don't remove them on translation.</comment>
|
||||||
|
</data>
|
||||||
<data name="FancyZones_SpanZonesAcrossMonitors.Description" xml:space="preserve">
|
<data name="FancyZones_SpanZonesAcrossMonitors.Description" xml:space="preserve">
|
||||||
<value>All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors</value>
|
<value>All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче