mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-23 19:49:17 +08:00
[MWB][Enterprise] Add new policies and improve settings UI for the Transfer File setting (#33571)
## Summary of the Pull Request ### Improve settings page for TransferFile setting The TransferFile setting depends on ShareClipboard setting. This is now visually shown. **Before the change:** ![image](https://github.com/microsoft/PowerToys/assets/61519853/735ad7bd-4f45-4914-8bbc-bc47170a9b47) **After the change** ![image](https://github.com/microsoft/PowerToys/assets/61519853/78fb74c3-29a0-4779-8f0c-9df6c4161be1) ### New policies are added for MWB Name | Supported states | Id | Behavior ------------ | ------------- | ------------ | ------------- Clipboard sharing enabled | disabled | MwbClipboardSharingEnabled | Disables the feature if set to disabled. File transfer enabled | disabled | MwbFileTransferEnabled | Disables the feature if set to disabled. Original user interface enabled | disabled | MwbUseOriginalUserInterface | Disables the feature if set to disabled. | Disallow blocking screensaver on other machines | enabled | MwbDisallowBlockingScreensaver | Disables the feature if set to enabled. | Connect only in same subnet | enabled & disabled | MwbSameSubnetOnly | Enables the feature if set to enabled.<br />Disables the feature if set to disabled. | Validate remote machine IP Address | enabled & disabled | MwbValidateRemoteIp | Enables the feature if set to enabled.<br />Disables the feature if set to disabled. Disable user defined IP Address mapping rules | enabled | MwbDisableUserDefinedIpMappingRules | If enabled the user can't define IP Address mapping rules. Predefined IP Address mappings | enabled with multi-line text value | MwbPolicyDefinedIpMappingRules | Allows admins to force define IP Address mapping rules. #### User Interface screenshots ![image](https://github.com/microsoft/PowerToys/assets/61519853/3d8a46c5-13f3-4a47-80a1-c0d242d8541c) ![image](https://github.com/microsoft/PowerToys/assets/61519853/44f4dc60-5106-45bf-9bb4-aa0bde9ef6fa) ![image](https://github.com/microsoft/PowerToys/assets/61519853/569be956-e889-442c-bdc9-e319ad3c19e3)
This commit is contained in:
parent
ca97e01d59
commit
16a1fb7981
1
.github/actions/spell-check/expect.txt
vendored
1
.github/actions/spell-check/expect.txt
vendored
@ -1378,6 +1378,7 @@ SCID
|
||||
Scip
|
||||
scipbe
|
||||
Scode
|
||||
screensaver
|
||||
screenshots
|
||||
scrollviewer
|
||||
sddl
|
||||
|
@ -176,4 +176,40 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getAllowedAdvancedPasteOnlineAIModelsValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbClipboardSharingEnabledValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbClipboardSharingEnabledValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbFileTransferEnabledValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbFileTransferEnabledValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbUseOriginalUserInterfaceValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbUseOriginalUserInterfaceValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbDisallowBlockingScreensaverValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbDisallowBlockingScreensaverValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbSameSubnetOnlyValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbSameSubnetOnlyValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbValidateRemoteIpValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbValidateRemoteIpValue());
|
||||
}
|
||||
GpoRuleConfigured GPOWrapper::GetConfiguredMwbDisableUserDefinedIpMappingRulesValue()
|
||||
{
|
||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredMwbDisableUserDefinedIpMappingRulesValue());
|
||||
}
|
||||
winrt::hstring GPOWrapper::GetConfiguredMwbPolicyDefinedIpMappingRules()
|
||||
{
|
||||
// Assuming powertoys_gpo::getConfiguredMwbPolicyDefinedIpMappingRules() returns a std::wstring
|
||||
std::wstring rules = powertoys_gpo::getConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
|
||||
// Convert std::wstring to winrt::hstring
|
||||
return to_hstring(rules.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,14 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
||||
static GpoRuleConfigured GetConfiguredQoiPreviewEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredQoiThumbnailsEnabledValue();
|
||||
static GpoRuleConfigured GetAllowedAdvancedPasteOnlineAIModelsValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbClipboardSharingEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbFileTransferEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbUseOriginalUserInterfaceValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbDisallowBlockingScreensaverValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbSameSubnetOnlyValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbValidateRemoteIpValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||
static winrt::hstring GPOWrapper::GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,14 @@ namespace PowerToys
|
||||
static GpoRuleConfigured GetConfiguredQoiPreviewEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredQoiThumbnailsEnabledValue();
|
||||
static GpoRuleConfigured GetAllowedAdvancedPasteOnlineAIModelsValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbClipboardSharingEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbFileTransferEnabledValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbUseOriginalUserInterfaceValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbDisallowBlockingScreensaverValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbSameSubnetOnlyValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbValidateRemoteIpValue();
|
||||
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||
static String GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Windows.h>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace powertoys_gpo {
|
||||
enum gpo_rule_configured_t {
|
||||
@ -71,11 +72,25 @@ namespace powertoys_gpo {
|
||||
const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation";
|
||||
const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState";
|
||||
const std::wstring POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS = L"AllowPowerToysAdvancedPasteOnlineAIModels";
|
||||
const std::wstring POLICY_MWB_CLIPBOARD_SHARING_ENABLED = L"MwbClipboardSharingEnabled";
|
||||
const std::wstring POLICY_MWB_FILE_TRANSFER_ENABLED = L"MwbFileTransferEnabled";
|
||||
const std::wstring POLICY_MWB_USE_ORIGINAL_USER_INTERFACE = L"MwbUseOriginalUserInterface";
|
||||
const std::wstring POLICY_MWB_DISALLOW_BLOCKING_SCREENSAVER = L"MwbDisallowBlockingScreensaver";
|
||||
const std::wstring POLICY_MWB_SAME_SUBNET_ONLY = L"MwbSameSubnetOnly";
|
||||
const std::wstring POLICY_MWB_VALIDATE_REMOTE_IP = L"MwbValidateRemoteIp";
|
||||
const std::wstring POLICY_MWB_DISABLE_USER_DEFINED_IP_MAPPING_RULES = L"MwbDisableUserDefinedIpMappingRules";
|
||||
const std::wstring POLICY_MWB_POLICY_DEFINED_IP_MAPPING_RULES = L"MwbPolicyDefinedIpMappingRules";
|
||||
|
||||
inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name)
|
||||
inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name, const bool is_multi_line_text = false)
|
||||
{
|
||||
// Set value type
|
||||
DWORD reg_value_type = REG_SZ;
|
||||
DWORD reg_flags = RRF_RT_REG_SZ;
|
||||
if (is_multi_line_text)
|
||||
{
|
||||
reg_value_type = REG_MULTI_SZ;
|
||||
reg_flags = RRF_RT_REG_MULTI_SZ;
|
||||
}
|
||||
|
||||
DWORD string_buffer_capacity;
|
||||
// Request required buffer capacity / string length
|
||||
@ -97,8 +112,26 @@ namespace powertoys_gpo {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// Convert buffer to std::wstring, delete buffer and return REG_SZ value
|
||||
std::wstring string_value = temp_buffer;
|
||||
// Convert buffer to std::wstring
|
||||
std::wstring string_value = L"";
|
||||
if (reg_value_type == REG_MULTI_SZ)
|
||||
{
|
||||
// If it is REG_MULTI_SZ handle this way
|
||||
wchar_t* currentString = temp_buffer;
|
||||
while (*currentString != L'\0')
|
||||
{
|
||||
// If first entry then assign the string, else add to the string
|
||||
string_value = (string_value == L"") ? currentString : (string_value + L"\r\n" + currentString);
|
||||
currentString += wcslen(currentString) + 1; // Move to the next string
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it is REG_SZ handle this way
|
||||
string_value = temp_buffer;
|
||||
}
|
||||
|
||||
// delete buffer, return string value
|
||||
delete temp_buffer;
|
||||
return string_value;
|
||||
}
|
||||
@ -475,4 +508,59 @@ namespace powertoys_gpo {
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbClipboardSharingEnabledValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_CLIPBOARD_SHARING_ENABLED);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbFileTransferEnabledValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_FILE_TRANSFER_ENABLED);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbUseOriginalUserInterfaceValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_USE_ORIGINAL_USER_INTERFACE);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbDisallowBlockingScreensaverValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_DISALLOW_BLOCKING_SCREENSAVER);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbSameSubnetOnlyValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_SAME_SUBNET_ONLY);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbValidateRemoteIpValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_VALIDATE_REMOTE_IP);
|
||||
}
|
||||
|
||||
inline gpo_rule_configured_t getConfiguredMwbDisableUserDefinedIpMappingRulesValue()
|
||||
{
|
||||
return getUtilityEnabledValue(POLICY_MWB_DISABLE_USER_DEFINED_IP_MAPPING_RULES);
|
||||
}
|
||||
|
||||
inline std::wstring getConfiguredMwbPolicyDefinedIpMappingRules()
|
||||
{
|
||||
// Important: HKLM has priority over HKCU
|
||||
auto mapping_rules = readRegistryStringValue(HKEY_LOCAL_MACHINE, POLICIES_PATH, POLICY_MWB_POLICY_DEFINED_IP_MAPPING_RULES, true);
|
||||
if (!mapping_rules.has_value())
|
||||
{
|
||||
mapping_rules = readRegistryStringValue(HKEY_CURRENT_USER, POLICIES_PATH, POLICY_MWB_POLICY_DEFINED_IP_MAPPING_RULES, true);
|
||||
}
|
||||
|
||||
// return value
|
||||
if (mapping_rules.has_value())
|
||||
{
|
||||
return mapping_rules.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::wstring ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
<definition name="SUPPORTED_POWERTOYS_0_78_0" displayName="$(string.SUPPORTED_POWERTOYS_0_78_0)"/>
|
||||
<definition name="SUPPORTED_POWERTOYS_0_81_0" displayName="$(string.SUPPORTED_POWERTOYS_0_81_0)"/>
|
||||
<definition name="SUPPORTED_POWERTOYS_0_81_1" displayName="$(string.SUPPORTED_POWERTOYS_0_81_1)"/>
|
||||
<definition name="SUPPORTED_POWERTOYS_0_83_0" displayName="$(string.SUPPORTED_POWERTOYS_0_83_0)"/>
|
||||
</definitions>
|
||||
</supportedOn>
|
||||
<categories>
|
||||
@ -32,6 +33,9 @@
|
||||
<category name="AdvancedPaste" displayName="$(string.AdvancedPaste)">
|
||||
<parentCategory ref="PowerToys" />
|
||||
</category>
|
||||
<category name="MouseWithoutBorders" displayName="$(string.MouseWithoutBorders)">
|
||||
<parentCategory ref="PowerToys" />
|
||||
</category>
|
||||
<category name="GeneralSettings" displayName="$(string.GeneralSettings)">
|
||||
<parentCategory ref="PowerToys" />
|
||||
</category>
|
||||
@ -507,5 +511,83 @@
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbClipboardSharingEnabled" class="Both" displayName="$(string.MwbClipboardSharingEnabled)" explainText="$(string.MwbClipboardSharingEnabledDescription)" key="Software\Policies\PowerToys" valueName="MwbClipboardSharingEnabled">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbFileTransferEnabled" class="Both" displayName="$(string.MwbFileTransferEnabled)" explainText="$(string.MwbFileTransferEnabledDescription)" key="Software\Policies\PowerToys" valueName="MwbFileTransferEnabled">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbUseOriginalUserInterface" class="Both" displayName="$(string.MwbUseOriginalUserInterface)" explainText="$(string.MwbUseOriginalUserInterfaceDescription)" key="Software\Policies\PowerToys" valueName="MwbUseOriginalUserInterface">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbDisallowBlockingScreensaver" class="Both" displayName="$(string.MwbDisallowBlockingScreensaver)" explainText="$(string.MwbDisallowBlockingScreensaverDescription)" key="Software\Policies\PowerToys" valueName="MwbDisallowBlockingScreensaver">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbSameSubnetOnly" class="Both" displayName="$(string.MwbSameSubnetOnly)" explainText="$(string.MwbSameSubnetOnlyDescription)" key="Software\Policies\PowerToys" valueName="MwbSameSubnetOnly">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbValidateRemoteIp" class="Both" displayName="$(string.MwbValidateRemoteIp)" explainText="$(string.MwbValidateRemoteIpDescription)" key="Software\Policies\PowerToys" valueName="MwbValidateRemoteIp">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbDisableUserDefinedIpMappingRules" class="Both" displayName="$(string.MwbDisableUserDefinedIpMappingRules)" explainText="$(string.MwbDisableUserDefinedIpMappingRulesDescription)" key="Software\Policies\PowerToys" valueName="MwbDisableUserDefinedIpMappingRules">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<enabledValue>
|
||||
<decimal value="1" />
|
||||
</enabledValue>
|
||||
<disabledValue>
|
||||
<decimal value="0" />
|
||||
</disabledValue>
|
||||
</policy>
|
||||
<policy name="MwbPolicyDefinedIpMappingRules" class="Both" displayName="$(string.MwbPolicyDefinedIpMappingRules)" explainText="$(string.MwbPolicyDefinedIpMappingRulesDescription)" presentation="$(presentation.MwbPolicyDefinedIpMappingRules)" key="Software\Policies\PowerToys">
|
||||
<parentCategory ref="MouseWithoutBorders" />
|
||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_83_0" />
|
||||
<elements>
|
||||
<!--Max length means here max length per line. We support 65 characters per line. (A string containing the hostname, a space and an IPv6 Address is max. 55 characters long.)-->
|
||||
<multiText id="MwbPolicyDefinedIpMappingsList" valueName="MwbPolicyDefinedIpMappingRules" maxLength="65" required="true"/>
|
||||
</elements>
|
||||
</policy>
|
||||
</policies>
|
||||
</policyDefinitions>
|
||||
|
@ -10,6 +10,7 @@
|
||||
<string id="InstallerUpdates">Installer and Updates</string>
|
||||
<string id="PowerToysRun">PowerToys Run</string>
|
||||
<string id="AdvancedPaste">Advanced Paste</string>
|
||||
<string id="MouseWithoutBorders">Mouse Without Borders</string>
|
||||
<string id="GeneralSettings">General settings</string>
|
||||
|
||||
<string id="SUPPORTED_POWERTOYS_0_64_0">PowerToys version 0.64.0 or later</string>
|
||||
@ -23,6 +24,7 @@
|
||||
<string id="SUPPORTED_POWERTOYS_0_78_0">PowerToys version 0.78.0 or later</string>
|
||||
<string id="SUPPORTED_POWERTOYS_0_81_0">PowerToys version 0.81.0 or later</string>
|
||||
<string id="SUPPORTED_POWERTOYS_0_81_1">PowerToys version 0.81.1 or later</string>
|
||||
<string id="SUPPORTED_POWERTOYS_0_83_0">PowerToys version 0.83.0 or later</string>
|
||||
|
||||
<string id="ConfigureAllUtilityGlobalEnabledStateDescription">This policy configures the enabled state for all PowerToys utilities.
|
||||
|
||||
@ -128,6 +130,65 @@ 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.
|
||||
</string>
|
||||
<string id="MwbClipboardSharingEnabledDescription">This policy configures if the user can share the clipboard between machines.
|
||||
|
||||
If you enable or don't configure this policy, the user takes control over the clipboard sharing setting.
|
||||
|
||||
If you disable this policy, the user won't be able to enable the clipboard sharing setting.
|
||||
</string>
|
||||
<string id="MwbFileTransferEnabledDescription">This policy configures if the user can transfer files between machines.
|
||||
|
||||
If you enable or don't configure this policy, the user takes control over the file sharing setting.
|
||||
|
||||
If you disable this policy, the user won't be able to enable the file sharing Settings.
|
||||
|
||||
Note: The file sharing feature depends on the clipboard sharing feature. Disabling clipboard sharing automatically disables file sharing too.
|
||||
</string>
|
||||
<string id="MwbUseOriginalUserInterfaceDescription">This policy configures if the user can use the old Mouse Without Borders user interface.
|
||||
|
||||
If you enable or don't configure this policy, the user takes control over the setting and can enable or disable the old user interface.
|
||||
|
||||
If you disable this policy, the user won't be able to enable the old user interface.
|
||||
</string>
|
||||
<string id="MwbDisallowBlockingScreensaverDescription">This policy configures if the user is allowed to disable the screensaver on the remote machines.
|
||||
|
||||
If you enable this policy, the user won't be able to enable the "block screensaver" screensaver setting and the screensaver is not blocked.
|
||||
|
||||
If you disable or don't configure this policy, the user takes control over the setting and can block the screensaver.
|
||||
</string>
|
||||
|
||||
<string id="MwbSameSubnetOnlyDescription">This policy configures if connections are only allowed in the same subnet.
|
||||
|
||||
If you enable this policy, the setting is enabled and only connections in the same subnet are allowed.
|
||||
|
||||
If you disable this policy, the setting is disabled and all connections are allowed.
|
||||
|
||||
If you don't configure this policy, the user takes control over the setting and can enable or disable it.
|
||||
</string>
|
||||
<string id="MwbValidateRemoteIpDescription">This policy configures if reverse DNS lookup is used to validate the remote machine IP Address.
|
||||
|
||||
If you enable this policy, the setting is enabled and the IP Address is validated.
|
||||
|
||||
If you disable this policy, the setting is disabled and the IP Address is not validated.
|
||||
|
||||
If you don't configure this policy, the user takes control over the setting and can enable or disable it.
|
||||
</string>
|
||||
<string id="MwbDisableUserDefinedIpMappingRulesDescription">This policy configures if the user can define IP Address mapping rules.
|
||||
|
||||
If you enable this policy, the setting is disabled and the user can't define rules or use existing ones.
|
||||
|
||||
If you disable or don't configure this policy, the user takes control over the setting.
|
||||
|
||||
Note: Enabling this policy does not prevent policy defined mapping rules from working.
|
||||
</string>
|
||||
<string id="MwbPolicyDefinedIpMappingRulesDescription">This policy allows you to define IP Address mapping rules.
|
||||
|
||||
If you enable this policy, you can define IP Address mapping rules that the user can't change or disable.
|
||||
Please enter one mapping per line in the format: "hostname IP"
|
||||
|
||||
If you disable or don't configure this policy, no predefined rules are applied.
|
||||
</string>
|
||||
|
||||
<string id="ConfigureAllUtilityGlobalEnabledState">Configure global utility enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityAdvancedPaste">Advanced Paste: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string>
|
||||
@ -175,12 +236,23 @@ If you disable this policy, the user won't be able to enable Enable paste with A
|
||||
<string id="ConfigureEnabledUtilityFileExplorerQOIPreview">QOI file preview: Configure enabled state</string>
|
||||
<string id="ConfigureEnabledUtilityFileExplorerQOIThumbnails">QOI file thumbnail: Configure enabled state</string>
|
||||
<string id="AllowPowerToysAdvancedPasteOnlineAIModels">Allow using online AI models</string>
|
||||
<string id="MwbClipboardSharingEnabled">Clipboard sharing enabled</string>
|
||||
<string id="MwbFileTransferEnabled">File transfer enabled</string>
|
||||
<string id="MwbUseOriginalUserInterface">Original user interface is available</string>
|
||||
<string id="MwbDisallowBlockingScreensaver">Disallow blocking screensaver on other machines</string>
|
||||
<string id="MwbSameSubnetOnly">Connect only in same subnet</string>
|
||||
<string id="MwbValidateRemoteIp">Validate remote machine IP Address</string>
|
||||
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
|
||||
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
|
||||
</stringTable>
|
||||
|
||||
<presentationTable>
|
||||
<presentation id="PowerToysRunIndividualPluginEnabledState">
|
||||
<listBox refId="PowerToysRunIndividualPluginEnabledList">List of managed plugins:</listBox>
|
||||
</presentation>
|
||||
<presentation id="MwbPolicyDefinedIpMappingRules">
|
||||
<multiTextBox refId="MwbPolicyDefinedIpMappingsList">List of IP Address mappings:</multiTextBox>
|
||||
</presentation>
|
||||
</presentationTable>
|
||||
|
||||
</resources>
|
||||
|
@ -12,8 +12,10 @@ using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
|
||||
@ -259,6 +261,11 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbClipboardSharingEnabledValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.ShareClipboard;
|
||||
@ -267,6 +274,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (ShareClipboardIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.ShareClipboard = value;
|
||||
@ -274,10 +286,19 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool ShareClipboardIsGpoConfigured => GPOWrapper.GetConfiguredMwbClipboardSharingEnabledValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal bool TransferFile
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbFileTransferEnabledValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.TransferFile;
|
||||
@ -286,10 +307,19 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (TransferFileIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_properties.TransferFile = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool TransferFileIsGpoConfigured => GPOWrapper.GetConfiguredMwbFileTransferEnabledValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal bool MatrixOneRow
|
||||
{
|
||||
get
|
||||
@ -491,6 +521,11 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbDisallowBlockingScreensaverValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.BlockScreenSaverOnOtherMachines;
|
||||
@ -499,6 +534,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (BlockScreenSaverIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.BlockScreenSaverOnOtherMachines = value;
|
||||
@ -506,6 +546,10 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool BlockScreenSaverIsGpoConfigured => GPOWrapper.GetConfiguredMwbDisallowBlockingScreensaverValue() == GpoRuleConfigured.Enabled;
|
||||
|
||||
internal bool MoveMouseRelatively
|
||||
{
|
||||
get
|
||||
@ -795,6 +839,15 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.ValidateRemoteMachineIP;
|
||||
@ -803,6 +856,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (ReverseLookupIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.ValidateRemoteMachineIP = value;
|
||||
@ -810,10 +868,23 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool ReverseLookupIsGpoConfigured => GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Enabled || GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal bool SameSubNetOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.SameSubnetOnly;
|
||||
@ -822,6 +893,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (SameSubNetOnlyIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.SameSubnetOnly = value;
|
||||
@ -829,10 +905,19 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool SameSubNetOnlyIsGpoConfigured => GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Enabled || GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal string Name2IP
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbDisableUserDefinedIpMappingRulesValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.Name2IP.Value;
|
||||
@ -841,6 +926,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (Name2IpIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.Name2IP.Value = value;
|
||||
@ -848,6 +938,18 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool Name2IpIsGpoConfigured => GPOWrapper.GetConfiguredMwbDisableUserDefinedIpMappingRulesValue() == GpoRuleConfigured.Enabled;
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal string Name2IpPolicyList => GPOWrapper.GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool Name2IpPolicyListIsGpoConfigured => !string.IsNullOrWhiteSpace(Name2IpPolicyList);
|
||||
|
||||
internal bool FirstCtrlShiftS
|
||||
{
|
||||
get
|
||||
@ -954,6 +1056,11 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbUseOriginalUserInterfaceValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.ShowOriginalUI;
|
||||
@ -962,6 +1069,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbUseOriginalUserInterfaceValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.ShowOriginalUI = value;
|
||||
|
@ -887,7 +887,8 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
if (!string.IsNullOrEmpty(Setting.Values.Name2IP))
|
||||
{
|
||||
string[] name2ip = Setting.Values.Name2IP.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
string combinedName2ipList = Setting.Values.Name2IpPolicyList + Separator + Setting.Values.Name2IP;
|
||||
string[] name2ip = combinedName2ipList.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] nameNip;
|
||||
|
||||
if (name2ip != null)
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using Windows.UI.Notifications;
|
||||
|
||||
namespace MouseWithoutBorders
|
||||
{
|
||||
@ -88,6 +89,8 @@ namespace MouseWithoutBorders
|
||||
this.linkLabelReConfigure = new System.Windows.Forms.LinkLabel();
|
||||
this.tabControlSetting = new System.Windows.Forms.TabControl();
|
||||
this.tabPageAdvancedSettings = new System.Windows.Forms.TabPage();
|
||||
this.groupBoxName2IPPolicyList = new System.Windows.Forms.GroupBox();
|
||||
this.textBoxMachineName2IPPolicyList = new System.Windows.Forms.TextBox();
|
||||
this.pictureBoxMouseWithoutBorders = new System.Windows.Forms.PictureBox();
|
||||
this.groupBoxDNS = new System.Windows.Forms.GroupBox();
|
||||
this.textBoxMachineName2IP = new System.Windows.Forms.TextBox();
|
||||
@ -103,6 +106,7 @@ namespace MouseWithoutBorders
|
||||
this.groupBoxMachineMatrix.SuspendLayout();
|
||||
this.tabControlSetting.SuspendLayout();
|
||||
this.tabPageAdvancedSettings.SuspendLayout();
|
||||
this.groupBoxName2IPPolicyList.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMouseWithoutBorders)).BeginInit();
|
||||
this.groupBoxDNS.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -977,6 +981,7 @@ namespace MouseWithoutBorders
|
||||
// tabPageAdvancedSettings
|
||||
//
|
||||
this.tabPageAdvancedSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(245)))), ((int)(((byte)(242)))));
|
||||
this.tabPageAdvancedSettings.Controls.Add(this.groupBoxName2IPPolicyList);
|
||||
this.tabPageAdvancedSettings.Controls.Add(this.pictureBoxMouseWithoutBorders);
|
||||
this.tabPageAdvancedSettings.Controls.Add(this.groupBoxDNS);
|
||||
this.tabPageAdvancedSettings.Controls.Add(this.textBoxDNS);
|
||||
@ -986,6 +991,33 @@ namespace MouseWithoutBorders
|
||||
this.tabPageAdvancedSettings.Size = new System.Drawing.Size(563, 362);
|
||||
this.tabPageAdvancedSettings.TabIndex = 2;
|
||||
this.tabPageAdvancedSettings.Text = "IP Mappings";
|
||||
//
|
||||
// groupBoxName2IPPolicyList
|
||||
//
|
||||
this.groupBoxName2IPPolicyList.Controls.Add(this.textBoxMachineName2IPPolicyList);
|
||||
this.groupBoxName2IPPolicyList.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupBoxName2IPPolicyList.Location = new System.Drawing.Point(3, 241);
|
||||
this.groupBoxName2IPPolicyList.Name = "groupBoxName2IPPolicyList";
|
||||
this.groupBoxName2IPPolicyList.Size = new System.Drawing.Size(357, 150);
|
||||
this.groupBoxName2IPPolicyList.TabIndex = 1;
|
||||
this.groupBoxName2IPPolicyList.TabStop = false;
|
||||
this.groupBoxName2IPPolicyList.Text = " Policy defined machine name to IP address mappings [Managed]";
|
||||
this.groupBoxName2IPPolicyList.ForeColor = Color.DimGray;
|
||||
this.groupBoxName2IPPolicyList.Visible = false;
|
||||
//
|
||||
// textBoxMachineName2IPPolicyList
|
||||
//
|
||||
this.textBoxMachineName2IPPolicyList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxMachineName2IPPolicyList.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.textBoxMachineName2IPPolicyList.Location = new System.Drawing.Point(3, 172); // 3,172
|
||||
this.textBoxMachineName2IPPolicyList.MaxLength = 1024;
|
||||
this.textBoxMachineName2IPPolicyList.Multiline = true;
|
||||
this.textBoxMachineName2IPPolicyList.Name = "textBoxMachineName2IPPolicyList";
|
||||
this.textBoxMachineName2IPPolicyList.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.textBoxMachineName2IPPolicyList.Size = new System.Drawing.Size(351, 131);
|
||||
this.textBoxMachineName2IPPolicyList.TabIndex = 1;
|
||||
this.textBoxMachineName2IPPolicyList.ReadOnly = true;
|
||||
this.textBoxMachineName2IPPolicyList.Visible = false;
|
||||
//
|
||||
// pictureBoxMouseWithoutBorders
|
||||
//
|
||||
@ -1098,12 +1130,13 @@ namespace MouseWithoutBorders
|
||||
this.tabControlSetting.ResumeLayout(false);
|
||||
this.tabPageAdvancedSettings.ResumeLayout(false);
|
||||
this.tabPageAdvancedSettings.PerformLayout();
|
||||
this.groupBoxName2IPPolicyList.ResumeLayout(false);
|
||||
this.groupBoxName2IPPolicyList.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMouseWithoutBorders)).EndInit();
|
||||
this.groupBoxDNS.ResumeLayout(false);
|
||||
this.groupBoxDNS.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -1140,6 +1173,8 @@ namespace MouseWithoutBorders
|
||||
private GroupBox groupBoxDNS;
|
||||
private TextBox textBoxDNS;
|
||||
private TextBox textBoxMachineName2IP;
|
||||
private GroupBox groupBoxName2IPPolicyList;
|
||||
private TextBox textBoxMachineName2IPPolicyList;
|
||||
private PictureBox pictureBoxMouseWithoutBorders;
|
||||
private GroupBox groupBoxOtherOptions;
|
||||
private CheckBox checkBoxDrawMouse;
|
||||
|
@ -853,6 +853,56 @@ namespace MouseWithoutBorders
|
||||
|
||||
comboBoxEasyMouse.Text = Setting.Values.HotKeyToggleEasyMouse == 0 ? "Disable" : new string(new char[] { (char)Setting.Values.HotKeyToggleEasyMouse });
|
||||
#endif
|
||||
|
||||
// Apply policy configuration on UI elements
|
||||
// Has to be the last action
|
||||
if (Setting.Values.ShareClipboardIsGpoConfigured)
|
||||
{
|
||||
checkBoxShareClipboard.Enabled = false;
|
||||
checkBoxShareClipboard.Text += " [Managed]";
|
||||
|
||||
// transfer file setting depends on clipboard sharing
|
||||
checkBoxTransferFile.Enabled = false;
|
||||
}
|
||||
|
||||
if (Setting.Values.TransferFileIsGpoConfigured)
|
||||
{
|
||||
checkBoxTransferFile.Enabled = false;
|
||||
checkBoxTransferFile.Text += " [Managed]";
|
||||
}
|
||||
|
||||
if (Setting.Values.BlockScreenSaverIsGpoConfigured)
|
||||
{
|
||||
checkBoxBlockScreenSaver.Enabled = false;
|
||||
checkBoxBlockScreenSaver.Text += " [Managed]";
|
||||
}
|
||||
|
||||
if (Setting.Values.SameSubNetOnlyIsGpoConfigured)
|
||||
{
|
||||
checkBoxSameSubNet.Enabled = false;
|
||||
checkBoxSameSubNet.Text += " [Managed]";
|
||||
}
|
||||
|
||||
if (Setting.Values.ReverseLookupIsGpoConfigured)
|
||||
{
|
||||
checkBoxReverseLookup.Enabled = false;
|
||||
checkBoxReverseLookup.Text += " [Managed]";
|
||||
}
|
||||
|
||||
if (Setting.Values.Name2IpIsGpoConfigured)
|
||||
{
|
||||
textBoxMachineName2IP.Enabled = false;
|
||||
groupBoxDNS.ForeColor = Color.DimGray;
|
||||
groupBoxDNS.Text += " [Managed]";
|
||||
}
|
||||
|
||||
if (Setting.Values.Name2IpPolicyListIsGpoConfigured)
|
||||
{
|
||||
pictureBoxMouseWithoutBorders.Visible = false;
|
||||
groupBoxName2IPPolicyList.Visible = true;
|
||||
textBoxMachineName2IPPolicyList.Visible = true;
|
||||
textBoxMachineName2IPPolicyList.Text = Setting.Values.Name2IpPolicyList;
|
||||
}
|
||||
}
|
||||
|
||||
private void RadioButton_CheckedChanged(object sender, EventArgs e)
|
||||
|
@ -208,28 +208,43 @@
|
||||
IsEnabled="{x:Bind ViewModel.CanUninstallService, Mode=OneWay}" />
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="MouseWithoutBorders_Settings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<InfoBar
|
||||
x:Uid="GPO_SomeSettingsAreManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.ShowPolicyConfiguredInfoForBehaviorSettings, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.ShowPolicyConfiguredInfoForBehaviorSettings, Mode=OneWay}"
|
||||
Severity="Informational">
|
||||
<!--InfoBar.IconSource>
|
||||
<FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||
</InfoBar.IconSource-->
|
||||
</InfoBar>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_WrapMouse">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_WrapMouse_ToggleSwitch" IsOn="{x:Bind ViewModel.WrapMouse, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_ShareClipboard">
|
||||
<tkcontrols:SettingsExpander
|
||||
x:Uid="MouseWithoutBorders_ShareClipboard"
|
||||
IsEnabled="{x:Bind ViewModel.CardForShareClipboardSettingIsEnabled, Mode=OneWay}"
|
||||
IsExpanded="True">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_ShareClipboard_ToggleSwitch" IsOn="{x:Bind ViewModel.ShareClipboard, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_TransferFile">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_TransferFile_ToggleSwitch" IsOn="{x:Bind ViewModel.TransferFile, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_TransferFile" IsEnabled="{x:Bind ViewModel.CardForTransferFileSettingIsEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_TransferFile_ToggleSwitch" IsOn="{x:Bind ViewModel.TransferFile, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_HideMouseAtScreenEdge">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_HideMouseAtScreenEdge_ToggleSwitch" IsOn="{x:Bind ViewModel.HideMouseAtScreenEdge, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_DrawMouseCursor">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_DrawMouseCursor_ToggleSwitch" IsOn="{x:Bind ViewModel.DrawMouseCursor, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_ValidateRemoteMachineIP">
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_ValidateRemoteMachineIP" IsEnabled="{x:Bind ViewModel.CardForValidateRemoteIpSettingIsEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_ValidateRemoteMachineIP_ToggleSwitch" IsOn="{x:Bind ViewModel.ValidateRemoteMachineIP, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_SameSubnetOnly">
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_SameSubnetOnly" IsEnabled="{x:Bind ViewModel.CardForSameSubnetOnlySettingIsEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_SameSubnetOnly_ToggleSwitch" IsOn="{x:Bind ViewModel.SameSubnetOnly, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_BlockScreenSaverOnOtherMachines">
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_BlockScreenSaverOnOtherMachines" IsEnabled="{x:Bind ViewModel.CardForBlockScreensaverSettingIsEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_BlockScreenSaverOnOtherMachines_ToggleSwitch" IsOn="{x:Bind ViewModel.BlockScreenSaverOnOtherMachines, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_MoveMouseRelatively">
|
||||
@ -292,11 +307,15 @@
|
||||
<controls:SettingsGroup x:Uid="MouseWithoutBorders_AdvancedSettings_Group" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsExpander x:Uid="MouseWithoutBorders_IPAddressMapping" IsExpanded="True">
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard HorizontalContentAlignment="Stretch" ContentAlignment="Vertical">
|
||||
<tkcontrols:SettingsCard
|
||||
HorizontalContentAlignment="Stretch"
|
||||
ContentAlignment="Vertical"
|
||||
IsEnabled="{x:Bind ViewModel.CardForName2IpSettingIsEnabled, Mode=OneWay}">
|
||||
<TextBox
|
||||
x:Uid="MouseWithoutBorders_IPAddressMapping_TextBoxControl"
|
||||
MinWidth="240"
|
||||
MinHeight="160"
|
||||
MaxHeight="480"
|
||||
AcceptsReturn="True"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
@ -304,6 +323,60 @@
|
||||
Text="{x:Bind ViewModel.Name2IP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Background="{ThemeResource InfoBarInformationalSeverityBackgroundBrush}"
|
||||
ContentAlignment="Vertical"
|
||||
Visibility="{x:Bind ViewModel.ShowPolicyConfiguredInfoForName2IPSetting, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
IsTabStop="{x:Bind ViewModel.ShowPolicyConfiguredInfoForName2IPSetting, Mode=OneWay}"
|
||||
Severity="Informational">
|
||||
<!--InfoBar.IconSource>
|
||||
<FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||
</InfoBar.IconSource-->
|
||||
</InfoBar>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard
|
||||
Margin="0,1,0,0"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Background="{ThemeResource InfoBarInformationalSeverityBackgroundBrush}"
|
||||
ContentAlignment="Vertical"
|
||||
Visibility="{x:Bind ViewModel.Name2IpListPolicyIsConfigured, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<InfoBar
|
||||
x:Uid="MouseWithoutBorders_PolicyIPAddressMappingInfo"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
IsTabStop="{x:Bind ViewModel.Name2IpListPolicyIsConfigured, Mode=OneWay}"
|
||||
Severity="Informational">
|
||||
<InfoBar.IconSource>
|
||||
<FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||
</InfoBar.IconSource>
|
||||
<InfoBar.Content>
|
||||
<TextBox
|
||||
x:Uid="MouseWithoutBorders_PolicyIPAddressMappingInfo_TextBoxControl"
|
||||
MinWidth="240"
|
||||
MinHeight="80"
|
||||
MaxHeight="160"
|
||||
Margin="0,0,44,16"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
Text="{x:Bind ViewModel.Name2IpListPolicyData, Mode=OneWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</InfoBar.Content>
|
||||
</InfoBar>
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
@ -313,12 +386,19 @@
|
||||
ActionIcon="{ui:FontIcon Glyph=}"
|
||||
Command="{x:Bind ViewModel.AddFirewallRuleEventHandler}"
|
||||
IsClickEnabled="True" />
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_ShowOriginalUI">
|
||||
<ToggleSwitch
|
||||
x:Uid="MouseWithoutBorders_ShowOriginalUI_ToggleSwitch"
|
||||
IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}"
|
||||
IsOn="{x:Bind ViewModel.ShowOriginalUI, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsCard x:Uid="MouseWithoutBorders_ShowOriginalUI" IsEnabled="{x:Bind ViewModel.CardForOriginalUiSettingIsEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="MouseWithoutBorders_ShowOriginalUI_ToggleSwitch" IsOn="{x:Bind ViewModel.ShowOriginalUI, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.ShowPolicyConfiguredInfoForOriginalUiSetting, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.ShowPolicyConfiguredInfoForOriginalUiSetting, Mode=OneWay}"
|
||||
Severity="Informational">
|
||||
<!--InfoBar.IconSource>
|
||||
<FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||
</InfoBar.IconSource-->
|
||||
</InfoBar>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
@ -4199,4 +4199,10 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Automatically close the AdvancedPaste window after it loses focus</value>
|
||||
<comment>AdvancedPaste is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="MouseWithoutBorders_PolicyIPAddressMappingInfo.Title" xml:space="preserve">
|
||||
<value>Rules defined by your organization</value>
|
||||
</data>
|
||||
<data name="MouseWithoutBorders_PolicyIPAddressMappingInfo_TextBoxControl.Description" xml:space="preserve">
|
||||
<value>You can not change, remove or disable these enforced rules.</value>
|
||||
</data>
|
||||
</root>
|
@ -66,11 +66,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
public bool ShowOriginalUI
|
||||
{
|
||||
get => Settings.Properties.ShowOriginalUI;
|
||||
get
|
||||
{
|
||||
if (_useOriginalUserInterfaceGpoConfiguration == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings.Properties.ShowOriginalUI;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (Settings.Properties.ShowOriginalUI != value)
|
||||
if (!_useOriginalUserInterfaceIsGPOConfigured && (Settings.Properties.ShowOriginalUI != value))
|
||||
{
|
||||
Settings.Properties.ShowOriginalUI = value;
|
||||
NotifyPropertyChanged(nameof(ShowOriginalUI));
|
||||
@ -78,6 +86,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForOriginalUiSettingIsEnabled => _useOriginalUserInterfaceIsGPOConfigured == false;
|
||||
|
||||
public bool ShowPolicyConfiguredInfoForOriginalUiSetting => IsEnabled && _useOriginalUserInterfaceIsGPOConfigured;
|
||||
|
||||
public bool UseService
|
||||
{
|
||||
get => Settings.Properties.UseService;
|
||||
@ -163,6 +175,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _enabledStateIsGPOConfigured;
|
||||
private bool _isEnabled;
|
||||
|
||||
// Configuration policy variables
|
||||
private GpoRuleConfigured _clipboardSharingEnabledGpoConfiguration;
|
||||
private bool _clipboardSharingEnabledIsGPOConfigured;
|
||||
private GpoRuleConfigured _fileTransferEnabledGpoConfiguration;
|
||||
private bool _fileTransferEnabledIsGPOConfigured;
|
||||
private GpoRuleConfigured _useOriginalUserInterfaceGpoConfiguration;
|
||||
private bool _useOriginalUserInterfaceIsGPOConfigured;
|
||||
private GpoRuleConfigured _disallowBlockingScreensaverGpoConfiguration;
|
||||
private bool _disallowBlockingScreensaverIsGPOConfigured;
|
||||
private GpoRuleConfigured _sameSubnetOnlyGpoConfiguration;
|
||||
private bool _sameSubnetOnlyIsGPOConfigured;
|
||||
private GpoRuleConfigured _validateRemoteIpGpoConfiguration;
|
||||
private bool _validateRemoteIpIsGPOConfigured;
|
||||
private GpoRuleConfigured _disableUserDefinedIpMappingRulesGpoConfiguration;
|
||||
private bool _disableUserDefinedIpMappingRulesIsGPOConfigured;
|
||||
private string _policyDefinedIpMappingRulesGPOData;
|
||||
private bool _policyDefinedIpMappingRulesIsGPOConfigured;
|
||||
|
||||
public string MachineHostName
|
||||
{
|
||||
get
|
||||
@ -385,6 +415,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
InitializeEnabledValue();
|
||||
InitializePolicyValues();
|
||||
|
||||
// MouseWithoutBorders settings may be changed by the logic in the utility as machines connect. We need to get a fresh version everytime instead of using a repository.
|
||||
MouseWithoutBordersSettings moduleSettings;
|
||||
@ -466,6 +497,33 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializePolicyValues()
|
||||
{
|
||||
// Policies supporting only enabled state
|
||||
_disallowBlockingScreensaverGpoConfiguration = GPOWrapper.GetConfiguredMwbDisallowBlockingScreensaverValue();
|
||||
_disallowBlockingScreensaverIsGPOConfigured = _disallowBlockingScreensaverGpoConfiguration == GpoRuleConfigured.Enabled;
|
||||
_disableUserDefinedIpMappingRulesGpoConfiguration = GPOWrapper.GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||
_disableUserDefinedIpMappingRulesIsGPOConfigured = _disableUserDefinedIpMappingRulesGpoConfiguration == GpoRuleConfigured.Enabled;
|
||||
|
||||
// Policies supporting only disabled state
|
||||
_clipboardSharingEnabledGpoConfiguration = GPOWrapper.GetConfiguredMwbClipboardSharingEnabledValue();
|
||||
_clipboardSharingEnabledIsGPOConfigured = _clipboardSharingEnabledGpoConfiguration == GpoRuleConfigured.Disabled;
|
||||
_fileTransferEnabledGpoConfiguration = GPOWrapper.GetConfiguredMwbFileTransferEnabledValue();
|
||||
_fileTransferEnabledIsGPOConfigured = _fileTransferEnabledGpoConfiguration == GpoRuleConfigured.Disabled;
|
||||
_useOriginalUserInterfaceGpoConfiguration = GPOWrapper.GetConfiguredMwbUseOriginalUserInterfaceValue();
|
||||
_useOriginalUserInterfaceIsGPOConfigured = _useOriginalUserInterfaceGpoConfiguration == GpoRuleConfigured.Disabled;
|
||||
|
||||
// Policies supporting enabled and disabled state
|
||||
_sameSubnetOnlyGpoConfiguration = GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue();
|
||||
_sameSubnetOnlyIsGPOConfigured = _sameSubnetOnlyGpoConfiguration == GpoRuleConfigured.Enabled || _sameSubnetOnlyGpoConfiguration == GpoRuleConfigured.Disabled;
|
||||
_validateRemoteIpGpoConfiguration = GPOWrapper.GetConfiguredMwbValidateRemoteIpValue();
|
||||
_validateRemoteIpIsGPOConfigured = _validateRemoteIpGpoConfiguration == GpoRuleConfigured.Enabled || _validateRemoteIpGpoConfiguration == GpoRuleConfigured.Disabled;
|
||||
|
||||
// Special policies
|
||||
_policyDefinedIpMappingRulesGPOData = GPOWrapper.GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
_policyDefinedIpMappingRulesIsGPOConfigured = !string.IsNullOrWhiteSpace(_policyDefinedIpMappingRulesGPOData);
|
||||
}
|
||||
|
||||
private void LoadViewModelFromSettings(MouseWithoutBordersSettings moduleSettings)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(moduleSettings);
|
||||
@ -569,6 +627,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
OnPropertyChanged(nameof(ShowInfobarRunAsAdminText));
|
||||
OnPropertyChanged(nameof(ShowInfobarCannotDragDropAsAdmin));
|
||||
OnPropertyChanged(nameof(ShowPolicyConfiguredInfoForBehaviorSettings));
|
||||
OnPropertyChanged(nameof(ShowPolicyConfiguredInfoForName2IPSetting));
|
||||
OnPropertyChanged(nameof(ShowPolicyConfiguredInfoForOriginalUiSetting));
|
||||
OnPropertyChanged(nameof(Name2IpListPolicyIsConfigured));
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@ -654,28 +716,49 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_clipboardSharingEnabledGpoConfiguration == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings.Properties.ShareClipboard;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (Settings.Properties.ShareClipboard != value)
|
||||
if (!_clipboardSharingEnabledIsGPOConfigured && (Settings.Properties.ShareClipboard != value))
|
||||
{
|
||||
Settings.Properties.ShareClipboard = value;
|
||||
NotifyPropertyChanged();
|
||||
OnPropertyChanged(nameof(TransferFile));
|
||||
OnPropertyChanged(nameof(CardForTransferFileSettingIsEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForShareClipboardSettingIsEnabled => _clipboardSharingEnabledIsGPOConfigured == false;
|
||||
|
||||
public bool TransferFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return Settings.Properties.TransferFile;
|
||||
if (_fileTransferEnabledGpoConfiguration == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings.Properties.TransferFile && Settings.Properties.ShareClipboard;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
// If ShareClipboard is disabled the file transfer does not work and the setting is disabled. => Don't save toggle state.
|
||||
// If FileTransferGpo is configured the file transfer does not work and the setting is disabled. => Don't save toggle state.
|
||||
if (!ShareClipboard || _fileTransferEnabledIsGPOConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.Properties.TransferFile != value)
|
||||
{
|
||||
Settings.Properties.TransferFile = value;
|
||||
@ -684,6 +767,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForTransferFileSettingIsEnabled
|
||||
{
|
||||
get => ShareClipboard && !_fileTransferEnabledIsGPOConfigured;
|
||||
}
|
||||
|
||||
public bool HideMouseAtScreenEdge
|
||||
{
|
||||
get
|
||||
@ -722,12 +810,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_validateRemoteIpGpoConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (_validateRemoteIpGpoConfiguration == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings.Properties.ValidateRemoteMachineIP;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (Settings.Properties.ValidateRemoteMachineIP != value)
|
||||
if (!_validateRemoteIpIsGPOConfigured && (Settings.Properties.ValidateRemoteMachineIP != value))
|
||||
{
|
||||
Settings.Properties.ValidateRemoteMachineIP = value;
|
||||
NotifyPropertyChanged();
|
||||
@ -735,6 +832,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForValidateRemoteIpSettingIsEnabled => _validateRemoteIpIsGPOConfigured == false;
|
||||
|
||||
public string Name2IP
|
||||
{
|
||||
// Due to https://github.com/microsoft/microsoft-ui-xaml/issues/1826, we must
|
||||
@ -742,11 +841,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
// to make its behavior consistent with the old UI and MWB internal code.
|
||||
get
|
||||
{
|
||||
if (_disableUserDefinedIpMappingRulesGpoConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return Settings.Properties.Name2IP.Value.Replace("\r\n", "\r");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_disableUserDefinedIpMappingRulesIsGPOConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newValue = value.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
|
||||
|
||||
if (Settings.Properties.Name2IP.Value != newValue)
|
||||
@ -757,16 +866,40 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForName2IpSettingIsEnabled => _disableUserDefinedIpMappingRulesIsGPOConfigured == false;
|
||||
|
||||
public bool ShowPolicyConfiguredInfoForName2IPSetting => _disableUserDefinedIpMappingRulesIsGPOConfigured && IsEnabled;
|
||||
|
||||
public string Name2IpListPolicyData
|
||||
{
|
||||
// Due to https://github.com/microsoft/microsoft-ui-xaml/issues/1826, we must
|
||||
// add back \n chars on set and remove them on get for the widget
|
||||
// to make its behavior consistent with the old UI and MWB internal code.
|
||||
// get => GPOWrapper.GetConfiguredMwbPolicyDefinedIpMappingRules().Replace("\r\n", "\r");
|
||||
get => _policyDefinedIpMappingRulesGPOData.Replace("\r\n", "\r");
|
||||
}
|
||||
|
||||
public bool Name2IpListPolicyIsConfigured => _policyDefinedIpMappingRulesIsGPOConfigured && IsEnabled;
|
||||
|
||||
public bool SameSubnetOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sameSubnetOnlyGpoConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (_sameSubnetOnlyGpoConfiguration == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings.Properties.SameSubnetOnly;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (Settings.Properties.SameSubnetOnly != value)
|
||||
if (!_sameSubnetOnlyIsGPOConfigured && (Settings.Properties.SameSubnetOnly != value))
|
||||
{
|
||||
Settings.Properties.SameSubnetOnly = value;
|
||||
NotifyPropertyChanged();
|
||||
@ -774,15 +907,27 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForSameSubnetOnlySettingIsEnabled => _sameSubnetOnlyIsGPOConfigured == false;
|
||||
|
||||
public bool BlockScreenSaverOnOtherMachines
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_disallowBlockingScreensaverGpoConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Settings.Properties.BlockScreenSaverOnOtherMachines;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_disallowBlockingScreensaverIsGPOConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.Properties.BlockScreenSaverOnOtherMachines != value)
|
||||
{
|
||||
Settings.Properties.BlockScreenSaverOnOtherMachines = value;
|
||||
@ -791,6 +936,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CardForBlockScreensaverSettingIsEnabled => _disallowBlockingScreensaverIsGPOConfigured == false;
|
||||
|
||||
// Should match EasyMouseOption enum from MouseWithoutBorders and the ComboBox in the MouseWithoutBordersView.cs
|
||||
private enum EasyMouseOption
|
||||
{
|
||||
@ -1083,6 +1230,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
SendCustomAction("uninstall_service");
|
||||
}
|
||||
|
||||
public bool ShowPolicyConfiguredInfoForBehaviorSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsEnabled && (_disallowBlockingScreensaverIsGPOConfigured
|
||||
|| _clipboardSharingEnabledIsGPOConfigured || _fileTransferEnabledIsGPOConfigured
|
||||
|| _sameSubnetOnlyIsGPOConfigured || _validateRemoteIpIsGPOConfigured);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowInfobarCannotDragDropAsAdmin
|
||||
{
|
||||
get { return IsElevated && IsEnabled; }
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <regex>
|
||||
|
||||
std::wstring gpo_rule_configured_to_string(powertoys_gpo::gpo_rule_configured_t gpo_rule)
|
||||
{
|
||||
@ -22,6 +23,18 @@ std::wstring gpo_rule_configured_to_string(powertoys_gpo::gpo_rule_configured_t
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring gpo_string_to_string(const std::wstring &gpo_value)
|
||||
{
|
||||
if (gpo_value == L"")
|
||||
{
|
||||
return L"not_configured";
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::regex_replace(gpo_value, std::wregex(L"\r\n"), std::wstring(L"|"));
|
||||
}
|
||||
}
|
||||
|
||||
void ReportGPOValues(const std::filesystem::path& tmpDir)
|
||||
{
|
||||
auto reportPath = tmpDir;
|
||||
@ -68,4 +81,12 @@ 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 << "getConfiguredMwbClipboardSharingEnabledValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbClipboardSharingEnabledValue()) << std::endl;
|
||||
report << "getConfiguredMwbFileTransferEnabledValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbFileTransferEnabledValue()) << std::endl;
|
||||
report << "getConfiguredMwbUseOriginalUserInterfaceValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbUseOriginalUserInterfaceValue()) << std::endl;
|
||||
report << "getConfiguredMwbDisallowBlockingScreensaverValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbDisallowBlockingScreensaverValue()) << std::endl;
|
||||
report << "getConfiguredMwbSameSubnetOnlyValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbSameSubnetOnlyValue()) << std::endl;
|
||||
report << "getConfiguredMwbValidateRemoteIpValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbValidateRemoteIpValue()) << std::endl;
|
||||
report << "getConfiguredMwbDisableUserDefinedIpMappingRulesValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredMwbDisableUserDefinedIpMappingRulesValue()) << std::endl;
|
||||
report << "getConfiguredMwbPolicyDefinedIpMappingRules: " << gpo_string_to_string(powertoys_gpo::getConfiguredMwbPolicyDefinedIpMappingRules()) << std::endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user