diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-03-04 13:59:25 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-03-04 13:59:25 +0100 |
commit | e26472693aac7fe5ef277889fd0136dd66159e94 (patch) | |
tree | 6873400c4679fd99823461f00f719b62db0f084f /src/webpluginfactory.cpp | |
parent | Fix merge (diff) | |
download | rekonq-e26472693aac7fe5ef277889fd0136dd66159e94.tar.xz |
WebPluginFactory. Cleaning code..
Diffstat (limited to 'src/webpluginfactory.cpp')
-rw-r--r-- | src/webpluginfactory.cpp | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp index 6265aeb3..c8060969 100644 --- a/src/webpluginfactory.cpp +++ b/src/webpluginfactory.cpp @@ -41,8 +41,8 @@ WebPluginFactory::WebPluginFactory(QObject *parent) : KWebPluginFactory(parent) + , _loadClickToFlash(false) { - loadClickToFlash = false; connect(this, SIGNAL(signalLoadClickToFlash(bool)), SLOT(setLoadClickToFlash(bool))); } @@ -55,7 +55,7 @@ WebPluginFactory::~WebPluginFactory() void WebPluginFactory::setLoadClickToFlash(bool load) { - loadClickToFlash = load; + _loadClickToFlash = load; } @@ -65,39 +65,37 @@ QObject *WebPluginFactory::create(const QString &mimeType, const QStringList &argumentValues) const { kDebug() << "loading mimeType: " << mimeType; - - if(ReKonfig::pluginsEnabled() == 0) // plugins are enabled + + switch( ReKonfig::pluginsEnabled() ) { + case 0: kDebug() << "No plugins found for" << mimeType << ". Falling back to QtWebKit ones..."; + return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues); + + case 1: + if( mimeType != QString("application/x-shockwave-flash") ) + break; + + if( _loadClickToFlash ) + { + emit signalLoadClickToFlash(false); + return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues); + } + else + { + ClickToFlash* ctf = new ClickToFlash(url); + connect(ctf, SIGNAL(signalLoadClickToFlash(bool)), this, SLOT(setLoadClickToFlash(bool))); + return ctf; + } + break; + + case 2: return 0; + + default: + kDebug() << "oh oh.. this should NEVER happen.."; + break; } - if(mimeType == QString("application/x-shockwave-flash") - && !loadClickToFlash) - { - ClickToFlash* ctf = new ClickToFlash(url); - connect(ctf, SIGNAL(signalLoadClickToFlash(bool)), this, SLOT(setLoadClickToFlash(bool))); - return ctf; - } - - // this let QtWebKit using builtin plugins - // to load in example flash contents and so on.. - kDebug() << "No plugins found for" << mimeType << ". Falling back to QtWebKit ones..."; - emit signalLoadClickToFlash(false); return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues); } - - -QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const -{ - QList<KWebPluginFactory::Plugin> plugins = KWebPluginFactory::plugins(); - - KWebPluginFactory::Plugin p; - - p.name = "application/x-shockwave-flash"; - p.description = "Plugin for flash animations"; - plugins.append(p); - - - return plugins; -} |