diff --git a/src/settings/dolphinsettingsdialog.h b/src/settings/dolphinsettingsdialog.h --- a/src/settings/dolphinsettingsdialog.h +++ b/src/settings/dolphinsettingsdialog.h @@ -49,6 +49,8 @@ void restoreDefaults(); private: + static SettingsPageBase *createTrashSettingsPage(QWidget *parent); + QList m_pages; }; diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -29,6 +29,7 @@ #include "viewmodes/viewsettingspage.h" #include "trash/trashsettingspage.h" +#include #include #include #include @@ -85,11 +86,13 @@ connect(servicesSettingsPage, &ServicesSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Trash - TrashSettingsPage* trashSettingsPage = new TrashSettingsPage(this); - KPageWidgetItem* trashSettingsFrame = addPage(trashSettingsPage, - i18nc("@title:group", "Trash")); - trashSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("trash-empty"))); - connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); + auto* trashSettingsPage = createTrashSettingsPage(this); + if (trashSettingsPage) { + KPageWidgetItem* trashSettingsFrame = addPage(trashSettingsPage, + i18nc("@title:group", "Trash")); + trashSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("trash-empty"))); + connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); + } // General GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(url, this); @@ -145,3 +148,11 @@ } } +SettingsPageBase *DolphinSettingsDialog::createTrashSettingsPage(QWidget *parent) +{ + if (!KAuthorized::authorizeControlModule(QStringLiteral("kcmtrash.desktop"))) { + return nullptr; + } + + return new TrashSettingsPage(parent); +}