Commit 5cfc52d0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Try to get accesskey

parent d156ab44
......@@ -142,7 +142,8 @@ QString MailWebEngineAccessKeyPrivate::script() const
" var r = matches[i].getBoundingClientRect();"
" out.push({"
" src: matches[i].href,"
" boudingRect: [r.top, r.left, r.width, r.height]"
" boudingRect: [r.top, r.left, r.width, r.height],"
" accessKey: matches[i].getAttribute('accesskey')"
" });"
"}"
"return out;})()");
......@@ -265,8 +266,8 @@ bool MailWebEngineAccessKey::checkForAccessKey(QKeyEvent *event)
}
QChar key = text.at(0).toUpper();
bool handled = false;
#if 0
if (d->mAccessKeyNodes.contains(key)) {
#if 0
QWebElement element = d->mAccessKeyNodes[key];
QPoint p = element.geometry().center();
QWebFrame *frame = element.webFrame();
......@@ -280,8 +281,8 @@ bool MailWebEngineAccessKey::checkForAccessKey(QKeyEvent *event)
QMouseEvent revent(QEvent::MouseButtonRelease, p, Qt::LeftButton, 0, 0);
QCoreApplication::sendEvent(this, &revent);
handled = true;
}
#endif
}
return handled;
}
......
......@@ -37,6 +37,23 @@ void MailWebEngineAccessKeyAnchor::initialize(const QVariant &result)
if (rect.size() == 4) {
mBoundingRect = QRect(rect.at(0).toInt(), rect.at(1).toInt(), rect.at(2).toInt(), rect.at(3).toInt());
}
mHref = map.value(QStringLiteral("href")).toString();
mAccessKey = map.value(QStringLiteral("accesskey")).toString();
//TODO
}
}
QString MailWebEngineAccessKeyAnchor::href() const
{
return mHref;
}
QString MailWebEngineAccessKeyAnchor::accessKey() const
{
return mAccessKey;
}
QRect MailWebEngineAccessKeyAnchor::boundingRect() const
{
return mBoundingRect;
}
......@@ -30,9 +30,15 @@ public:
MailWebEngineAccessKeyAnchor();
QRect boundingRect() const;
QString accessKey() const;
QString href() const;
private:
void initialize(const QVariant &result);
QRect mBoundingRect;
QString mAccessKey;
QString mHref;
};
}
#endif // MAILWEBENGINEACCESSKEYANCHOR_H
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