[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:
Heiko
2024-07-22 16:49:45 +02:00
committed by GitHub
parent ca97e01d59
commit 16a1fb7981
15 changed files with 782 additions and 25 deletions

View File

@@ -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="&#xE72E;" />
</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="&#xE72E;" />
</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="&#xE72E;" />
</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=&#xE8A7;}"
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="&#xE72E;" />
</InfoBar.IconSource-->
</InfoBar>
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>

View File

@@ -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>

View File

@@ -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; }