1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

Browser: Store default config values in a single place

Note that this fixes contradictory default values for group
"Preferences", key "Home". This is exactly the kind of errors I want to
prevent with this new style.

The hope is that this can later be used to:
- verify that all accesses to the same key use the same default value,
- and extract the default values more easily.
This commit is contained in:
Ben Wiederhake 2023-06-01 14:21:06 +02:00 committed by Jelle Raaijmakers
parent 9ee098b119
commit 2420effa7d
8 changed files with 55 additions and 37 deletions

View file

@ -9,6 +9,7 @@
#include <AK/LexicalPath.h>
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
#include <Applications/BrowserSettings/Defaults.h>
#include <LibCore/Proxy.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
@ -37,7 +38,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_destination_path = builder.to_deprecated_string();
}
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, false);
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, Browser::default_close_download_widget_on_finish);
m_elapsed_timer.start();
m_download = Web::ResourceLoader::the().connector().start_request("GET", url);