Commit 6875bb4c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Merge remote-tracking branch 'origin/release/21.04'

parents 9fc82d78 b0ea197e
Pipeline #67788 canceled with stage
......@@ -66,7 +66,9 @@ LanguageToolConfigWidget::LanguageToolConfigWidget(QWidget *parent)
refreshButton->setToolTip(i18n("Refresh"));
languageLayout->addWidget(refreshButton);
connect(refreshButton, &QToolButton::clicked, this, [this]() {
mLanguageToolUpdateCombobox->checkListOfLanguagesFromSpecificPath(mInstancePath->text());
if (LanguageToolManager::self()->allowToGetListOfLanguages()) {
mLanguageToolUpdateCombobox->checkListOfLanguagesFromSpecificPath(mInstancePath->text());
}
});
mainLayout->addLayout(languageLayout);
......
......@@ -122,3 +122,8 @@ void LanguageToolManager::setUseLocalInstance(bool useLocalInstance)
{
mUseLocalInstance = useLocalInstance;
}
bool LanguageToolManager::allowToGetListOfLanguages() const
{
return mUseLocalInstance;
}
......@@ -41,6 +41,8 @@ public:
Q_REQUIRED_RESULT QColor grammarColorForError(const QString &error);
Q_REQUIRED_RESULT bool allowToGetListOfLanguages() const;
private:
Q_DISABLE_COPY(LanguageToolManager)
QHash<QString, QColor> mGrammarColor;
......
......@@ -25,7 +25,9 @@ LanguageToolResultWidget::LanguageToolResultWidget(QWidget *parent)
addExtraWidget();
mLanguageToolUpdateCombobox->setLanguageToolCombobox(mLanguageToolComboBox);
mLanguageToolUpdateCombobox->setParentWidget(this);
mLanguageToolUpdateCombobox->refreshListOfLanguages();
if (LanguageToolManager::self()->allowToGetListOfLanguages()) {
mLanguageToolUpdateCombobox->refreshListOfLanguages();
}
}
LanguageToolResultWidget::~LanguageToolResultWidget()
......
......@@ -37,12 +37,9 @@ void LanguageToolUpdateComboBox::checkListOfLanguagesFromSpecificPath(const QStr
void LanguageToolUpdateComboBox::refreshListOfLanguages()
{
auto job = new LanguageToolGetListOfLanguageJob(this);
job->setUrl(LanguageToolManager::self()->languageToolLanguagesPath());
job->setNetworkAccessManager(LanguageToolManager::self()->networkAccessManager());
connect(job, &LanguageToolGetListOfLanguageJob::finished, this, &LanguageToolUpdateComboBox::slotGetLanguagesFinished);
connect(job, &LanguageToolGetListOfLanguageJob::error, this, &LanguageToolUpdateComboBox::slotGetLanguagesError);
job->start();
if (LanguageToolManager::self()->allowToGetListOfLanguages()) {
checkListOfLanguagesFromSpecificPath(LanguageToolManager::self()->languageToolLanguagesPath());
}
}
QWidget *LanguageToolUpdateComboBox::parentWidget() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment