]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Dolphin: Cleanup kcms
authorAlexander Lohnau <alexander.lohnau@gmx.de>
Mon, 4 May 2020 18:30:25 +0000 (20:30 +0200)
committerAlexander Lohnau <alexander.lohnau@gmx.de>
Mon, 4 May 2020 18:36:15 +0000 (20:36 +0200)
Summary: Refactor forearch, adjust formatting, remove unnecessary version checks.

Test Plan: Compiles

Reviewers: #dolphin, ngraham, elvisangelaccio, meven

Reviewed By: #dolphin, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29377

src/settings/kcm/kcmdolphingeneral.cpp
src/settings/kcm/kcmdolphingeneral.h
src/settings/kcm/kcmdolphinnavigation.cpp
src/settings/kcm/kcmdolphinnavigation.h
src/settings/kcm/kcmdolphinservices.cpp
src/settings/kcm/kcmdolphinservices.h
src/settings/kcm/kcmdolphinviewmodes.cpp
src/settings/kcm/kcmdolphinviewmodes.h

index a82cb3858c409609fedb07b468ed34a7a427d39e..39eccff76fab0ab3df20bef6b0293c2978160afc 100644 (file)
 
 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>(QStringLiteral("dolphingeneral"));)
 
-DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QVariantList& args) :
-    KCModule(parent),
+DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args) :
+    KCModule(parent, args),
     m_pages()
 {
-    Q_UNUSED(args)
-
     setButtons(KCModule::Default | KCModule::Help);
 
     QVBoxLayout* topLayout = new QVBoxLayout(this);
@@ -49,29 +47,17 @@ DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QV
     // 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 'Previews' tab
     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
     connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
-#endif
     m_pages.append(behaviorPage);
     m_pages.append(previewsPage);
     m_pages.append(confirmationsPage);
@@ -85,14 +71,14 @@ DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
 
 void DolphinGeneralConfigModule::save()
 {
-    foreach (SettingsPageBase* page, m_pages) {
+    for (SettingsPageBase* page : qAsConst(m_pages)) {
         page->applySettings();
     }
 }
 
 void DolphinGeneralConfigModule::defaults()
 {
-    foreach (SettingsPageBase* page, m_pages) {
+    for (SettingsPageBase* page : qAsConst(m_pages)) {
         page->applySettings();
     }
 }
index c542c0139545bcb9e6ad441832bc17467b3e47b0..2b60c7591d11e94fceda3f1603cbd3c8fdca310c 100644 (file)
@@ -34,7 +34,7 @@ class DolphinGeneralConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    DolphinGeneralConfigModule(QWidget* parent, const QVariantList& args);
+    DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args);
     ~DolphinGeneralConfigModule() override;
 
     void save() override;
index 2cdabdeee0e22d124cb65b58356f1c4328a59f18..f8de4eed22e2c34ae0f9a18c00ca252c0b0fede9 100644 (file)
 
 K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPlugin<DolphinNavigationConfigModule>(QStringLiteral("dolphinnavigation"));)
 
-DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget* parent, const QVariantList& args) :
-    KCModule(parent),
+DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget *parent, const QVariantList &args) :
+    KCModule(parent, args),
     m_navigation(nullptr)
 {
-    Q_UNUSED(args)
-
     setButtons(KCModule::Default | KCModule::Help);
 
     QVBoxLayout* topLayout = new QVBoxLayout(this);
     topLayout->setContentsMargins(0, 0, 0, 0);
 
     m_navigation = new NavigationSettingsPage(this);
-#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 64, 0)
-    connect(m_navigation, &NavigationSettingsPage::changed, this, QOverload<>::of(&DolphinNavigationConfigModule::changed));
-#else
     connect(m_navigation, &NavigationSettingsPage::changed, this, &DolphinNavigationConfigModule::markAsChanged);
-#endif
     topLayout->addWidget(m_navigation, 0, {});
 }
 
index 2bcc7ababe2ae7ac2315c1384188c5c0d72a9171..7eb6b26e78b044a73efdd9d9f0f7f02fe88aa393 100644 (file)
@@ -32,14 +32,14 @@ class DolphinNavigationConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    DolphinNavigationConfigModule(QWidget* parent, const QVariantList& args);
+    DolphinNavigationConfigModule(QWidget *parent, const QVariantList &args);
     ~DolphinNavigationConfigModule() override;
 
     void save() override;
     void defaults() override;
 
 private:
