Commit 68f803ef authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Merge remote-tracking branch 'origin/Applications/16.04'

parents a74b04e5 c38b1479
......@@ -62,6 +62,7 @@ MailWebView::MailWebView(KActionCollection *actionCollection, QWidget *parent)
connect(this, &QWebView::loadStarted, mWebViewAccessKey, &WebViewAccessKey::hideAccessKeys);
connect(mScamDetection, &ScamDetection::messageMayBeAScam, this, &MailWebView::messageMayBeAScam);
connect(page(), &QWebPage::scrollRequested, mWebViewAccessKey, &WebViewAccessKey::hideAccessKeys);
connect(mWebViewAccessKey, &WebViewAccessKey::openUrl, this, &MailWebView::linkClicked);
}
MailWebView::~MailWebView()
......
......@@ -205,17 +205,14 @@ bool WebViewAccessKey::checkForAccessKey(QKeyEvent *event)
if (d->mAccessKeyNodes.contains(key)) {
QWebElement element = d->mAccessKeyNodes[key];
QPoint p = element.geometry().center();
QWebFrame *frame = element.webFrame();
Q_ASSERT(frame);
do {
p -= frame->scrollPosition();
frame = frame->parentFrame();
} while (frame && frame != d->mWebView->page()->mainFrame());
QMouseEvent pevent(QEvent::MouseButtonPress, p, Qt::LeftButton, 0, 0);
QCoreApplication::sendEvent(this, &pevent);
QMouseEvent revent(QEvent::MouseButtonRelease, p, Qt::LeftButton, 0, 0);
QCoreApplication::sendEvent(this, &revent);
handled = true;
if (element.tagName().compare(QLatin1String("A"), Qt::CaseInsensitive) == 0) {
const QString linkKey(linkElementKey(element));
if (!linkKey.isEmpty()) {
handled = true;
Q_EMIT openUrl(QUrl(linkKey));
}
}
}
return handled;
}
......
......@@ -49,6 +49,9 @@ public:
public Q_SLOTS:
void hideAccessKeys();
Q_SIGNALS:
void openUrl(const QUrl &url);
private:
WebViewAccessKeyPrivate *const d;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment