SEBWIN-302: Implemented configuration for browser window toolbar.

This commit is contained in:
dbuechel 2020-01-08 09:55:23 +01:00
parent df61e79861
commit 45e1b001e3
7 changed files with 32 additions and 2 deletions

View file

@ -93,6 +93,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
case Keys.Browser.QuitUrlConfirmation:
MapQuitUrlConfirmation(settings, value);
break;
case Keys.Browser.ShowToolbar:
MapShowToolbar(settings, value);
break;
case Keys.Browser.StartUrl:
MapStartUrl(settings, value);
break;
@ -263,6 +266,15 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
}
}
private void MapShowToolbar(AppSettings settings, object value)
{
if (value is bool show)
{
settings.Browser.AdditionalWindow.ShowToolbar = show;
settings.Browser.MainWindow.ShowToolbar = show;
}
}
private void MapStartUrl(AppSettings settings, object value)
{
if (value is string url)

View file

@ -51,6 +51,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
internal const string PopupBlockForeignHost = "newBrowserWindowByLinkBlockForeign";
internal const string QuitUrl = "quitURL";
internal const string QuitUrlConfirmation = "quitURLConfirm";
internal const string ShowToolbar = "enableBrowserWindowToolbar";
internal const string StartUrl = "startURL";
internal const string UserAgentModeDesktop = "browserUserAgentWinDesktopMode";
internal const string UserAgentModeMobile = "browserUserAgentWinTouchMode";

View file

@ -75,5 +75,10 @@ namespace SafeExamBrowser.Settings.Browser
/// Determines whether the user will need to confirm every reload attempt.
/// </summary>
public bool ShowReloadWarning { get; set; }
/// <summary>
/// Determines whether the window toolbar is visible.
/// </summary>
public bool ShowToolbar { get; set; }
}
}

View file

@ -42,7 +42,7 @@
<Popup x:Name="MenuPopup" IsOpen="False" AllowsTransparency="True" PopupAnimation="Slide" Placement="Custom" PlacementTarget="{Binding ElementName=BrowserControlHost}">
<Border Background="{StaticResource BackgroundBrush}" BorderBrush="LightGray" BorderThickness="1,0,1,1" Width="250">
<StackPanel Orientation="Vertical">
<Grid Height="40">
<Grid x:Name="ZoomMenuItem" Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />

View file

@ -253,10 +253,16 @@ namespace SafeExamBrowser.UserInterface.Desktop
ForwardButton.IsEnabled = WindowSettings.AllowForwardNavigation;
ForwardButton.Visibility = WindowSettings.AllowForwardNavigation ? Visibility.Visible : Visibility.Collapsed;
MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole;
ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.AllowReloading ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;
UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden;
ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed;
}
private void InitializeBounds()

View file

@ -42,7 +42,7 @@
<Popup x:Name="MenuPopup" IsOpen="False" AllowsTransparency="True" PopupAnimation="Slide" Placement="Custom" PlacementTarget="{Binding ElementName=BrowserControlHost}">
<Border Background="{StaticResource BackgroundBrush}" BorderBrush="LightGray" BorderThickness="1,0,1,1" Width="350">
<StackPanel Orientation="Vertical">
<Grid Height="55">
<Grid x:Name="ZoomMenuItem" Height="55">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />

View file

@ -253,11 +253,17 @@ namespace SafeExamBrowser.UserInterface.Mobile
ForwardButton.IsEnabled = WindowSettings.AllowForwardNavigation;
ForwardButton.Visibility = WindowSettings.AllowForwardNavigation ? Visibility.Visible : Visibility.Collapsed;
MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole;
ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.AllowReloading ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;
UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden;
ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed;
if (!WindowSettings.AllowAddressBar)
{
BackwardButton.Height = 35;