Show "Select directory ..." button in web view

This commit is contained in:
Martchus 2018-10-28 17:32:31 +01:00
parent e59a80c0f6
commit ec02a9e483
1 changed files with 7 additions and 3 deletions

View File

@ -251,11 +251,15 @@ void WebPage::injectJavaScripts(bool ok)
{ {
Q_UNUSED(ok) Q_UNUSED(ok)
// show folder path selection when double-clicking input // show folder path selection when double-clicking input
injectJavaScript(QStringLiteral("jQuery('#folderPath').dblclick(function(event) {" injectJavaScript(QStringLiteral("var button = jQuery('<button type=\"button\" class=\"btn btn-sm\" "
" if (event.target && !event.target.getAttribute('readonly')) {" "style=\"float: right;\">Select directory ...</button>');"
"button.click(function(event) {"
" if (!document.getElementById('folderPath').getAttribute('readonly')) {"
" console.log('nativeInterface.showFolderPathSelection: ' + event.target.value);" " console.log('nativeInterface.showFolderPathSelection: ' + event.target.value);"
" }" " }"
"});")); "});"
"var help = jQuery('#folderPath + * + .help-block');"
"help.prepend(button);"));
} }
/*! /*!