From 7e4e12bd84f47eb35ce6610688d504e84a674ee4 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Tue, 11 Jun 2024 14:35:58 -0500 Subject: [PATCH 01/30] Added stuff for an enabled toggle --- .../SettingsXAML/Views/PowerPreviewPage.xaml | 5 ++ .../Views/PowerPreviewPage.xaml.cs | 8 ++- .../Settings.UI/Strings/en-us/Resources.resw | 3 ++ .../ViewModels/PowerPreviewViewModel.cs | 50 +++++++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml index f4836958201f..df60ee446358 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml @@ -13,6 +13,11 @@ + + + + + /// An empty page that can be used on its own or navigated to within a Frame. /// - public sealed partial class PowerPreviewPage : Page + public sealed partial class PowerPreviewPage : Page, IRefreshablePage { public PowerPreviewViewModel ViewModel { get; set; } @@ -22,5 +23,10 @@ public PowerPreviewPage() ViewModel = new PowerPreviewViewModel(SettingsRepository.GetInstance(settingsUtils), SettingsRepository.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage); DataContext = ViewModel; } + + public void RefreshEnabledState() + { + ViewModel.RefreshEnabledState(); + } } } diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index 5099a48b418c..0fc11b609f19 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4192,4 +4192,7 @@ Activate by holding the key for the character you want to add an accent to, then If you do not have credits you will see an 'API key quota exceeded' error + + Enable File Explorer add-ons + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index fa494f6cd581..72f5e4dc8fb0 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -208,8 +208,33 @@ public PowerPreviewViewModel(ISettingsRepository moduleSet { _qoiThumbnailIsEnabled = Settings.Properties.EnableQoiThumbnail; } + + InitializeEnabledValue(); } + private void InitializeEnabledValue() + { + /*_enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredFancyZonesEnabledValue(); + if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) + { + // Get the enabled state from GPO. + _enabledStateIsGPOConfigured = true; + _isEnabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled; + } + else + {*/ + _isEnabled = GeneralSettingsConfig.Enabled.PowerPreview; + /*}*/ + } + + public void RefreshEnabledState() + { + InitializeEnabledValue(); + OnPropertyChanged(nameof(IsEnabled)); + } + + private bool _isEnabled; + private GpoRuleConfigured _svgRenderEnabledGpoRuleConfiguration; private bool _svgRenderEnabledStateIsGPOConfigured; private bool _svgRenderIsGpoEnabled; @@ -285,6 +310,31 @@ public PowerPreviewViewModel(ISettingsRepository moduleSet private bool _qoiThumbnailIsGpoDisabled; private bool _qoiThumbnailIsEnabled; + public bool IsEnabled + { + get => _isEnabled; + set + { + /*if (_enabledStateIsGPOConfigured) + { + // If it's GPO configured, shouldn't be able to change this state. + return; + }*/ + + if (_isEnabled != value) + { + _isEnabled = value; + OnPropertyChanged(nameof(IsEnabled)); + + // Set the status in the general settings + GeneralSettingsConfig.Enabled.PowerPreview = value; + var outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig); + + SendConfigMSG(outgoing.ToString()); + } + } + } + public bool SomePreviewPaneEnabledGposConfigured { get From 79919c979125950d6eb9ea27d2c36fb194a3a3ec Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 12 Jun 2024 14:37:09 -0500 Subject: [PATCH 02/30] Removed incorrect summary --- .../Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml.cs index eaa13fb791df..ea5f3ff2a8e3 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml.cs @@ -9,9 +9,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views { - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// public sealed partial class PowerPreviewPage : Page, IRefreshablePage { public PowerPreviewViewModel ViewModel { get; set; } From 2b513b6d61cd79e1a4805f9c3d414e7b4cc2d9ee Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Thu, 13 Jun 2024 12:06:25 -0500 Subject: [PATCH 03/30] Added most of a GPO --- src/common/GPOWrapper/GPOWrapper.cpp | 4 ++++ src/common/GPOWrapper/GPOWrapper.h | 1 + src/common/GPOWrapper/GPOWrapper.idl | 1 + src/common/ManagedCommon/ModuleType.cs | 1 + src/common/utils/gpo.h | 12 +++++++++--- src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs | 3 +++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/common/GPOWrapper/GPOWrapper.cpp b/src/common/GPOWrapper/GPOWrapper.cpp index ee75ae71f5ce..71f6a02ad326 100644 --- a/src/common/GPOWrapper/GPOWrapper.cpp +++ b/src/common/GPOWrapper/GPOWrapper.cpp @@ -176,4 +176,8 @@ namespace winrt::PowerToys::GPOWrapper::implementation { return static_cast(powertoys_gpo::getAllowedAdvancedPasteOnlineAIModelsValue()); } + GpoRuleConfigured GPOWrapper::GetConfiguredFileExplorerPreviewEnabledValue() + { + return static_cast(powertoys_gpo::getConfiguredFileExplorerPreviewEnabledValue()); + } } diff --git a/src/common/GPOWrapper/GPOWrapper.h b/src/common/GPOWrapper/GPOWrapper.h index e6e231c3c106..22604559320d 100644 --- a/src/common/GPOWrapper/GPOWrapper.h +++ b/src/common/GPOWrapper/GPOWrapper.h @@ -50,6 +50,7 @@ namespace winrt::PowerToys::GPOWrapper::implementation static GpoRuleConfigured GetConfiguredQoiPreviewEnabledValue(); static GpoRuleConfigured GetConfiguredQoiThumbnailsEnabledValue(); static GpoRuleConfigured GetAllowedAdvancedPasteOnlineAIModelsValue(); + static GpoRuleConfigured GetConfiguredFileExplorerPreviewEnabledValue(); }; } diff --git a/src/common/GPOWrapper/GPOWrapper.idl b/src/common/GPOWrapper/GPOWrapper.idl index 6bd22d8c31b5..a0a6b0c8bed8 100644 --- a/src/common/GPOWrapper/GPOWrapper.idl +++ b/src/common/GPOWrapper/GPOWrapper.idl @@ -54,6 +54,7 @@ namespace PowerToys static GpoRuleConfigured GetConfiguredQoiPreviewEnabledValue(); static GpoRuleConfigured GetConfiguredQoiThumbnailsEnabledValue(); static GpoRuleConfigured GetAllowedAdvancedPasteOnlineAIModelsValue(); + static GpoRuleConfigured GetConfiguredFileExplorerPreviewEnabledValue(); } } } diff --git a/src/common/ManagedCommon/ModuleType.cs b/src/common/ManagedCommon/ModuleType.cs index de57f5138c5d..6c1b557b4abc 100644 --- a/src/common/ManagedCommon/ModuleType.cs +++ b/src/common/ManagedCommon/ModuleType.cs @@ -30,5 +30,6 @@ public enum ModuleType MeasureTool, ShortcutGuide, PowerOCR, + PowerPreview, } } diff --git a/src/common/utils/gpo.h b/src/common/utils/gpo.h index 9c852bae58ef..c3a967f808b4 100644 --- a/src/common/utils/gpo.h +++ b/src/common/utils/gpo.h @@ -59,6 +59,7 @@ namespace powertoys_gpo { const std::wstring POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES = L"ConfigureEnabledUtilityEnvironmentVariables"; const std::wstring POLICY_CONFIGURE_ENABLED_QOI_PREVIEW = L"ConfigureEnabledUtilityFileExplorerQOIPreview"; const std::wstring POLICY_CONFIGURE_ENABLED_QOI_THUMBNAILS = L"ConfigureEnabledUtilityFileExplorerQOIThumbnails"; + const std::wstring POLICY_CONFIGURE_ENABLED_FILE_EXPLORER_PREVIEW = L"ConfigureEnabledUtilityFileExplorerPreview"; // The registry value names for PowerToys installer and update policies. const std::wstring POLICY_DISABLE_PER_USER_INSTALLATION = L"PerUserInstallationDisabled"; @@ -422,7 +423,7 @@ namespace powertoys_gpo { } inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID) - { + { if (pluginID == "" || pluginID == " ") { // this plugin id can't exist in the registry @@ -431,7 +432,7 @@ namespace powertoys_gpo { std::wstring plugin_id(pluginID.begin(), pluginID.end()); auto individual_plugin_setting = getPolicyListValue(POWER_LAUNCHER_INDIVIDUAL_PLUGIN_ENABLED_LIST_PATH, plugin_id); - + if (individual_plugin_setting.has_value()) { if (*individual_plugin_setting == L"0") @@ -458,7 +459,7 @@ namespace powertoys_gpo { { // If no individual plugin policy exists, we check the policy with the setting for all plugins. return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS); - } + } } inline gpo_rule_configured_t getConfiguredQoiPreviewEnabledValue() @@ -475,4 +476,9 @@ namespace powertoys_gpo { { return getUtilityEnabledValue(POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS); } + + inline gpo_rule_configured_t getConfiguredFileExplorerPreviewEnabledValue() + { + return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_EXPLORER_PREVIEW); + } } diff --git a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs index 843198b29bb9..9fb46667e53b 100644 --- a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs @@ -68,6 +68,7 @@ public static bool GetIsModuleEnabled(Library.GeneralSettings generalSettingsCon case ModuleType.MeasureTool: return generalSettingsConfig.Enabled.MeasureTool; case ModuleType.ShortcutGuide: return generalSettingsConfig.Enabled.ShortcutGuide; case ModuleType.PowerOCR: return generalSettingsConfig.Enabled.PowerOcr; + case ModuleType.PowerPreview: return generalSettingsConfig.Enabled.PowerPreview; default: return false; } } @@ -100,6 +101,7 @@ internal static void SetIsModuleEnabled(GeneralSettings generalSettingsConfig, M case ModuleType.MeasureTool: generalSettingsConfig.Enabled.MeasureTool = isEnabled; break; case ModuleType.ShortcutGuide: generalSettingsConfig.Enabled.ShortcutGuide = isEnabled; break; case ModuleType.PowerOCR: generalSettingsConfig.Enabled.PowerOcr = isEnabled; break; + case ModuleType.PowerPreview: generalSettingsConfig.Enabled.PowerPreview = isEnabled; break; } } @@ -131,6 +133,7 @@ public static GpoRuleConfigured GetModuleGpoConfiguration(ModuleType moduleType) case ModuleType.MeasureTool: return GPOWrapper.GetConfiguredScreenRulerEnabledValue(); case ModuleType.ShortcutGuide: return GPOWrapper.GetConfiguredShortcutGuideEnabledValue(); case ModuleType.PowerOCR: return GPOWrapper.GetConfiguredTextExtractorEnabledValue(); + case ModuleType.PowerPreview: return GPOWrapper.GetConfiguredFileExplorerPreviewEnabledValue(); default: return GpoRuleConfigured.Unavailable; } } From 9dabee3f455aef4c527407528da5f21c81a1f325 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Thu, 13 Jun 2024 12:13:38 -0500 Subject: [PATCH 04/30] Added to BugReportTool --- tools/BugReportTool/BugReportTool/ReportGPOValues.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp b/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp index 3aa19a80eb76..99b5dfa22fd0 100644 --- a/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp +++ b/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp @@ -68,4 +68,5 @@ void ReportGPOValues(const std::filesystem::path& tmpDir) report << "getConfiguredQoiPreviewEnabledValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredQoiPreviewEnabledValue()) << std::endl; report << "getConfiguredQoiThumbnailsEnabledValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredQoiThumbnailsEnabledValue()) << std::endl; report << "getAllowedAdvancedPasteOnlineAIModelsValue: " << gpo_rule_configured_to_string(powertoys_gpo::getAllowedAdvancedPasteOnlineAIModelsValue()) << std::endl; + report << "getConfiguredFileExplorerPreviewEnabledValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredFileExplorerPreviewEnabledValue()) << std::endl; } From d6bd83b8e950054a07c46bb7671b1ff9f6bbabf3 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Thu, 13 Jun 2024 13:50:55 -0500 Subject: [PATCH 05/30] Updated .adml and .admx --- src/gpo/assets/PowerToys.admx | 1014 ++++++++++++++------------- src/gpo/assets/en-US/PowerToys.adml | 264 +++---- 2 files changed, 646 insertions(+), 632 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index 316254ff3e3c..cb89c2fe964b 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -1,507 +1,519 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 9e26fbde74e1..52d9e32702b1 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -1,187 +1,189 @@ - - PowerToys - PowerToys - - - Microsoft PowerToys - Installer and Updates - PowerToys Run - Advanced Paste - - PowerToys version 0.64.0 or later - PowerToys version 0.68.0 or later - PowerToys version 0.69.0 or later - PowerToys version 0.70.0 or later - PowerToys version 0.73.0 or later - PowerToys version 0.75.0 or later - PowerToys version 0.76.0 or later - PowerToys version 0.77.0 or later - PowerToys version 0.78.0 or later - PowerToys version 0.81.0 or later - PowerToys version 0.81.1 or later + + PowerToys + PowerToys + + + Microsoft PowerToys + Installer and Updates + PowerToys Run + Advanced Paste + + PowerToys version 0.64.0 or later + PowerToys version 0.68.0 or later + PowerToys version 0.69.0 or later + PowerToys version 0.70.0 or later + PowerToys version 0.73.0 or later + PowerToys version 0.75.0 or later + PowerToys version 0.76.0 or later + PowerToys version 0.77.0 or later + PowerToys version 0.78.0 or later + PowerToys version 0.81.0 or later + PowerToys version 0.81.1 or later + PowerToys version 0.82.0 or later This policy configures the enabled state for all PowerToys utilities. -If you enable this setting, all utilities will be always enabled and the user won't be able to disable it. + If you enable this setting, all utilities will be always enabled and the user won't be able to disable it. -If you disable this setting, all utilities will be always disabled and the user won't be able to enable it. + If you disable this setting, all utilities will be always disabled and the user won't be able to enable it. -If you don't configure this setting, users are able to enable or disable the utilities. + If you don't configure this setting, users are able to enable or disable the utilities. -The individual enabled state policies for the utilities will override this policy. - + The individual enabled state policies for the utilities will override this policy. + This policy configures the enabled state for a PowerToys utility. -If you enable this setting, the utility will be always enabled and the user won't be able to disable it. + If you enable this setting, the utility will be always enabled and the user won't be able to disable it. -If you disable this setting, the utility will be always disabled and the user won't be able to enable it. + If you disable this setting, the utility will be always disabled and the user won't be able to enable it. -If you don't configure this setting, users are able to enable or disable the utility. + If you don't configure this setting, users are able to enable or disable the utility. -This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. - + This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. + (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) -This policy configures the enabled state for a PowerToys utility. + This policy configures the enabled state for a PowerToys utility. -If you enable this setting, the utility will be always enabled and the user won't be able to disable it. + If you enable this setting, the utility will be always enabled and the user won't be able to disable it. -If you disable this setting, the utility will be always disabled and the user won't be able to enable it. + If you disable this setting, the utility will be always disabled and the user won't be able to enable it. -If you don't configure this setting, users are able to enable or disable the utility. + If you don't configure this setting, users are able to enable or disable the utility. -This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. - + This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. + This policy configures whether per-user PowerToys installation is allowed or not. -If enabled, per-user installation is not allowed. + If enabled, per-user installation is not allowed. -If disabled or not configured, per-user installation is allowed. - + If disabled or not configured, per-user installation is allowed. + This policy configures whether the automatic download and installation of available updates is disabled or not. (On metered connections updates are never downloaded.) -If enabled, automatic download and installation is disabled. + If enabled, automatic download and installation is disabled. -If disabled or not configured, the user can control this in the settings. - + If disabled or not configured, the user can control this in the settings. + This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.) -If enabled, the notification is suspended. + If enabled, the notification is suspended. -If disabled or not configured, the notification is shown. + If disabled or not configured, the notification is shown. -Note: The notification about new major versions is always displayed. + Note: The notification about new major versions is always displayed. -This policy has no effect if the update notification is disabled by the policy "Disable Action Center notification for new updates" or the user setting. - + This policy has no effect if the update notification is disabled by the policy "Disable Action Center notification for new updates" or the user setting. + This policy configures whether the action center notification for new updates is shown or not. -If enabled, the notification is disabled. + If enabled, the notification is disabled. -If disabled or not configured, the user can control if the notification is shown or not. - + If disabled or not configured, the user can control if the notification is shown or not. + This policy allows you to configure if the window with the release notes is shown after updates. -If enabled, the window with the release notes is not shown automatically. + If enabled, the window with the release notes is not shown automatically. -If disabled or not configured, the user can control this in the settings of PowerToys. - + If disabled or not configured, the user can control this in the settings of PowerToys. + This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.) -If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu. + If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu. -If this setting is disabled, experimentation is not allowed. - + If this setting is disabled, experimentation is not allowed. + This policy configures the enabled state for all PowerToys Run plugins. All plugins will have the same state. -If you enable this setting, the plugins will be always enabled and the user won't be able to disable it. + If you enable this setting, the plugins will be always enabled and the user won't be able to disable it. -If you disable this setting, the plugins will be always disabled and the user won't be able to enable it. + If you disable this setting, the plugins will be always disabled and the user won't be able to enable it. -If you don't configure this setting, users are able to enable or disable the plugins. + If you don't configure this setting, users are able to enable or disable the plugins. -You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins". + You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins". -Note: Changes require a restart of PowerToys Run. - + Note: Changes require a restart of PowerToys Run. + With this policy you can configure an individual enabled state for each PowerToys Run plugin that you add to the list. -If you enable this setting, you can define the list of plugins and their enabled states: - - The value name (first column) is the plugin ID. You will find it in the plugin.json file which is located in the plugin folder. - - The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2 for user takes control. - - Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0 + If you enable this setting, you can define the list of plugins and their enabled states: + - The value name (first column) is the plugin ID. You will find it in the plugin.json file which is located in the plugin folder. + - The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2 for user takes control. + - Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0 -If you disable or don't configure this policy, either the user or the policy "Configure enabled state for all plugins" takes control over the enabled state of the plugins. + If you disable or don't configure this policy, either the user or the policy "Configure enabled state for all plugins" takes control over the enabled state of the plugins. -You can set the enabled state for all plugins not configured by this policy using the policy "Configure enabled state for all plugins". + You can set the enabled state for all plugins not configured by this policy using the policy "Configure enabled state for all plugins". -Note: Changes require a restart of PowerToys Run. - + Note: Changes require a restart of PowerToys Run. + This policy configures the enabled disable state for using Advanced Paste online AI models. -If you enable or don't configure this policy, the user takes control over the enabled state of the Enable paste with AI Advanced Paste setting. - -If you disable this policy, the user won't be able to enable Enable paste with AI Advanced Paste setting and use Advanced Paste AI prompt nor set up the Open AI key in PowerToys Settings. - - Configure global utility enabled state - Advanced Paste: Configure enabled state - Always On Top: Configure enabled state - Awake: Configure enabled state - Color Picker: Configure enabled state - Command Not Found: Configure enabled state - Crop And Lock: Configure enabled state - Environment Variables: Configure enabled state - FancyZones: Configure enabled state - File Locksmith: Configure enabled state - SVG file preview: Configure enabled state - Markdown file preview: Configure enabled state - Source code file preview: Configure enabled state - PDF file preview: Configure enabled state - Gcode file preview: Configure enabled state - SVG file thumbnail: Configure enabled state - PDF file thumbnail: Configure enabled state - Gcode file thumbnail: Configure enabled state - STL file thumbnail: Configure enabled state - Hosts file editor: Configure enabled state - Image Resizer: Configure enabled state - Keyboard Manager: Configure enabled state - Find My Mouse: Configure enabled state - Mouse Highlighter: Configure enabled state - Mouse Jump: Configure enabled state - Mouse Pointer Crosshairs: Configure enabled state - Mouse Without Borders: Configure enabled state - Peek: Configure enabled state - Power Rename: Configure enabled state - PowerToys Run: Configure enabled state - Quick Accent: Configure enabled state - Registry Preview: Configure enabled state - Screen Ruler: Configure enabled state - Shortcut Guide: Configure enabled state - Text Extractor: Configure enabled state - Video Conference Mute: Configure enabled state - Disable per-user installation - Disable automatic downloads - Do not show the release notes after updates - Suspend Action Center notification for new updates - Disable Action Center notification for new updates - Allow Experimentation - Configure enabled state for all plugins - Configure enabled state for individual plugins - QOI file preview: Configure enabled state - QOI file thumbnail: Configure enabled state - Advanced Paste: Allow using online AI models - - - - - List of managed plugins: - - - - + If you enable or don't configure this policy, the user takes control over the enabled state of the Enable paste with AI Advanced Paste setting. + + If you disable this policy, the user won't be able to enable Enable paste with AI Advanced Paste setting and use Advanced Paste AI prompt nor set up the Open AI key in PowerToys Settings. + + Configure global utility enabled state + Advanced Paste: Configure enabled state + Always On Top: Configure enabled state + Awake: Configure enabled state + Color Picker: Configure enabled state + Command Not Found: Configure enabled state + Crop And Lock: Configure enabled state + Environment Variables: Configure enabled state + FancyZones: Configure enabled state + File Locksmith: Configure enabled state + File Explorer add-ons: Configure enabled state + SVG file preview: Configure enabled state + Markdown file preview: Configure enabled state + Source code file preview: Configure enabled state + PDF file preview: Configure enabled state + Gcode file preview: Configure enabled state + SVG file thumbnail: Configure enabled state + PDF file thumbnail: Configure enabled state + Gcode file thumbnail: Configure enabled state + STL file thumbnail: Configure enabled state + Hosts file editor: Configure enabled state + Image Resizer: Configure enabled state + Keyboard Manager: Configure enabled state + Find My Mouse: Configure enabled state + Mouse Highlighter: Configure enabled state + Mouse Jump: Configure enabled state + Mouse Pointer Crosshairs: Configure enabled state + Mouse Without Borders: Configure enabled state + Peek: Configure enabled state + Power Rename: Configure enabled state + PowerToys Run: Configure enabled state + Quick Accent: Configure enabled state + Registry Preview: Configure enabled state + Screen Ruler: Configure enabled state + Shortcut Guide: Configure enabled state + Text Extractor: Configure enabled state + Video Conference Mute: Configure enabled state + Disable per-user installation + Disable automatic downloads + Do not show the release notes after updates + Suspend Action Center notification for new updates + Disable Action Center notification for new updates + Allow Experimentation + Configure enabled state for all plugins + Configure enabled state for individual plugins + QOI file preview: Configure enabled state + QOI file thumbnail: Configure enabled state + Advanced Paste: Allow using online AI models + + + + + List of managed plugins: + + + + From b65f6338c680afa2cc6b61b805a0a5ab0af989fd Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Thu, 13 Jun 2024 14:16:12 -0500 Subject: [PATCH 06/30] Added a card to the Dashboard --- src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs | 3 ++- .../Settings.UI/Strings/en-us/Resources.resw | 3 +++ .../Settings.UI/ViewModels/DashboardViewModel.cs | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs index 9fb46667e53b..09746bb87117 100644 --- a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs @@ -6,7 +6,6 @@ using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Views; -using Windows.UI; namespace Microsoft.PowerToys.Settings.UI.Helpers { @@ -22,6 +21,7 @@ public static string GetModuleLabelResourceName(ModuleType moduleType) case ModuleType.MouseHighlighter: case ModuleType.MouseJump: case ModuleType.MousePointerCrosshairs: return $"MouseUtils_{moduleType}/Header"; + case ModuleType.PowerPreview: return "FileExplorerPreview/ModuleTitle"; default: return $"{moduleType}/ModuleTitle"; } } @@ -36,6 +36,7 @@ public static string GetModuleTypeFluentIconName(ModuleType moduleType) case ModuleType.MousePointerCrosshairs: return "ms-appx:///Assets/Settings/Icons/MouseCrosshairs.png"; case ModuleType.MeasureTool: return "ms-appx:///Assets/Settings/Icons/ScreenRuler.png"; case ModuleType.PowerLauncher: return $"ms-appx:///Assets/Settings/Icons/PowerToysRun.png"; + case ModuleType.PowerPreview: return $"ms-appx:///Assets/Settings/Icons/FileExplorerPreview.png"; default: return $"ms-appx:///Assets/Settings/Icons/{moduleType}.png"; } } diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index 0fc11b609f19..5847c9434838 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4195,4 +4195,7 @@ Activate by holding the key for the character you want to add an accent to, then Enable File Explorer add-ons + + Custom preview handlers for Windows File Explorer + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs index 90f4640ea34c..fdeb3e27d5fd 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs @@ -170,6 +170,7 @@ private ObservableCollection GetModuleItems(ModuleType modu ModuleType.MeasureTool => GetModuleItemsMeasureTool(), ModuleType.ShortcutGuide => GetModuleItemsShortcutGuide(), ModuleType.PowerOCR => GetModuleItemsPowerOCR(), + ModuleType.PowerPreview => GetModuleItemsPowerPreview(), _ => new ObservableCollection(), // never called, all values listed above }; } @@ -474,6 +475,15 @@ private ObservableCollection GetModuleItemsPowerOCR() return new ObservableCollection(list); } + private ObservableCollection GetModuleItemsPowerPreview() + { + var list = new List + { + new DashboardModuleTextItem() { Label = resourceLoader.GetString("FileExplorerPreview_ShortDescription") }, + }; + return new ObservableCollection(list); + } + internal void SWVersionButtonClicked() { NavigationService.Navigate(typeof(GeneralPage)); From a40d5c5d6c02f1d73e9b1a02b8961b432ef5b793 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Mon, 17 Jun 2024 14:51:56 -0500 Subject: [PATCH 07/30] Fixed adml --- src/gpo/assets/en-US/PowerToys.adml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 52d9e32702b1..208f8ec3b5d9 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -138,7 +138,7 @@ Environment Variables: Configure enabled state FancyZones: Configure enabled state File Locksmith: Configure enabled state - File Explorer add-ons: Configure enabled state + File Explorer add-ons: Configure enabled state SVG file preview: Configure enabled state Markdown file preview: Configure enabled state Source code file preview: Configure enabled state From cd3172c2554959e48d1fe883236fc1c6610ea97f Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Mon, 17 Jun 2024 14:57:27 -0500 Subject: [PATCH 08/30] Reordered things so File Explorer appears in the right place --- src/common/ManagedCommon/ModuleType.cs | 2 +- src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs | 6 +++--- .../Settings.UI/ViewModels/DashboardViewModel.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/ManagedCommon/ModuleType.cs b/src/common/ManagedCommon/ModuleType.cs index 6c1b557b4abc..ae1825822c85 100644 --- a/src/common/ManagedCommon/ModuleType.cs +++ b/src/common/ManagedCommon/ModuleType.cs @@ -13,6 +13,7 @@ public enum ModuleType CropAndLock, EnvironmentVariables, FancyZones, + PowerPreview, FileLocksmith, FindMyMouse, Hosts, @@ -30,6 +31,5 @@ public enum ModuleType MeasureTool, ShortcutGuide, PowerOCR, - PowerPreview, } } diff --git a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs index 09746bb87117..89a8dfd39d8f 100644 --- a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs @@ -52,6 +52,7 @@ public static bool GetIsModuleEnabled(Library.GeneralSettings generalSettingsCon case ModuleType.CropAndLock: return generalSettingsConfig.Enabled.CropAndLock; case ModuleType.EnvironmentVariables: return generalSettingsConfig.Enabled.EnvironmentVariables; case ModuleType.FancyZones: return generalSettingsConfig.Enabled.FancyZones; + case ModuleType.PowerPreview: return generalSettingsConfig.Enabled.PowerPreview; case ModuleType.FileLocksmith: return generalSettingsConfig.Enabled.FileLocksmith; case ModuleType.FindMyMouse: return generalSettingsConfig.Enabled.FindMyMouse; case ModuleType.Hosts: return generalSettingsConfig.Enabled.Hosts; @@ -69,7 +70,6 @@ public static bool GetIsModuleEnabled(Library.GeneralSettings generalSettingsCon case ModuleType.MeasureTool: return generalSettingsConfig.Enabled.MeasureTool; case ModuleType.ShortcutGuide: return generalSettingsConfig.Enabled.ShortcutGuide; case ModuleType.PowerOCR: return generalSettingsConfig.Enabled.PowerOcr; - case ModuleType.PowerPreview: return generalSettingsConfig.Enabled.PowerPreview; default: return false; } } @@ -85,6 +85,7 @@ internal static void SetIsModuleEnabled(GeneralSettings generalSettingsConfig, M case ModuleType.CropAndLock: generalSettingsConfig.Enabled.CropAndLock = isEnabled; break; case ModuleType.EnvironmentVariables: generalSettingsConfig.Enabled.EnvironmentVariables = isEnabled; break; case ModuleType.FancyZones: generalSettingsConfig.Enabled.FancyZones = isEnabled; break; + case ModuleType.PowerPreview: generalSettingsConfig.Enabled.PowerPreview = isEnabled; break; case ModuleType.FileLocksmith: generalSettingsConfig.Enabled.FileLocksmith = isEnabled; break; case ModuleType.FindMyMouse: generalSettingsConfig.Enabled.FindMyMouse = isEnabled; break; case ModuleType.Hosts: generalSettingsConfig.Enabled.Hosts = isEnabled; break; @@ -102,7 +103,6 @@ internal static void SetIsModuleEnabled(GeneralSettings generalSettingsConfig, M case ModuleType.MeasureTool: generalSettingsConfig.Enabled.MeasureTool = isEnabled; break; case ModuleType.ShortcutGuide: generalSettingsConfig.Enabled.ShortcutGuide = isEnabled; break; case ModuleType.PowerOCR: generalSettingsConfig.Enabled.PowerOcr = isEnabled; break; - case ModuleType.PowerPreview: generalSettingsConfig.Enabled.PowerPreview = isEnabled; break; } } @@ -117,6 +117,7 @@ public static GpoRuleConfigured GetModuleGpoConfiguration(ModuleType moduleType) case ModuleType.CropAndLock: return GPOWrapper.GetConfiguredCropAndLockEnabledValue(); case ModuleType.EnvironmentVariables: return GPOWrapper.GetConfiguredEnvironmentVariablesEnabledValue(); case ModuleType.FancyZones: return GPOWrapper.GetConfiguredFancyZonesEnabledValue(); + case ModuleType.PowerPreview: return GPOWrapper.GetConfiguredFileExplorerPreviewEnabledValue(); case ModuleType.FileLocksmith: return GPOWrapper.GetConfiguredFileLocksmithEnabledValue(); case ModuleType.FindMyMouse: return GPOWrapper.GetConfiguredFindMyMouseEnabledValue(); case ModuleType.Hosts: return GPOWrapper.GetConfiguredHostsFileEditorEnabledValue(); @@ -134,7 +135,6 @@ public static GpoRuleConfigured GetModuleGpoConfiguration(ModuleType moduleType) case ModuleType.MeasureTool: return GPOWrapper.GetConfiguredScreenRulerEnabledValue(); case ModuleType.ShortcutGuide: return GPOWrapper.GetConfiguredShortcutGuideEnabledValue(); case ModuleType.PowerOCR: return GPOWrapper.GetConfiguredTextExtractorEnabledValue(); - case ModuleType.PowerPreview: return GPOWrapper.GetConfiguredFileExplorerPreviewEnabledValue(); default: return GpoRuleConfigured.Unavailable; } } diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs index fdeb3e27d5fd..ab2ff44d1b4d 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs @@ -153,6 +153,7 @@ private ObservableCollection GetModuleItems(ModuleType modu ModuleType.CropAndLock => GetModuleItemsCropAndLock(), ModuleType.EnvironmentVariables => GetModuleItemsEnvironmentVariables(), ModuleType.FancyZones => GetModuleItemsFancyZones(), + ModuleType.PowerPreview => GetModuleItemsPowerPreview(), ModuleType.FileLocksmith => GetModuleItemsFileLocksmith(), ModuleType.FindMyMouse => GetModuleItemsFindMyMouse(), ModuleType.Hosts => GetModuleItemsHosts(), @@ -170,7 +171,6 @@ private ObservableCollection GetModuleItems(ModuleType modu ModuleType.MeasureTool => GetModuleItemsMeasureTool(), ModuleType.ShortcutGuide => GetModuleItemsShortcutGuide(), ModuleType.PowerOCR => GetModuleItemsPowerOCR(), - ModuleType.PowerPreview => GetModuleItemsPowerPreview(), _ => new ObservableCollection(), // never called, all values listed above }; } From 40707c4b07c9c2d527dff4f76b666c11c2b7bd05 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Mon, 17 Jun 2024 16:36:39 -0500 Subject: [PATCH 09/30] Finished copying from other modules --- .../Settings.UI/Helpers/ModuleHelper.cs | 1 + .../SettingsXAML/Views/PowerPreviewPage.xaml | 12 ++++++++++-- .../ViewModels/PowerPreviewViewModel.cs | 19 +++++++++++++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs index 89a8dfd39d8f..a88af2c20eea 100644 --- a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs @@ -150,6 +150,7 @@ public static System.Type GetModulePageType(ModuleType moduleType) ModuleType.CropAndLock => typeof(CropAndLockPage), ModuleType.EnvironmentVariables => typeof(EnvironmentVariablesPage), ModuleType.FancyZones => typeof(FancyZonesPage), + ModuleType.PowerPreview => typeof(PowerPreviewPage), ModuleType.FileLocksmith => typeof(FileLocksmithPage), ModuleType.FindMyMouse => typeof(MouseUtilsPage), ModuleType.Hosts => typeof(HostsPage), diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml index df60ee446358..c4d846226bf3 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml @@ -13,10 +13,18 @@ - - + + moduleSet private void InitializeEnabledValue() { - /*_enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredFancyZonesEnabledValue(); + _enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredFancyZonesEnabledValue(); if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) { // Get the enabled state from GPO. @@ -222,9 +222,9 @@ private void InitializeEnabledValue() _isEnabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled; } else - {*/ - _isEnabled = GeneralSettingsConfig.Enabled.PowerPreview; - /*}*/ + { + _isEnabled = GeneralSettingsConfig.Enabled.PowerPreview; + } } public void RefreshEnabledState() @@ -233,6 +233,8 @@ public void RefreshEnabledState() OnPropertyChanged(nameof(IsEnabled)); } + private GpoRuleConfigured _enabledGpoRuleConfiguration; + private bool _enabledStateIsGPOConfigured; private bool _isEnabled; private GpoRuleConfigured _svgRenderEnabledGpoRuleConfiguration; @@ -315,11 +317,11 @@ public bool IsEnabled get => _isEnabled; set { - /*if (_enabledStateIsGPOConfigured) + if (_enabledStateIsGPOConfigured) { // If it's GPO configured, shouldn't be able to change this state. return; - }*/ + } if (_isEnabled != value) { @@ -335,6 +337,11 @@ public bool IsEnabled } } + public bool IsEnabledGpoConfigured + { + get => _enabledStateIsGPOConfigured; + } + public bool SomePreviewPaneEnabledGposConfigured { get From 75e8ed91aea9ea6a2561cb2c8f06149fb3cb5e56 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Mon, 17 Jun 2024 16:45:18 -0500 Subject: [PATCH 10/30] Made sure it was using its own GPO --- src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index 41972e4a6289..5a8ea93546de 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -214,7 +214,7 @@ public PowerPreviewViewModel(ISettingsRepository moduleSet private void InitializeEnabledValue() { - _enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredFancyZonesEnabledValue(); + _enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredFileExplorerPreviewEnabledValue(); if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) { // Get the enabled state from GPO. From 43074da08ac84d974848edf0355dfc88ec0326de Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Tue, 18 Jun 2024 15:17:56 -0500 Subject: [PATCH 11/30] Allowed it to save the setting --- src/settings-ui/Settings.UI.Library/EnabledModules.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI.Library/EnabledModules.cs b/src/settings-ui/Settings.UI.Library/EnabledModules.cs index 0c0ef406fbad..9812106c755f 100644 --- a/src/settings-ui/Settings.UI.Library/EnabledModules.cs +++ b/src/settings-ui/Settings.UI.Library/EnabledModules.cs @@ -56,7 +56,7 @@ public bool ImageResizer private bool fileExplorerPreview = true; - [JsonPropertyName("File Explorer Preview")] + [JsonPropertyName("File Explorer")] public bool PowerPreview { get => fileExplorerPreview; From 877d12c766c985f9491495b5a855f2e5569212eb Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Tue, 18 Jun 2024 15:22:01 -0500 Subject: [PATCH 12/30] Disabled settings when module is not enabled --- .../Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml index c4d846226bf3..f71f37624f41 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml @@ -26,7 +26,7 @@ IsTabStop="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}" Severity="Informational" /> - + - + Date: Fri, 21 Jun 2024 15:02:18 -0500 Subject: [PATCH 13/30] Reformatted .adml and .admx --- src/gpo/assets/PowerToys.admx | 1023 +++++++++++++-------------- src/gpo/assets/en-US/PowerToys.adml | 264 +++---- 2 files changed, 643 insertions(+), 644 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index cb89c2fe964b..82888bbf644a 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -2,518 +2,517 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 208f8ec3b5d9..3d37b7acca14 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -2,188 +2,188 @@ - PowerToys - PowerToys - - - Microsoft PowerToys - Installer and Updates - PowerToys Run - Advanced Paste - - PowerToys version 0.64.0 or later - PowerToys version 0.68.0 or later - PowerToys version 0.69.0 or later - PowerToys version 0.70.0 or later - PowerToys version 0.73.0 or later - PowerToys version 0.75.0 or later - PowerToys version 0.76.0 or later - PowerToys version 0.77.0 or later - PowerToys version 0.78.0 or later - PowerToys version 0.81.0 or later - PowerToys version 0.81.1 or later - PowerToys version 0.82.0 or later + PowerToys + PowerToys + + + Microsoft PowerToys + Installer and Updates + PowerToys Run + Advanced Paste + + PowerToys version 0.64.0 or later + PowerToys version 0.68.0 or later + PowerToys version 0.69.0 or later + PowerToys version 0.70.0 or later + PowerToys version 0.73.0 or later + PowerToys version 0.75.0 or later + PowerToys version 0.76.0 or later + PowerToys version 0.77.0 or later + PowerToys version 0.78.0 or later + PowerToys version 0.81.0 or later + PowerToys version 0.81.1 or later + PowerToys version 0.82.0 or later This policy configures the enabled state for all PowerToys utilities. - If you enable this setting, all utilities will be always enabled and the user won't be able to disable it. +If you enable this setting, all utilities will be always enabled and the user won't be able to disable it. - If you disable this setting, all utilities will be always disabled and the user won't be able to enable it. +If you disable this setting, all utilities will be always disabled and the user won't be able to enable it. - If you don't configure this setting, users are able to enable or disable the utilities. +If you don't configure this setting, users are able to enable or disable the utilities. - The individual enabled state policies for the utilities will override this policy. - +The individual enabled state policies for the utilities will override this policy. + This policy configures the enabled state for a PowerToys utility. - If you enable this setting, the utility will be always enabled and the user won't be able to disable it. +If you enable this setting, the utility will be always enabled and the user won't be able to disable it. - If you disable this setting, the utility will be always disabled and the user won't be able to enable it. +If you disable this setting, the utility will be always disabled and the user won't be able to enable it. - If you don't configure this setting, users are able to enable or disable the utility. +If you don't configure this setting, users are able to enable or disable the utility. - This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. - +This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. + (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) - This policy configures the enabled state for a PowerToys utility. +This policy configures the enabled state for a PowerToys utility. - If you enable this setting, the utility will be always enabled and the user won't be able to disable it. +If you enable this setting, the utility will be always enabled and the user won't be able to disable it. - If you disable this setting, the utility will be always disabled and the user won't be able to enable it. +If you disable this setting, the utility will be always disabled and the user won't be able to enable it. - If you don't configure this setting, users are able to enable or disable the utility. +If you don't configure this setting, users are able to enable or disable the utility. - This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. - +This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. + This policy configures whether per-user PowerToys installation is allowed or not. - If enabled, per-user installation is not allowed. +If enabled, per-user installation is not allowed. - If disabled or not configured, per-user installation is allowed. - +If disabled or not configured, per-user installation is allowed. + This policy configures whether the automatic download and installation of available updates is disabled or not. (On metered connections updates are never downloaded.) - If enabled, automatic download and installation is disabled. +If enabled, automatic download and installation is disabled. - If disabled or not configured, the user can control this in the settings. - +If disabled or not configured, the user can control this in the settings. + This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.) - If enabled, the notification is suspended. +If enabled, the notification is suspended. - If disabled or not configured, the notification is shown. +If disabled or not configured, the notification is shown. - Note: The notification about new major versions is always displayed. +Note: The notification about new major versions is always displayed. - This policy has no effect if the update notification is disabled by the policy "Disable Action Center notification for new updates" or the user setting. - +This policy has no effect if the update notification is disabled by the policy "Disable Action Center notification for new updates" or the user setting. + This policy configures whether the action center notification for new updates is shown or not. - If enabled, the notification is disabled. +If enabled, the notification is disabled. - If disabled or not configured, the user can control if the notification is shown or not. - +If disabled or not configured, the user can control if the notification is shown or not. + This policy allows you to configure if the window with the release notes is shown after updates. - If enabled, the window with the release notes is not shown automatically. +If enabled, the window with the release notes is not shown automatically. - If disabled or not configured, the user can control this in the settings of PowerToys. - +If disabled or not configured, the user can control this in the settings of PowerToys. + This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.) - If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu. +If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu. - If this setting is disabled, experimentation is not allowed. - +If this setting is disabled, experimentation is not allowed. + This policy configures the enabled state for all PowerToys Run plugins. All plugins will have the same state. - If you enable this setting, the plugins will be always enabled and the user won't be able to disable it. +If you enable this setting, the plugins will be always enabled and the user won't be able to disable it. - If you disable this setting, the plugins will be always disabled and the user won't be able to enable it. +If you disable this setting, the plugins will be always disabled and the user won't be able to enable it. - If you don't configure this setting, users are able to enable or disable the plugins. +If you don't configure this setting, users are able to enable or disable the plugins. - You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins". +You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins". - Note: Changes require a restart of PowerToys Run. - +Note: Changes require a restart of PowerToys Run. + With this policy you can configure an individual enabled state for each PowerToys Run plugin that you add to the list. - If you enable this setting, you can define the list of plugins and their enabled states: - - The value name (first column) is the plugin ID. You will find it in the plugin.json file which is located in the plugin folder. - - The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2 for user takes control. - - Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0 +If you enable this setting, you can define the list of plugins and their enabled states: + - The value name (first column) is the plugin ID. You will find it in the plugin.json file which is located in the plugin folder. + - The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2 for user takes control. + - Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0 - If you disable or don't configure this policy, either the user or the policy "Configure enabled state for all plugins" takes control over the enabled state of the plugins. +If you disable or don't configure this policy, either the user or the policy "Configure enabled state for all plugins" takes control over the enabled state of the plugins. - You can set the enabled state for all plugins not configured by this policy using the policy "Configure enabled state for all plugins". +You can set the enabled state for all plugins not configured by this policy using the policy "Configure enabled state for all plugins". - Note: Changes require a restart of PowerToys Run. - +Note: Changes require a restart of PowerToys Run. + This policy configures the enabled disable state for using Advanced Paste online AI models. - If you enable or don't configure this policy, the user takes control over the enabled state of the Enable paste with AI Advanced Paste setting. - - If you disable this policy, the user won't be able to enable Enable paste with AI Advanced Paste setting and use Advanced Paste AI prompt nor set up the Open AI key in PowerToys Settings. - - Configure global utility enabled state - Advanced Paste: Configure enabled state - Always On Top: Configure enabled state - Awake: Configure enabled state - Color Picker: Configure enabled state - Command Not Found: Configure enabled state - Crop And Lock: Configure enabled state - Environment Variables: Configure enabled state - FancyZones: Configure enabled state - File Locksmith: Configure enabled state - File Explorer add-ons: Configure enabled state - SVG file preview: Configure enabled state - Markdown file preview: Configure enabled state - Source code file preview: Configure enabled state - PDF file preview: Configure enabled state - Gcode file preview: Configure enabled state - SVG file thumbnail: Configure enabled state - PDF file thumbnail: Configure enabled state - Gcode file thumbnail: Configure enabled state - STL file thumbnail: Configure enabled state - Hosts file editor: Configure enabled state - Image Resizer: Configure enabled state - Keyboard Manager: Configure enabled state - Find My Mouse: Configure enabled state - Mouse Highlighter: Configure enabled state - Mouse Jump: Configure enabled state - Mouse Pointer Crosshairs: Configure enabled state - Mouse Without Borders: Configure enabled state - Peek: Configure enabled state - Power Rename: Configure enabled state - PowerToys Run: Configure enabled state - Quick Accent: Configure enabled state - Registry Preview: Configure enabled state - Screen Ruler: Configure enabled state - Shortcut Guide: Configure enabled state - Text Extractor: Configure enabled state - Video Conference Mute: Configure enabled state - Disable per-user installation - Disable automatic downloads - Do not show the release notes after updates - Suspend Action Center notification for new updates - Disable Action Center notification for new updates - Allow Experimentation - Configure enabled state for all plugins - Configure enabled state for individual plugins - QOI file preview: Configure enabled state - QOI file thumbnail: Configure enabled state - Advanced Paste: Allow using online AI models - - - - - List of managed plugins: - - - - +If you enable or don't configure this policy, the user takes control over the enabled state of the Enable paste with AI Advanced Paste setting. + +If you disable this policy, the user won't be able to enable Enable paste with AI Advanced Paste setting and use Advanced Paste AI prompt nor set up the Open AI key in PowerToys Settings. + + Configure global utility enabled state + Advanced Paste: Configure enabled state + Always On Top: Configure enabled state + Awake: Configure enabled state + Color Picker: Configure enabled state + Command Not Found: Configure enabled state + Crop And Lock: Configure enabled state + Environment Variables: Configure enabled state + FancyZones: Configure enabled state + File Locksmith: Configure enabled state + File Explorer add-ons: Configure enabled state + SVG file preview: Configure enabled state + Markdown file preview: Configure enabled state + Source code file preview: Configure enabled state + PDF file preview: Configure enabled state + Gcode file preview: Configure enabled state + SVG file thumbnail: Configure enabled state + PDF file thumbnail: Configure enabled state + Gcode file thumbnail: Configure enabled state + STL file thumbnail: Configure enabled state + Hosts file editor: Configure enabled state + Image Resizer: Configure enabled state + Keyboard Manager: Configure enabled state + Find My Mouse: Configure enabled state + Mouse Highlighter: Configure enabled state + Mouse Jump: Configure enabled state + Mouse Pointer Crosshairs: Configure enabled state + Mouse Without Borders: Configure enabled state + Peek: Configure enabled state + Power Rename: Configure enabled state + PowerToys Run: Configure enabled state + Quick Accent: Configure enabled state + Registry Preview: Configure enabled state + Screen Ruler: Configure enabled state + Shortcut Guide: Configure enabled state + Text Extractor: Configure enabled state + Video Conference Mute: Configure enabled state + Disable per-user installation + Disable automatic downloads + Do not show the release notes after updates + Suspend Action Center notification for new updates + Disable Action Center notification for new updates + Allow Experimentation + Configure enabled state for all plugins + Configure enabled state for individual plugins + QOI file preview: Configure enabled state + QOI file thumbnail: Configure enabled state + Advanced Paste: Allow using online AI models + + + + + List of managed plugins: + + + + From 9e85b631ec89e9514578bffa304fa5035342b3e9 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Fri, 21 Jun 2024 15:51:04 -0500 Subject: [PATCH 14/30] Added a check to stop it from starting the handlers if the module is disabled --- .../previewpane/powerpreview/powerpreview.cpp | 99 ++++++++++--------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/src/modules/previewpane/powerpreview/powerpreview.cpp b/src/modules/previewpane/powerpreview/powerpreview.cpp index 1eef1f0398a1..617e47831d77 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.cpp +++ b/src/modules/previewpane/powerpreview/powerpreview.cpp @@ -218,56 +218,59 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues& { bool notifyShell = false; - for (auto& fileExplorerModule : m_fileExplorerModules) + if (m_enabled) { - const auto toggle = settings.get_bool_value(fileExplorerModule.settingName); - const auto gpo_rule = fileExplorerModule.checkModuleGPOEnabledRuleFunction(); - const auto gpo_is_configured = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled || gpo_rule == powertoys_gpo::gpo_rule_configured_disabled; - - if (gpo_rule == powertoys_gpo::gpo_rule_configured_unavailable) - { - Logger::warn(L"Couldn't read the gpo rule for Power Preview module {}", fileExplorerModule.settingName); - } - if (gpo_rule == powertoys_gpo::gpo_rule_configured_wrong_value) - { - Logger::warn(L"gpo rule for Power Preview module {} is set to an unknown value", fileExplorerModule.settingName); - } - - // Skip if no need to update - if (!toggle.has_value() && !gpo_is_configured) - { - continue; - } - - bool module_new_state = false; - if (toggle.has_value()) - { - module_new_state = *toggle; - } - if (gpo_is_configured) - { - // gpo rule overrides settings state - module_new_state = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled; - } - - // Skip if no need to update - if (module_new_state == fileExplorerModule.registryChanges.isApplied()) - { - continue; - } - - // (Un)Apply registry changes depending on the new setting value - const bool updated = module_new_state ? fileExplorerModule.registryChanges.apply() : fileExplorerModule.registryChanges.unApply(); - - if (updated) - { - notifyShell = true; - Trace::PowerPreviewSettingsUpdated(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); - } - else + for (auto& fileExplorerModule : m_fileExplorerModules) { - Logger::error(L"Couldn't {} file explorer module {} during apply_settings", *toggle ? L"enable " : L"disable", fileExplorerModule.settingName); - Trace::PowerPreviewSettingsUpdateFailed(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); + const auto toggle = settings.get_bool_value(fileExplorerModule.settingName); + const auto gpo_rule = fileExplorerModule.checkModuleGPOEnabledRuleFunction(); + const auto gpo_is_configured = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled || gpo_rule == powertoys_gpo::gpo_rule_configured_disabled; + + if (gpo_rule == powertoys_gpo::gpo_rule_configured_unavailable) + { + Logger::warn(L"Couldn't read the gpo rule for Power Preview module {}", fileExplorerModule.settingName); + } + if (gpo_rule == powertoys_gpo::gpo_rule_configured_wrong_value) + { + Logger::warn(L"gpo rule for Power Preview module {} is set to an unknown value", fileExplorerModule.settingName); + } + + // Skip if no need to update + if (!toggle.has_value() && !gpo_is_configured) + { + continue; + } + + bool module_new_state = false; + if (toggle.has_value()) + { + module_new_state = *toggle; + } + if (gpo_is_configured) + { + // gpo rule overrides settings state + module_new_state = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled; + } + + // Skip if no need to update + if (module_new_state == fileExplorerModule.registryChanges.isApplied()) + { + continue; + } + + // (Un)Apply registry changes depending on the new setting value + const bool updated = module_new_state ? fileExplorerModule.registryChanges.apply() : fileExplorerModule.registryChanges.unApply(); + + if (updated) + { + notifyShell = true; + Trace::PowerPreviewSettingsUpdated(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); + } + else + { + Logger::error(L"Couldn't {} file explorer module {} during apply_settings", *toggle ? L"enable " : L"disable", fileExplorerModule.settingName); + Trace::PowerPreviewSettingsUpdateFailed(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); + } } } if (notifyShell) From b35df528a9250aa3d40521feb1c6a011b247504d Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Fri, 21 Jun 2024 16:21:13 -0500 Subject: [PATCH 15/30] Made sure enable() called apply_settings so that the modules start --- .../previewpane/powerpreview/powerpreview.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/previewpane/powerpreview/powerpreview.cpp b/src/modules/previewpane/powerpreview/powerpreview.cpp index 617e47831d77..b7b268a97a83 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.cpp +++ b/src/modules/previewpane/powerpreview/powerpreview.cpp @@ -166,6 +166,18 @@ void PowerPreviewModule::enable() } m_enabled = true; + + try + { + PowerToysSettings::PowerToyValues settings = + PowerToysSettings::PowerToyValues::load_from_settings_file(PowerPreviewModule::get_key()); + + apply_settings(settings); + } + catch (std::exception const& e) + { + Trace::InitSetErrorLoadingFile(e.what()); + } } // Disable active preview handlers. From f197ee3f07a550f4756d1da872552d0a2873c118 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 26 Jun 2024 13:34:40 -0500 Subject: [PATCH 16/30] Updated .adml and .admx --- src/gpo/assets/PowerToys.admx | 175 ++++++++++++++-------------- src/gpo/assets/en-US/PowerToys.adml | 53 ++++++--- 2 files changed, 126 insertions(+), 102 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index 82888bbf644a..4c4fd2bf7e58 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -5,7 +5,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -33,6 +33,9 @@ + + + @@ -137,9 +140,9 @@ - + - + @@ -147,7 +150,7 @@ - + @@ -157,7 +160,7 @@ - + @@ -167,7 +170,7 @@ - + @@ -177,7 +180,7 @@ - + @@ -187,7 +190,7 @@ - + @@ -197,7 +200,7 @@ - + @@ -207,9 +210,9 @@ - + - + @@ -217,9 +220,9 @@ - + - + @@ -227,9 +230,9 @@ - + - + @@ -237,9 +240,9 @@ - + - + @@ -247,7 +250,7 @@ - + @@ -257,7 +260,7 @@ - + @@ -267,9 +270,9 @@ - + - + @@ -277,7 +280,7 @@ - + @@ -287,7 +290,7 @@ - + @@ -297,7 +300,7 @@ - + @@ -307,7 +310,7 @@ - + @@ -317,9 +320,9 @@ - - - + + + @@ -327,9 +330,9 @@ - - - + + + @@ -337,9 +340,9 @@ - - - + + + @@ -347,9 +350,9 @@ - - - + + + @@ -357,9 +360,9 @@ - - - + + + @@ -367,9 +370,9 @@ - + - + @@ -377,9 +380,9 @@ - - - + + + @@ -387,9 +390,16 @@ - - - + + + + + + + + + + @@ -397,8 +407,8 @@ - - + + @@ -407,8 +417,8 @@ - - + + @@ -417,8 +427,8 @@ - - + + @@ -427,9 +437,9 @@ - - - + + + @@ -437,9 +447,9 @@ - - - + + + @@ -447,9 +457,9 @@ - - - + + + @@ -457,9 +467,9 @@ - - - + + + @@ -467,9 +477,9 @@ - - - + + + @@ -477,9 +487,9 @@ - - - + + + @@ -487,9 +497,9 @@ - - - + + + @@ -497,16 +507,9 @@ - - - - - - - - - - + + + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 3d37b7acca14..ccac11415584 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -10,6 +10,7 @@ Installer and Updates PowerToys Run Advanced Paste + File Previewers PowerToys version 0.64.0 or later PowerToys version 0.68.0 or later @@ -22,7 +23,7 @@ PowerToys version 0.78.0 or later PowerToys version 0.81.0 or later PowerToys version 0.81.1 or later - PowerToys version 0.82.0 or later + PowerToys version 0.83.0 or later This policy configures the enabled state for all PowerToys utilities. @@ -45,13 +46,11 @@ If you don't configure this setting, users are able to enable or disable the uti This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. - (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) + This policy configures the enabled state for a PowerToys utility. -This policy configures the enabled state for a PowerToys utility. +If you enable this setting, the utility will be always enabled and the user won't be able to disable it. They can still disable single add-ons. -If you enable this setting, the utility will be always enabled and the user won't be able to disable it. - -If you disable this setting, the utility will be always disabled and the user won't be able to enable it. +If you disable this setting, the utility will be always disabled and the user won't be able to enable it or any single add-ons. If you don't configure this setting, users are able to enable or disable the utility. @@ -127,6 +126,28 @@ Note: Changes require a restart of PowerToys Run. If you enable or don't configure this policy, the user takes control over the enabled state of the Enable paste with AI Advanced Paste setting. If you disable this policy, the user won't be able to enable Enable paste with AI Advanced Paste setting and use Advanced Paste AI prompt nor set up the Open AI key in PowerToys Settings. + + This policy configures the enabled state for a File Explorer add-on. + +If you enable this setting, the add-on will be always enabled and the user won't be able to disable it. + +If you disable this setting, the add-on will be always disabled and the user won't be able to enable it. + +If you don't configure this setting, users are able to enable or disable the add-on. + +This policy has a lower priority than the policy "File Explorer add-ons: Configure enabled state" and will not enable an add-on if the higher priority policy is set to Disabled. + + (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) + +This policy configures the enabled state for a File Explorer add-on. + +If you enable this setting, the add-on will be always enabled and the user won't be able to disable it. + +If you disable this setting, the add-on will be always disabled and the user won't be able to enable it. + +If you don't configure this setting, users are able to enable or disable the add-on. + +This policy has a lower priority than the policy "File Explorer add-ons: Configure enabled state" and will not enable an add-on if the higher priority policy is set to Disabled. Configure global utility enabled state Advanced Paste: Configure enabled state @@ -139,15 +160,6 @@ If you disable this policy, the user won't be able to enable Enable paste with A FancyZones: Configure enabled state File Locksmith: Configure enabled state File Explorer add-ons: Configure enabled state - SVG file preview: Configure enabled state - Markdown file preview: Configure enabled state - Source code file preview: Configure enabled state - PDF file preview: Configure enabled state - Gcode file preview: Configure enabled state - SVG file thumbnail: Configure enabled state - PDF file thumbnail: Configure enabled state - Gcode file thumbnail: Configure enabled state - STL file thumbnail: Configure enabled state Hosts file editor: Configure enabled state Image Resizer: Configure enabled state Keyboard Manager: Configure enabled state @@ -173,9 +185,18 @@ If you disable this policy, the user won't be able to enable Enable paste with A Allow Experimentation Configure enabled state for all plugins Configure enabled state for individual plugins + Advanced Paste: Allow using online AI models + SVG file preview: Configure enabled state + Markdown file preview: Configure enabled state + Source code file preview: Configure enabled state + PDF file preview: Configure enabled state + Gcode file preview: Configure enabled state + SVG file thumbnail: Configure enabled state + PDF file thumbnail: Configure enabled state + Gcode file thumbnail: Configure enabled state + STL file thumbnail: Configure enabled state QOI file preview: Configure enabled state QOI file thumbnail: Configure enabled state - Advanced Paste: Allow using online AI models From 4f15ce6bb43e44ddd8895788d3e7b62220bc83f0 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 26 Jun 2024 14:02:32 -0500 Subject: [PATCH 17/30] Reordered .adml and .admx --- src/gpo/assets/PowerToys.admx | 186 ++++++++++++++-------------- src/gpo/assets/en-US/PowerToys.adml | 22 ++-- 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index 4c4fd2bf7e58..cf1443141d13 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -150,8 +150,8 @@ - - + + @@ -160,8 +160,8 @@ - - + + @@ -170,8 +170,8 @@ - - + + @@ -180,8 +180,8 @@ - - + + @@ -190,8 +190,8 @@ - - + + @@ -200,8 +200,8 @@ - - + + @@ -210,9 +210,9 @@ - - - + + + @@ -220,9 +220,9 @@ - - - + + + @@ -230,9 +230,9 @@ - - - + + + @@ -240,9 +240,9 @@ - - - + + + @@ -250,8 +250,8 @@ - - + + @@ -260,7 +260,7 @@ - + @@ -270,9 +270,9 @@ - + - + @@ -280,7 +280,7 @@ - + @@ -290,7 +290,7 @@ - + @@ -300,7 +300,7 @@ - + @@ -310,7 +310,7 @@ - + @@ -320,9 +320,9 @@ - - - + + + @@ -330,9 +330,9 @@ - - - + + + @@ -340,9 +340,9 @@ - - - + + + @@ -350,9 +350,9 @@ - - - + + + @@ -360,9 +360,9 @@ - - - + + + @@ -370,9 +370,9 @@ - + - + @@ -380,9 +380,9 @@ - - - + + + @@ -390,16 +390,9 @@ - - - - - - - - - - + + + @@ -407,8 +400,8 @@ - - + + @@ -417,8 +410,8 @@ - - + + @@ -427,8 +420,8 @@ - - + + @@ -437,9 +430,9 @@ - - - + + + @@ -447,9 +440,9 @@ - - - + + + @@ -457,9 +450,9 @@ - - - + + + @@ -467,9 +460,9 @@ - - - + + + @@ -477,9 +470,9 @@ - - - + + + @@ -487,9 +480,9 @@ - - - + + + @@ -497,9 +490,9 @@ - - - + + + @@ -507,9 +500,16 @@ - - - + + + + + + + + + + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index ccac11415584..3cb0d55a2673 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -160,6 +160,17 @@ This policy has a lower priority than the policy "File Explorer add-ons: Configu FancyZones: Configure enabled state File Locksmith: Configure enabled state File Explorer add-ons: Configure enabled state + SVG file preview: Configure enabled state + Markdown file preview: Configure enabled state + Source code file preview: Configure enabled state + PDF file preview: Configure enabled state + Gcode file preview: Configure enabled state + SVG file thumbnail: Configure enabled state + PDF file thumbnail: Configure enabled state + Gcode file thumbnail: Configure enabled state + STL file thumbnail: Configure enabled state + QOI file preview: Configure enabled state + QOI file thumbnail: Configure enabled state Hosts file editor: Configure enabled state Image Resizer: Configure enabled state Keyboard Manager: Configure enabled state @@ -186,17 +197,6 @@ This policy has a lower priority than the policy "File Explorer add-ons: Configu Configure enabled state for all plugins Configure enabled state for individual plugins Advanced Paste: Allow using online AI models - SVG file preview: Configure enabled state - Markdown file preview: Configure enabled state - Source code file preview: Configure enabled state - PDF file preview: Configure enabled state - Gcode file preview: Configure enabled state - SVG file thumbnail: Configure enabled state - PDF file thumbnail: Configure enabled state - Gcode file thumbnail: Configure enabled state - STL file thumbnail: Configure enabled state - QOI file preview: Configure enabled state - QOI file thumbnail: Configure enabled state From 7d1f2133d0b3de9aeec917b7c5f63720d3b1540b Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Fri, 28 Jun 2024 10:45:35 -0500 Subject: [PATCH 18/30] Renamed File Previewer to File Explorer add-on --- src/gpo/assets/PowerToys.admx | 46 ++++++++++++++--------------- src/gpo/assets/en-US/PowerToys.adml | 6 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index cf1443141d13..f5aed59cd934 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -33,7 +33,7 @@ - + @@ -150,8 +150,8 @@ - - + + @@ -160,8 +160,8 @@ - - + + @@ -170,8 +170,8 @@ - - + + @@ -180,8 +180,8 @@ - - + + @@ -190,8 +190,8 @@ - - + + @@ -200,8 +200,8 @@ - - + + @@ -210,8 +210,8 @@ - - + + @@ -220,8 +220,8 @@ - - + + @@ -230,8 +230,8 @@ - - + + @@ -240,8 +240,8 @@ - - + + @@ -250,8 +250,8 @@ - - + + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 3cb0d55a2673..b029e04bedbf 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -10,7 +10,7 @@ Installer and Updates PowerToys Run Advanced Paste - File Previewers + File Explorer add-ons PowerToys version 0.64.0 or later PowerToys version 0.68.0 or later @@ -127,7 +127,7 @@ If you enable or don't configure this policy, the user takes control over the en If you disable this policy, the user won't be able to enable Enable paste with AI Advanced Paste setting and use Advanced Paste AI prompt nor set up the Open AI key in PowerToys Settings. - This policy configures the enabled state for a File Explorer add-on. + This policy configures the enabled state for a File Explorer add-on. If you enable this setting, the add-on will be always enabled and the user won't be able to disable it. @@ -137,7 +137,7 @@ If you don't configure this setting, users are able to enable or disable the add This policy has a lower priority than the policy "File Explorer add-ons: Configure enabled state" and will not enable an add-on if the higher priority policy is set to Disabled. - (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) + (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) This policy configures the enabled state for a File Explorer add-on. From b905634c9f4a2e3b7b6889cccf5542ea471fbc54 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Fri, 28 Jun 2024 11:31:07 -0500 Subject: [PATCH 19/30] Improved C++ code --- .../previewpane/powerpreview/powerpreview.cpp | 113 ++++++++++-------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/src/modules/previewpane/powerpreview/powerpreview.cpp b/src/modules/previewpane/powerpreview/powerpreview.cpp index b7b268a97a83..553963755c8a 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.cpp +++ b/src/modules/previewpane/powerpreview/powerpreview.cpp @@ -230,59 +230,70 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues& { bool notifyShell = false; - if (m_enabled) + // check gpo for Power Preview module + const auto enabled_gpo_rule = powertoys_gpo::getConfiguredFileExplorerPreviewEnabledValue(); + const auto enabled_gpo_is_configured = enabled_gpo_rule == powertoys_gpo::gpo_rule_configured_enabled || enabled_gpo_rule == powertoys_gpo::gpo_rule_configured_disabled; + const auto is_enabled = enabled_gpo_is_configured ? enabled_gpo_rule == powertoys_gpo::gpo_rule_configured_enabled : m_enabled; + + if (enabled_gpo_rule == powertoys_gpo::gpo_rule_configured_unavailable) + { + Logger::warn(L"Couldn't read the gpo rule for Power Preview"); + } + if (enabled_gpo_rule == powertoys_gpo::gpo_rule_configured_wrong_value) + { + Logger::warn(L"gpo rule for Power Preview is set to an unknown value"); + } + + for (auto& fileExplorerModule : m_fileExplorerModules) { - for (auto& fileExplorerModule : m_fileExplorerModules) + const auto toggle = settings.get_bool_value(fileExplorerModule.settingName); + const auto gpo_rule = fileExplorerModule.checkModuleGPOEnabledRuleFunction(); + const auto gpo_is_configured = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled || gpo_rule == powertoys_gpo::gpo_rule_configured_disabled; + + if (gpo_rule == powertoys_gpo::gpo_rule_configured_unavailable) + { + Logger::warn(L"Couldn't read the gpo rule for Power Preview module {}", fileExplorerModule.settingName); + } + if (gpo_rule == powertoys_gpo::gpo_rule_configured_wrong_value) + { + Logger::warn(L"gpo rule for Power Preview module {} is set to an unknown value", fileExplorerModule.settingName); + } + + // Skip if no need to update + if (!toggle.has_value() && !gpo_is_configured) + { + continue; + } + + bool module_new_state = false; + if (toggle.has_value()) + { + module_new_state = *toggle && is_enabled; + } + if (gpo_is_configured) + { + // gpo rule overrides settings state + module_new_state = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled; + } + + // Skip if no need to update + if (module_new_state == fileExplorerModule.registryChanges.isApplied()) + { + continue; + } + + // (Un)Apply registry changes depending on the new setting value + const bool updated = module_new_state ? fileExplorerModule.registryChanges.apply() : fileExplorerModule.registryChanges.unApply(); + + if (updated) + { + notifyShell = true; + Trace::PowerPreviewSettingsUpdated(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); + } + else { - const auto toggle = settings.get_bool_value(fileExplorerModule.settingName); - const auto gpo_rule = fileExplorerModule.checkModuleGPOEnabledRuleFunction(); - const auto gpo_is_configured = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled || gpo_rule == powertoys_gpo::gpo_rule_configured_disabled; - - if (gpo_rule == powertoys_gpo::gpo_rule_configured_unavailable) - { - Logger::warn(L"Couldn't read the gpo rule for Power Preview module {}", fileExplorerModule.settingName); - } - if (gpo_rule == powertoys_gpo::gpo_rule_configured_wrong_value) - { - Logger::warn(L"gpo rule for Power Preview module {} is set to an unknown value", fileExplorerModule.settingName); - } - - // Skip if no need to update - if (!toggle.has_value() && !gpo_is_configured) - { - continue; - } - - bool module_new_state = false; - if (toggle.has_value()) - { - module_new_state = *toggle; - } - if (gpo_is_configured) - { - // gpo rule overrides settings state - module_new_state = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled; - } - - // Skip if no need to update - if (module_new_state == fileExplorerModule.registryChanges.isApplied()) - { - continue; - } - - // (Un)Apply registry changes depending on the new setting value - const bool updated = module_new_state ? fileExplorerModule.registryChanges.apply() : fileExplorerModule.registryChanges.unApply(); - - if (updated) - { - notifyShell = true; - Trace::PowerPreviewSettingsUpdated(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); - } - else - { - Logger::error(L"Couldn't {} file explorer module {} during apply_settings", *toggle ? L"enable " : L"disable", fileExplorerModule.settingName); - Trace::PowerPreviewSettingsUpdateFailed(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); - } + Logger::error(L"Couldn't {} file explorer module {} during apply_settings", *toggle ? L"enable " : L"disable", fileExplorerModule.settingName); + Trace::PowerPreviewSettingsUpdateFailed(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true); } } if (notifyShell) From e3e9583b3d9e79aa273dad13092012fcdda4c635 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Fri, 28 Jun 2024 11:43:58 -0500 Subject: [PATCH 20/30] Hid the info bars when the module is disabled --- .../SettingsXAML/Views/PowerPreviewPage.xaml | 12 ++++++------ .../Settings.UI/ViewModels/PowerPreviewViewModel.cs | 12 ++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml index f71f37624f41..a8c91bbf2e42 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml @@ -30,8 +30,8 @@ Date: Fri, 28 Jun 2024 12:12:45 -0500 Subject: [PATCH 21/30] Changed the dashboard text --- src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs | 2 +- src/settings-ui/Settings.UI/Strings/en-us/Resources.resw | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs index a88af2c20eea..9cf390fe7f30 100644 --- a/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/ModuleHelper.cs @@ -21,7 +21,7 @@ public static string GetModuleLabelResourceName(ModuleType moduleType) case ModuleType.MouseHighlighter: case ModuleType.MouseJump: case ModuleType.MousePointerCrosshairs: return $"MouseUtils_{moduleType}/Header"; - case ModuleType.PowerPreview: return "FileExplorerPreview/ModuleTitle"; + case ModuleType.PowerPreview: return "FileExplorerPreview_DashboardTitle"; default: return $"{moduleType}/ModuleTitle"; } } diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index 5847c9434838..a9a0c913f3b6 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4198,4 +4198,7 @@ Activate by holding the key for the character you want to add an accent to, then Custom preview handlers for Windows File Explorer + + File Explorer add-ons + \ No newline at end of file From 4c42c9086f8dc909cf1c4317789cc6eb89837e04 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Sun, 30 Jun 2024 17:09:34 -0500 Subject: [PATCH 22/30] Updated for consistent behavior --- src/gpo/assets/en-US/PowerToys.adml | 12 ++++++----- .../previewpane/powerpreview/powerpreview.cpp | 20 +++++++++++-------- .../ViewModels/PowerPreviewViewModel.cs | 12 ++++------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index b029e04bedbf..bd6c17e4d25a 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -48,11 +48,13 @@ This policy has a higher priority than the policy "Configure global utility enab This policy configures the enabled state for a PowerToys utility. -If you enable this setting, the utility will be always enabled and the user won't be able to disable it. They can still disable single add-ons. +If you enable this setting, the utility will be always enabled and the user won't be able to disable it. They can still disable individual add-ons. -If you disable this setting, the utility will be always disabled and the user won't be able to enable it or any single add-ons. +If you disable this setting, the utility will be always disabled and the user won't be able to enable it or any individual add-ons. -If you don't configure this setting, users are able to enable or disable the utility. +If you don't configure this setting, users are able to enable or disable the utility and any individual add-ons. + +The individual enabled state policies for the individual add-ons will override this policy. This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. @@ -135,7 +137,7 @@ If you disable this setting, the add-on will be always disabled and the user won If you don't configure this setting, users are able to enable or disable the add-on. -This policy has a lower priority than the policy "File Explorer add-ons: Configure enabled state" and will not enable an add-on if the higher priority policy is set to Disabled. +This policy has a higher priority than the policy "File Explorer add-ons: Configure enabled state" and overrides it. (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) @@ -147,7 +149,7 @@ If you disable this setting, the add-on will be always disabled and the user won If you don't configure this setting, users are able to enable or disable the add-on. -This policy has a lower priority than the policy "File Explorer add-ons: Configure enabled state" and will not enable an add-on if the higher priority policy is set to Disabled. +This policy has a higher priority than the policy "File Explorer add-ons: Configure enabled state" and overrides it. Configure global utility enabled state Advanced Paste: Configure enabled state diff --git a/src/modules/previewpane/powerpreview/powerpreview.cpp b/src/modules/previewpane/powerpreview/powerpreview.cpp index 553963755c8a..19a3f1635e34 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.cpp +++ b/src/modules/previewpane/powerpreview/powerpreview.cpp @@ -183,20 +183,24 @@ void PowerPreviewModule::enable() // Disable active preview handlers. void PowerPreviewModule::disable() { - for (auto& fileExplorerModule : m_fileExplorerModules) - { - if (!fileExplorerModule.registryChanges.unApply()) - { - Logger::error(L"Couldn't disable file explorer module {} during module disable() call", fileExplorerModule.settingName); - } - } - if (m_enabled) { Trace::EnabledPowerPreview(false); } m_enabled = false; + + try + { + PowerToysSettings::PowerToyValues settings = + PowerToysSettings::PowerToyValues::load_from_settings_file(PowerPreviewModule::get_key()); + + apply_settings(settings); + } + catch (std::exception const& e) + { + Trace::InitSetErrorLoadingFile(e.what()); + } } // Returns if the powertoys is enabled diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index f3ea87bb6097..5a8ea93546de 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -327,8 +327,6 @@ public bool IsEnabled { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); - OnPropertyChanged(nameof(SomePreviewPaneEnabledGposConfigured)); - OnPropertyChanged(nameof(SomeThumbnailEnabledGposConfigured)); // Set the status in the general settings GeneralSettingsConfig.Enabled.PowerPreview = value; @@ -348,10 +346,9 @@ public bool SomePreviewPaneEnabledGposConfigured { get { - return IsEnabled && - (_svgRenderEnabledStateIsGPOConfigured || _mdRenderEnabledStateIsGPOConfigured + return _svgRenderEnabledStateIsGPOConfigured || _mdRenderEnabledStateIsGPOConfigured || _monacoRenderEnabledStateIsGPOConfigured || _pdfRenderEnabledStateIsGPOConfigured - || _gcodeRenderEnabledStateIsGPOConfigured || _qoiRenderEnabledStateIsGPOConfigured); + || _gcodeRenderEnabledStateIsGPOConfigured || _qoiRenderEnabledStateIsGPOConfigured; } } @@ -359,10 +356,9 @@ public bool SomeThumbnailEnabledGposConfigured { get { - return IsEnabled && - (_svgThumbnailEnabledStateIsGPOConfigured || _pdfThumbnailEnabledStateIsGPOConfigured + return _svgThumbnailEnabledStateIsGPOConfigured || _pdfThumbnailEnabledStateIsGPOConfigured || _gcodeThumbnailEnabledStateIsGPOConfigured || _stlThumbnailEnabledStateIsGPOConfigured - || _qoiThumbnailEnabledStateIsGPOConfigured); + || _qoiThumbnailEnabledStateIsGPOConfigured; } } From c9174f930cd258b7c8f8ebfa6bc6981c5755fc75 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 3 Jul 2024 10:31:01 -0500 Subject: [PATCH 23/30] Stopped the global utility policy from affecting individual previewers --- src/common/utils/gpo.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/common/utils/gpo.h b/src/common/utils/gpo.h index c3a967f808b4..002f4106172e 100644 --- a/src/common/utils/gpo.h +++ b/src/common/utils/gpo.h @@ -254,47 +254,47 @@ namespace powertoys_gpo { inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW); } inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW); } inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW); } inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW); } inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW); } inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS); } inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue() @@ -464,12 +464,12 @@ namespace powertoys_gpo { inline gpo_rule_configured_t getConfiguredQoiPreviewEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QOI_PREVIEW); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_QOI_PREVIEW); } inline gpo_rule_configured_t getConfiguredQoiThumbnailsEnabledValue() { - return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QOI_THUMBNAILS); + return getConfiguredValue(POLICY_CONFIGURE_ENABLED_QOI_THUMBNAILS); } inline gpo_rule_configured_t getAllowedAdvancedPasteOnlineAIModelsValue() From 7a4052da67195cdbd82ea6dd07432e73834b2983 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 3 Jul 2024 10:59:18 -0500 Subject: [PATCH 24/30] Turned off previewers if module is disabled --- src/modules/previewpane/powerpreview/powerpreview.cpp | 5 ++++- .../Settings.UI/ViewModels/PowerPreviewViewModel.cs | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/previewpane/powerpreview/powerpreview.cpp b/src/modules/previewpane/powerpreview/powerpreview.cpp index 19a3f1635e34..aeb2f40b9b6e 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.cpp +++ b/src/modules/previewpane/powerpreview/powerpreview.cpp @@ -272,7 +272,7 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues& bool module_new_state = false; if (toggle.has_value()) { - module_new_state = *toggle && is_enabled; + module_new_state = *toggle; } if (gpo_is_configured) { @@ -280,6 +280,9 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues& module_new_state = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled; } + //Don't start previewer if the File Explorer module is disabled + module_new_state = module_new_state && is_enabled; + // Skip if no need to update if (module_new_state == fileExplorerModule.registryChanges.isApplied()) { diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index 5a8ea93546de..ce053b45c2f5 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -327,6 +327,8 @@ public bool IsEnabled { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); + OnPropertyChanged(nameof(SomePreviewPaneEnabledGposConfigured)); + OnPropertyChanged(nameof(SomeThumbnailEnabledGposConfigured)); // Set the status in the general settings GeneralSettingsConfig.Enabled.PowerPreview = value; @@ -346,9 +348,9 @@ public bool SomePreviewPaneEnabledGposConfigured { get { - return _svgRenderEnabledStateIsGPOConfigured || _mdRenderEnabledStateIsGPOConfigured + return IsEnabled && (_svgRenderEnabledStateIsGPOConfigured || _mdRenderEnabledStateIsGPOConfigured || _monacoRenderEnabledStateIsGPOConfigured || _pdfRenderEnabledStateIsGPOConfigured - || _gcodeRenderEnabledStateIsGPOConfigured || _qoiRenderEnabledStateIsGPOConfigured; + || _gcodeRenderEnabledStateIsGPOConfigured || _qoiRenderEnabledStateIsGPOConfigured); } } @@ -356,9 +358,9 @@ public bool SomeThumbnailEnabledGposConfigured { get { - return _svgThumbnailEnabledStateIsGPOConfigured || _pdfThumbnailEnabledStateIsGPOConfigured + return IsEnabled && (_svgThumbnailEnabledStateIsGPOConfigured || _pdfThumbnailEnabledStateIsGPOConfigured || _gcodeThumbnailEnabledStateIsGPOConfigured || _stlThumbnailEnabledStateIsGPOConfigured - || _qoiThumbnailEnabledStateIsGPOConfigured; + || _qoiThumbnailEnabledStateIsGPOConfigured); } } From 779214e85fcce3350330feaf0fbae9aee56b7424 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 3 Jul 2024 15:13:39 -0500 Subject: [PATCH 25/30] Updated .adml --- src/gpo/assets/en-US/PowerToys.adml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index bd6c17e4d25a..99d79fde7c9d 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -54,8 +54,6 @@ If you disable this setting, the utility will be always disabled and the user wo If you don't configure this setting, users are able to enable or disable the utility and any individual add-ons. -The individual enabled state policies for the individual add-ons will override this policy. - This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. This policy configures whether per-user PowerToys installation is allowed or not. @@ -137,7 +135,7 @@ If you disable this setting, the add-on will be always disabled and the user won If you don't configure this setting, users are able to enable or disable the add-on. -This policy has a higher priority than the policy "File Explorer add-ons: Configure enabled state" and overrides it. +The policy "File Explorer add-ons: Configure enabled state" will override this policy. (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) @@ -149,7 +147,7 @@ If you disable this setting, the add-on will be always disabled and the user won If you don't configure this setting, users are able to enable or disable the add-on. -This policy has a higher priority than the policy "File Explorer add-ons: Configure enabled state" and overrides it. +The policy "File Explorer add-ons: Configure enabled state" will override this policy. Configure global utility enabled state Advanced Paste: Configure enabled state From 9c83638d0b89f05dccdafc129d6edad36d655b10 Mon Sep 17 00:00:00 2001 From: acekirkpatrick <90979177+acekirkpatrick@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:21:20 -0500 Subject: [PATCH 26/30] Update .adml for clarification Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> --- src/gpo/assets/en-US/PowerToys.adml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index dac3b0024a23..0bdf085dd664 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -149,7 +149,7 @@ If you disable this setting, the add-on will be always disabled and the user won If you don't configure this setting, users are able to enable or disable the add-on. -The policy "File Explorer add-ons: Configure enabled state" will override this policy. +Note: If you disable the policy "File Explorer add-ons: Configure enabled state" all File Explorer Add-ons are disabled. This policy configures if the user can share the clipboard between machines. From b31bcab23c46c003621cdd9198d4cae1e0fadafc Mon Sep 17 00:00:00 2001 From: acekirkpatrick <90979177+acekirkpatrick@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:31:26 -0500 Subject: [PATCH 27/30] Update .adml for clarification Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> --- src/gpo/assets/en-US/PowerToys.adml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 0bdf085dd664..53d728be9465 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -137,7 +137,7 @@ If you disable this setting, the add-on will be always disabled and the user won If you don't configure this setting, users are able to enable or disable the add-on. -The policy "File Explorer add-ons: Configure enabled state" will override this policy. +Note: If you disable the policy "File Explorer add-ons: Configure enabled state" all File Explorer Add-ons are disabled. (Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook) From 7f6ab6f9232cca0aeeed1277a4d507e731dbbbd4 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Thu, 8 Aug 2024 15:43:02 -0500 Subject: [PATCH 28/30] Updated version information in the .admx and .adml --- src/gpo/assets/PowerToys.admx | 7 ++++--- src/gpo/assets/en-US/PowerToys.adml | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index 0d20bab9304d..e6b41e590a18 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -1,11 +1,11 @@ - + - + @@ -20,6 +20,7 @@ + @@ -149,7 +150,7 @@ - + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index 53d728be9465..b8ca92173567 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -1,7 +1,7 @@ - + PowerToys PowerToys @@ -26,6 +26,7 @@ PowerToys version 0.81.0 or later PowerToys version 0.81.1 or later PowerToys version 0.83.0 or later + PowerToys version 0.84.0 or later This policy configures the enabled state for all PowerToys utilities. From 893e5def06a71666bf8e4b2d20b9e029e15282a9 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 4 Sep 2024 15:30:17 -0500 Subject: [PATCH 29/30] Updated .adml and .admx to version 0.85.0 --- src/gpo/assets/PowerToys.admx | 4 ++-- src/gpo/assets/en-US/PowerToys.adml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index e6b41e590a18..f16b0d8663fc 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -20,7 +20,7 @@ - + @@ -150,7 +150,7 @@ - + diff --git a/src/gpo/assets/en-US/PowerToys.adml b/src/gpo/assets/en-US/PowerToys.adml index b8ca92173567..35eb0e8813e8 100644 --- a/src/gpo/assets/en-US/PowerToys.adml +++ b/src/gpo/assets/en-US/PowerToys.adml @@ -26,7 +26,7 @@ PowerToys version 0.81.0 or later PowerToys version 0.81.1 or later PowerToys version 0.83.0 or later - PowerToys version 0.84.0 or later + PowerToys version 0.85.0 or later This policy configures the enabled state for all PowerToys utilities. From 34381adfe4b856f588518b7c9889f4c7db1546a3 Mon Sep 17 00:00:00 2001 From: Ace Kirkpatrick Date: Wed, 4 Sep 2024 15:49:37 -0500 Subject: [PATCH 30/30] Change to revision comment --- src/gpo/assets/PowerToys.admx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpo/assets/PowerToys.admx b/src/gpo/assets/PowerToys.admx index f16b0d8663fc..9c0fb360a230 100644 --- a/src/gpo/assets/PowerToys.admx +++ b/src/gpo/assets/PowerToys.admx @@ -5,7 +5,7 @@ - +