┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/general/previewssettingspage.cpp
diff options
context:
space:
mode:
authorAhmad Samir <[email protected]>2022-05-05 22:07:03 +0200
committerAhmad Samir <[email protected]>2022-05-31 14:25:13 +0000
commite58f0c085cbf4932b4bf83ec2b6fd6a536a8c7bb (patch)
tree18993d47aa421f94caba89c320c0ac922ce9821c /src/settings/general/previewssettingspage.cpp
parent5cbe6b530249ab5f5b1b9f57cf794a2b7faec269 (diff)
Port away from deprecated ThumbCreator API
Configurability of individual preview plugins has been deprecated since KIO 5.87.
Diffstat (limited to 'src/settings/general/previewssettingspage.cpp')
-rw-r--r--src/settings/general/previewssettingspage.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp
index f12338aef..4c36288eb 100644
--- a/src/settings/general/previewssettingspage.cpp
+++ b/src/settings/general/previewssettingspage.cpp
@@ -45,9 +45,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 +59,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 +155,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,6 +166,7 @@ void PreviewsSettingsPage::configureService(const QModelIndex& index)
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
+#endif
void PreviewsSettingsPage::loadPreviewPlugins()
{
@@ -170,15 +174,18 @@ void PreviewsSettingsPage::loadPreviewPlugins()
const QVector<KPluginMetaData> plugins = KIO::PreviewJob::availableThumbnailerPlugins();
for (const KPluginMetaData &plugin : plugins) {
- const bool configurable = plugin.value(QStringLiteral("Configurable"), false);
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, configurable, ServiceModel::ConfigurableRole);
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);
+#endif
}
model->sort(Qt::DisplayRole);