X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f987a1c404663f8f8964596548294dc1ae31f377..76e3eab6ea3545339da2fd30b838acbc8c0ff607:/src/settings/kcm/kcmdolphingeneral.cpp diff --git a/src/settings/kcm/kcmdolphingeneral.cpp b/src/settings/kcm/kcmdolphingeneral.cpp index 39eccff76..417979d23 100644 --- a/src/settings/kcm/kcmdolphingeneral.cpp +++ b/src/settings/kcm/kcmdolphingeneral.cpp @@ -1,62 +1,49 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2009 Peter Penz + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kcmdolphingeneral.h" #include "settings/general/behaviorsettingspage.h" -#include "settings/general/previewssettingspage.h" #include "settings/general/confirmationssettingspage.h" +#include "settings/general/previewssettingspage.h" #include #include -#include #include #include #include -K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin(QStringLiteral("dolphingeneral"));) +K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json") -DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args) : - KCModule(parent, args), - m_pages() +DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data) + : KCModule(qobject_cast(parent), data) + , m_pages() { - setButtons(KCModule::Default | KCModule::Help); + setButtons(KCModule::Default | KCModule::Help | KCModule::Apply); - QVBoxLayout* topLayout = new QVBoxLayout(this); + const auto parentWidget = qobject_cast(parent); + QVBoxLayout *topLayout = new QVBoxLayout(parentWidget); topLayout->setContentsMargins(0, 0, 0, 0); - QTabWidget* tabWidget = new QTabWidget(this); + QTabWidget *tabWidget = new QTabWidget(parentWidget); // initialize 'Behavior' tab - BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget); + BehaviorSettingsPage *behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget); tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); connect(behaviorPage, &BehaviorSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged); // initialize 'Previews' tab - PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget); + PreviewsSettingsPage *previewsPage = new PreviewsSettingsPage(tabWidget); tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews")); connect(previewsPage, &PreviewsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged); // initialize 'Confirmations' tab - ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget); - tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations")); + ConfirmationsSettingsPage *confirmationsPage = new ConfirmationsSettingsPage(tabWidget); + tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations")); connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged); m_pages.append(behaviorPage); m_pages.append(previewsPage); @@ -71,14 +58,14 @@ DolphinGeneralConfigModule::~DolphinGeneralConfigModule() void DolphinGeneralConfigModule::save() { - for (SettingsPageBase* page : qAsConst(m_pages)) { + for (SettingsPageBase *page : qAsConst(m_pages)) { page->applySettings(); } } void DolphinGeneralConfigModule::defaults() { - for (SettingsPageBase* page : qAsConst(m_pages)) { + for (SettingsPageBase *page : qAsConst(m_pages)) { page->applySettings(); } }