mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[AdvancedPaste]Check "Paste with AI" enabled state for enabling custom actions (#35026)
* [AdvancedPaste] Check OpenAI enabled state for custom actions * Add some more explanations to the expected exception * Add description saying that it requires Paste with AI to be enabled * Check openAI enabled only if we have custom actions --------- Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
@@ -102,7 +102,10 @@
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="AdvancedPaste_Direct_Access_Hotkeys_GroupSettings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="AdvancedPasteUI_Actions" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="AdvancedPasteUI_Actions"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsOpenAIEnabled, Mode=OneWay}">
|
||||
<Button
|
||||
x:Uid="AdvancedPasteUI_AddCustomActionButton"
|
||||
Click="AddCustomActionButton_Click"
|
||||
@@ -130,6 +133,7 @@
|
||||
x:Name="CustomActions"
|
||||
x:Uid="CustomActions"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsEnabled="{x:Bind ViewModel.IsOpenAIEnabled, Mode=OneWay}"
|
||||
IsTabStop="False"
|
||||
ItemsSource="{x:Bind ViewModel.CustomActions, Mode=OneWay}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@@ -2000,7 +2000,8 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
<value>Actions</value>
|
||||
</data>
|
||||
<data name="AdvancedPasteUI_Actions.Description" xml:space="preserve">
|
||||
<value>Create and manage advanced paste custom actions</value>
|
||||
<value>Create and manage advanced paste custom actions.
|
||||
(Requires Paste with AI to be enabled)</value>
|
||||
</data>
|
||||
<data name="AdvancedPasteUI_AddCustomActionButton.Content" xml:space="preserve">
|
||||
<value>Add custom action</value>
|
||||
|
||||
@@ -397,6 +397,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
PasswordCredential cred = vault.Retrieve("https://platform.openai.com/api-keys", "PowerToys_AdvancedPaste_OpenAIKey");
|
||||
vault.Remove(cred);
|
||||
OnPropertyChanged(nameof(IsOpenAIEnabled));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -411,6 +412,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
PasswordCredential cred = new PasswordCredential("https://platform.openai.com/api-keys", "PowerToys_AdvancedPaste_OpenAIKey", password);
|
||||
vault.Add(cred);
|
||||
OnPropertyChanged(nameof(IsOpenAIEnabled));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user