MCPcopy Create free account
hub / github.com/Martchus/syncthingtray / injectJavaScripts

Method injectJavaScripts

syncthingwidgets/webview/webpage.cpp:464–480  ·  view source on GitHub ↗

! * \brief Injects the JavaScript code required for additional features. * \remarks Called when the page has been loaded. */

Source from the content-addressed store, hash-verified

462 * \remarks Called when the page has been loaded.
463 */
464void WebPage::injectJavaScripts(bool ok)
465{
466 Q_UNUSED(ok)
467 // show folder path selection when double-clicking input
468 if (!Settings::values().enableWipFeatures) {
469 return;
470 }
471 injectJavaScript(QStringLiteral("var button = jQuery('<button type=\"button\" class=\"btn btn-sm\" "
472 "style=\"float: right;\">Select directory …</button>');"
473 "button.click(function(event) {"
474 " if (!document.getElementById('folderPath').getAttribute('readonly')) {"
475 " console.log('nativeInterface.showFolderPathSelection: ' + event.target.value);"
476 " }"
477 "});"
478 "var help = jQuery('#folderPath + * + .help-block');"
479 "help.prepend(button);"));
480}
481
482/*!
483 * \brief Invokes native methods requested via JavaScript log.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected