|
53 | 53 | #include "scriptrepositorydialog.h" |
54 | 54 | #include "services/databaseservice.h" |
55 | 55 | #ifdef LANGUAGETOOL_ENABLED |
| 56 | +#include "services/languagetoolchecker.h" |
56 | 57 | #include "services/languagetoolclient.h" |
57 | 58 | #endif |
58 | 59 | #include "services/nextclouddeckservice.h" |
@@ -2168,6 +2169,48 @@ void SettingsDialog::on_languageToolTestConnectionButton_clicked() { |
2168 | 2169 |
|
2169 | 2170 | client->checkText(options); |
2170 | 2171 | } |
| 2172 | + |
| 2173 | +void SettingsDialog::on_languageToolResetIgnoredRulesButton_clicked() { |
| 2174 | + auto *checker = LanguageToolChecker::instance(); |
| 2175 | + if (checker == nullptr) { |
| 2176 | + return; |
| 2177 | + } |
| 2178 | + |
| 2179 | + const int count = checker->ignoredRules().size(); |
| 2180 | + if (count == 0) { |
| 2181 | + QMessageBox::information(this, tr("LanguageTool"), |
| 2182 | + tr("There are no ignored rules to reset.")); |
| 2183 | + return; |
| 2184 | + } |
| 2185 | + |
| 2186 | + if (QMessageBox::question(this, tr("LanguageTool"), tr("Reset %n ignored rule(s)?", "", count), |
| 2187 | + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { |
| 2188 | + checker->clearIgnoredRules(); |
| 2189 | + QMessageBox::information(this, tr("LanguageTool"), |
| 2190 | + tr("All ignored rules have been reset.")); |
| 2191 | + } |
| 2192 | +} |
| 2193 | + |
| 2194 | +void SettingsDialog::on_languageToolResetIgnoredWordsButton_clicked() { |
| 2195 | + auto *checker = LanguageToolChecker::instance(); |
| 2196 | + if (checker == nullptr) { |
| 2197 | + return; |
| 2198 | + } |
| 2199 | + |
| 2200 | + const int count = checker->ignoredWords().size(); |
| 2201 | + if (count == 0) { |
| 2202 | + QMessageBox::information(this, tr("LanguageTool"), |
| 2203 | + tr("There are no ignored words to reset.")); |
| 2204 | + return; |
| 2205 | + } |
| 2206 | + |
| 2207 | + if (QMessageBox::question(this, tr("LanguageTool"), tr("Reset %n ignored word(s)?", "", count), |
| 2208 | + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { |
| 2209 | + checker->clearIgnoredWords(); |
| 2210 | + QMessageBox::information(this, tr("LanguageTool"), |
| 2211 | + tr("All ignored words have been reset.")); |
| 2212 | + } |
| 2213 | +} |
2171 | 2214 | #endif |
2172 | 2215 |
|
2173 | 2216 | void SettingsDialog::onLayoutSettingsStored(const QString &workspaceIdentifier) { |
|
0 commit comments