]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Port away from deprecated ThumbCreator API
authorAhmad Samir <a.samirh78@gmail.com>
Thu, 5 May 2022 20:07:03 +0000 (22:07 +0200)
committerAhmad Samir <a.samirh78@gmail.com>
Tue, 31 May 2022 14:25:13 +0000 (14:25 +0000)
Configurability of individual preview plugins has been deprecated since KIO
5.87.

src/settings/general/configurepreviewplugindialog.cpp
src/settings/general/configurepreviewplugindialog.h
src/settings/general/previewssettingspage.cpp
src/settings/general/previewssettingspage.h

index b60ba5a0cfb4706cd294ecd6253b3dfd4673210d..5aa3f9d39f33c04bb1354077b96e082de8bfd77c 100644 (file)
@@ -6,6 +6,8 @@
 
 #include "configurepreviewplugindialog.h"
 
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+
 #include <KIO/DeleteJob>
 #include <KIO/JobUiDelegate>
 #include <KIO/ThumbCreator>
@@ -67,3 +69,5 @@ ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& plugin
     okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
     okButton->setDefault(true);
 }
+
+#endif // KIO_VERSION
index d6a28f53f022cbd0782400387d05f1cfc3e2b5d1..967780c37b9af5529ea104ca352b650cd4e26539 100644 (file)
@@ -7,6 +7,11 @@
 #ifndef CONFIGUREPREVIEWPLUGINDIALOG_H
 #define CONFIGUREPREVIEWPLUGINDIALOG_H
 
+#include <QtGlobal>
+#include <kiowidgets_export.h>
+
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+
 #include <QDialog>
 
 /**
@@ -29,5 +34,6 @@ public:
                                  QWidget* parent);
     ~ConfigurePreviewPluginDialog() override = default;
 };
+#endif // KIOWIDGETS_BUILD_DEPRECATED_SINCE
 
 #endif
index f12338aef0f2afa4712cec402cb1547cc65f3e3f..4c36288eb5d71af9d0cd04a5fa904bbac7e5f4a6 100644 (file)
@@ -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);
index 1e61aa24dc1e54fb3a24c6bbd6c1484e04a429bb..4dee27adad5fb6b0b866b93b008c2cfdeed48af0 100644 (file)
@@ -7,6 +7,9 @@
 #ifndef PREVIEWSSETTINGSPAGE_H
 #define PREVIEWSSETTINGSPAGE_H
 
+
+#include <kiowidgets_export.h>
+
 #include "settings/settingspagebase.h"
 
 class QSpinBox;
@@ -38,7 +41,9 @@ protected:
     void showEvent(QShowEvent* event) override;
 
 private Q_SLOTS:
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
     void configureService(const QModelIndex& index);
+#endif
 
 private:
     void loadPreviewPlugins();