Set default lang only if index received

This commit is contained in:
Philipp David 2022-01-17 09:49:47 +01:00
parent b9beb3c7d2
commit 83e1dd285a
No known key found for this signature in database
GPG Key ID: 967A5D5EB5071577

View File

@ -169,10 +169,22 @@ TranslationsModel::~TranslationsModel()
void TranslationsModel::translationDirChanged(const QString& path) void TranslationsModel::translationDirChanged(const QString& path)
{ {
qDebug() << "Dir changed:" << path; qDebug() << "Dir changed:" << path;
reloadLocalFiles(); if (!d->no_language_set)
{
reloadLocalFiles();
}
selectLanguage(selectedLanguage());
}
void TranslationsModel::indexReceived()
{
qDebug() << "Got translations index!";
d->m_index_job.reset();
if (d->no_language_set) if (d->no_language_set)
{ {
reloadLocalFiles();
auto language = d->m_system_locale; auto language = d->m_system_locale;
if (!findLanguage(language)) if (!findLanguage(language))
{ {
@ -186,17 +198,8 @@ void TranslationsModel::translationDirChanged(const QString& path)
APPLICATION->settings()->set("Language", selectedLanguage()); APPLICATION->settings()->set("Language", selectedLanguage());
d->no_language_set = false; d->no_language_set = false;
} }
else
{
selectLanguage(selectedLanguage());
}
}
void TranslationsModel::indexReceived() else if(d->m_selectedLanguage != defaultLangCode)
{
qDebug() << "Got translations index!";
d->m_index_job.reset();
if(d->m_selectedLanguage != defaultLangCode)
{ {
downloadTranslation(d->m_selectedLanguage); downloadTranslation(d->m_selectedLanguage);
} }