┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 917aa42ce..f7ca69553 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -156,6 +156,10 @@ DolphinMainWindow::DolphinMainWindow()
connect(undoManager, &KIO::FileUndoManager::undoAvailable, this, &DolphinMainWindow::slotUndoAvailable);
connect(undoManager, &KIO::FileUndoManager::undoTextChanged, this, &DolphinMainWindow::slotUndoTextChanged);
+#if KIO_VERSION >= QT_VERSION_CHECK(6, 17, 0)
+ connect(undoManager, &KIO::FileUndoManager::redoAvailable, this, &DolphinMainWindow::slotRedoAvailable);
+ connect(undoManager, &KIO::FileUndoManager::redoTextChanged, this, &DolphinMainWindow::slotRedoTextChanged);
+#endif
connect(undoManager, &KIO::FileUndoManager::jobRecordingStarted, this, &DolphinMainWindow::clearStatusBar);
connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished, this, &DolphinMainWindow::showCommand);
@@ -891,6 +895,31 @@ void DolphinMainWindow::undo()
KIO::FileUndoManager::self()->undo();
}
+#if KIO_VERSION >= QT_VERSION_CHECK(6, 17, 0)
+void DolphinMainWindow::slotRedoAvailable(bool available)
+{
+ QAction *redoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Redo));
+ if (redoAction) {
+ redoAction->setEnabled(available);
+ }
+}
+
+void DolphinMainWindow::slotRedoTextChanged(const QString &text)
+{
+ QAction *redoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Redo));
+ if (redoAction) {
+ redoAction->setText(text);
+ }
+}
+
+void DolphinMainWindow::redo()
+{
+ clearStatusBar();
+ KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
+ KIO::FileUndoManager::self()->redo();
+}
+#endif
+
void DolphinMainWindow::cut()
{
if (m_activeViewContainer->view()->selectedItems().isEmpty()) {
@@ -1554,6 +1583,9 @@ void DolphinMainWindow::updateHamburgerMenu()
}
menu->addAction(ac->action(QStringLiteral("basic_actions")));
menu->addAction(ac->action(KStandardAction::name(KStandardAction::Undo)));
+#if KIO_VERSION >= QT_VERSION_CHECK(6, 17, 0)
+ menu->addAction(ac->action(KStandardAction::name(KStandardAction::Redo)));
+#endif
if (!toolBar()->isVisible()
|| (!toolbarActions.contains(ac->action(QStringLiteral("toggle_search")))
&& !toolbarActions.contains(ac->action(QStringLiteral("open_preferred_search_tool"))))) {
@@ -1813,6 +1845,9 @@ void DolphinMainWindow::setupActions()
// setup 'Edit' menu
KStandardAction::undo(this, &DolphinMainWindow::undo, actionCollection());
+#if KIO_VERSION >= QT_VERSION_CHECK(6, 17, 0)
+ KStandardAction::redo(this, &DolphinMainWindow::redo, actionCollection());
+#endif
// i18n: This will be the last paragraph for the whatsthis for all three:
// Cut, Copy and Paste
@@ -2094,6 +2129,18 @@ void DolphinMainWindow::setupActions()
"will ask for your confirmation beforehand."));
undoAction->setEnabled(false); // undo should be disabled by default
+#if KIO_VERSION >= QT_VERSION_CHECK(6, 17, 0)
+ auto redoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Redo));
+ redoAction->setWhatsThis(xi18nc("@info:whatsthis",
+ "This redoes "
+ "the last change you undid.<nl/>"
+ "Such changes include <interface>creating</interface>, <interface>renaming</interface> "
+ "and <interface>moving</interface> files or folders to a different location "
+ "or to the <filename>Trash</filename>.<nl/>Any changes that cannot be undone "
+ "will ask for your confirmation beforehand."));
+ redoAction->setEnabled(false); // redo should be disabled by default
+#endif
+
{
QScopedPointer<QAction> forwardAction(KStandardAction::forward(nullptr, nullptr, nullptr));
m_forwardAction = new KToolBarPopupAction(forwardAction->icon(), forwardAction->text(), actionCollection());