[education/rkward] rkward: Partially fix package intallation dialog buttons. This still needs some cleanups.
Thomas Friedrichsmeier
null at kde.org
Sun May 1 22:14:09 BST 2022
Git commit 21618af825ba0ddb2cb7d1f7b4e5530eb39476dd by Thomas Friedrichsmeier.
Committed on 01/05/2022 at 21:13.
Pushed by tfry into branch 'master'.
Partially fix package intallation dialog buttons. This still needs some cleanups.
M +3 -2 rkward/dialogs/rkloadlibsdialog.cpp
M +0 -1 rkward/misc/rkprogresscontrol.cpp
M +7 -1 rkward/misc/rkprogresscontrol.h
https://invent.kde.org/education/rkward/commit/21618af825ba0ddb2cb7d1f7b4e5530eb39476dd
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 78b40681..e49139c1 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -50,7 +50,9 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
setFaceType (KPageDialog::Tabbed);
setModal (modal);
setWindowTitle (i18n ("Configure Packages"));
- setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
+ setStandardButtons (QDialogButtonBox::Apply);
+ auto button = buttonBox()->addButton(i18n("Close"), QDialogButtonBox::NoRole); // Not using standard close button, as that will call reject
+ connect(button, &QPushButton::clicked, this, &RKLoadLibsDialog::close);
LoadUnloadWidget *luwidget = new LoadUnloadWidget (this);
addChild (luwidget, i18n ("Load / Unload R packages"));
@@ -85,7 +87,6 @@ KPageWidgetItem* RKLoadLibsDialog::addChild (QWidget *child_page, const QString
RK_TRACE (DIALOGS);
// TODO: Can't convert these signal/slot connections to new syntax, without creating a common base class for the child pages
- connect (this, SIGNAL (accepted()), child_page, SLOT (ok()));
connect (button (QDialogButtonBox::Apply), SIGNAL (clicked(bool)), child_page, SLOT (apply()));
connect (this, SIGNAL(rejected()), child_page, SLOT (cancel()));
connect (child_page, &QObject::destroyed, this, &RKLoadLibsDialog::childDeleted);
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index e7331a05..1147c6bb 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -428,7 +428,6 @@ void RKInlineProgressControl::setCloseAction(const QString &label) {
void RKInlineProgressControl::cancelAndClose() {
RK_TRACE(MISC);
- display_area->window()->removeEventFilter(this);
for (int i = 0; i < unfinished_commands.size(); ++i) {
RInterface::instance()->cancelCommand(unfinished_commands[i]);
}
diff --git a/rkward/misc/rkprogresscontrol.h b/rkward/misc/rkprogresscontrol.h
index 53592664..2f5deae3 100644
--- a/rkward/misc/rkprogresscontrol.h
+++ b/rkward/misc/rkprogresscontrol.h
@@ -24,6 +24,7 @@ class RKProgressControlDialog;
This class is a functional combination of the older RKCancelDialog and RKErrorDialog classes. Depending on the selected mode it can be used to allow the user to cancel running actions, to display errors / warning / regular output, only when errors occur or also during normal progress, etc. It provides facilities to get output from an RCommand directly, or you can manually submit output fragments via newOutput and newError.
Note that this class is not a dialog in itself. Rather, a dialog is only created, if / when it is actually needed.
TODO: This and RKwatch should use a common means of displaying the output to achieve a common look and feel.
+TODO: Remove in favor of RKInlineProgressControl ?
@author Thomas Friedrichsmeier
*/
@@ -102,7 +103,12 @@ class QAction;
class RKInlineProgressControl : public QObject {
public:
-/** @param allow_cancel Whether the operation may be cancelled. If true, a cancel button will be added. If false, will also prevent the parent dialog from being closed. Default: true */
+/** A modernized and trimmed down version of RKProgressControl that can be shown as an overlay to an existing widget, instead of as a separate dialog.
+ *
+ * The progress control self-destructs after it was closed (or after the last associated command has finished, if setAutoCloseWhenCommandsDone() ).
+ * Thus, the basic usage rules are: Always create a new progress control for a new operation. Don't access after calling show(), and no need to delete.
+ *
+ * @param allow_cancel Whether the operation may be cancelled. If true, a cancel button will be added. If false, will also prevent the parent dialog from being closed. */
RKInlineProgressControl(QWidget *display_area, bool allow_cancel);
~RKInlineProgressControl();
void addRCommand(RCommand *command);
More information about the rkward-tracker
mailing list