1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* SPDX-FileCopyrightText: 2009 Peter Penz <[email protected]>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kcmdolphingeneral.h"
#include "settings/general/behaviorsettingspage.h"
#include "settings/general/confirmationssettingspage.h"
#include "settings/general/previewssettingspage.h"
#include <KLocalizedString>
#include <KPluginFactory>
#include <kconfigwidgets_version.h>
#include <QTabWidget>
#include <QVBoxLayout>
K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json")
DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
, m_pages()
{
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0);
QTabWidget *tabWidget = new QTabWidget(this);
// initialize 'Behavior' tab
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);
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"));
connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
m_pages.append(behaviorPage);
m_pages.append(previewsPage);
m_pages.append(confirmationsPage);
topLayout->addWidget(tabWidget, 0, {});
}
DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
{
}
void DolphinGeneralConfigModule::save()
{
for (SettingsPageBase *page : qAsConst(m_pages)) {
page->applySettings();
}
}
void DolphinGeneralConfigModule::defaults()
{
for (SettingsPageBase *page : qAsConst(m_pages)) {
page->applySettings();
}
}
#include "kcmdolphingeneral.moc"
#include "moc_kcmdolphingeneral.cpp"
|