2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Added ability to remove dictionary from context menu.

This commit is contained in:
23rd
2020-02-08 16:57:43 +03:00
parent e9e9ea2d69
commit a0f995b134
4 changed files with 66 additions and 10 deletions

View File

@@ -134,6 +134,17 @@ bool DictionaryExists(int langId) {
return (bad == end(kDictExtensions));
}
bool RemoveDictionary(int langId) {
if (!langId) {
return true;
}
const auto fileName = Spellchecker::LocaleFromLangId(langId).name();
const auto folder = qsl("%1/%2/")
.arg(DictionariesPath())
.arg(fileName);
return QDir(folder).removeRecursively();
}
bool WriteDefaultDictionary() {
// This is an unused function.
const auto en = QLocale::English;

View File

@@ -27,6 +27,8 @@ MTP::DedicatedLoader::Location GetDownloadLocation(int id);
[[nodiscard]] QString DictPathByLangId(int langId);
bool UnpackDictionary(const QString &path, int langId);
[[nodiscard]] bool DictionaryExists(int langId);
bool RemoveDictionary(int langId);
[[nodiscard]] bool IsEn(int langId);
bool WriteDefaultDictionary();
std::vector<Dict> Dictionaries();