Changeset View
Changeset View
Standalone View
Standalone View
runners/spellchecker/spellcheck_config.cpp
Show All 13 Lines | |||||
14 | 14 | | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | *********************************************************************/ | 17 | *********************************************************************/ | ||
18 | 18 | | |||
19 | #include "spellcheck_config.h" | 19 | #include "spellcheck_config.h" | ||
20 | 20 | | |||
21 | #include <QGridLayout> | 21 | #include <QGridLayout> | ||
22 | #include <QProcess> | ||||
22 | 23 | | |||
23 | #include <KConfigGroup> | 24 | #include <KConfigGroup> | ||
24 | #include <KPluginFactory> | 25 | #include <KPluginFactory> | ||
25 | #include <KPluginLoader> | 26 | #include <KPluginLoader> | ||
26 | #include <KSharedConfig> | 27 | #include <KSharedConfig> | ||
27 | 28 | | |||
28 | //For the macro | 29 | //For the macro | ||
29 | #include <KRunner/AbstractRunner> | 30 | #include <KRunner/AbstractRunner> | ||
Show All 11 Lines | 39 | { | |||
41 | QGridLayout* layout = new QGridLayout(this); | 42 | QGridLayout* layout = new QGridLayout(this); | ||
42 | 43 | | |||
43 | layout->addWidget(m_ui, 0, 0); | 44 | layout->addWidget(m_ui, 0, 0); | ||
44 | 45 | | |||
45 | connect(m_ui->m_requireTriggerWord, SIGNAL(stateChanged(int)), this, SLOT(changed())); | 46 | connect(m_ui->m_requireTriggerWord, SIGNAL(stateChanged(int)), this, SLOT(changed())); | ||
46 | connect(m_ui->m_requireTriggerWord, SIGNAL(stateChanged(int)), this, SLOT(toggleTriggerWord(int))); | 47 | connect(m_ui->m_requireTriggerWord, SIGNAL(stateChanged(int)), this, SLOT(toggleTriggerWord(int))); | ||
47 | connect(m_ui->m_triggerWord, SIGNAL(textChanged(QString)), this, SLOT(changed())); | 48 | connect(m_ui->m_triggerWord, SIGNAL(textChanged(QString)), this, SLOT(changed())); | ||
48 | 49 | | |||
50 | m_ui->m_openKcmButton->setIcon(QIcon::fromTheme(QStringLiteral("tools-check-spelling"))); | ||||
51 | connect(m_ui->m_openKcmButton, &QPushButton::clicked, this, &SpellCheckConfig::openKcm); | ||||
52 | | ||||
49 | load(); | 53 | load(); | ||
50 | } | 54 | } | ||
51 | 55 | | |||
52 | SpellCheckConfig::~SpellCheckConfig() | 56 | SpellCheckConfig::~SpellCheckConfig() | ||
53 | { | 57 | { | ||
54 | } | 58 | } | ||
55 | 59 | | |||
56 | void SpellCheckConfig::toggleTriggerWord(int state) | 60 | void SpellCheckConfig::toggleTriggerWord(int state) | ||
57 | { | 61 | { | ||
58 | if (state == Qt::Unchecked) { | 62 | if (state == Qt::Unchecked) { | ||
59 | m_ui->m_triggerWord->setEnabled(false); | 63 | m_ui->m_triggerWord->setEnabled(false); | ||
60 | } else { | 64 | } else { | ||
61 | m_ui->m_triggerWord->setEnabled(true); | 65 | m_ui->m_triggerWord->setEnabled(true); | ||
62 | } | 66 | } | ||
63 | } | 67 | } | ||
64 | 68 | | |||
69 | void SpellCheckConfig::openKcm() | ||||
70 | { | ||||
71 | QProcess::startDetached(QStringLiteral("kcmshell5"), {QStringLiteral("spellchecking")}); | ||||
72 | } | ||||
73 | | ||||
65 | void SpellCheckConfig::load() | 74 | void SpellCheckConfig::load() | ||
66 | { | 75 | { | ||
67 | KCModule::load(); | 76 | KCModule::load(); | ||
68 | 77 | | |||
69 | //FIXME: This shouldn't be hardcoded! | 78 | //FIXME: This shouldn't be hardcoded! | ||
70 | KSharedConfig::Ptr cfg = KSharedConfig::openConfig( QLatin1String( "krunnerrc" ) ); | 79 | KSharedConfig::Ptr cfg = KSharedConfig::openConfig( QLatin1String( "krunnerrc" ) ); | ||
71 | KConfigGroup conf = cfg->group( "Runners" ); | 80 | KConfigGroup conf = cfg->group( "Runners" ); | ||
72 | KConfigGroup grp = KConfigGroup( &conf, "Spell Checker"); | 81 | KConfigGroup grp = KConfigGroup( &conf, "Spell Checker"); | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |