mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
BrowserSettings+Ladybird: Convert home / new tab page to resource URIs
This commit is contained in:
parent
1b30b510b9
commit
818471b7a7
6 changed files with 33 additions and 45 deletions
|
@ -7,28 +7,10 @@
|
|||
|
||||
#include "Settings.h"
|
||||
#include "StringUtils.h"
|
||||
#include <AK/URL.h>
|
||||
#include <BrowserSettings/Defaults.h>
|
||||
#include <Ladybird/Utilities.h>
|
||||
|
||||
namespace Ladybird {
|
||||
|
||||
static QString rebase_default_url_on_serenity_resource_root(StringView default_url)
|
||||
{
|
||||
URL url { default_url };
|
||||
Vector<DeprecatedString> paths;
|
||||
|
||||
for (auto segment : s_serenity_resource_root.split('/'))
|
||||
paths.append(move(segment));
|
||||
|
||||
for (size_t i = 0; i < url.path_segment_count(); ++i)
|
||||
paths.append(url.path_segment_at_index(i));
|
||||
|
||||
url.set_paths(move(paths));
|
||||
|
||||
return qstring_from_ak_deprecated_string(url.to_deprecated_string());
|
||||
}
|
||||
|
||||
Settings::Settings()
|
||||
: m_search_engine(WebView::default_search_engine())
|
||||
{
|
||||
|
@ -100,7 +82,7 @@ void Settings::set_autocomplete_engine(EngineProvider const& engine_provider)
|
|||
|
||||
QString Settings::new_tab_page()
|
||||
{
|
||||
static auto const default_new_tab_url = rebase_default_url_on_serenity_resource_root(Browser::default_new_tab_url);
|
||||
static auto const default_new_tab_url = qstring_from_ak_string(Browser::default_new_tab_url());
|
||||
return m_qsettings->value("new_tab_page", default_new_tab_url).toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue