Warning, file /education/kwordquiz/src/kwqtutorprefs.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2010 Peter Hedlund <peter.hedlund@kdemail.net>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "kwqtutorprefs.h"
0007 
0008 #include <QPushButton>
0009 
0010 #include <KConfigSkeleton>
0011 #include <KLocalizedString>
0012 
0013 #include "preftutor.h"
0014 
0015 KWQTutorPrefs::KWQTutorPrefs(QWidget *parent, const QString &name, KConfigSkeleton *config,
0016                  KActionCollection *actionCollection)
0017   : KConfigDialog(parent, name, config)
0018 {
0019   m_config = config;
0020 
0021   m_prefTutor = new PrefTutor(0);
0022   addPage(m_prefTutor, i18nc("@title:group tutor settings", "Tutor"), QStringLiteral("kwordquiz"), i18nc("@title:group tutor settings", "Tutor Settings"), true);
0023 
0024   m_shortcutsWidget = new KShortcutsEditor( actionCollection, 0, KShortcutsEditor::GlobalAction );
0025   addPage(m_shortcutsWidget, i18nc("Shortcuts Config", "Shortcuts"), QStringLiteral("configure-shortcuts"), i18n("Shortcuts Settings"));
0026 
0027   connect(m_shortcutsWidget, &KShortcutsEditor::keyChange, this, &KWQTutorPrefs::slotEnableApplyButton);
0028 
0029   setHelp(QString(), QStringLiteral("kwordquiz"));
0030 }
0031 
0032 bool KWQTutorPrefs::hasChanged()
0033 {
0034   return m_shortcutsWidget->isModified();
0035 }
0036 
0037 void KWQTutorPrefs::updateSettings( )
0038 {
0039   m_shortcutsWidget->save();
0040 }
0041 
0042 void KWQTutorPrefs::updateWidgetsDefault()
0043 {
0044   bool bUseDefaults = m_config->useDefaults(true);
0045   m_shortcutsWidget->allDefault();
0046   m_config->useDefaults(bUseDefaults);
0047 }
0048 
0049 void KWQTutorPrefs::slotEnableApplyButton()
0050 {
0051   buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(true);
0052 }