diff options
author | matgic78 <matgic78@gmail.com> | 2009-11-22 14:53:33 +0100 |
---|---|---|
committer | matgic78 <matgic78@gmail.com> | 2009-11-27 16:11:57 +0100 |
commit | 19d7611101253c27a841480fca55f1bc5cd767b6 (patch) | |
tree | 0ae960f684382824291b474afa3e2c0bfb8d55ee /src/clicktoflash.cpp | |
parent | ClickToFlash : first step (diff) | |
download | rekonq-19d7611101253c27a841480fca55f1bc5cd767b6.tar.xz |
clicktoflash : step 2 make it work when there are more than one plugin in the same page
Diffstat (limited to 'src/clicktoflash.cpp')
-rw-r--r-- | src/clicktoflash.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/clicktoflash.cpp b/src/clicktoflash.cpp index d89c1ec5..39d55e5a 100644 --- a/src/clicktoflash.cpp +++ b/src/clicktoflash.cpp @@ -39,9 +39,9 @@ #include <KDebug> -ClickToFlash::ClickToFlash(const WebPluginFactory *factory, QWidget *parent) +ClickToFlash::ClickToFlash(const WebPluginFactory *factory, QUrl pluginUrl, QWidget *parent) : QWidget(parent) - , m_factory(factory) + , m_url(pluginUrl) { kDebug() << "creating clicktoflash"; @@ -96,6 +96,7 @@ void ClickToFlash::loadAll() */ void ClickToFlash::load(bool loadAll) { + kDebug() << "called"; QWidget *parent = parentWidget(); QWebView *view = 0; while (parent) @@ -126,17 +127,37 @@ void ClickToFlash::load(bool loadAll) elements.append(docElement.findAll(selector.arg(QLatin1String("embed")))); QWebElement element; + kDebug() << m_url; + bool isRightElement = false; foreach (element, elements) { - QWebElement substitute = element.clone(); - emit signalLoadClickToFlash(true); - element.replace(substitute); + // TODO : find a proper solution to compare a QWebElement with a plugin + if(QUrl(element.attribute("data")) == m_url + || QUrl(element.attribute("src")) == m_url) + isRightElement = true; + + QWebElementCollection collec = element.findAll("param"); + int i = 0; + while(i < collec.count() && isRightElement == false) + { + if(QUrl(collec.at(i).attribute("value")) == m_url) + isRightElement = true; + i++; + } + + if(isRightElement) + { + QWebElement substitute = element.clone(); + emit signalLoadClickToFlash(true); + element.replace(substitute); + return; + } } frames += frame->childFrames(); } - deleteLater(); + //deleteLater(); } |