mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
WebView: Don't cache form data when adding create search engine action
This commit is contained in:
parent
6a2579a22c
commit
d10c47a825
|
@ -880,16 +880,16 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const WebHitTestResult
|
||||||
|
|
||||||
void WebView::checkForForm(QAction *action, const QPoint &pos)
|
void WebView::checkForForm(QAction *action, const QPoint &pos)
|
||||||
{
|
{
|
||||||
m_formData.clear();
|
m_clickedPos = pos;
|
||||||
QPointer<QAction> act = action;
|
QPointer<QAction> act = action;
|
||||||
|
|
||||||
page()->runJavaScript(Scripts::getFormData(pos), [this, act](const QVariant &res) {
|
page()->runJavaScript(Scripts::getFormData(pos), [this, act](const QVariant &res) {
|
||||||
m_formData = res.toMap();
|
const QVariantMap &map = res.toMap();
|
||||||
if (!act || m_formData.isEmpty())
|
if (!act || map.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QUrl url = m_formData.value(QSL("action")).toUrl();
|
const QUrl url = map.value(QSL("action")).toUrl();
|
||||||
const QString method = m_formData.value(QSL("method")).toString();
|
const QString method = map.value(QSL("method")).toString();
|
||||||
|
|
||||||
if (!url.isEmpty() && (method == QL1S("get") || method == QL1S("post"))) {
|
if (!url.isEmpty() && (method == QL1S("get") || method == QL1S("post"))) {
|
||||||
act->setVisible(true);
|
act->setVisible(true);
|
||||||
|
@ -902,7 +902,9 @@ void WebView::checkForForm(QAction *action, const QPoint &pos)
|
||||||
|
|
||||||
void WebView::createSearchEngine()
|
void WebView::createSearchEngine()
|
||||||
{
|
{
|
||||||
mApp->searchEnginesManager()->addEngineFromForm(m_formData, this);
|
page()->runJavaScript(Scripts::getFormData(m_clickedPos), [this](const QVariant &res) {
|
||||||
|
mApp->searchEnginesManager()->addEngineFromForm(res.toMap(), this);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
#if QTWEBENGINE_DISABLED
|
||||||
|
|
|
@ -177,13 +177,13 @@ private:
|
||||||
int m_progress;
|
int m_progress;
|
||||||
|
|
||||||
QUrl m_clickedUrl;
|
QUrl m_clickedUrl;
|
||||||
|
QPoint m_clickedPos;
|
||||||
|
|
||||||
WebPage* m_page;
|
WebPage* m_page;
|
||||||
bool m_actionsInitialized;
|
bool m_actionsInitialized;
|
||||||
bool m_firstLoad;
|
bool m_firstLoad;
|
||||||
|
|
||||||
QObject *m_rwhvqt;
|
QObject *m_rwhvqt;
|
||||||
QVariantMap m_formData;
|
|
||||||
|
|
||||||
static bool s_forceContextMenuOnMouseRelease;
|
static bool s_forceContextMenuOnMouseRelease;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user