]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodelrolesupdater.cpp
Fix includes
[dolphin.git] / src / kitemviews / kfileitemmodelrolesupdater.cpp
index 5c212a98422f0a937c53edea02646ad5117bc39c..f17a77e0aee172fd91c6259c79a7ff8c8e126c7b 100644 (file)
@@ -23,9 +23,7 @@
 
 #include <KConfig>
 #include <KConfigGroup>
-#include <KDebug>
 #include <KFileItem>
-#include <KGlobal>
 #include <KIconLoader>
 #include <KJobWidgets>
 #include <KIO/JobUiDelegate>
@@ -45,7 +43,6 @@
 #ifdef HAVE_BALOO
     #include "private/kbaloorolesprovider.h"
     #include <Baloo/File>
-    #include <Baloo/FileFetchJob>
     #include <Baloo/FileMonitor>
 #endif
 
@@ -97,7 +94,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
 {
     Q_ASSERT(model);
 
-    const KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
+    const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
     m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList()
                                                          << "directorythumbnail"
                                                          << "imagethumbnail"
@@ -705,21 +702,8 @@ void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& itemUrl)
         return;
     }
 
-    Baloo::FileFetchJob* job = new Baloo::FileFetchJob(item.localPath());
-    connect(job, &Baloo::FileFetchJob::finished, this, &KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished);
-    job->setProperty("item", QVariant::fromValue(item));
-    job->start();
-#else
-#ifndef Q_CC_MSVC
-    Q_UNUSED(itemUrl);
-#endif
-#endif
-}
-
-void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob)
-{
-#ifdef HAVE_BALOO
-    const KFileItem item = kjob->property("item").value<KFileItem>();
+    Baloo::File file(item.localPath());
+    file.load();
 
     const KBalooRolesProvider& rolesProvider = KBalooRolesProvider::instance();
     QHash<QByteArray, QVariant> data;
@@ -731,8 +715,7 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob)
         data.insert(role, QVariant());
     }
 
-    Baloo::FileFetchJob* job = static_cast<Baloo::FileFetchJob*>(kjob);
-    QHashIterator<QByteArray, QVariant> it(rolesProvider.roleValues(job->file(), m_roles));
+    QHashIterator<QByteArray, QVariant> it(rolesProvider.roleValues(file, m_roles));
     while (it.hasNext()) {
         it.next();
         data.insert(it.key(), it.value());
@@ -744,6 +727,10 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob)
     m_model->setData(index, data);
     connect(m_model, &KFileItemModel::itemsChanged,
             this,    &KFileItemModelRolesUpdater::slotItemsChanged);
+#else
+#ifndef Q_CC_MSVC
+    Q_UNUSED(itemUrl);
+#endif
 #endif
 }
 
@@ -753,7 +740,7 @@ void KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived(const QStrin
     const bool getIsExpandableRole = m_roles.contains("isExpandable");
 
     if (getSizeRole || getIsExpandableRole) {
-        const int index = m_model->index(KUrl(path));
+        const int index = m_model->index(QUrl::fromLocalFile(path));
         if (index >= 0) {
             QHash<QByteArray, QVariant> data;