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:
@@ -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;
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user