From ec02a9e4834027fe71a0ca7e3dc6c6ce921acb7e Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 28 Oct 2018 17:32:31 +0100 Subject: [PATCH] Show "Select directory ..." button in web view --- widgets/webview/webpage.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/widgets/webview/webpage.cpp b/widgets/webview/webpage.cpp index a6c20eb..1c5229c 100644 --- a/widgets/webview/webpage.cpp +++ b/widgets/webview/webpage.cpp @@ -251,11 +251,15 @@ void WebPage::injectJavaScripts(bool ok) { Q_UNUSED(ok) // show folder path selection when double-clicking input - injectJavaScript(QStringLiteral("jQuery('#folderPath').dblclick(function(event) {" - " if (event.target && !event.target.getAttribute('readonly')) {" + injectJavaScript(QStringLiteral("var button = jQuery('');" + "button.click(function(event) {" + " if (!document.getElementById('folderPath').getAttribute('readonly')) {" " console.log('nativeInterface.showFolderPathSelection: ' + event.target.value);" " }" - "});")); + "});" + "var help = jQuery('#folderPath + * + .help-block');" + "help.prepend(button);")); } /*!