X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/8ffc72e87f4cffa8dce32da06e9a1d51a595765e..be51e7233294263e3c2866e101e1151dbc61ccbe:/src/settings/kcm/kcmdolphingeneral.cpp diff --git a/src/settings/kcm/kcmdolphingeneral.cpp b/src/settings/kcm/kcmdolphingeneral.cpp index 00781f657..e34b52fce 100644 --- a/src/settings/kcm/kcmdolphingeneral.cpp +++ b/src/settings/kcm/kcmdolphingeneral.cpp @@ -1,82 +1,58 @@ -/*************************************************************************** - * 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/interface/confirmationssettingspage.h" +#include "settings/interface/folderstabssettingspage.h" +#include "settings/interface/interfacesettingspage.h" +#include "settings/interface/previewssettingspage.h" #include #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), - m_pages() +DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data) + : KCModule(parent, data) + , m_pages() { - Q_UNUSED(args) + setButtons(KCModule::Default | KCModule::Help | KCModule::Apply); - setButtons(KCModule::Default | KCModule::Help); - - QVBoxLayout* topLayout = new QVBoxLayout(this); + QVBoxLayout *topLayout = new QVBoxLayout(widget()); topLayout->setContentsMargins(0, 0, 0, 0); - QTabWidget* tabWidget = new QTabWidget(this); + QTabWidget *tabWidget = new QTabWidget(widget()); + tabWidget->setDocumentMode(true); + tabWidget->tabBar()->setExpanding(true); - // initialize 'Behavior' tab - BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget); - tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 64, 0) - connect(behaviorPage, &BehaviorSettingsPage::changed, this, QOverload<>::of(&DolphinGeneralConfigModule::changed)); -#else - connect(behaviorPage, &BehaviorSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged); -#endif + // initialize 'Folders & Tabs' tab + FoldersTabsSettingsPage *foldersTabsPage = new FoldersTabsSettingsPage(tabWidget); + tabWidget->addTab(foldersTabsPage, i18nc("@title:tab Behavior settings", "Behavior")); + connect(foldersTabsPage, &FoldersTabsSettingsPage::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")); -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 64, 0) - connect(previewsPage, &PreviewsSettingsPage::changed, this, QOverload<>::of(&DolphinGeneralConfigModule::changed)); -#else connect(previewsPage, &PreviewsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged); -#endif // initialize 'Confirmations' tab - ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget); - tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations")); -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 64, 0) - connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, QOverload<>::of(&DolphinGeneralConfigModule::changed)); -#else + ConfirmationsSettingsPage *confirmationsPage = new ConfirmationsSettingsPage(tabWidget); + tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations")); connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged); -#endif - m_pages.append(behaviorPage); + m_pages.append(foldersTabsPage); m_pages.append(previewsPage); m_pages.append(confirmationsPage); - topLayout->addWidget(tabWidget, 0, nullptr); + topLayout->addWidget(tabWidget, 0, {}); } DolphinGeneralConfigModule::~DolphinGeneralConfigModule() @@ -85,16 +61,18 @@ DolphinGeneralConfigModule::~DolphinGeneralConfigModule() void DolphinGeneralConfigModule::save() { - foreach (SettingsPageBase* page, m_pages) { + for (SettingsPageBase *page : std::as_const(m_pages)) { page->applySettings(); } } void DolphinGeneralConfigModule::defaults() { - foreach (SettingsPageBase* page, m_pages) { + for (SettingsPageBase *page : std::as_const(m_pages)) { page->applySettings(); } } #include "kcmdolphingeneral.moc" + +#include "moc_kcmdolphingeneral.cpp"