diff --git a/src/dialogs/preferences/AppearanceOptionsWidget.cpp b/src/dialogs/preferences/AppearanceOptionsWidget.cpp index ebf0d4c1..ff4d9cd8 100644 --- a/src/dialogs/preferences/AppearanceOptionsWidget.cpp +++ b/src/dialogs/preferences/AppearanceOptionsWidget.cpp @@ -61,9 +61,7 @@ AppearanceOptionsWidget::AppearanceOptionsWidget(PreferencesDialog *dialog) &AppearanceOptionsWidget::updateFontFromConfig); connect(ui->colorComboBox, &QComboBox::currentTextChanged, - this, [this](const QString &str) { - ui->editButton->setEnabled(ThemeWorker().isCustomTheme(str)); - }); + this, &AppearanceOptionsWidget::updateModificationButtons); } AppearanceOptionsWidget::~AppearanceOptionsWidget() {} @@ -90,7 +88,7 @@ void AppearanceOptionsWidget::updateThemeFromConfig(bool interfaceThemeChanged) } ui->themeComboBox->setCurrentIndex(currInterfaceThemeIndex); ui->colorComboBox->updateFromConfig(interfaceThemeChanged); - ui->editButton->setEnabled(ThemeWorker().isCustomTheme(ui->colorComboBox->currentText())); + updateModificationButtons(ui->colorComboBox->currentText()); } void AppearanceOptionsWidget::on_fontSelectionButton_clicked() @@ -245,6 +243,14 @@ void AppearanceOptionsWidget::onLanguageComboBoxCurrentIndexChanged(int index) qWarning() << tr("Cannot set language, not found in available ones"); } +void AppearanceOptionsWidget::updateModificationButtons(const QString& theme) +{ + bool editable = ThemeWorker().isCustomTheme(theme); + ui->editButton->setEnabled(editable); + ui->deleteButton->setEnabled(editable); + ui->renameButton->setEnabled(editable); +} + QIcon AppearanceOptionsWidget::getIconFromSvg(const QString& fileName, const QColor& after, const QColor& before) { QFile file(fileName); diff --git a/src/dialogs/preferences/AppearanceOptionsWidget.h b/src/dialogs/preferences/AppearanceOptionsWidget.h index d3d84845..8c1ed682 100644 --- a/src/dialogs/preferences/AppearanceOptionsWidget.h +++ b/src/dialogs/preferences/AppearanceOptionsWidget.h @@ -53,6 +53,8 @@ private slots: void on_editButton_clicked(); void onLanguageComboBoxCurrentIndexChanged(int index); + void updateModificationButtons(const QString& theme); + /** * @brief Changes all @a before colors in given @a fileName svg file to @a after