1 /*
2 * Copyright (C) 2014 Jeremy Whiting <jpwhiting@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20 #include "kanagramconfigdialog.h"
21
22 #include "mainsettings.h"
23 #include "vocabsettings.h"
24
25 #include <KLocalizedString>
26
27 #include <QLoggingCategory>
28
Q_DECLARE_LOGGING_CATEGORY(KANAGRAM)29 Q_DECLARE_LOGGING_CATEGORY(KANAGRAM)
30
31 KanagramConfigDialog::KanagramConfigDialog(QWidget *parent, const QString &name,
32 KCoreConfigSkeleton *config) :
33 KConfigDialog(parent, name, config)
34 {
35 // add the main settings page
36 m_mainSettingsPage = new MainSettings( this );
37 addPage(m_mainSettingsPage , i18nc("@title:group main settings page name", "General" ), QStringLiteral("preferences-other") );
38 connect(m_mainSettingsPage, &MainSettings::widgetModified, this, &KanagramConfigDialog::settingsModified);
39
40 // create and add the vocabsettings page
41 m_vocabSettingsPage = new VocabSettings( this );
42 addPage(m_vocabSettingsPage, i18n("Vocabularies"), QStringLiteral("document-properties") );
43 connect(m_vocabSettingsPage, &VocabSettings::widgetModified, this, &KanagramConfigDialog::settingsModified);
44
45 m_hasChanged = false;
46
47 setHelp(QStringLiteral("configuring"), QStringLiteral("kanagram"));
48 }
49
~KanagramConfigDialog()50 KanagramConfigDialog::~KanagramConfigDialog()
51 {
52 }
53
updateSettings()54 void KanagramConfigDialog::updateSettings()
55 {
56 if (m_mainSettingsPage->saveLanguage()) {
57 emit settingsChanged(objectName());
58 m_hasChanged = false;
59 }
60 KConfigDialog::updateSettings();
61 }
62
updateWidgets()63 void KanagramConfigDialog::updateWidgets()
64 {
65 }
66
updateWidgetsDefault()67 void KanagramConfigDialog::updateWidgetsDefault()
68 {
69 }
70
hasChanged()71 bool KanagramConfigDialog::hasChanged()
72 {
73 return m_hasChanged;
74 }
75
isDefault()76 bool KanagramConfigDialog::isDefault()
77 {
78 return true;
79 }
80
settingsModified()81 void KanagramConfigDialog::settingsModified()
82 {
83 m_hasChanged = true;
84 updateButtons();
85 }
86
87 #include "moc_kanagramconfigdialog.cpp"
88