From d0fd5e3869e485b47757cc999b428a443d6aff5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Mon, 6 Feb 2023 21:44:09 +0000 Subject: [PATCH] Remove deprecated ConfigurePreviewPluginDialog --- src/CMakeLists.txt | 4 -- .../general/configurepreviewplugindialog.cpp | 71 ------------------- .../general/configurepreviewplugindialog.h | 36 ---------- src/settings/general/previewssettingspage.cpp | 25 ------- src/settings/general/previewssettingspage.h | 3 - 5 files changed, 139 deletions(-) delete mode 100644 src/settings/general/configurepreviewplugindialog.cpp delete mode 100644 src/settings/general/configurepreviewplugindialog.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d9e40dc5f..ca0fbe8f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -288,7 +288,6 @@ target_sources(dolphinstatic PRIVATE selectionmode/bottombarcontentscontainer.cpp selectionmode/topbar.cpp settings/general/behaviorsettingspage.cpp - settings/general/configurepreviewplugindialog.cpp settings/general/confirmationssettingspage.cpp settings/general/generalsettingspage.cpp settings/general/previewssettingspage.cpp @@ -347,7 +346,6 @@ target_sources(dolphinstatic PRIVATE selectionmode/bottombarcontentscontainer.h selectionmode/topbar.h settings/general/behaviorsettingspage.h - settings/general/configurepreviewplugindialog.h settings/general/confirmationssettingspage.h settings/general/generalsettingspage.h settings/general/previewssettingspage.h @@ -524,7 +522,6 @@ if(NOT WIN32) settings/kcm/kcmdolphingeneral.cpp settings/general/behaviorsettingspage.cpp settings/general/previewssettingspage.cpp - settings/general/configurepreviewplugindialog.cpp settings/general/confirmationssettingspage.cpp settings/settingspagebase.cpp settings/serviceitemdelegate.cpp @@ -532,7 +529,6 @@ if(NOT WIN32) settings/kcm/kcmdolphingeneral.h settings/general/behaviorsettingspage.h settings/general/previewssettingspage.h - settings/general/configurepreviewplugindialog.h settings/general/confirmationssettingspage.h settings/settingspagebase.h settings/serviceitemdelegate.h diff --git a/src/settings/general/configurepreviewplugindialog.cpp b/src/settings/general/configurepreviewplugindialog.cpp deleted file mode 100644 index a391812df..000000000 --- a/src/settings/general/configurepreviewplugindialog.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2011 Peter Penz - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#include "configurepreviewplugindialog.h" - -#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString &pluginName, const QString &desktopEntryName, QWidget *parent) - : QDialog(parent) -{ - QSharedPointer previewPlugin; - const QString pluginPath = QPluginLoader(desktopEntryName).fileName(); - if (!pluginPath.isEmpty()) { - newCreator create = (newCreator)QLibrary::resolve(pluginPath, "new_creator"); - if (create) { - previewPlugin.reset(dynamic_cast(create())); - } - } - - setWindowTitle(i18nc("@title:window", "Configure Preview for %1", pluginName)); - setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); - setMinimumWidth(400); - - auto layout = new QVBoxLayout(this); - - if (previewPlugin) { - auto configurationWidget = previewPlugin->createConfigurationWidget(); - configurationWidget->setParent(this); - layout->addWidget(configurationWidget); - - layout->addStretch(); - - connect(this, &ConfigurePreviewPluginDialog::accepted, this, [=] { - // TODO: It would be great having a mechanism to tell PreviewJob that only previews - // for a specific MIME-type should be regenerated. As this is not available yet we - // delete the whole thumbnails directory. - previewPlugin->writeConfiguration(configurationWidget); - - // https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html#DIRECTORY - const QString thumbnailsPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/thumbnails/"); - KIO::del(QUrl::fromLocalFile(thumbnailsPath), KIO::HideProgressInfo); - }); - } - - auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfigurePreviewPluginDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigurePreviewPluginDialog::reject); - layout->addWidget(buttonBox); - - auto okButton = buttonBox->button(QDialogButtonBox::Ok); - okButton->setShortcut(Qt::CTRL | Qt::Key_Return); - okButton->setDefault(true); -} - -#endif // KIO_VERSION diff --git a/src/settings/general/configurepreviewplugindialog.h b/src/settings/general/configurepreviewplugindialog.h deleted file mode 100644 index 66504cce2..000000000 --- a/src/settings/general/configurepreviewplugindialog.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2011 Peter Penz - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef CONFIGUREPREVIEWPLUGINDIALOG_H -#define CONFIGUREPREVIEWPLUGINDIALOG_H - -#include - -#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) - -#include - -/** - * @brief Dialog for configuring preview-plugins. - */ -class ConfigurePreviewPluginDialog : public QDialog -{ - Q_OBJECT - -public: - /** - * @param pluginName User visible name of the plugin - * @param desktopEntryName The name of the plugin that is noted in the desktopentry. - * Is used to instantiate the plugin to get the configuration - * widget. - * @param parent Parent widget. - */ - ConfigurePreviewPluginDialog(const QString &pluginName, const QString &desktopEntryName, QWidget *parent); - ~ConfigurePreviewPluginDialog() override = default; -}; -#endif // KIOWIDGETS_BUILD_DEPRECATED_SINCE - -#endif diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp index 358798f58..fa715237a 100644 --- a/src/settings/general/previewssettingspage.cpp +++ b/src/settings/general/previewssettingspage.cpp @@ -6,7 +6,6 @@ #include "previewssettingspage.h" -#include "configurepreviewplugindialog.h" #include "dolphin_generalsettings.h" #include "settings/serviceitemdelegate.h" #include "settings/servicemodel.h" @@ -45,12 +44,6 @@ 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); proxyModel->setSourceModel(serviceModel); @@ -150,19 +143,6 @@ 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(); - const QString pluginName = model->data(index).toString(); - const QString desktopEntryName = model->data(index, ServiceModel::DesktopEntryNameRole).toString(); - - ConfigurePreviewPluginDialog *dialog = new ConfigurePreviewPluginDialog(pluginName, desktopEntryName, this); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->show(); -} -#endif - void PreviewsSettingsPage::loadPreviewPlugins() { QAbstractItemModel *model = m_listView->model(); @@ -176,11 +156,6 @@ void PreviewsSettingsPage::loadPreviewPlugins() 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); -#endif } model->sort(Qt::DisplayRole); diff --git a/src/settings/general/previewssettingspage.h b/src/settings/general/previewssettingspage.h index 2c3e4dfef..d6d22ae21 100644 --- a/src/settings/general/previewssettingspage.h +++ b/src/settings/general/previewssettingspage.h @@ -40,9 +40,6 @@ 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(); -- 2.47.3