kcmdolphinservices.cpp 2.63 KB
Newer Older
1
/***************************************************************************
2
 *   Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com>             *
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *                                                                         *
 *   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            *
 ***************************************************************************/

#include "kcmdolphinservices.h"

Roman Inflianskas's avatar
Roman Inflianskas committed
22
23
#include "settings/services/servicessettingspage.h"

24
#include <kconfigwidgets_version.h>
Peter Penz's avatar
Peter Penz committed
25
26
#include <KPluginFactory>
#include <KPluginLoader>
27
28
29

#include <QVBoxLayout>

30
K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPlugin<DolphinServicesConfigModule>(QStringLiteral("dolphinservices"));)
31
32

DolphinServicesConfigModule::DolphinServicesConfigModule(QWidget* parent, const QVariantList& args) :
33
    KCModule(parent),
Kevin Funk's avatar
Kevin Funk committed
34
    m_services(nullptr)
35
{
36
    Q_UNUSED(args)
37
38
39
40

    setButtons(KCModule::Default | KCModule::Help);

    QVBoxLayout* topLayout = new QVBoxLayout(this);
Laurent Montel's avatar
Laurent Montel committed
41
    topLayout->setContentsMargins(0, 0, 0, 0);
42
43

    m_services = new ServicesSettingsPage(this);
44
#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 64, 0)
45
    connect(m_services, &ServicesSettingsPage::changed, this, QOverload<>::of(&DolphinServicesConfigModule::changed));
46
47
48
#else
    connect(m_services, &ServicesSettingsPage::changed, this, &DolphinServicesConfigModule::markAsChanged);
#endif
49
    topLayout->addWidget(m_services, 0, {});
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
}

DolphinServicesConfigModule::~DolphinServicesConfigModule()
{
}

void DolphinServicesConfigModule::save()
{
    m_services->applySettings();
}

void DolphinServicesConfigModule::defaults()
{
    m_services->restoreDefaults();
}

#include "kcmdolphinservices.moc"