Hello there,

My name is Hans and I am a user of LyX. I would like to contribute to
the project. As I have some experience with C++ and Object Orientated
programming, the first thing I did was looking at an existing bug,
which was a GUI Dialog synchronization bug,
http://www.lyx.org/trac/ticket/8177

During this endeavor, I encountered another small bug, which is in the
general inset parameter dialog, InsetParamsDialog: the "New
Inset"-button is enabled even on read-only documents. To reproduce
(Lyx 2.1.0svn): go to menu `Help` - Open the `Introduction` - Section
2: `Navigating the Documentation` - Click on `Hyperlink:
lyx-d...@lists.lyx.org'.

The following patch resolves this bug:


@@ -179,10 +179,11 @@ docstring InsetParamsDialog::checkWidgets(bool immediate)

        okPB->setEnabled(!immediate && widget_ok && !read_only && 
valid_argument);
        bool const can_be_restored = !immediate && !read_only
                        && ins && (ins != d->inset_ || d->changed_);
        restorePB->setEnabled(can_be_restored);
+       newPB->setEnabled(widget_ok && !read_only && valid_argument);
        applyPB->setEnabled(!immediate && lfun_ok && widget_ok && !read_only
&& valid_argument);
        d->widget_->setEnabled(!read_only);
        synchronizedCB->setEnabled(!immediate);
        return argument;
 }


Note that I did not include `!immediate` in the Boolean expression, as
that variable only applies to changes already applied to the current
inset and does not change the insertion-behavior of a new inset.


Is there a reason the InsetParamsDialog doesn't use the
ButtonController, i.e. by inheriting from GuiDialog? Most of
InsetParamsDialog's implementation is a duplicate of
ButtonController's implementation. As such, both InsetParamsDialog and
ButtonController serve the same purpose, except that InsetParamsDialog
only supports one QLineEdit widget and associated QLabel. The
ButtonController is part of a GuiDialog, and InsetParamsDialog is not
a GuiDialog. I think InsetParamsDialog should also inherit from
GuiDialog to enhance maintainability and would like to take on this
task.


Regards,

Hans

Reply via email to