[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [rekonq] src: Get sure rekonq makes use of djvu plugin
From:       Andrea Diamantini <adjam7 () gmail ! com>
Date:       2012-08-14 15:15:58
Message-ID: 20120814151558.109BFA6094 () git ! kde ! org
[Download RAW message or body]

Git commit 3b7a1ffae0ae9e5fd0c1dd238434e0bf312fa6ad by Andrea Diamantini.
Committed on 14/08/2012 at 10:57.
Pushed by adjam into branch 'master'.

Get sure rekonq makes use of djvu plugin

Also, clean up mimetype detection, following kdewebkit.

I tried implementing this using the protected excludeMimeType in
kwebpluginfactory, but I fear it has to be declared virtual to let
the trick work. Isn't it?
BUG: 304562
CCMAIL: adawit@kde.org

M  +13   -1    src/webpluginfactory.cpp
M  +1    -1    src/webpluginfactory.h

http://commits.kde.org/rekonq/3b7a1ffae0ae9e5fd0c1dd238434e0bf312fa6ad

diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
index b62af1c..083ea74 100644
--- a/src/webpluginfactory.cpp
+++ b/src/webpluginfactory.cpp
@@ -50,13 +50,25 @@ void WebPluginFactory::setLoadClickToFlash(bool load)
 }
 
 
-QObject *WebPluginFactory::create(const QString &mimeType,
+QObject *WebPluginFactory::create(const QString &_mimeType,
                                   const QUrl &url,
                                   const QStringList &argumentNames,
                                   const QStringList &argumentValues) const
 {
+    QString mimeType(_mimeType.trimmed());
+    // If no mimetype is provided, follow kwebpluginfactory road to determine/guess it
+    if (mimeType.isEmpty())
+    {
+        extractGuessedMimeType(url, &mimeType);
+    }
+
     kDebug() << "loading mimeType: " << mimeType;
 
+    // we'd like to use djvu plugin if possible. If not available, rekonq protocol handler
+    // will provide a part to load it. See BUG:304562 about
+    if (mimeType == QL1S("image/vnd.djvu") || mimeType == QL1S("image/x.djvu"))
+        return 0;
+
     switch (ReKonfig::pluginsEnabled())
     {
     case 0:
diff --git a/src/webpluginfactory.h b/src/webpluginfactory.h
index b1bcd96..82bf02c 100644
--- a/src/webpluginfactory.h
+++ b/src/webpluginfactory.h
@@ -43,7 +43,7 @@ class REKONQ_TESTS_EXPORT WebPluginFactory : public KWebPluginFactory
 public:
     WebPluginFactory(QObject *parent);
 
-    virtual QObject *create(const QString &mimeType,
+    virtual QObject *create(const QString &_mimeType,
                             const QUrl &url,
                             const QStringList &argumentNames,
                             const QStringList &argumentValues) const;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic