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

List:       kde-commits
Subject:    [kio-extras] thumbnail: [Thumbnailer] Use enabled plugins passed in as metadata
From:       Kai Uwe Broulik <null () kde ! org>
Date:       2018-09-18 8:41:51
Message-ID: E1g2BZv-000652-CL () code ! kde ! org
[Download RAW message or body]

Git commit ed68ea157d59f105a50888642f98241e639a9fdc by Kai Uwe Broulik.
Committed on 18/09/2018 at 08:40.
Pushed by broulik into branch 'master'.

[Thumbnailer] Use enabled plugins passed in as metadata

The thumbnailer lives in a separate application, so it will read the enabled plugins \
from a different configuration than the calling application (e.g. dolphinrc).
This leads to folder thumbnails following the default settings instead of \
user-configured settings, causing disabled plugins to be used and blacklisted \
thumbnails never being used even if enabled by the user.

BUG: 388303

Differential Revision: https://phabricator.kde.org/D15097

M  +9    -5    thumbnail/thumbnail.cpp

https://commits.kde.org/kio-extras/ed68ea157d59f105a50888642f98241e639a9fdc

diff --git a/thumbnail/thumbnail.cpp b/thumbnail/thumbnail.cpp
index d92d71e9..e57bdb28 100644
--- a/thumbnail/thumbnail.cpp
+++ b/thumbnail/thumbnail.cpp
@@ -86,6 +86,10 @@
 // plugin       - the name of the plugin library to be used for thumbnail creation.
 //                Provided by the application to save an addition KTrader
 //                query here.
+// enabledPlugins - a list of enabled thumbnailer plugins. PreviewJob does not call
+//                  this thumbnail slave when a given plugin isn't enabled. However,
+//                  for directory thumbnails it doesn't know that the thumbnailer
+//                  internally also loads the plugins.
 // shmid        - the shared memory segment id to write the image's data to.
 //                The segment is assumed to provide enough space for a 32-bit
 //                image sized width x height pixels.
@@ -153,6 +157,11 @@ ThumbnailProtocol::~ThumbnailProtocol()
 void ThumbnailProtocol::get(const QUrl &url)
 {
     m_mimeType = metaData("mimeType");
+    m_enabledPlugins = metaData("enabledPlugins").split(QLatin1Char(','), \
QString::SkipEmptyParts); +    if (m_enabledPlugins.isEmpty()) {
+        const KConfigGroup globalConfig(KSharedConfig::openConfig(), \
"PreviewSettings"); +        m_enabledPlugins = globalConfig.readEntry("Plugins", \
KIO::PreviewJob::defaultPlugins()); +    }
     //qDebug() << "Wanting MIME Type:" << m_mimeType;
 #ifdef THUMBNAIL_HACK
     // ### HACK
@@ -671,11 +680,6 @@ const QImage ThumbnailProtocol::getIcon()
 bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& \
                filePath,
                                            int segmentWidth, int segmentHeight)
 {
-    if (m_enabledPlugins.isEmpty()) {
-        const KConfigGroup globalConfig(KSharedConfig::openConfig(), \
                "PreviewSettings");
-        m_enabledPlugins = globalConfig.readEntry("Plugins", \
                KIO::PreviewJob::defaultPlugins());
-    }
-
     const QMimeDatabase db;
     const QUrl fileUrl = QUrl::fromLocalFile(filePath);
     const QString subPlugin = pluginForMimeType(db.mimeTypeForUrl(fileUrl).name());


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

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