1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

WebView: Check for m_clickedUrl.isEmpty() in mouseReleaseEvent

This commit is contained in:
David Rosca 2015-10-02 15:50:29 +02:00
parent 4d5808d915
commit 7f101700ca

View File

@ -993,10 +993,9 @@ void WebView::_mousePressEvent(QMouseEvent *event)
event->accept(); event->accept();
break; break;
case Qt::LeftButton: { case Qt::LeftButton:
m_clickedUrl = page()->hitTestContent(event->pos()).linkUrl(); m_clickedUrl = page()->hitTestContent(event->pos()).linkUrl();
break; break;
}
default: default:
break; break;
@ -1011,16 +1010,18 @@ void WebView::_mouseReleaseEvent(QMouseEvent *event)
} }
switch (event->button()) { switch (event->button()) {
case Qt::MiddleButton: { case Qt::MiddleButton:
if (!m_clickedUrl.isEmpty()) {
const QUrl link = page()->hitTestContent(event->pos()).linkUrl(); const QUrl link = page()->hitTestContent(event->pos()).linkUrl();
if (m_clickedUrl == link && isUrlValid(link)) { if (m_clickedUrl == link && isUrlValid(link)) {
userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier); userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier);
event->accept(); event->accept();
} }
break;
} }
break;
case Qt::LeftButton: { case Qt::LeftButton:
if (!m_clickedUrl.isEmpty()) {
const QUrl link = page()->hitTestContent(event->pos()).linkUrl(); const QUrl link = page()->hitTestContent(event->pos()).linkUrl();
if (m_clickedUrl == link && isUrlValid(link)) { if (m_clickedUrl == link && isUrlValid(link)) {
if (event->modifiers() & Qt::ControlModifier) { if (event->modifiers() & Qt::ControlModifier) {
@ -1032,8 +1033,8 @@ void WebView::_mouseReleaseEvent(QMouseEvent *event)
event->accept(); event->accept();
} }
} }
break;
} }
break;
case Qt::RightButton: case Qt::RightButton:
if (s_forceContextMenuOnMouseRelease) { if (s_forceContextMenuOnMouseRelease) {