[Settings][Plugin manager] Activation commands: Fix conflict with calc plugin and add warning (#19593)

* update activation commands

* add warning and badges

* fix spelling

* fix badge style

* fixes

* small fixes missed

* spell fix

* revert changes for Program plugin

* small tweaks

* Add Grid control

* merge warnings

* fix spelling

* fix resource

* updating conflicitng keywords

* remove keywordWarning and warningBagde

* fix broken reference

* add new information bar
This commit is contained in:
Heiko
2022-08-23 22:28:41 +02:00
committed by GitHub
parent 4c796c0b53
commit c85305695e
5 changed files with 35 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
{
"ID": "5D69806A5A474115821C3E4C56B9C793",
"ActionKeyword": "(",
"ActionKeyword": ")",
"IsGlobal": true,
"Name": "Time and date",
"Author": "htcfreek",

View File

@@ -56,10 +56,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
settings.Disabled = value;
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(ShowNotAccessibleWarning));
NotifyPropertyChanged(nameof(ShowNotAllowedKeywordWarning));
NotifyPropertyChanged(nameof(Enabled));
NotifyPropertyChanged(nameof(DisabledOpacity));
NotifyPropertyChanged(nameof(IsGlobalAndEnabled));
NotifyPropertyChanged(nameof(ShowBadgeOnPluginSettingError));
}
}
}
@@ -91,6 +91,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(ShowNotAccessibleWarning));
NotifyPropertyChanged(nameof(IsGlobalAndEnabled));
NotifyPropertyChanged(nameof(ShowBadgeOnPluginSettingError));
}
}
}
@@ -108,8 +109,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
settings.WeightBoost = value;
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(ShowNotAccessibleWarning));
NotifyPropertyChanged(nameof(ShowNotAllowedKeywordWarning));
}
}
}
@@ -128,7 +127,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
settings.ActionKeyword = value;
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(ShowNotAccessibleWarning));
NotifyPropertyChanged(nameof(ShowNotAllowedKeywordWarning));
NotifyPropertyChanged(nameof(ShowBadgeOnPluginSettingError));
}
}
}
@@ -180,14 +179,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
get => !Disabled && !IsGlobal && string.IsNullOrWhiteSpace(ActionKeyword);
}
private static readonly List<string> NotAllowedKeywords = new List<string>()
public bool ShowBadgeOnPluginSettingError
{
"~", @"\", @"\\",
};
public bool ShowNotAllowedKeywordWarning
{
get => !Disabled && NotAllowedKeywords.Contains(ActionKeyword);
get => !Disabled && ShowNotAccessibleWarning;
}
}
}

View File

@@ -101,7 +101,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
if (
e.PropertyName == nameof(PowerLauncherPluginViewModel.ShowNotAccessibleWarning)
|| e.PropertyName == nameof(PowerLauncherPluginViewModel.ShowNotAllowedKeywordWarning)
|| e.PropertyName == nameof(PowerLauncherPluginViewModel.ShowBadgeOnPluginSettingError)
)
{
// Don't trigger a settings update if the changed property is for visual notification.

View File

@@ -1267,9 +1267,6 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="Run_AllPluginsDisabled.Message" xml:space="preserve">
<value>Enable at least one plugin to get started</value>
</data>
<data name="Run_NotAllowedActionKeyword.Title" xml:space="preserve">
<value>This activation command is already in use by another plugin.</value>
</data>
<data name="Run_PluginUseDescription.Header" xml:space="preserve">
<value>Plugins</value>
</data>
@@ -2164,4 +2161,10 @@ From there, simply click on one of the supported files in the File Explorer and
<data name="AlwaysOnTop_RoundCorners.Content" xml:space="preserve">
<value>Enable round corners</value>
</data>
</root>
<data name="Run_ConflictingKeywordInfo.Title" xml:space="preserve">
<value>Some characters and phrases may conflict with global queries of other plugins if you use them as activation command.</value>
</data>
<data name="Run_ConflictingKeywordInfo_Link.Content" xml:space="preserve">
<value>Learn more about conflicting activation commands</value>
</data>
</root>

View File

@@ -242,6 +242,18 @@
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}">
<muxc:InfoBar x:Uid="Run_ConflictingKeywordInfo"
Severity="Informational"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}">
<muxc:InfoBar.ActionButton>
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_PowerToysRun#direct-activation-commands"
x:Uid="Run_ConflictingKeywordInfo_Link"/>
</muxc:InfoBar.ActionButton>
</muxc:InfoBar>
<controls:Setting x:Uid="Run_PluginUseDescription" Icon="&#xEA86;">
<controls:Setting.ActionContent>
<AutoSuggestBox x:Uid="PowerLauncher_SearchList"
@@ -283,14 +295,21 @@
Height="20" />
</controls:Setting.Icon>
<controls:Setting.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="16">
<StackPanel Orientation="Horizontal" Spacing="16" >
<!-- todo(Stefan): InfoBadge not available
<muxc:InfoBadge AutomationProperties.AccessibilityView="Raw"
Visibility="{x:Bind ShowNotAccessibleWarning}"
Visibility="{x:Bind ShowBadgeOnPluginSettingError}"
Style="{StaticResource CriticalIconInfoBadgeStyle}" />
-->
<!-- Temporary badge replacement for InfoBadge control (htcfreek). (Normally you need one grid per icon group. But if you want to show two badges at the same place in a StackPanel you have to put all FontIcons into the same Grid.)-->
<Grid>
<!-- Error badge -->
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource InfoBarIconBackgroundGlyph}" Foreground="{ThemeResource InfoBarErrorSeverityIconBackground}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}"/>
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource InfoBarErrorIconGlyph}" Foreground="{ThemeResource InfoBarErrorSeverityIconForeground}" Visibility="{x:Bind ShowBadgeOnPluginSettingError}"/>
</Grid>
<ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle"
IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}"/>
</StackPanel>
@@ -311,11 +330,6 @@
IsTabStop="{x:Bind ShowNotAccessibleWarning}"
IsOpen="{x:Bind ShowNotAccessibleWarning}"
IsClosable="False" />
<muxc:InfoBar Severity="Error"
x:Uid="Run_NotAllowedActionKeyword"
IsTabStop="{x:Bind ShowNotAllowedKeywordWarning}"
IsOpen="{x:Bind ShowNotAllowedKeywordWarning}"
IsClosable="False" />
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<StackPanel Orientation="Vertical">