mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird: Use the same default new tab page URL as Browser
This commit is contained in:
parent
e7faca4431
commit
529546e14f
Notes:
sideshowbarker
2024-07-17 01:28:15 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/529546e14f Pull-request: https://github.com/SerenityOS/serenity/pull/19309
1 changed files with 21 additions and 1 deletions
|
@ -5,9 +5,28 @@
|
|||
*/
|
||||
|
||||
#include "Settings.h"
|
||||
#include "Utilities.h"
|
||||
#include <AK/URL.h>
|
||||
#include <Applications/BrowserSettings/Defaults.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
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_qsettings = new QSettings("Serenity", "Ladybird", this);
|
||||
|
@ -15,7 +34,8 @@ Settings::Settings()
|
|||
|
||||
QString Settings::new_tab_page()
|
||||
{
|
||||
return m_qsettings->value("new_tab_page", "about:blank").toString();
|
||||
static auto const default_new_tab_url = rebase_default_url_on_serenity_resource_root(Browser::default_new_tab_url);
|
||||
return m_qsettings->value("new_tab_page", default_new_tab_url).toString();
|
||||
}
|
||||
|
||||
void Settings::set_new_tab_page(QString const& page)
|
||||
|
|
Loading…
Reference in a new issue