Hi, I would like to propose allowing plasmoids to enable plugins (ie. Flash) in the WebView widget. I can tell that I personally expected the current Web Browser to be able to play flash videos when I tried it...
Anyway, I'm not sure if it is currently possible in C++ (does not seem so), but the scripting API does not have access to WebView settings so I added the following functions to Plasma::WebView - bool pluginsEnabled() - void setPluginsEnabled(bool) [Attached is a .diff to apply in trunk/KDE/kdelibs/plasma/widgets] It works fine for me I could see youtube videos in a test javascript plasmoid: var layout = new LinearLayout(); var web = new WebView(); web.pluginsEnabled = true; // Yay! web.url('http://www.youtube.com'); layout.addItems(web); There was a few issues with video position in the page which would have to be found & fixed but are obviously unrelated to this patch, which only enables the plugin. (BTW Could those be the same issues that the VideoWidget have?) Those issues could also only be local, as flash is already unstable on my development VBox image... [that is, more than its usual instability] I was wondering if this was appropriate or if it opens the gates to too many such helper functions, as there are other settings that might be interesting to have access to: http://doc.trolltech.com/4.6/qwebsettings.html I guess the alternative could be to allow access the the QWebView::settings() object. So I would like to open the discussion on this feature, I know a few participants in the javascript jam would love to have this ;) Mathieu
Index: webview.h =================================================================== --- webview.h (revision 1096015) +++ webview.h (working copy) @@ -54,6 +54,7 @@ Q_PROPERTY(QSizeF contentsSize READ contentsSize) Q_PROPERTY(QRectF viewportGeometry READ viewportGeometry) Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) + Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) public: explicit WebView(QGraphicsItem *parent = 0); @@ -138,6 +139,20 @@ void setZoomFactor(const qreal zoom); /** + * The enabled state of the plugins + * + * @param page the page to set in this view + */ + Q_INVOKABLE bool pluginsEnabled(); + + /** + * Enables or disables plugins + * + * @param page the page to set in this view + */ + Q_INVOKABLE bool setPluginsEnabled(bool enabled); + + /** * Sets the page to use in this item. The owner of the webpage remains, * however if this WebView object is the owner of the current page, * then the current page is deleted Index: webview.cpp =================================================================== --- webview.cpp (revision 1096015) +++ webview.cpp (working copy) @@ -152,6 +152,16 @@ d->webView->setZoomFactor(zoom); } +bool WebView::pluginsEnabled() +{ + return d->webView->settings()->testAttribute(QWebSettings::PluginsEnabled); +} + +void WebView::setPluginsEnabled(bool enabled) +{ + d->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, enabled); +} + void WebView::setPage(QWebPage *page) { d->webView->setPage(page);
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel