#include <KConfig>
#include <KConfigGroup>
-#include <KDebug>
#include <KFileItem>
-#include <KGlobal>
#include <KIconLoader>
#include <KJobWidgets>
#include <KIO/JobUiDelegate>
#ifdef HAVE_BALOO
#include "private/kbaloorolesprovider.h"
#include <Baloo/File>
- #include <Baloo/FileFetchJob>
#include <Baloo/FileMonitor>
#endif
{
Q_ASSERT(model);
- const KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
+ const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList()
<< "directorythumbnail"
<< "imagethumbnail"
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;
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());
m_model->setData(index, data);
connect(m_model, &KFileItemModel::itemsChanged,
this, &KFileItemModelRolesUpdater::slotItemsChanged);
+#else
+#ifndef Q_CC_MSVC
+ Q_UNUSED(itemUrl);
+#endif
#endif
}
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;