diff options
Diffstat (limited to 'src/settings/interface')
6 files changed, 5 insertions, 143 deletions
diff --git a/src/settings/interface/configurepreviewplugindialog.cpp b/src/settings/interface/configurepreviewplugindialog.cpp deleted file mode 100644 index 8846d8261..000000000 --- a/src/settings/interface/configurepreviewplugindialog.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#include "configurepreviewplugindialog.h" - -#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) - -#include <KIO/DeleteJob> -#include <KIO/JobUiDelegate> -#include <KIO/ThumbCreator> -#include <KJobWidgets> -#include <KLocalizedString> -#include <QPluginLoader> - -#include <QDialogButtonBox> -#include <QPushButton> -#include <QStandardPaths> -#include <QUrl> -#include <QVBoxLayout> - -ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString &pluginName, const QString &desktopEntryName, QWidget *parent) - : QDialog(parent) -{ - QSharedPointer<ThumbCreator> previewPlugin; - const QString pluginPath = QPluginLoader(desktopEntryName).fileName(); - if (!pluginPath.isEmpty()) { - newCreator create = (newCreator)QLibrary::resolve(pluginPath, "new_creator"); - if (create) { - previewPlugin.reset(dynamic_cast<ThumbCreator *>(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); -} - -#include "moc_configurepreviewplugindialog.cpp" - -#endif // KIO_VERSION diff --git a/src/settings/interface/configurepreviewplugindialog.h b/src/settings/interface/configurepreviewplugindialog.h deleted file mode 100644 index 66504cce2..000000000 --- a/src/settings/interface/configurepreviewplugindialog.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef CONFIGUREPREVIEWPLUGINDIALOG_H -#define CONFIGUREPREVIEWPLUGINDIALOG_H - -#include <kiowidgets_export.h> - -#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87) - -#include <QDialog> - -/** - * @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/interface/folderstabssettingspage.cpp b/src/settings/interface/folderstabssettingspage.cpp index d71ad2d96..85a0e8e13 100644 --- a/src/settings/interface/folderstabssettingspage.cpp +++ b/src/settings/interface/folderstabssettingspage.cpp @@ -160,7 +160,7 @@ void FoldersTabsSettingsPage::applySettings() settings->setCloseActiveSplitView(m_closeActiveSplitView->isChecked()); const QUrl url(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile)); if (url.isValid() && KProtocolManager::supportsListing(url)) { - KIO::StatJob *job = KIO::statDetails(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo); + KIO::StatJob *job = KIO::stat(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo); connect(job, &KJob::result, this, [this, settings, url](KJob *job) { if (job->error() == 0 && qobject_cast<KIO::StatJob *>(job)->statResult().isDir()) { settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile)); diff --git a/src/settings/interface/interfacesettingspage.cpp b/src/settings/interface/interfacesettingspage.cpp index e941cf467..6a3fc8c90 100644 --- a/src/settings/interface/interfacesettingspage.cpp +++ b/src/settings/interface/interfacesettingspage.cpp @@ -59,14 +59,14 @@ InterfaceSettingsPage::~InterfaceSettingsPage() void InterfaceSettingsPage::applySettings() { - for (SettingsPageBase *page : qAsConst(m_pages)) { + for (SettingsPageBase *page : std::as_const(m_pages)) { page->applySettings(); } } void InterfaceSettingsPage::restoreDefaults() { - for (SettingsPageBase *page : qAsConst(m_pages)) { + for (SettingsPageBase *page : std::as_const(m_pages)) { page->restoreDefaults(); } } diff --git a/src/settings/interface/previewssettingspage.cpp b/src/settings/interface/previewssettingspage.cpp index ef98d0f8d..dd1ce942e 100644 --- a/src/settings/interface/previewssettingspage.cpp +++ b/src/settings/interface/previewssettingspage.cpp @@ -6,9 +6,7 @@ #include "previewssettingspage.h" -#include "configurepreviewplugindialog.h" #include "dolphin_generalsettings.h" -#include "settings/serviceitemdelegate.h" #include "settings/servicemodel.h" #include <KIO/PreviewJob> @@ -45,12 +43,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); @@ -111,7 +103,7 @@ void PreviewsSettingsPage::applySettings() m_enabledPreviewPlugins.clear(); for (int i = 0; i < rowCount; ++i) { const QModelIndex index = model->index(i, 0); - const bool checked = model->data(index, Qt::CheckStateRole).toBool(); + const bool checked = model->data(index, Qt::CheckStateRole).value<Qt::CheckState>() == Qt::Checked; if (checked) { const QString enabledPlugin = model->data(index, Qt::UserRole).toString(); m_enabledPreviewPlugins.append(enabledPlugin); @@ -150,19 +142,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(); @@ -173,14 +152,9 @@ void PreviewsSettingsPage::loadPreviewPlugins() model->insertRow(0); const QModelIndex index = model->index(0, 0); - model->setData(index, show, Qt::CheckStateRole); + model->setData(index, show ? Qt::Checked : Qt::Unchecked, 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/interface/previewssettingspage.h b/src/settings/interface/previewssettingspage.h index 2c3e4dfef..d6d22ae21 100644 --- a/src/settings/interface/previewssettingspage.h +++ b/src/settings/interface/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(); |
