[LyX/master] Properly disable Apply/OK in InsetParamsDialog (#11440)

Juergen Spitzmueller spitz at lyx.org
Thu Jan 7 12:28:08 UTC 2021


commit e947cdab3ea8f91206b71f187e75fd4d244a02c9
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Jan 7 13:28:10 2021 +0100

    Properly disable Apply/OK in InsetParamsDialog (#11440)
---
 src/frontends/qt/InsetParamsDialog.cpp |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/frontends/qt/InsetParamsDialog.cpp b/src/frontends/qt/InsetParamsDialog.cpp
index ebac60b..d2c0cae 100644
--- a/src/frontends/qt/InsetParamsDialog.cpp
+++ b/src/frontends/qt/InsetParamsDialog.cpp
@@ -193,14 +193,16 @@ docstring InsetParamsDialog::checkWidgets(bool immediate)
 		? d->widget_->creationCode() : LFUN_INSET_MODIFY;
 	bool const lfun_ok = lyx::getStatus(FuncRequest(code, argument)).enabled();
 
+	bool const changed_inset = ins && (ins != d->inset_ || d->changed_);
 	buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!immediate && widget_ok
-							    && !read_only && valid_argument);
-	bool const can_be_restored = !immediate && !read_only
-			&& ins && (ins != d->inset_ || d->changed_);
+							    && !read_only && valid_argument
+							    && (!ins || changed_inset));
+	bool const can_be_restored = !immediate && !read_only && changed_inset;
 	buttonBox->button(QDialogButtonBox::Reset)->setEnabled(can_be_restored);
-	buttonBox->button(QDialogButtonBox::Apply)->setEnabled(ins && !immediate
+	buttonBox->button(QDialogButtonBox::Apply)->setEnabled(!immediate
 							       && lfun_ok && widget_ok
-							       && !read_only && valid_argument);
+							       && !read_only && valid_argument
+							       && changed_inset);
 	immediateApplyCB->setEnabled(ins && !read_only);
 	// This seems to be the only way to access custom buttons
 	QList<QAbstractButton*> buttons = buttonBox->buttons();


More information about the lyx-cvs mailing list