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"
29 #include <KLocalizedString>
32 #include <QVBoxLayout>
34 GeneralSettingsPage::GeneralSettingsPage(const QUrl
& url
, QWidget
* parent
) :
35 SettingsPageBase(parent
),
38 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
39 topLayout
->setMargin(0);
41 QTabWidget
* tabWidget
= new QTabWidget(this);
43 // initialize 'Behavior' tab
44 BehaviorSettingsPage
* behaviorPage
= new BehaviorSettingsPage(url
, tabWidget
);
45 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
46 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
48 // initialize 'Previews' tab
49 PreviewsSettingsPage
* previewsPage
= new PreviewsSettingsPage(tabWidget
);
50 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
51 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
53 // initialize 'Context Menu' tab
54 ConfirmationsSettingsPage
* confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
55 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
56 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
58 // initialize 'Status Bar' tab
59 StatusBarSettingsPage
* statusBarPage
= new StatusBarSettingsPage(tabWidget
);
60 tabWidget
->addTab(statusBarPage
, i18nc("@title:tab Status Bar settings", "Status Bar"));
61 connect(statusBarPage
, &StatusBarSettingsPage::changed
, this, &GeneralSettingsPage::changed
);
63 m_pages
.append(behaviorPage
);
64 m_pages
.append(previewsPage
);
65 m_pages
.append(confirmationsPage
);
66 m_pages
.append(statusBarPage
);
68 topLayout
->addWidget(tabWidget
, 0, 0);
71 GeneralSettingsPage::~GeneralSettingsPage()
75 void GeneralSettingsPage::applySettings()
77 foreach (SettingsPageBase
* page
, m_pages
) {
78 page
->applySettings();
82 void GeneralSettingsPage::restoreDefaults()
84 foreach (SettingsPageBase
* page
, m_pages
) {
85 page
->restoreDefaults();