From fcda48e14aee987394e1dbfcd68687ef80f6d2ca Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 18 Jun 2018 12:07:34 +0200 Subject: AddressBar: code cleanup AddressBar: match input for protocol or '.' in addition to url validity --- lib/addressbar/urllineedit.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/addressbar/urllineedit.cpp') diff --git a/lib/addressbar/urllineedit.cpp b/lib/addressbar/urllineedit.cpp index 33bc9dc..29a14cd 100644 --- a/lib/addressbar/urllineedit.cpp +++ b/lib/addressbar/urllineedit.cpp @@ -24,7 +24,7 @@ UrlLineEdit::UrlLineEdit(QWidget *parent) m_listView->setVisible(false); connect(m_listView, &Completer::completionActivated, this, &UrlLineEdit::setText); - auto *addressbar = qobject_cast(parent); + addressbar = qobject_cast(parent); Q_CHECK_PTR(addressbar); auto *copyAction = new QAction(tr("Copy URL"), this); @@ -41,9 +41,8 @@ UrlLineEdit::UrlLineEdit(QWidget *parent) actions.append(pasteAction); auto *loadAction = new QAction(tr("Paste and load"), this); - connect(loadAction, &QAction::triggered, this, [this]() { - this->setText(qApp->clipboard()->text()); - emit returnPressed(); + connect(loadAction, &QAction::triggered, this, [=]() { + emit addressbar->load(QUrl::fromUserInput(qApp->clipboard()->text())); }); actions.append(loadAction); @@ -115,7 +114,7 @@ void UrlLineEdit::focusOutEvent(QFocusEvent *event) if(url.isValid()) setUrl(url); - emit focusView(); + emit addressbar->giveFocus(); QLineEdit::focusOutEvent(event); } -- cgit v1.2.1