diff options
| author | arnav dhamija <[email protected]> | 2017-02-13 22:23:41 +0530 |
|---|---|---|
| committer | arnav dhamija <[email protected]> | 2017-02-13 22:23:41 +0530 |
| commit | 41253c0c81bafb54a0b6c82e5282e3add85e8a50 (patch) | |
| tree | 9a5ccfbade73ee481884ac53aa7e2fe724f25272 /src/settings/dolphinsettingsdialog.cpp | |
| parent | 67099640b90588af1c72c340756253400da3e95b (diff) | |
| parent | 7fce8f0e9b1e0bb2deb6e32fe88d5411b9be2834 (diff) | |
Merge branch 'master' of git.kde.org:dolphin
Diffstat (limited to 'src/settings/dolphinsettingsdialog.cpp')
| -rw-r--r-- | src/settings/dolphinsettingsdialog.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 9eb57f10b..50fd41e4c 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -29,6 +29,7 @@ #include "viewmodes/viewsettingspage.h" #include "trash/trashsettingspage.h" +#include <KAuthorized> #include <KWindowConfig> #include <KLocalizedString> #include <QIcon> @@ -85,11 +86,13 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent) : 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); @@ -102,7 +105,9 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent) : m_pages.append(viewSettingsPage); m_pages.append(navigationSettingsPage); m_pages.append(servicesSettingsPage); - m_pages.append(trashSettingsPage); + if (trashSettingsPage) { + m_pages.append(trashSettingsPage); + } m_pages.append(generalSettingsPage); const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "SettingsDialog"); @@ -145,3 +150,11 @@ void DolphinSettingsDialog::restoreDefaults() } } +SettingsPageBase *DolphinSettingsDialog::createTrashSettingsPage(QWidget *parent) +{ + if (!KAuthorized::authorizeControlModule(QStringLiteral("kcmtrash.desktop"))) { + return nullptr; + } + + return new TrashSettingsPage(parent); +} |
