src/EditRecipe.cpp

changeset 171
6cd2d808d863
parent 169
541ddf3edb10
child 249
3c28dc8dd51d
--- a/src/EditRecipe.cpp	Wed Apr 27 13:07:54 2022 +0200
+++ b/src/EditRecipe.cpp	Thu Apr 28 13:08:20 2022 +0200
@@ -683,6 +683,7 @@
     connect(ui->est_ogEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::est_og_changed);
     connect(ui->color_methodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::colormethod_changed);
     connect(ui->ibu_methodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::ibumethod_changed);
+    connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditRecipe::locked_changed);
 
     // All signals from tab "Fermentables"
     ui->fermentablesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
@@ -733,8 +734,10 @@
     connect(ui->sp_acidtypeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::sp_type_changed);
     connect(ui->sp_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::sp_ph_changed);
 
+    setLocked(recipe->locked);
+
     ui->saveButton->setEnabled(false);
-    ui->deleteButton->setEnabled((id >= 0) ? true:false);
+    ui->deleteButton->setEnabled((id >= 0 && ! recipe->locked) ? true:false);
 
     emit refreshAll();
 }
@@ -1171,7 +1174,7 @@
 void EditRecipe::is_changed()
 {
     ui->saveButton->setEnabled(true);
-    ui->deleteButton->setEnabled((this->recno >= 0) ? true:false);
+    ui->deleteButton->setEnabled(((this->recno >= 0) ? true:false) && ! recipe->locked);
     this->textIsChanged = true;
     WindowTitle();
 }

mercurial