Git commit 958c25daeccbeec78eac6da2d93265c4ea70ca6f by Thomas Friedrichsmeier. Committed on 10/07/2024 at 20:43. Pushed by tfry into branch 'master'.
Allow plugins to read status of overwrite box on <browser> M +4 -0 doc/rkwardplugins/index.docbook M +3 -0 rkward/plugin/rkpluginbrowser.cpp https://invent.kde.org/education/rkward/-/commit/958c25daeccbeec78eac6da2d93265c4ea70ca6f diff --git a/doc/rkwardplugins/index.docbook b/doc/rkwardplugins/index.docbook index eb9f6bb13..87fc3fba1 100644 --- a/doc/rkwardplugins/index.docbook +++ b/doc/rkwardplugins/index.docbook @@ -3891,6 +3891,10 @@ Attributes: <term>selection</term> <listitem><para>Current text (selected file name) in the browser (string)</para></listitem> </varlistentry> + <varlistentry> + <term><parameter>overwrite</parameter></term> + <listitem><para>Whether the "overwrite" option is checked (boolean, read-only, i.e. you can read the state of the checkbox, but not change it, programatically)</para></listitem> + </varlistentry> </variablelist></para></listitem> </varlistentry> diff --git a/rkward/plugin/rkpluginbrowser.cpp b/rkward/plugin/rkpluginbrowser.cpp index 07168fca2..a6b4ca080 100644 --- a/rkward/plugin/rkpluginbrowser.cpp +++ b/rkward/plugin/rkpluginbrowser.cpp @@ -59,6 +59,9 @@ RKPluginBrowser::RKPluginBrowser (const QDomElement &element, RKComponent *paren connect (overwrite_confirm, &QCheckBox::toggled, this, &RKPluginBrowser::validateInput); vbox->addWidget (overwrite_confirm); overwrite_confirm->setVisible (mode == GetFileNameWidget::SaveFile); + auto overwrite_prop = new RKComponentPropertyBool(this, true); + addChild("overwrite", overwrite_prop); + connect(overwrite_confirm, &QCheckBox::toggled, overwrite_prop, [overwrite_prop](bool checked) { if (checked != overwrite_prop->boolValue()) overwrite_prop->setBoolValue(checked); }); validation_timer.setSingleShot (true); connect (&validation_timer, &QTimer::timeout, this, &RKPluginBrowser::validateInput);
