summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Iastrubni <diegoiast@gmail.com>2022-07-14 18:32:51 +0300
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-25 07:58:58 -0700
commit2905bda0f2333dd36250b2d19d822b0c328305ce (patch)
tree1e15b003fd84d475e0aec9a1e0ae5f7ca2585cf4
parent700c709c00d12a4d4d29e69586e5417a06b97b60 (diff)
downloadserenity-2905bda0f2333dd36250b2d19d822b0c328305ce.zip
Ladybird: Add a protocol to the URL, when one is not set
When a http(s):// is not written by the user - lets manually add one.
-rw-r--r--Ladybird/Tab.cpp4
-rw-r--r--Ladybird/Tab.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/Ladybird/Tab.cpp b/Ladybird/Tab.cpp
index b010bbd2d6..28e1a5eed5 100644
--- a/Ladybird/Tab.cpp
+++ b/Ladybird/Tab.cpp
@@ -73,8 +73,10 @@ Tab::Tab(QMainWindow* window)
QObject::connect(focus_location_edit_action, &QAction::triggered, m_location_edit, &QLineEdit::selectAll);
}
-void Tab::navigate(QString const& url)
+void Tab::navigate(QString url)
{
+ if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive))
+ url = "http://" + url;
view().load(url.toUtf8().data());
}
diff --git a/Ladybird/Tab.h b/Ladybird/Tab.h
index 5ef7e081c8..c9490e63fd 100644
--- a/Ladybird/Tab.h
+++ b/Ladybird/Tab.h
@@ -23,7 +23,7 @@ public:
WebView& view() { return *m_view; }
- void navigate(QString const&);
+ void navigate(QString);
void debug_request(String const& request, String const& argument);