1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "generalsettingspage.h"
23 #include "behaviorsettingspage.h"
24 #include "confirmationssettingspage.h"
25 #include "previewssettingspage.h"
26 #include <settings/settingspagebase.h>
27 #include "statusbarsettingspage.h"
30 #include <KLocalizedString>
33 #include <QVBoxLayout>
35 GeneralSettingsPage::GeneralSettingsPage(const QUrl
& url
, QWidget
* parent
) :
36 SettingsPageBase(parent
),
39 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
40 topLayout
->setMargin(0);
41 topLayout
->setSpacing(KDialog::spacingHint());
43 KTabWidget
* tabWidget
= new KTabWidget(this);
45 // initialize 'Behavior' tab
46 BehaviorSettingsPage
* behaviorPage
= new BehaviorSettingsPage(url
, tabWidget
);
47 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
48 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
50 // initialize 'Previews' tab
51 PreviewsSettingsPage
* previewsPage
= new PreviewsSettingsPage(tabWidget
);
52 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
53 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
55 // initialize 'Context Menu' tab
56 ConfirmationsSettingsPage
* confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
57 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
58 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
60 // initialize 'Status Bar' tab
61 StatusBarSettingsPage
* statusBarPage
= new StatusBarSettingsPage(tabWidget
);
62 tabWidget
->addTab(statusBarPage
, i18nc("@title:tab Status Bar settings", "Status Bar"));
63 connect(statusBarPage
, &StatusBarSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
65 m_pages
.append(behaviorPage
);
66 m_pages
.append(previewsPage
);
67 m_pages
.append(confirmationsPage
);
68 m_pages
.append(statusBarPage
);
70 topLayout
->addWidget(tabWidget
, 0, 0);
73 GeneralSettingsPage::~GeneralSettingsPage()
77 void GeneralSettingsPage::applySettings()
79 foreach (SettingsPageBase
* page
, m_pages
) {
80 page
->applySettings();
84 void GeneralSettingsPage::restoreDefaults()
86 foreach (SettingsPageBase
* page
, m_pages
) {
87 page
->restoreDefaults();