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) ...@@ -62,6 +62,7 @@ MailWebView::MailWebView(KActionCollection *actionCollection, QWidget *parent)
connect(this, &QWebView::loadStarted, mWebViewAccessKey, &WebViewAccessKey::hideAccessKeys); connect(this, &QWebView::loadStarted, mWebViewAccessKey, &WebViewAccessKey::hideAccessKeys);
connect(mScamDetection, &ScamDetection::messageMayBeAScam, this, &MailWebView::messageMayBeAScam); connect(mScamDetection, &ScamDetection::messageMayBeAScam, this, &MailWebView::messageMayBeAScam);
connect(page(), &QWebPage::scrollRequested, mWebViewAccessKey, &WebViewAccessKey::hideAccessKeys); connect(page(), &QWebPage::scrollRequested, mWebViewAccessKey, &WebViewAccessKey::hideAccessKeys);
connect(mWebViewAccessKey, &WebViewAccessKey::openUrl, this, &MailWebView::linkClicked);
} }
MailWebView::~MailWebView() MailWebView::~MailWebView()
......
...@@ -205,17 +205,14 @@ bool WebViewAccessKey::checkForAccessKey(QKeyEvent *event) ...@@ -205,17 +205,14 @@ bool WebViewAccessKey::checkForAccessKey(QKeyEvent *event)
if (d->mAccessKeyNodes.contains(key)) { if (d->mAccessKeyNodes.contains(key)) {
QWebElement element = d->mAccessKeyNodes[key]; QWebElement element = d->mAccessKeyNodes[key];
QPoint p = element.geometry().center(); QPoint p = element.geometry().center();
QWebFrame *frame = element.webFrame();
Q_ASSERT(frame); if (element.tagName().compare(QLatin1String("A"), Qt::CaseInsensitive) == 0) {
do { const QString linkKey(linkElementKey(element));
p -= frame->scrollPosition(); if (!linkKey.isEmpty()) {
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; handled = true;
Q_EMIT openUrl(QUrl(linkKey));
}
}
} }
return handled; return handled;
} }
......
...@@ -49,6 +49,9 @@ public: ...@@ -49,6 +49,9 @@ public:
public Q_SLOTS: public Q_SLOTS:
void hideAccessKeys(); void hideAccessKeys();
Q_SIGNALS:
void openUrl(const QUrl &url);
private: private:
WebViewAccessKeyPrivate *const d; 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