File indexing completed on 2025-01-26 03:29:46
0001 /* 0002 * Copyright (C) 2014 Jeremy Whiting <jpwhiting@kde.org> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation; either version 2 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program; if not, write to the 0016 * Free Software Foundation, Inc., 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 ***************************************************************************/ 0019 0020 #include "kanagramconfigdialog.h" 0021 0022 #include "mainsettings.h" 0023 #include "vocabsettings.h" 0024 0025 #include <KLocalizedString> 0026 0027 #include <QLoggingCategory> 0028 0029 Q_DECLARE_LOGGING_CATEGORY(KANAGRAM) 0030 0031 KanagramConfigDialog::KanagramConfigDialog(QWidget *parent, const QString &name, 0032 KCoreConfigSkeleton *config) : 0033 KConfigDialog(parent, name, config) 0034 { 0035 // add the main settings page 0036 m_mainSettingsPage = new MainSettings( this ); 0037 addPage(m_mainSettingsPage , i18nc("@title:group main settings page name", "General" ), QStringLiteral("preferences-other") ); 0038 connect(m_mainSettingsPage, &MainSettings::widgetModified, this, &KanagramConfigDialog::settingsModified); 0039 0040 // create and add the vocabsettings page 0041 m_vocabSettingsPage = new VocabSettings( this ); 0042 addPage(m_vocabSettingsPage, i18n("Vocabularies"), QStringLiteral("document-properties") ); 0043 connect(m_vocabSettingsPage, &VocabSettings::widgetModified, this, &KanagramConfigDialog::settingsModified); 0044 0045 m_hasChanged = false; 0046 0047 setHelp(QStringLiteral("configuring"), QStringLiteral("kanagram")); 0048 } 0049 0050 KanagramConfigDialog::~KanagramConfigDialog() 0051 { 0052 } 0053 0054 void KanagramConfigDialog::updateSettings() 0055 { 0056 if (m_mainSettingsPage->saveLanguage()) { 0057 Q_EMIT settingsChanged(objectName()); 0058 m_hasChanged = false; 0059 } 0060 KConfigDialog::updateSettings(); 0061 } 0062 0063 void KanagramConfigDialog::updateWidgets() 0064 { 0065 } 0066 0067 void KanagramConfigDialog::updateWidgetsDefault() 0068 { 0069 } 0070 0071 bool KanagramConfigDialog::hasChanged() 0072 { 0073 return m_hasChanged; 0074 } 0075 0076 bool KanagramConfigDialog::isDefault() 0077 { 0078 return true; 0079 } 0080 0081 void KanagramConfigDialog::settingsModified() 0082 { 0083 m_hasChanged = true; 0084 updateButtons(); 0085 } 0086 0087 #include "moc_kanagramconfigdialog.cpp"