From 5b14fc424462a5d3a5a509bd177c04e9cba2ce17 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Wed, 17 Jun 2020 01:29:30 +0200 Subject: Makes gemini protocol handler a bit more robust.Makes style preview a file in about: instead of hardcoding it. Starts to implement the options menu for redirection configuration. --- src/browsertab.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/browsertab.cpp') diff --git a/src/browsertab.cpp b/src/browsertab.cpp index 4e5f25c..09bb56c 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -59,6 +59,8 @@ BrowserTab::BrowserTab(MainWindow *mainWindow) : QWidget(nullptr), this->ui->text_browser->setVisible(true); this->ui->text_browser->setContextMenuPolicy(Qt::CustomContextMenu); + + connect(this->ui->url_bar, &SearchBar::escapePressed, this, &BrowserTab::on_url_bar_escapePressed); } BrowserTab::~BrowserTab() @@ -156,7 +158,7 @@ void BrowserTab::focusUrlBar() void BrowserTab::on_url_bar_returnPressed() { - QUrl url{this->ui->url_bar->text()}; + QUrl url { this->ui->url_bar->text().trimmed() }; if (url.scheme().isEmpty()) { @@ -166,6 +168,11 @@ void BrowserTab::on_url_bar_returnPressed() this->navigateTo(url, PushImmediate); } +void BrowserTab::on_url_bar_escapePressed() +{ + this->ui->url_bar->setText(this->current_location.toString(QUrl::FullyEncoded)); +} + void BrowserTab::on_refresh_button_clicked() { reloadPage(); @@ -443,8 +450,6 @@ void BrowserTab::on_redirected(const QUrl &uri, bool is_permanent) } } - // TODO: Implement cross-protocol redirections - // TODO: Implement cross-host redirection if (this->startRequest(uri)) { redirection_count += 1; -- cgit v1.2.3