-    NavigationSettingsPagem_navigation;
+    NavigationSettingsPage *m_navigation;
 };
 
 #endif
index e6a8867d7dde1754f0d9f88d368e308d0f098d14..92e71bae0eb8da71a2467533f529d760768a37c0 100644 (file)
 K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPlugin<DolphinServicesConfigModule>(QStringLiteral("dolphinservices"));)
 
 DolphinServicesConfigModule::DolphinServicesConfigModule(QWidget* parent, const QVariantList& args) :
-    KCModule(parent),
+    KCModule(parent, args),
     m_services(nullptr)
 {
-    Q_UNUSED(args)
-
     setButtons(KCModule::Default | KCModule::Help);
 
     QVBoxLayout* topLayout = new QVBoxLayout(this);
     topLayout->setContentsMargins(0, 0, 0, 0);
 
     m_services = new ServicesSettingsPage(this);
-#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 64, 0)
-    connect(m_services, &ServicesSettingsPage::changed, this, QOverload<>::of(&DolphinServicesConfigModule::changed));
-#else
     connect(m_services, &ServicesSettingsPage::changed, this, &DolphinServicesConfigModule::markAsChanged);
-#endif
     topLayout->addWidget(m_services, 0, {});
 }
 
index 6c6af6728a12f8beee2a7ee4579089886515af98..a567450ca512d04e3a1647109b4afb4a185e32d1 100644 (file)
@@ -39,7 +39,7 @@ public:
     void defaults() override;
 
 private:
-    ServicesSettingsPagem_services;
+    ServicesSettingsPage *m_services;
 };
 
 #endif
index 4fac1160073a7128d47ee0258fcf06a33b8f3c2a..91abe5cd42f34ce43ab4b949fc1e245ec8e9a133 100644 (file)
 
 K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPlugin<DolphinViewModesConfigModule>(QStringLiteral("dolphinviewmodes"));)
 
-DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args) :
-    KCModule(parent),
+DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget *parent, const QVariantList &args) :
+    KCModule(parent, args),
     m_tabs()
 {
-    Q_UNUSED(args)
-
     setButtons(KCModule::Default | KCModule::Help);
 
     QVBoxLayout* topLayout = new QVBoxLayout(this);
@@ -74,7 +72,7 @@ DolphinViewModesConfigModule::~DolphinViewModesConfigModule()
 
 void DolphinViewModesConfigModule::save()
 {
-    foreach (ViewSettingsTab* tab, m_tabs) {
+    for (ViewSettingsTab *tab : qAsConst(m_tabs)) {
         tab->applySettings();
     }
     reparseConfiguration();
@@ -82,7 +80,7 @@ void DolphinViewModesConfigModule::save()
 
 void DolphinViewModesConfigModule::defaults()
 {
-    foreach (ViewSettingsTab* tab, m_tabs) {
+    for (ViewSettingsTab *tab : qAsConst(m_tabs)) {
         tab->restoreDefaultSettings();
     }
     reparseConfiguration();
@@ -90,13 +88,15 @@ void DolphinViewModesConfigModule::defaults()
 
 void DolphinViewModesConfigModule::reparseConfiguration()
 {
-    QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
+    QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KonqMain"),
+                                                      QStringLiteral("org.kde.Konqueror.Main"),
+                                                      QStringLiteral("reparseConfiguration"));
     QDBusConnection::sessionBus().send(message);
 }
 
 void DolphinViewModesConfigModule::viewModeChanged()
 {
-    emit changed(true);
+    emit markAsChanged();
 }
 
 #include "kcmdolphinviewmodes.moc"
index c3775adff9d1b90c27ff719f7e918e4816aa4fe5..40965b0e6832e3441f9775631ffd513e86046efc 100644 (file)
@@ -32,7 +32,7 @@ class DolphinViewModesConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args);
+    DolphinViewModesConfigModule(QWidget *parent, const QVariantList &args);
     ~DolphinViewModesConfigModule() override;
 
     void save() override;