[PastePlain] Introduce Paste as Plain Text module (#23645)

* [PastePlain] Introduce Paste as Plain Text module

* fix build

* add telemetry

* update settings UI

* spell

* Add navigation items to Settings and OOBE

* Add PastePlain to the Quick Access flyout

* try to fix PastePlain not being enabled from runner/settings

* load dll properly

* installer files

* Add PastePlain project name

* Use win32 APIs in the module interface instead

* Fix spellcheck

* Fix build errors

* Add success, error and invoke telemetry

* Add Settings Telemetry

* Add GPO definitions

* Fix analyzer errors

* Use static_cast instead of reinterpret_cast

* Add images to Settings

* Add note about replacing clipboard contents

* Fix learn more text

* Add link to readme

* Remove unneeded C# app

* Fix installer

* Fix spellchecker

---------

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
Carlos Zamora
2023-02-23 06:59:49 -08:00
committed by GitHub
parent cbf1c61c58
commit 1e1429177b
50 changed files with 1576 additions and 19 deletions

View File

@@ -0,0 +1,55 @@
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.PastePlainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:CommunityToolkit.WinUI.UI"
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<controls:SettingsPageControl
x:Uid="PastePlain"
ModuleImageSource="ms-appx:///Assets/Modules/PastePlain.png">
<controls:SettingsPageControl.ModuleContent>
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}"
Orientation="Vertical" Spacing="2">
<labs:SettingsCard
x:Uid="PastePlain_EnableToggleControl_HeaderText"
HeaderIcon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsPastePlain.png}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
<ToggleSwitch
x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
</labs:SettingsCard>
<InfoBar
x:Uid="GPO_IsSettingForced"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}"
Severity="Informational" />
<controls:SettingsGroup
x:Uid="Shortcut"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<labs:SettingsCard
x:Uid="Activation_Shortcut"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
Glyph=&#xEDA7;}">
<controls:ShortcutControl
MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
</labs:SettingsCard>
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>
<controls:SettingsPageControl.PrimaryLinks>
<controls:PageLink
x:Uid="LearnMore_PastePlain"
Link="https://aka.ms/PowerToysOverview_PastePlain" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</Page>

View File

@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PastePlainPage : Page, IRefreshablePage
{
private PastePlainViewModel ViewModel { get; set; }
public PastePlainPage()
{
var settingsUtils = new SettingsUtils();
ViewModel = new PastePlainViewModel(
settingsUtils,
SettingsRepository<GeneralSettings>.GetInstance(settingsUtils),
SettingsRepository<PastePlainSettings>.GetInstance(settingsUtils),
ShellPage.SendDefaultIPCMessage);
DataContext = ViewModel;
InitializeComponent();
}
public void RefreshEnabledState()
{
ViewModel.RefreshEnabledState();
}
}
}

View File

@@ -100,6 +100,11 @@
helpers:NavHelper.NavigateTo="views:MouseUtilsPage"
Icon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsMouseUtils.png}" />
<NavigationViewItem
x:Uid="Shell_PastePlain"
helpers:NavHelper.NavigateTo="views:PastePlainPage"
Icon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsPastePlain.png}" />
<NavigationViewItem
x:Uid="Shell_PowerRename"
helpers:NavHelper.NavigateTo="views:PowerRenamePage"