X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/caf49dafa557caa9bd985702a240284348c82b40..e19aa49a082076d5ae69931893c1d47b98f85e30:/src/settings/general/previewssettingspage.cpp diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp index 5d176f465..b30d1940a 100644 --- a/src/settings/general/previewssettingspage.cpp +++ b/src/settings/general/previewssettingspage.cpp @@ -13,12 +13,11 @@ #include #include -#include +#include #include #include #include -#include #include #include #include @@ -45,9 +44,12 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : m_listView = new QListView(this); QScroller::grabGesture(m_listView->viewport(), QScroller::TouchGesture); +#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView); connect(delegate, &ServiceItemDelegate::requestServiceConfiguration, this, &PreviewsSettingsPage::configureService); + m_listView->setItemDelegate(delegate); +#endif ServiceModel* serviceModel = new ServiceModel(this); QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this); @@ -56,7 +58,6 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); m_listView->setModel(proxyModel); - m_listView->setItemDelegate(delegate); m_listView->setVerticalScrollMode(QListView::ScrollPerPixel); m_listView->setUniformItemSizes(true); @@ -153,6 +154,7 @@ void PreviewsSettingsPage::showEvent(QShowEvent* event) SettingsPageBase::showEvent(event); } +#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) void PreviewsSettingsPage::configureService(const QModelIndex& index) { const QAbstractItemModel* model = index.model(); @@ -163,22 +165,26 @@ void PreviewsSettingsPage::configureService(const QModelIndex& index) dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); } +#endif void PreviewsSettingsPage::loadPreviewPlugins() { QAbstractItemModel* model = m_listView->model(); - const KService::List plugins = KServiceTypeTrader::self()->query(QStringLiteral("ThumbCreator")); - for (const KService::Ptr& service : plugins) { - const bool configurable = service->property(QStringLiteral("Configurable"), QVariant::Bool).toBool(); - const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName()); + const QVector plugins = KIO::PreviewJob::availableThumbnailerPlugins(); + for (const KPluginMetaData &plugin : plugins) { + const bool show = m_enabledPreviewPlugins.contains(plugin.pluginId()); model->insertRow(0); const QModelIndex index = model->index(0, 0); model->setData(index, show, Qt::CheckStateRole); + model->setData(index, plugin.name(), Qt::DisplayRole); + model->setData(index, plugin.pluginId(), ServiceModel::DesktopEntryNameRole); + +#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) + const bool configurable = plugin.value(QStringLiteral("Configurable"), false); model->setData(index, configurable, ServiceModel::ConfigurableRole); - model->setData(index, service->name(), Qt::DisplayRole); - model->setData(index, service->desktopEntryName(), ServiceModel::DesktopEntryNameRole); +#endif } model->sort(Qt::DisplayRole);