SEBWIN-428: Fixed bug where visibility of reload button wasn't according to the active settings.

This commit is contained in:
Damian Büchel 2021-08-09 12:29:11 +02:00
parent c6853f9239
commit 66e7c50a8e
5 changed files with 21 additions and 6 deletions

View file

@ -147,6 +147,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
case Keys.Browser.ResetOnQuitUrl: case Keys.Browser.ResetOnQuitUrl:
MapResetOnQuitUrl(settings, value); MapResetOnQuitUrl(settings, value);
break; break;
case Keys.Browser.ShowReloadButton:
MapShowReloadButton(settings, value);
break;
case Keys.Browser.ShowToolbar: case Keys.Browser.ShowToolbar:
MapShowToolbar(settings, value); MapShowToolbar(settings, value);
break; break;
@ -436,6 +439,15 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
} }
} }
private void MapShowReloadButton(AppSettings settings, object value)
{
if (value is bool show)
{
settings.Browser.AdditionalWindow.ShowReloadButton = show;
settings.Browser.MainWindow.ShowReloadButton = show;
}
}
private void MapRequestFilter(IDictionary<string, object> rawData, AppSettings settings) private void MapRequestFilter(IDictionary<string, object> rawData, AppSettings settings)
{ {
var processMainRequests = rawData.TryGetValue(Keys.Browser.Filter.EnableMainRequestFilter, out var value) && value as bool? == true; var processMainRequests = rawData.TryGetValue(Keys.Browser.Filter.EnableMainRequestFilter, out var value) && value as bool? == true;

View file

@ -29,14 +29,12 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
private void AllowBrowserToolbarForReloading(IDictionary<string, object> rawData, AppSettings settings) private void AllowBrowserToolbarForReloading(IDictionary<string, object> rawData, AppSettings settings)
{ {
var showReloadButton = rawData.TryGetValue(Keys.Browser.ShowReloadButton, out var v) && v is bool show && show; if (settings.Browser.AdditionalWindow.AllowReloading && settings.Browser.AdditionalWindow.ShowReloadButton)
if (settings.Browser.AdditionalWindow.AllowReloading && showReloadButton)
{ {
settings.Browser.AdditionalWindow.ShowToolbar = true; settings.Browser.AdditionalWindow.ShowToolbar = true;
} }
if (settings.Browser.MainWindow.AllowReloading && showReloadButton) if (settings.Browser.MainWindow.AllowReloading && settings.Browser.MainWindow.ShowReloadButton)
{ {
settings.Browser.MainWindow.ShowToolbar = true; settings.Browser.MainWindow.ShowToolbar = true;
} }

View file

@ -76,6 +76,11 @@ namespace SafeExamBrowser.Settings.Browser
/// </summary> /// </summary>
public bool ShowHomeButton { get; set; } public bool ShowHomeButton { get; set; }
/// <summary>
/// Determines whether the reload button is visible.
/// </summary>
public bool ShowReloadButton { get; set; }
/// <summary> /// <summary>
/// Determines whether the user will need to confirm every reload attempt. /// Determines whether the user will need to confirm every reload attempt.
/// </summary> /// </summary>

View file

@ -343,7 +343,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed; HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed;
MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole; MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole;
ReloadButton.IsEnabled = WindowSettings.AllowReloading; ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.AllowReloading ? Visibility.Visible : Visibility.Collapsed; ReloadButton.Visibility = WindowSettings.ShowReloadButton ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed; Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;
UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden; UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden;
ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed; ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed;

View file

@ -343,7 +343,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed; HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed;
MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole; MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole;
ReloadButton.IsEnabled = WindowSettings.AllowReloading; ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.AllowReloading ? Visibility.Visible : Visibility.Collapsed; ReloadButton.Visibility = WindowSettings.ShowReloadButton ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed; Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;
UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden; UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden;
ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed; ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed;