[education/rkward] rkward: Update legacy SLOT connections
Thomas Friedrichsmeier
null at kde.org
Sun May 12 16:29:42 BST 2024
Git commit 9dc1b1defd9ad60f37ea1c8a47f4ee5b52e36769 by Thomas Friedrichsmeier.
Committed on 12/05/2024 at 15:19.
Pushed by tfry into branch 'master'.
Update legacy SLOT connections
M +1 -1 rkward/agents/rkprintagent.cpp
M +3 -3 rkward/dataeditor/rkvareditmodel.cpp
M +29 -29 rkward/dataeditor/twintable.cpp
M +2 -2 rkward/dialogs/rkloadlibsdialog.cpp
M +1 -1 rkward/dialogs/rkreadlinedialog.cpp
M +1 -1 rkward/misc/celleditor.cpp
M +1 -1 rkward/misc/editformatdialog.cpp
M +4 -4 rkward/misc/editlabelsdialog.cpp
M +1 -1 rkward/misc/rksaveobjectchooser.cpp
M +2 -2 rkward/misc/rkspinbox.cpp
M +1 -1 rkward/plugin/rkcomponentcontext.cpp
M +1 -1 rkward/plugin/rkcomponentmap.cpp
M +7 -7 rkward/plugin/rkmatrixinput.cpp
M +3 -3 rkward/plugin/rkstandardcomponent.cpp
M +2 -2 rkward/plugin/rkstandardcomponentgui.cpp
M +1 -1 rkward/rbackend/rkrbackendprotocol_backend.cpp
M +1 -1 rkward/rbackend/rktransmitter.cpp
M +17 -17 rkward/rkconsole.cpp
M +18 -28 rkward/rkward.cpp
M +0 -4 rkward/rkward.h
M +1 -1 rkward/scriptbackends/qtscriptbackend.cpp
M +2 -2 rkward/windows/detachedwindowcontainer.cpp
M +1 -1 rkward/windows/rkcodecompletion.cpp
M +8 -32 rkward/windows/rkcommandeditorwindow.cpp
M +4 -4 rkward/windows/rkcommandeditorwindow.h
M +4 -4 rkward/windows/rkcommandlog.cpp
M +14 -14 rkward/windows/rkhtmlwindow.cpp
M +3 -3 rkward/windows/rkmdiwindow.cpp
M +14 -14 rkward/windows/rktoplevelwindowgui.cpp
M +21 -21 rkward/windows/rkwindowcatcher.cpp
M +4 -4 rkward/windows/rkworkplaceview.cpp
https://invent.kde.org/education/rkward/-/commit/9dc1b1defd9ad60f37ea1c8a47f4ee5b52e36769
diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index 926855400..81dec957c 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -88,7 +88,7 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
ts.start();
printaction->trigger();
if (ts.elapsed() < 5000) {
- QTimer::singleShot (1800000, agent, SLOT (deleteLater()));
+ QTimer::singleShot(1800000, agent, &QObject::deleteLater);
} else {
agent->deleteLater ();
}
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index 51e661361..09a27ec14 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -93,7 +93,7 @@ void RKVarEditModel::checkDuplicates () {
if (duplicate_check_triggered) return;
duplicate_check_triggered = true;
- QTimer::singleShot (0, this, SLOT (checkDuplicatesNow()));
+ QTimer::singleShot(0, this, &RKVarEditModel::checkDuplicatesNow);
}
void RKVarEditModel::checkDuplicatesNow () {
@@ -131,8 +131,8 @@ void RKVarEditModel::scheduleReset () {
if (!reset_scheduled) {
reset_scheduled = true;
- QTimer::singleShot (0, this, SLOT (doResetNow()));
- beginResetModel ();
+ QTimer::singleShot(0, this, &RKVarEditModel::doResetNow);
+ beginResetModel();
}
}
diff --git a/rkward/dataeditor/twintable.cpp b/rkward/dataeditor/twintable.cpp
index 832485c36..35db3af8a 100644
--- a/rkward/dataeditor/twintable.cpp
+++ b/rkward/dataeditor/twintable.cpp
@@ -96,48 +96,48 @@ TwinTable::~TwinTable() {
void TwinTable::initActions () {
RK_TRACE (EDITOR);
- editCut = actionCollection ()->addAction (KStandardAction::Cut, "cut", this, SLOT(cut()));
+ editCut = actionCollection()->addAction(KStandardAction::Cut, "cut", this, &TwinTable::cut);
editCut->setWhatsThis(i18n("Cuts the selected section and puts it to the clipboard"));
- editCopy = actionCollection ()->addAction (KStandardAction::Copy, "copy", this, SLOT(copy()));
+ editCopy = actionCollection()->addAction (KStandardAction::Copy, "copy", this, &TwinTable::copy);
editCopy->setWhatsThis(i18n("Copies the selected section to the clipboard"));
// editor->editActions ()->addAction (editCopy); // this is a read-only action, not an "edit" action
- editPaste = actionCollection ()->addAction (KStandardAction::Paste, "paste", this, SLOT(paste()));
+ editPaste = actionCollection()->addAction(KStandardAction::Paste, "paste", this, qOverload<>(&TwinTable::paste));
editPaste->setWhatsThis(i18n("Pastes the clipboard contents to current position"));
- editPasteToTable = actionCollection ()->addAction ("paste_to_table", this, SLOT(pasteToTable()));
- editPasteToTable->setText (i18n("Paste inside table"));
- editPasteToTable->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionPasteInsideTable));
+ editPasteToTable = actionCollection()->addAction("paste_to_table", this, &TwinTable::pasteToTable);
+ editPasteToTable->setText(i18n("Paste inside table"));
+ editPasteToTable->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionPasteInsideTable));
editPasteToTable->setWhatsThis(i18n("Pastes the clipboard contents to current position, but not beyond the table's boundaries"));
- editPasteToSelection = actionCollection ()->addAction ("paste_to_selection", this, SLOT(pasteToSelection()));
- editPasteToSelection->setText (i18n("Paste inside selection"));
- editPasteToSelection->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionPasteInsideSelection));
+ editPasteToSelection = actionCollection()->addAction("paste_to_selection", this, &TwinTable::pasteToSelection);
+ editPasteToSelection->setText(i18n("Paste inside selection"));
+ editPasteToSelection->setIcon(RKStandardIcons::getIcon (RKStandardIcons::ActionPasteInsideSelection));
editPasteToSelection->setWhatsThis(i18n("Pastes the clipboard contents to current position, but not beyond the boundaries of the current selection"));
// header menus
- action_insert_col_left = actionCollection ()->addAction ("insert_col_left", this, SLOT (insertColumn()));
- action_insert_col_left->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionInsertVar));
- action_delete_col = actionCollection ()->addAction ("delete_col", this, SLOT (deleteColumn()));
- action_delete_col->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDeleteVar));
-
- action_insert_row_above = actionCollection ()->addAction ("insert_row_above", this, SLOT (insertRow()));
- action_insert_row_above->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionInsertRow));
- action_delete_row = actionCollection ()->addAction ("delete_row", this, SLOT (deleteRow()));
- action_delete_row->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDeleteRow));
- action_delete_rows = actionCollection ()->addAction ("delete_rows", this, SLOT (deleteSelectedRows()));
- action_delete_rows->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDeleteRow));
+ action_insert_col_left = actionCollection()->addAction("insert_col_left", this, &TwinTable::insertColumn);
+ action_insert_col_left->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionInsertVar));
+ action_delete_col = actionCollection()->addAction("delete_col", this, &TwinTable::deleteColumn);
+ action_delete_col->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionDeleteVar));
+
+ action_insert_row_above = actionCollection()->addAction("insert_row_above", this, &TwinTable::insertRow);
+ action_insert_row_above->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionInsertRow));
+ action_delete_row = actionCollection()->addAction("delete_row", this, &TwinTable::deleteRow);
+ action_delete_row->setIcon(RKStandardIcons::getIcon (RKStandardIcons::ActionDeleteRow));
+ action_delete_rows = actionCollection()->addAction("delete_rows", this, &TwinTable::deleteSelectedRows);
+ action_delete_rows->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionDeleteRow));
// global actions
- action_show_rownames = actionCollection ()->addAction ("show_rownames", this, SLOT (showRownames(bool)));
- action_show_rownames->setText (i18n("Show / Edit row names"));
- action_show_rownames->setCheckable (true);
- action_enable_editing = actionCollection ()->addAction ("enable_editing", this, SLOT (enableEditing(bool)));
- action_enable_editing->setText (i18n("Enable editing"));
- action_enable_editing->setCheckable (true);
+ action_show_rownames = actionCollection()->addAction("show_rownames", this, &TwinTable::showRownames);
+ action_show_rownames->setText(i18n("Show / Edit row names"));
+ action_show_rownames->setCheckable(true);
+ action_enable_editing = actionCollection()->addAction ("enable_editing", this, &TwinTable::enableEditing);
+ action_enable_editing->setText(i18n("Enable editing"));
+ action_enable_editing->setCheckable(true);
// these actually do the same thing, but are designed to work well in the toolbar
- QActionGroup *lockactions = new QActionGroup (this);
- lockactions->setExclusive (true);
- action_tb_lock_editing = new KToggleAction (i18nc ("verb: switch to read-only state. Make this short.", "Lock"), this);
+ QActionGroup *lockactions = new QActionGroup(this);
+ lockactions->setExclusive(true);
+ action_tb_lock_editing = new KToggleAction(i18nc("verb: switch to read-only state. Make this short.", "Lock"), this);
action_tb_lock_editing->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionLock));
action_tb_lock_editing->setActionGroup (lockactions);
action_tb_lock_editing->setWhatsThis(i18n ("Disable editing (to prevent accidental modification of data)"));
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index cfe1d33af..0c4efd18d 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -63,8 +63,8 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
configure_pluginmaps_pageitem = addChild (new RKPluginMapSelectionWidget (this), i18n ("Manage RKWard Plugins"));
- connect (this, &KPageDialog::currentPageChanged, this, &RKLoadLibsDialog::slotPageChanged);
- QTimer::singleShot (0, this, SLOT (slotPageChanged()));
+ connect(this, &KPageDialog::currentPageChanged, this, &RKLoadLibsDialog::slotPageChanged);
+ QTimer::singleShot(0, this, [this](){ slotPageChanged(); });
RCommand *command = new RCommand(".libPaths()", RCommand::App | RCommand::GetStringVector);
connect(command->notifier(), &RCommandNotifier::commandFinished, this, [this](RCommand *command) {
diff --git a/rkward/dialogs/rkreadlinedialog.cpp b/rkward/dialogs/rkreadlinedialog.cpp
index 07d778c6d..7482bef0d 100644
--- a/rkward/dialogs/rkreadlinedialog.cpp
+++ b/rkward/dialogs/rkreadlinedialog.cpp
@@ -82,7 +82,7 @@ bool RKReadLineDialog::readLine (QWidget *parent, const QString &caption, const
RKReadLineDialog *dialog = new RKReadLineDialog (parent, caption, prompt, command);
if (!stored_geom.isNull ()) dialog->restoreGeometry (stored_geom);
- QTimer::singleShot (0, dialog->input, SLOT(setFocus()));
+ QTimer::singleShot(0, dialog, [dialog](){ dialog->input->setFocus(); });
int res = dialog->exec ();
*result = dialog->input->text ();
stored_geom = dialog->saveGeometry ();
diff --git a/rkward/misc/celleditor.cpp b/rkward/misc/celleditor.cpp
index 27e5cb286..38a526bdd 100644
--- a/rkward/misc/celleditor.cpp
+++ b/rkward/misc/celleditor.cpp
@@ -50,7 +50,7 @@ void CellEditor::setValueLabels (const RObject::ValueLabels& labels) {
}
connect (value_list, &QMenu::triggered, this, &CellEditor::selectedFromList);
- QTimer::singleShot (200, this, SLOT (showValueLabels()));
+ QTimer::singleShot(200, this, &CellEditor::showValueLabels);
}
void CellEditor::selectedFromList (QAction* action) {
diff --git a/rkward/misc/editformatdialog.cpp b/rkward/misc/editformatdialog.cpp
index 8b568f758..961992b67 100644
--- a/rkward/misc/editformatdialog.cpp
+++ b/rkward/misc/editformatdialog.cpp
@@ -122,7 +122,7 @@ void EditFormatDialogProxy::initialize (const RKVariable::FormattingOptions& opt
dialog->initialize (options, varname);
connect (dialog, &QDialog::finished, this, &EditFormatDialogProxy::dialogDone);
- QTimer::singleShot (0, dialog, SLOT (exec()));
+ QTimer::singleShot(0, dialog, &EditFormatDialog::exec);
}
void EditFormatDialogProxy::dialogDone (int result) {
diff --git a/rkward/misc/editlabelsdialog.cpp b/rkward/misc/editlabelsdialog.cpp
index 67b02f25a..c40fa17d4 100644
--- a/rkward/misc/editlabelsdialog.cpp
+++ b/rkward/misc/editlabelsdialog.cpp
@@ -35,9 +35,9 @@ RKVarLevelsTable::RKVarLevelsTable (QWidget *parent, const RObject::ValueLabels&
verticalHeader ()->setFixedWidth (40);
setMinimumWidth (80);
- addAction (KStandardAction::cut (this, SLOT (cut()), this));
- addAction (KStandardAction::copy (this, SLOT (copy()), this));
- addAction (KStandardAction::paste (this, SLOT (paste()), this));
+ addAction(KStandardAction::cut(this, &RKVarLevelsTable::cut, this));
+ addAction(KStandardAction::copy(this, &RKVarLevelsTable::copy, this));
+ addAction(KStandardAction::paste(this, &RKVarLevelsTable::paste, this));
setContextMenuPolicy (Qt::ActionsContextMenu);
setModel (lmodel = new RKVarLevelsTableModel (labels, this));
@@ -244,7 +244,7 @@ void EditLabelsDialogProxy::initialize (const RObject::ValueLabels& labels, cons
dialog = new EditLabelsDialog (this, labels, varname);
connect (dialog, &QDialog::finished, this, &EditLabelsDialogProxy::dialogDone);
- QTimer::singleShot (0, dialog, SLOT (exec()));
+ QTimer::singleShot(0, dialog, &EditLabelsDialog::exec);
}
void EditLabelsDialogProxy::dialogDone (int result) {
diff --git a/rkward/misc/rksaveobjectchooser.cpp b/rkward/misc/rksaveobjectchooser.cpp
index 24af3cbe7..317a44e49 100644
--- a/rkward/misc/rksaveobjectchooser.cpp
+++ b/rkward/misc/rksaveobjectchooser.cpp
@@ -133,7 +133,7 @@ void RKSaveObjectChooser::objectRemoved (RObject* removed) {
} else if (removed == current_object) {
stopListenForObject (removed);
current_full_name.clear (); // hack to achieve proper Q_EMIT of change signal
- QTimer::singleShot (0, this, SLOT (updateState()));
+ QTimer::singleShot(0, this, &RKSaveObjectChooser::updateState);
} else {
RK_ASSERT (false);
}
diff --git a/rkward/misc/rkspinbox.cpp b/rkward/misc/rkspinbox.cpp
index 4904b5f7b..a6b9036aa 100644
--- a/rkward/misc/rkspinbox.cpp
+++ b/rkward/misc/rkspinbox.cpp
@@ -66,7 +66,7 @@ int RKSpinBox::valueFromText (const QString & text) const {
if (ok && (new_value != real_value)) {
double *cheat = const_cast<double*> (&real_value);
*cheat = new_value;
- QTimer::singleShot (0, const_cast<RKSpinBox*>(this), SLOT (emitValueChange()));
+ QTimer::singleShot(0, const_cast<RKSpinBox*>(this), &RKSpinBox::emitValueChange);
}
return 0;
} else {
@@ -75,7 +75,7 @@ int RKSpinBox::valueFromText (const QString & text) const {
if (ok && (new_value != int_value)) {
int *cheat = const_cast<int*> (&int_value);
*cheat = new_value;
- QTimer::singleShot (0, const_cast<RKSpinBox*>(this), SLOT (emitValueChange()));
+ QTimer::singleShot(0, const_cast<RKSpinBox*>(this), &RKSpinBox::emitValueChange);
}
return 0;
}
diff --git a/rkward/plugin/rkcomponentcontext.cpp b/rkward/plugin/rkcomponentcontext.cpp
index a7b3e857e..76230e450 100644
--- a/rkward/plugin/rkcomponentcontext.cpp
+++ b/rkward/plugin/rkcomponentcontext.cpp
@@ -46,7 +46,7 @@ RKContextHandler::~RKContextHandler () {
void RKContextHandler::addAction (const QString &id, RKComponentHandle *handle) {
RK_TRACE (PLUGIN);
- QAction *action = actionCollection ()->addAction (id, this, SLOT (componentActionActivated()));
+ QAction *action = actionCollection()->addAction(id, this, &RKContextHandler::componentActionActivated);
action->setText (handle->getLabel ());
action_map.insert (action, handle);
}
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index 6e553e798..3f826bdf6 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -710,7 +710,7 @@ void RKComponentMap::addedEntry (const QString &id, RKComponentHandle *handle) {
RK_TRACE (PLUGIN);
handle->setAccessible (true);
- QAction *action = actionCollection ()->addAction (id, this, SLOT (activateComponent()));
+ QAction *action = actionCollection()->addAction(id, this, &RKComponentMap::activateComponent);
action->setText (handle->getLabel ());
actionCollection ()->setShortcutsConfigurable (action, true);
}
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index bf0de4b67..f2bb18d65 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -94,13 +94,13 @@ RKMatrixInput::RKMatrixInput (const QDomElement& element, RKComponent* parent_co
}
// define standard actions
- QAction *cut = KStandardAction::cut (this, SLOT (cut()), this);
- display->addAction (cut);
- QAction *copy = KStandardAction::copy (this, SLOT (copy()), this);
- display->addAction (copy);
- QAction *paste = KStandardAction::paste (this, SLOT (paste()), this);
- display->addAction (paste);
- display->setContextMenuPolicy (Qt::ActionsContextMenu);
+ QAction *cut = KStandardAction::cut(this, &RKMatrixInput::cut, this);
+ display->addAction(cut);
+ QAction *copy = KStandardAction::copy(this, &RKMatrixInput::copy, this);
+ display->addAction(copy);
+ QAction *paste = KStandardAction::paste(this, &RKMatrixInput::paste, this);
+ display->addAction(paste);
+ display->setContextMenuPolicy(Qt::ActionsContextMenu);
display->setRKItemDelegate (new RKItemDelegate (display, model, true));
connect (display, &RKTableView::blankSelectionRequest, this, &RKMatrixInput::clearSelectedCells);
diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp
index 4bcb471fa..51a98c037 100644
--- a/rkward/plugin/rkstandardcomponent.cpp
+++ b/rkward/plugin/rkstandardcomponent.cpp
@@ -348,7 +348,7 @@ void RKStandardComponent::buildAndInitialize (const QDomElement &doc_element, co
if (gui && (!enslaved)) {
// somehow, when switching the interface, and we show before the old GUI has been fully deleted (it is deleted via deleteLater (), then there may be strange graphical glitches until the GUI is first redrawn completely.
// Likely a difficult bug in Qt. Delaying the show until the next event loop solves the problem.
- QTimer::singleShot (0, gui, SLOT (show()));
+ QTimer::singleShot(0, gui, [this]() { gui->show(); });
}
changed ();
Q_EMIT standardInitializationComplete();
@@ -386,7 +386,7 @@ void RKStandardComponent::close () {
RK_TRACE (PLUGIN);
if (gui && (!parentComponent ())) {
- QTimer::singleShot (0, gui, SLOT (close()));
+ QTimer::singleShot(0, gui, [this]() { gui->close(); });
} else {
RK_ASSERT (false);
}
@@ -401,7 +401,7 @@ void RKStandardComponent::changed () {
// don't trigger update twice
if (!update_pending) {
update_pending = true;
- QTimer::singleShot (0, this, SLOT (handleChange()));
+ QTimer::singleShot(0, this, [this](){ handleChange(); });
}
}
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 907af957e..79c85f221 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -150,7 +150,7 @@ RKStandardComponentGUI::RKStandardComponentGUI (RKStandardComponent *component,
area->setWindow(code_display);
KActionCollection *action_collection = new KActionCollection (this);
- action_collection->addAction (KStandardAction::Copy, this, SLOT (copyCode()));
+ action_collection->addAction(KStandardAction::Copy, "copy", this, &RKStandardComponentGUI::copyCode);
}
}
@@ -297,7 +297,7 @@ void RKStandardComponentGUI::showEvent (QShowEvent *e) {
setMinimumSize (min.expandedTo (QSize (50, 50)));
if (toggle_code_box) { // this is a dialog, not wizard
- QTimer::singleShot (0, this, SLOT (doPostShowCleanup()));
+ QTimer::singleShot(0, this, &RKStandardComponentGUI::doPostShowCleanup);
}
}
diff --git a/rkward/rbackend/rkrbackendprotocol_backend.cpp b/rkward/rbackend/rkrbackendprotocol_backend.cpp
index cf0d0623b..b4882daef 100644
--- a/rkward/rbackend/rkrbackendprotocol_backend.cpp
+++ b/rkward/rbackend/rkrbackendprotocol_backend.cpp
@@ -125,7 +125,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#endif
RKRBackendTransmitter transmitter (servername, token);
- RKRBackendProtocolBackend::p_transmitter = &transmitter; // cppcheck-suppress danglingReference ; -> valid for the lifetime of the backend
+ RKRBackendProtocolBackend::p_transmitter = &transmitter; // cppcheck-suppress danglingLifetime ; -> valid for the lifetime of the backend
RKRBackendProtocolBackend backend (data_dir, rkd_server_name);
transmitter.start ();
RKRBackend::this_pointer->run (locale_dir);
diff --git a/rkward/rbackend/rktransmitter.cpp b/rkward/rbackend/rktransmitter.cpp
index a39aadc2f..851352759 100644
--- a/rkward/rbackend/rktransmitter.cpp
+++ b/rkward/rbackend/rktransmitter.cpp
@@ -263,7 +263,7 @@ void RKAbstractTransmitter::setConnection (QLocalSocket *_connection) {
connect (connection, &QLocalSocket::disconnected, this, &RKAbstractTransmitter::disconnected);
// In case something is pending already.
- if (connection->bytesAvailable ()) QTimer::singleShot (0, this, SLOT (fetchTransmission()));
+ if (connection->bytesAvailable ()) QTimer::singleShot(0, this, &RKAbstractTransmitter::fetchTransmission);
}
void RKAbstractTransmitter::disconnected () {
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 98b5d7d42..7f6515463 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -857,35 +857,35 @@ void RKConsole::initializeActions (KActionCollection *ac) {
RKStandardActions::copyLinesToOutput (this, this, SLOT (copyLinesToOutput()));
RKStandardActions::functionHelp (this, this);
RKStandardActions::onlineHelp (this, this);
- run_selection_action = RKStandardActions::runCurrent (this, this, SLOT (runSelection()));
+ run_selection_action = RKStandardActions::runCurrent(this, this, SLOT (runSelection()));
- interrupt_command_action = ac->addAction ("interrupt", this, SLOT (resetConsole()));
- interrupt_command_action->setText (i18n ("Interrupt running command"));
- ac->setDefaultShortcut (interrupt_command_action, REAL_CTRL_KEY | Qt::Key_C);
- interrupt_command_action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionInterrupt));
- interrupt_command_action->setEnabled (false);
+ interrupt_command_action = ac->addAction("interrupt", this, &RKConsole::resetConsole);
+ interrupt_command_action->setText(i18n("Interrupt running command"));
+ ac->setDefaultShortcut(interrupt_command_action, REAL_CTRL_KEY | Qt::Key_C);
+ interrupt_command_action->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionInterrupt));
+ interrupt_command_action->setEnabled(false);
- copy_literal_action = ac->addAction ("rkconsole_copy_literal", this, SLOT (literalCopy()));
- ac->setDefaultShortcut (copy_literal_action, REAL_CMD_KEY | Qt::Key_C);
- copy_literal_action->setText (i18n ("Copy selection literally"));
+ copy_literal_action = ac->addAction("rkconsole_copy_literal", this, &RKConsole::literalCopy);
+ ac->setDefaultShortcut(copy_literal_action, REAL_CMD_KEY | Qt::Key_C);
+ copy_literal_action->setText(i18n("Copy selection literally"));
- copy_commands_action = ac->addAction ("rkconsole_copy_commands", this, SLOT (copyCommands()));
- copy_commands_action->setText (i18n ("Copy commands, only"));
+ copy_commands_action = ac->addAction("rkconsole_copy_commands", this, &RKConsole::copyCommands);
+ copy_commands_action->setText(i18n("Copy commands, only"));
RKStandardActions::pasteSpecial (this, this, SLOT (submitBatch(QString)));
- ac->addAction (KStandardAction::Clear, "rkconsole_clear", this, SLOT (clear()));
- paste_action = ac->addAction (KStandardAction::Paste, "rkconsole_paste", this, SLOT (paste()));
+ ac->addAction(KStandardAction::Clear, "rkconsole_clear", this, &RKConsole::clear);
+ paste_action = ac->addAction(KStandardAction::Paste, "rkconsole_paste", this, &RKConsole::paste);
addProxyAction ("file_print", i18n ("Print Console"));
addProxyAction ("file_export_html");
addProxyAction ("view_inc_font_sizes");
addProxyAction ("view_dec_font_sizes");
- QAction *action = ac->addAction ("loadhistory", this, SLOT (userLoadHistory()));
- action->setText (i18n ("Import command history..."));
- action = ac->addAction ("savehistory", this, SLOT (userSaveHistory()));
- action->setText (i18n ("Export command history..."));
+ QAction *action = ac->addAction("loadhistory", this, [this](){ userLoadHistory(); });
+ action->setText(i18n("Import command history..."));
+ action = ac->addAction("savehistory", this, [this](){ userSaveHistory(); });
+ action->setText(i18n("Export command history..."));
}
void RKConsole::pipeUserCommand (const QString &command) {
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 9dad43b1a..62d2159a0 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -93,7 +93,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
// This nevers gets called. It's needed to trick ld into linking correctly. Nothing else.
void bogusCalls () {
-#ifndef CCPCHECK_ONLY // it would rightfully complain about some of these
+#ifndef CPPCHECK_ONLY // it would rightfully complain about some of these
ShowEditTextFileAgent::showEditFiles(nullptr); // TODO: AAAAAAAARGGGH!!!! It won't link without this bogus line!!!
RKReadLineDialog::readLine(nullptr, QString(), QString(), nullptr, nullptr); // TODO: see above
RKSelectListDialog::doSelect(nullptr, QString(), QStringList(), QStringList(), false); // TODO: see above
@@ -177,7 +177,7 @@ RKWardMainWindow::RKWardMainWindow() : KParts::MainWindow() {
RKComponentMap::initialize ();
// stuff which should wait until the event loop is running
- QTimer::singleShot (0, this, SLOT (doPostInit()));
+ QTimer::singleShot(0, this, &RKWardMainWindow::doPostInit);
}
RKWardMainWindow::~RKWardMainWindow() {
@@ -476,16 +476,16 @@ void RKWardMainWindow::initActions() {
QAction *action;
// TODO: is there a way to insert actions between standard actions without having to give all standard actions custom ids?
- new_data_frame = actionCollection ()->addAction ("new_data_frame", this, SLOT (slotNewDataFrame()));
+ new_data_frame = actionCollection()->addAction("new_data_frame", this, &RKWardMainWindow::slotNewDataFrame);
new_data_frame->setText (i18n ("Dataset"));
new_data_frame->setIcon (RKStandardIcons::getIcon (RKStandardIcons::WindowDataFrameEditor));
new_data_frame->setWhatsThis(i18n ("Creates new empty dataset and opens it for editing"));
- new_command_editor = actionCollection ()->addAction (KStandardAction::New, "new_command_editor", this, SLOT(slotNewCommandEditor()));
+ new_command_editor = actionCollection()->addAction(KStandardAction::New, "new_command_editor", this, &RKWardMainWindow::slotNewCommandEditor);
new_command_editor->setText (i18n ("Script File"));
new_command_editor->setIcon (RKStandardIcons::getIcon (RKStandardIcons::WindowCommandEditor));
- new_output = actionCollection ()->addAction("new_output", this, SLOT(slotNewOutput()));
+ new_output = actionCollection()->addAction("new_output", this, &RKWardMainWindow::slotNewOutput);
new_output->setText(i18n("Output document"));
new_output->setIcon(RKStandardIcons::getIcon(RKStandardIcons::WindowOutput));
new_output->setWhatsThis(i18n("Creates and activates a new output document"));
@@ -495,7 +495,7 @@ void RKWardMainWindow::initActions() {
actionCollection()->setDefaultShortcut(fileOpenScript, Qt::ControlModifier | Qt::AltModifier | Qt::Key_O);
fileOpenScript->setText(i18n("Open R Script File..."));
- fileOpenOutput = actionCollection()->addAction(KStandardAction::Open, "file_open_output", this, SLOT(slotOpenOutput()));
+ fileOpenOutput = actionCollection()->addAction(KStandardAction::Open, "file_open_output", this, [this](){ slotOpenOutput(); });
actionCollection()->setDefaultShortcut(fileOpenOutput, QKeySequence());
fileOpenOutput->setText(i18n("Open RKWard Output File..."));
@@ -525,54 +525,54 @@ void RKWardMainWindow::initActions() {
fileOpenRecentWorkspace->setText (i18n ("Open Recent Workspace"));
fileOpenRecentWorkspace->setWhatsThis(i18n ("Opens a recently used file"));
- fileSaveWorkspace = actionCollection ()->addAction (KStandardAction::Save, "file_savex", this, SLOT(slotFileSaveWorkspace()));
+ fileSaveWorkspace = actionCollection()->addAction(KStandardAction::Save, "file_savex", this, [](){ RKSaveAgent::saveWorkspace(); });
fileSaveWorkspace->setText (i18n ("Save Workspace"));
actionCollection ()->setDefaultShortcut (fileSaveWorkspace, Qt::ControlModifier | Qt::AltModifier | Qt::Key_S);
fileSaveWorkspace->setWhatsThis(i18n ("Saves the actual document"));
- fileSaveWorkspaceAs = actionCollection ()->addAction (KStandardAction::SaveAs, "file_save_asx", this, SLOT(slotFileSaveWorkspaceAs()));
+ fileSaveWorkspaceAs = actionCollection()->addAction(KStandardAction::SaveAs, "file_save_asx", this, [](){ RKSaveAgent::saveWorkspaceAs(); });
actionCollection ()->setDefaultShortcut (fileSaveWorkspaceAs, Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier | Qt::Key_S);
fileSaveWorkspaceAs->setText (i18n ("Save Workspace As"));
fileSaveWorkspaceAs->setWhatsThis(i18n ("Saves the actual document as..."));
- fileQuit = actionCollection ()->addAction (KStandardAction::Quit, "file_quitx", this, SLOT(close()));
+ fileQuit = actionCollection()->addAction(KStandardAction::Quit, "file_quitx", this, &RKWardMainWindow::close);
fileQuit->setWhatsThis(i18n ("Quits the application"));
- interrupt_all_commands = actionCollection ()->addAction ("cancel_all_commands", this, SLOT (slotCancelAllCommands()));
+ interrupt_all_commands = actionCollection()->addAction("cancel_all_commands", this, &RKWardMainWindow::slotCancelAllCommands);
interrupt_all_commands->setText (i18n ("Interrupt all commands"));
actionCollection ()->setDefaultShortcut (interrupt_all_commands, Qt::ShiftModifier | Qt::Key_Escape);
interrupt_all_commands->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionInterrupt));
interrupt_all_commands->setEnabled (false); // enabled from within setRStatus()
- action = actionCollection ()->addAction ("carbon_copy", this, SLOT (configureCarbonCopy()));
+ action = actionCollection()->addAction("carbon_copy", this, &RKWardMainWindow::configureCarbonCopy);
action->setText (i18n ("CC commands to output..."));
// These two currently do the same thing
- action = actionCollection ()->addAction ("load_unload_libs", this, SLOT (slotFileLoadLibs()));
+ action = actionCollection()->addAction("load_unload_libs", this, &RKWardMainWindow::slotFileLoadLibs); // TODO: set page
action->setText (i18n ("Manage R packages and plugins..."));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigurePackages));
- action = actionCollection ()->addAction ("configure_packages", this, SLOT (slotFileLoadLibs()));
+ action = actionCollection()->addAction("configure_packages", this, &RKWardMainWindow::slotFileLoadLibs); // TODO: set page
action->setText (i18n ("Manage R packages and plugins..."));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigurePackages));
setStandardToolBarMenuEnabled (true);
createStandardStatusBarAction ();
- close_all_editors = actionCollection ()->addAction ("close_all_editors", this, SLOT (slotCloseAllEditors()));
+ close_all_editors = actionCollection()->addAction("close_all_editors", this, &RKWardMainWindow::slotCloseAllEditors);
close_all_editors->setText (i18n ("Close All Data"));
close_all_editors->setWhatsThis(i18n ("Closes all open data editors"));
- action = actionCollection ()->addAction (KStandardAction::Close, "window_close", this, SLOT (slotCloseWindow()));
+ action = actionCollection()->addAction(KStandardAction::Close, "window_close", this, &RKWardMainWindow::slotCloseWindow);
- window_close_all = actionCollection ()->addAction ("window_close_all", this, SLOT (slotCloseAllWindows()));
+ window_close_all = actionCollection()->addAction("window_close_all", this, &RKWardMainWindow::slotCloseAllWindows);
window_close_all->setText (i18n ("Close All"));
- window_detach = actionCollection ()->addAction ("window_detach", this, SLOT (slotDetachWindow()));
+ window_detach = actionCollection()->addAction("window_detach", this, &RKWardMainWindow::slotDetachWindow);
window_detach->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDetachWindow));
window_detach->setText (i18n ("Detach"));
- configure = actionCollection ()->addAction (KStandardAction::Preferences, "options_configure", this, SLOT (slotConfigure()));
+ configure = actionCollection()->addAction(KStandardAction::Preferences, "options_configure", this, &RKWardMainWindow::slotConfigure);
action = actionCollection()->addAction("setup_wizard");
action->setText(i18n("Check installation"));
connect(action, &QAction::triggered, &RKSetupWizard::manualCheck);
@@ -888,16 +888,6 @@ void RKWardMainWindow::slotFileLoadLibs () {
dial->show ();
}
-void RKWardMainWindow::slotFileSaveWorkspace () {
- RK_TRACE (APP);
- RKSaveAgent::saveWorkspace();
-}
-
-void RKWardMainWindow::slotFileSaveWorkspaceAs () {
- RK_TRACE (APP);
- RKSaveAgent::saveWorkspaceAs();
-}
-
void RKWardMainWindow::updateCWD () {
RK_TRACE (APP);
diff --git a/rkward/rkward.h b/rkward/rkward.h
index 39d87d51b..c1138fdf6 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -76,10 +76,6 @@ public Q_SLOTS:
void askOpenWorkspace (const QUrl &url=QUrl());
/** creates a new (empty) data.frame */
void slotNewDataFrame ();
- /** save a document */
- void slotFileSaveWorkspace();
- /** save a document by a new filename*/
- void slotFileSaveWorkspaceAs();
/** shows the dialog to install/load/unload packages */
void slotFileLoadLibs ();
/** shows the dialog to import data */
diff --git a/rkward/scriptbackends/qtscriptbackend.cpp b/rkward/scriptbackends/qtscriptbackend.cpp
index 25d0b53e6..cc432db12 100644
--- a/rkward/scriptbackends/qtscriptbackend.cpp
+++ b/rkward/scriptbackends/qtscriptbackend.cpp
@@ -90,7 +90,7 @@ void QtScriptBackend::destroy () {
dead = true;
code_property = nullptr;
if (script_thread) script_thread->kill ();
- QTimer::singleShot (10000, this, SLOT (deleteLater())); // don't wait for ever for the process to die, even if it's somewhat dangerous
+ QTimer::singleShot(10000, this, [this](){ deleteLater(); }); // don't wait for ever for the process to die, even if it's somewhat dangerous
}
busy = false;
diff --git a/rkward/windows/detachedwindowcontainer.cpp b/rkward/windows/detachedwindowcontainer.cpp
index 002b3c90f..0b80b9094 100644
--- a/rkward/windows/detachedwindowcontainer.cpp
+++ b/rkward/windows/detachedwindowcontainer.cpp
@@ -30,9 +30,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
DetachedWindowContainer::DetachedWindowContainer (RKMDIWindow *widget_to_capture, bool copy_geometry) : KParts::MainWindow () {
RK_TRACE (APP);
- actionCollection ()->addAction (KStandardAction::Close, "dwindow_close", this, SLOT(close()));
+ actionCollection()->addAction(KStandardAction::Close, "dwindow_close", this, &DetachedWindowContainer::close);
- QAction *reattach = actionCollection ()->addAction ("dwindow_attach", this, SLOT(slotReattach()));
+ QAction *reattach = actionCollection()->addAction("dwindow_attach", this, &DetachedWindowContainer::slotReattach);
reattach->setText (i18n ("Attach to main window"));
reattach->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionAttachWindow));
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index 9b9453db0..71cce3b78 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -41,7 +41,7 @@ public:
if (invocationType == KTextEditor::CodeCompletionModel::UserInvocation) {
// NOTE: Without this short timeout, the completion window will sometimes disappear, again, right away.
- QTimer::singleShot (50, manager, SLOT(userTriggeredCompletion()));
+ QTimer::singleShot(50, manager, [this](){ manager->userTriggeredCompletion();});
}
}
QVariant data (const QModelIndex&, int) const override {
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 75ca903c5..b035ac19a 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -345,7 +345,7 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
action_run_all = RKStandardActions::runAll (this, this, SLOT (runAll()));
action_run_current = RKStandardActions::runCurrent (this, this, SLOT (runCurrent()), true);
// NOTE: enter_and_submit is not currently added to the menu
- QAction *action = ac->addAction ("enter_and_submit", this, SLOT (enterAndSubmit()));
+ QAction *action = ac->addAction("enter_and_submit", this, &RKCommandEditorWindow::enterAndSubmit);
action->setText (i18n ("Insert line break and run"));
ac->setDefaultShortcuts (action, QList<QKeySequence>() << (Qt::AltModifier | Qt::Key_Return) << (Qt::AltModifier | Qt::Key_Enter));
ac->setDefaultShortcut (action, Qt::AltModifier | Qt::Key_Return); // KF5 TODO: This line needed only for KF5 < 5.2, according to documentation
@@ -364,7 +364,7 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
ac->addAction ("unmark_block", actionmenu_unmark_block);
connect (actionmenu_unmark_block->menu(), &QMenu::aboutToShow, this, &RKCommandEditorWindow::clearUnusedBlocks);
- action_setwd_to_script = ac->addAction ("setwd_to_script", this, SLOT (setWDToScript()));
+ action_setwd_to_script = ac->addAction("setwd_to_script", this, &RKCommandEditorWindow::setWDToScript);
action_setwd_to_script->setText (i18n ("CD to script directory"));
action_setwd_to_script->setWhatsThis(i18n ("Change the working directory to the directory of this script"));
action_setwd_to_script->setToolTip (action_setwd_to_script->statusTip ());
@@ -446,18 +446,15 @@ void RKCommandEditorWindow::initBlocks () {
colorsquare.fill (colors[i]);
QIcon icon (colorsquare);
- record.mark = ac->addAction ("markblock" + QString::number (i), this, SLOT (markBlock()));
+ record.mark = ac->addAction("markblock" + QString::number(i), this, [this, i](){ markBlock(i); });
record.mark->setIcon (icon);
- record.mark->setData (i);
actionmenu_mark_block->addAction (record.mark);
- record.unmark = ac->addAction ("unmarkblock" + QString::number (i), this, SLOT (unmarkBlock()));
+ record.unmark = ac->addAction("unmarkblock" + QString::number(i), this, [this, i](){ unmarkBlock(i); });
record.unmark->setIcon (icon);
- record.unmark->setData (i);
actionmenu_unmark_block->addAction (record.unmark);
- record.run = ac->addAction ("runblock" + QString::number (i), this, SLOT (runBlock()));
+ record.run = ac->addAction("runblock" + QString::number(i), this, [this, i](){ runBlock(i); });
ac->setDefaultShortcut (record.run, shortcuts[i]);
record.run->setIcon (icon);
- record.run->setData (i);
actionmenu_run_block->addAction (record.run);
// these two not strictly needed due to removeBlock(), below. Silences a GCC warning, however.
@@ -943,17 +940,10 @@ void RKCommandEditorWindow::runAll () {
RKConsole::pipeUserCommand (command);
}
-void RKCommandEditorWindow::runBlock () {
+void RKCommandEditorWindow::runBlock(int index) {
RK_TRACE (COMMANDEDITOR);
- QAction* action = qobject_cast<QAction*>(sender ());
- if (!action) {
- RK_ASSERT (false);
- return;
- }
-
clearUnusedBlocks (); // this block might have been removed meanwhile
- int index = action->data ().toInt ();
RK_ASSERT ((index >= 0) && (index < block_records.size ()));
if (block_records[index].active) {
QString command = m_doc->text (*(block_records[index].range));
@@ -963,16 +953,9 @@ void RKCommandEditorWindow::runBlock () {
}
}
-void RKCommandEditorWindow::markBlock () {
+void RKCommandEditorWindow::markBlock(int index) {
RK_TRACE (COMMANDEDITOR);
- QAction* action = qobject_cast<QAction*>(sender ());
- if (!action) {
- RK_ASSERT (false);
- return;
- }
-
- int index = action->data ().toInt ();
RK_ASSERT ((index >= 0) && (index < block_records.size ()));
if (m_view->selection ()) {
addBlock (index, m_view->selectionRange ());
@@ -981,16 +964,9 @@ void RKCommandEditorWindow::markBlock () {
}
}
-void RKCommandEditorWindow::unmarkBlock () {
+void RKCommandEditorWindow::unmarkBlock(int index) {
RK_TRACE (COMMANDEDITOR);
- QAction* action = qobject_cast<QAction*>(sender ());
- if (!action) {
- RK_ASSERT (false);
- return;
- }
-
- int index = action->data ().toInt ();
RK_ASSERT ((index >= 0) && (index < block_records.size ()));
removeBlock (index);
}
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index d2ee97273..27af46d55 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -141,12 +141,12 @@ protected:
void setWindowStyleHint (const QString& hint) override;
private Q_SLOTS:
/** mark current selection as a block */
- void markBlock ();
+ void markBlock(int index);
/** unmark a block */
- void unmarkBlock ();
+ void unmarkBlock(int index);
/** run a block */
- void runBlock ();
- void clearUnusedBlocks ();
+ void runBlock(int index);
+ void clearUnusedBlocks();
/** handler to control when autosaves should be created, preview should be updated */
void textChanged ();
/** Render the (.Rmd) current script */
diff --git a/rkward/windows/rkcommandlog.cpp b/rkward/windows/rkcommandlog.cpp
index 9a9f1d78a..8877cb50a 100644
--- a/rkward/windows/rkcommandlog.cpp
+++ b/rkward/windows/rkcommandlog.cpp
@@ -295,10 +295,10 @@ RKCommandLogPart::~RKCommandLogPart () {
void RKCommandLogPart::initActions () {
RK_TRACE (APP);
- copy = actionCollection ()->addAction (KStandardAction::Copy, "log_copy", log->getView (), SLOT (copy()));
- actionCollection ()->addAction (KStandardAction::Clear, "log_clear", log, SLOT (clearLog()));
- actionCollection ()->addAction (KStandardAction::SelectAll, "log_select_all", log->getView (), SLOT (selectAll()));
- QAction *configure = actionCollection ()->addAction ("log_configure", log, SLOT(configureLog()));
+ copy = actionCollection()->addAction(KStandardAction::Copy, "log_copy", log->getView(), &RKCommandLogView::copy);
+ actionCollection()->addAction(KStandardAction::Clear, "log_clear", log, &RKCommandLog::clearLog);
+ actionCollection()->addAction(KStandardAction::SelectAll, "log_select_all", log->getView(), &RKCommandLogView::selectAll);
+ QAction *configure = actionCollection()->addAction("log_configure", log, &RKCommandLog::configureLog);
configure->setText (i18n ("Configure"));
run_selection = RKStandardActions::runCurrent (log, log, SLOT(runSelection()));
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 7e3b51118..4708c7c88 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -866,12 +866,12 @@ void RKHTMLWindowPart::initActions () {
#endif
// common actions
- actionCollection ()->addAction (KStandardAction::Copy, "copy", window->view->pageAction (RKWebPage::Copy), SLOT (trigger()));
+ actionCollection()->addAction(KStandardAction::Copy, "copy", window->view->pageAction(RKWebPage::Copy), &QAction::trigger);
QAction* zoom_in = actionCollection ()->addAction ("zoom_in", new QAction (QIcon::fromTheme("zoom-in"), i18n ("Zoom In"), this));
connect (zoom_in, &QAction::triggered, window, &RKHTMLWindow::zoomIn);
QAction* zoom_out = actionCollection ()->addAction ("zoom_out", new QAction (QIcon::fromTheme("zoom-out"), i18n ("Zoom Out"), this));
connect (zoom_out, &QAction::triggered, window, &RKHTMLWindow::zoomOut);
- actionCollection ()->addAction (KStandardAction::SelectAll, "select_all", window->view->pageAction (RKWebPage::SelectAll), SLOT (trigger()));
+ actionCollection()->addAction(KStandardAction::SelectAll, "select_all", window->view->pageAction(RKWebPage::SelectAll), &QAction::trigger);
// unfortunately, this will only affect the default encoding, not necessarily the "real" encoding
KCodecAction *encoding = new KCodecAction (QIcon::fromTheme("character-set"), i18n ("Default &Encoding"), this, true);
encoding->setWhatsThis(i18n ("Set the encoding to assume in case no explicit encoding has been set in the page or in the HTTP headers."));
@@ -883,46 +883,46 @@ void RKHTMLWindowPart::initActions () {
}
});
- print = actionCollection()->addAction(KStandardAction::Print, "print_html", window, SLOT (slotPrint()));
+ print = actionCollection()->addAction(KStandardAction::Print, "print_html", window, &RKHTMLWindow::slotPrint);
export_page = actionCollection()->addAction("save_html", new QAction(QIcon::fromTheme("file-save"), i18n("Export Page as HTML"), this));
connect(export_page, &QAction::triggered, window, &RKHTMLWindow::slotExport);
run_selection = RKStandardActions::runCurrent (window, window, SLOT (runSelection()));
// help window actions
- back = actionCollection ()->addAction (KStandardAction::Back, "help_back", window, SLOT (slotBack()));
+ back = actionCollection()->addAction(KStandardAction::Back, "help_back", window, &RKHTMLWindow::slotBack);
back->setEnabled (false);
- forward = actionCollection ()->addAction (KStandardAction::Forward, "help_forward", window, SLOT (slotForward()));
+ forward = actionCollection()->addAction(KStandardAction::Forward, "help_forward", window, &RKHTMLWindow::slotForward);
forward->setEnabled (false);
// output window actions
- window->file_save_action = actionCollection()->addAction(KStandardAction::Save, window, SLOT(slotSave()));
+ window->file_save_action = actionCollection()->addAction(KStandardAction::Save, "file_save", window, &RKHTMLWindow::slotSave);
window->file_save_action->setText(i18n("Save Output"));
- window->file_save_as_action = actionCollection()->addAction(KStandardAction::SaveAs, window, SLOT(slotSaveAs()));
+ window->file_save_as_action = actionCollection()->addAction(KStandardAction::SaveAs, "file_save_as", window, &RKHTMLWindow::slotSaveAs);
window->file_save_as_action->setText(i18n("Save Output As"));
- outputFlush = actionCollection ()->addAction ("output_flush", window, SLOT (flushOutput()));
+ outputFlush = actionCollection()->addAction("output_flush", window, &RKHTMLWindow::flushOutput);
outputFlush->setText (i18n ("&Clear Output"));
outputFlush->setIcon (QIcon::fromTheme("edit-delete"));
outputRefresh = actionCollection()->addAction("output_refresh", window->page->action(RKWebPage::Reload));
- revert = actionCollection()->addAction("output_revert", window, SLOT(slotRevert()));
+ revert = actionCollection()->addAction("output_revert", window, &RKHTMLWindow::slotRevert);
revert->setText(i18n("&Revert to last saved state"));
revert->setIcon(QIcon::fromTheme("edit-undo"));
- activate = actionCollection()->addAction("output_activate", window, SLOT(slotActivate()));
+ activate = actionCollection()->addAction("output_activate", window, &RKHTMLWindow::slotActivate);
activate->setText(i18n("Set Output as &Active"));
activate->setIcon(QIcon::fromTheme("emblem-favorite"));
activate->setWhatsThis(i18n("Set this output as the file to append output to."));
- actionCollection ()->addAction (KStandardAction::Find, "find", window->findbar, SLOT (activate()));
+ actionCollection()->addAction(KStandardAction::Find, "find", window->findbar, &RKFindBar::activate);
QAction* findAhead = actionCollection ()->addAction ("find_ahead", new QAction (i18n ("Find as you type"), this));
actionCollection ()->setDefaultShortcut (findAhead, '/');
connect (findAhead, &QAction::triggered, window->findbar, &RKFindBar::activate);
- actionCollection ()->addAction (KStandardAction::FindNext, "find_next", window->findbar, SLOT (forward()));
- actionCollection ()->addAction (KStandardAction::FindPrev, "find_previous", window->findbar, SLOT (backward()));
+ actionCollection()->addAction(KStandardAction::FindNext, "find_next", window->findbar, &RKFindBar::forward);
+ actionCollection()->addAction(KStandardAction::FindPrev, "find_previous", window->findbar, &RKFindBar::backward);
}
void RKHTMLWindowPart::setOutputDirectoryActionsEnabled(bool enable) {
@@ -1397,7 +1397,7 @@ void RKOutputWindowManager::setCurrentOutputPath (const QString &_path) {
// watch list (KDE 4.10.2; always?), so we need to re-add it. To make things complex, however, this may happen
// asynchronously, with this function called (via rk.set.output.html.file()), _before_ KDirWatch purges the file.
// To hack around the race condition, we re-watch the output file after a short delay.
- QTimer::singleShot (100, this, SLOT (rewatchOutput()));
+ QTimer::singleShot(100, this, [this](){ rewatchOutput(); });
#endif
if (path == current_default_path) return;
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index dadd46753..2f5e1a87b 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -315,7 +315,7 @@ void RKMDIWindow::enterEvent (QEnterEvent *event) {
//
// Finally, in some cases (such as when a new script window was created), we need a short delay, as we may be catching an enter event on a window that is in the same place,
// where the newly created window goes. This would cause activation to switch back, immediately.
- QTimer::singleShot (50, this, SLOT (slotActivateForFocusFollowsMouse()));
+ QTimer::singleShot(50, this, [this](){ slotActivateForFocusFollowsMouse(); });
}
}
}
@@ -417,11 +417,11 @@ void RKMDIWindow::setMetaInfo (const QString& _generic_window_name, const QUrl&
settings_page = _settings_page;
if (!help_url.isEmpty ()) {
- QAction *action = standardActionCollection ()->addAction ("window_help", this, SLOT (showWindowHelp()));
+ QAction *action = standardActionCollection()->addAction("window_help", this, &RKMDIWindow::showWindowHelp);
action->setText (i18n ("Help on %1", generic_window_name));
}
if (settings_page != RKSettings::NoPage) {
- QAction *action = standardActionCollection ()->addAction ("window_configure", this, SLOT (showWindowSettings()));
+ QAction *action = standardActionCollection()->addAction("window_configure", this, &RKMDIWindow::showWindowSettings);
action->setText (i18n ("Configure %1", generic_window_name));
}
}
diff --git a/rkward/windows/rktoplevelwindowgui.cpp b/rkward/windows/rktoplevelwindowgui.cpp
index b4007984d..83eafcb0a 100644
--- a/rkward/windows/rktoplevelwindowgui.cpp
+++ b/rkward/windows/rktoplevelwindowgui.cpp
@@ -53,17 +53,17 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI(KXmlGuiWindow *for_window) : QObject(fo
setXMLFile ("rktoplevelwindowgui.rc");
// help menu
- QAction *help_invoke_r_help = actionCollection ()->addAction ("invoke_r_help", this, SLOT(invokeRHelp()));
+ QAction *help_invoke_r_help = actionCollection()->addAction("invoke_r_help", this, &RKTopLevelWindowGUI::invokeRHelp);
help_invoke_r_help->setText (i18n ("Help on R"));
- QAction *show_help_search = actionCollection ()->addAction ("show_help_search", this, SLOT(showHelpSearch()));
+ QAction *show_help_search = actionCollection()->addAction("show_help_search", this, &RKTopLevelWindowGUI::showHelpSearch);
show_help_search->setText (i18n ("Search R Help"));
- QAction *show_rkward_help = actionCollection ()->addAction (KStandardAction::HelpContents, "rkward_help", this, SLOT (showRKWardHelp()));
+ QAction *show_rkward_help = actionCollection()->addAction(KStandardAction::HelpContents, "rkward_help", this, &RKTopLevelWindowGUI::showRKWardHelp);
show_rkward_help->setText(i18n("RKWard Dashboard and Help"));
- actionCollection()->addAction(KStandardAction::AboutApp, "about_app", this, SLOT(showAboutApplication()));
- actionCollection()->addAction(KStandardAction::WhatsThis, "whats_this", this, SLOT(startWhatsThis()));
- actionCollection()->addAction(KStandardAction::ReportBug, "report_bug", this, SLOT(reportRKWardBug()));
- actionCollection()->addAction(KStandardAction::SwitchApplicationLanguage, "switch_application_language", this, SLOT(showSwitchApplicationLanguage()));
+ actionCollection()->addAction(KStandardAction::AboutApp, "about_app", this, &RKTopLevelWindowGUI::showAboutApplication);
+ actionCollection()->addAction(KStandardAction::WhatsThis, "whats_this", this, &RKTopLevelWindowGUI::startWhatsThis);
+ actionCollection()->addAction(KStandardAction::ReportBug, "report_bug", this, &RKTopLevelWindowGUI::reportRKWardBug);
+ actionCollection()->addAction(KStandardAction::SwitchApplicationLanguage, "switch_application_language", this, &RKTopLevelWindowGUI::showSwitchApplicationLanguage);
help_invoke_r_help->setWhatsThis(i18n ("Shows the R help index"));
show_help_search->setWhatsThis(i18n ("Shows/raises the R Help Search window"));
@@ -71,16 +71,16 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI(KXmlGuiWindow *for_window) : QObject(fo
// window menu
// NOTE: enabling / disabling the prev/next actions is not a good idea. It will cause the script windows to "accept" their shortcuts, when disabled
- prev_action = actionCollection ()->addAction ("prev_window", this, SLOT (previousWindow()));
- prev_action->setText (i18n ("Previous Window"));
+ prev_action = actionCollection()->addAction("prev_window", this, &RKTopLevelWindowGUI::previousWindow);
+ prev_action->setText(i18n("Previous Window"));
prev_action->setIcon(QIcon(":/rkward/icons/window_back.png"));
actionCollection ()->setDefaultShortcut (prev_action, Qt::ControlModifier | Qt::Key_Tab);
- next_action = actionCollection ()->addAction ("next_window", this, SLOT (nextWindow()));
- next_action->setText (i18n ("Next Window"));
+ next_action = actionCollection()->addAction("next_window", this, &RKTopLevelWindowGUI::nextWindow);
+ next_action->setText(i18n("Next Window"));
next_action->setIcon(QIcon(":rkward/icons/window_forward.png"));
actionCollection ()->setDefaultShortcut (next_action, Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Tab);
- QAction* action = actionCollection ()->addAction ("window_activate_docview", this, SLOT(activateDocumentView()));
+ QAction* action = actionCollection()->addAction("window_activate_docview", this, &RKTopLevelWindowGUI::activateDocumentView);
action->setText (i18n ("Activate Document view"));
actionCollection ()->setDefaultShortcut (action, Qt::AltModifier | Qt::Key_0);
@@ -92,8 +92,8 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI(KXmlGuiWindow *for_window) : QObject(fo
connect(output_windows_menu, &QMenu::triggered, this, &RKTopLevelWindowGUI::slotOutputShow);
// settings
- KStandardAction::keyBindings (this, SLOT (configureShortcuts()), actionCollection ());
- KStandardAction::configureToolbars (this, SLOT (configureToolbars()), actionCollection ());
+ KStandardAction::keyBindings(this, &RKTopLevelWindowGUI::configureShortcuts, actionCollection());
+ KStandardAction::configureToolbars(this, &RKTopLevelWindowGUI::configureToolbars, actionCollection());
// Color scheme action. NOTE: selection is non-permanent for KF5 <= 5.87.0, auto-saved afterwards. Apparently, auto-save cannot be implemented for earlier versions within a few lines of code
KColorSchemeManager *manager = new KColorSchemeManager(this);
actionCollection()->addAction(QStringLiteral("colorscheme_menu"), KColorSchemeMenu::createMenu(manager, this));
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 585faccfa..3316945e2 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -270,7 +270,7 @@ RKCaughtX11Window::RKCaughtX11Window(QWindow* window_to_embed, int device_number
#endif
// We need to make sure that the R backend has had a chance to do event processing on the new device, or else embedding will fail (sometimes).
- QTimer::singleShot (100, this, SLOT (doEmbed()));
+ QTimer::singleShot(100, this, [this](){ doEmbed(); });
}
RKCaughtX11Window::RKCaughtX11Window(RKGraphicsDevice* rkward_device, int device_number) : RKMDIWindow(nullptr, X11Window) {
@@ -290,7 +290,7 @@ RKCaughtX11Window::RKCaughtX11Window(RKGraphicsDevice* rkward_device, int device
xembed_container->show();
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- QTimer::singleShot (0, this, SLOT (doEmbed()));
+ QTimer::singleShot(0, this, [this](){ doEmbed(); });
}
void RKCaughtX11Window::commonInit (int device_number) {
@@ -357,7 +357,7 @@ void RKCaughtX11Window::doEmbed () {
if (!isAttached ()) {
// make xembed_container resizable, again, now that it actually has a content
dynamic_size_action->setChecked (true);
- QTimer::singleShot (0, this, SLOT (fixedSizeToggled())); // For whatever reason, apparently we have to wait for the next event loop with this.
+ QTimer::singleShot(0, this, [this](){ fixedSizeToggled(); }); // For whatever reason, apparently we have to wait for the next event loop with this.
}
// try to be helpful when the window is too large to fit on screen
@@ -742,35 +742,35 @@ RKCaughtX11WindowPart::RKCaughtX11WindowPart(RKCaughtX11Window *window) : KParts
window->actions_not_for_preview.append (window->dynamic_size_action);
QAction *action;
- action = actionCollection ()->addAction ("set_fixed_size_1", window, SLOT (setFixedSize1()));
+ action = actionCollection()->addAction("set_fixed_size_1", window, &RKCaughtX11Window::setFixedSize1);
action->setText (i18n ("Set fixed size 500x500"));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("set_fixed_size_2", window, SLOT (setFixedSize2()));
+ action = actionCollection()->addAction("set_fixed_size_2", window, &RKCaughtX11Window::setFixedSize2);
action->setText (i18n ("Set fixed size 1000x1000"));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("set_fixed_size_3", window, SLOT (setFixedSize3()));
+ action = actionCollection()->addAction("set_fixed_size_3", window, &RKCaughtX11Window::setFixedSize3);
action->setText (i18n ("Set fixed size 2000x2000"));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("set_fixed_size_manual", window, SLOT (setFixedSizeManual()));
+ action = actionCollection()->addAction("set_fixed_size_manual", window, &RKCaughtX11Window::setFixedSizeManual);
action->setText (i18n ("Set specified fixed size..."));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("plot_prev", window, SLOT (previousPlot()));
+ action = actionCollection()->addAction("plot_prev", window, &RKCaughtX11Window::previousPlot);
window->actions_not_for_preview.append (action);
action->setText (i18n ("Previous plot"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveLeft));
window->plot_prev_action = (QAction *) action;
- action = actionCollection ()->addAction ("plot_first", window, SLOT (firstPlot()));
+ action = actionCollection()->addAction("plot_first", window, &RKCaughtX11Window::firstPlot);
window->actions_not_for_preview.append (action);
action->setText (i18n ("First plot"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveFirst));
window->plot_first_action = (QAction *) action;
- action = actionCollection ()->addAction ("plot_next", window, SLOT (nextPlot()));
+ action = actionCollection()->addAction("plot_next", window, &RKCaughtX11Window::nextPlot);
window->actions_not_for_preview.append (action);
action->setText (i18n ("Next plot"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveRight));
window->plot_next_action = (QAction *) action;
- action = actionCollection ()->addAction ("plot_last", window, SLOT (lastPlot()));
+ action = actionCollection()->addAction("plot_last", window, &RKCaughtX11Window::lastPlot);
window->actions_not_for_preview.append (action);
action->setText (i18n ("Last plot"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveLast));
@@ -782,44 +782,44 @@ RKCaughtX11WindowPart::RKCaughtX11WindowPart(RKCaughtX11Window *window) : KParts
actionCollection ()->addAction ("plot_list", action);
connect (action, &QAction::triggered, window, &RKCaughtX11Window::gotoPlot);
- action = actionCollection ()->addAction ("plot_force_append", window, SLOT (forceAppendCurrentPlot()));
+ action = actionCollection()->addAction("plot_force_append", window, &RKCaughtX11Window::forceAppendCurrentPlot);
window->actions_not_for_preview.append (action);
action->setText (i18n ("Append this plot"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionSnapshot));
window->plot_force_append_action = (QAction *) action;
- action = actionCollection ()->addAction ("plot_remove", window, SLOT (removeCurrentPlot()));
+ action = actionCollection()->addAction("plot_remove", window, &RKCaughtX11Window::removeCurrentPlot);
window->actions_not_for_preview.append (action);
action->setText (i18n ("Remove this plot"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRemovePlot));
window->plot_remove_action = (QAction *) action;
- action = actionCollection ()->addAction ("plot_clear_history", window, SLOT (clearHistory()));
+ action = actionCollection()->addAction("plot_clear_history", window, &RKCaughtX11Window::clearHistory);
window->plot_clear_history_action = (QAction *) action;
action->setText (i18n ("Clear history"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionClear));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("plot_properties", window, SLOT (showPlotInfo()));
+ action = actionCollection()->addAction("plot_properties", window, &RKCaughtX11Window::showPlotInfo);
window->plot_properties_action = (QAction *) action;
action->setText (i18n ("Plot properties"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDocumentInfo));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("device_activate", window, SLOT (activateDevice()));
+ action = actionCollection()->addAction("device_activate", window, &RKCaughtX11Window::activateDevice);
action->setText (i18n ("Make active"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionFlagGreen));
window->actions_not_for_preview.append (action);
- action = actionCollection ()->addAction ("device_copy_to_output", window, SLOT (copyDeviceToOutput()));
+ action = actionCollection()->addAction("device_copy_to_output", window, &RKCaughtX11Window::copyDeviceToOutput);
action->setText (i18n ("Copy to output"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::WindowOutput));
- action = actionCollection ()->addAction (KStandardAction::Print, "device_print", window, SLOT (printDevice()));
- action = actionCollection ()->addAction ("device_copy_to_r_object", window, SLOT (copyDeviceToRObject()));
+ action = actionCollection()->addAction(KStandardAction::Print, "device_print", window, &RKCaughtX11Window::printDevice);
+ action = actionCollection()->addAction("device_copy_to_r_object", window, &RKCaughtX11Window::copyDeviceToRObject);
action->setText (i18n ("Store as R object..."));
- action = actionCollection ()->addAction ("device_duplicate", window, SLOT (duplicateDevice()));
+ action = actionCollection()->addAction("device_duplicate", window, &RKCaughtX11Window::duplicateDevice);
action->setText (i18n ("Duplicate"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionWindowDuplicate));
- action = window->stop_interaction = actionCollection ()->addAction ("stop_interaction", window, SLOT (stopInteraction()));
+ action = window->stop_interaction = actionCollection()->addAction("stop_interaction", window, &RKCaughtX11Window::stopInteraction);
action->setText (i18n ("Stop interaction"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionInterrupt));
action->setVisible (false);
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index bf1bb5089..df859a4fa 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -91,10 +91,10 @@ void RKWorkplaceViewPane::showContextMenu (const QPoint &pos) {
if (tab < 0) return; // no context menu for the empty area
QMenu* m = new QMenu (this);
- QAction *action = KStandardAction::close (this, SLOT (contextMenuClosePage()), this);
+ QAction *action = KStandardAction::close(this, &RKWorkplaceViewPane::contextMenuClosePage, this);
action->setData (tab);
m->addAction (action);
- action = m->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionDetachWindow), i18n("Detach"), this, SLOT (contextMenuDetachWindow()));
+ action = m->addAction(RKStandardIcons::getIcon(RKStandardIcons::ActionDetachWindow), i18n("Detach"), this, &RKWorkplaceViewPane::contextMenuDetachWindow);
action->setData (tab);
m->exec (mapToGlobal (pos));
delete m;
@@ -235,14 +235,14 @@ RKWorkplaceViewPane* RKWorkplaceView::activePane () const {
void RKWorkplaceView::initActions (KActionCollection *ac) {
RK_TRACE (APP);
- action_page_left = (QAction *) ac->addAction ("left_window", this, SLOT (pageLeft()));
+ action_page_left = (QAction *) ac->addAction("left_window", this, &RKWorkplaceView::pageLeft);
action_page_left->setText (i18n ("Window Left"));
ac->setDefaultShortcuts (action_page_left, {
Qt::ControlModifier | Qt::Key_Less,
Qt::ControlModifier | Qt::Key_Comma
});
- action_page_right = (QAction *) ac->addAction ("right_window", this, SLOT (pageRight()));
+ action_page_right = (QAction *) ac->addAction("right_window", this, &RKWorkplaceView::pageRight);
action_page_right->setText (i18n ("Window Right"));
ac->setDefaultShortcuts (action_page_right, {
Qt::ControlModifier | Qt::Key_Greater,
More information about the rkward-tracker
mailing list