Commit b1a95de9 authored by Nate Graham's avatar Nate Graham
Browse files

foldermodel: hide undo action when it's not available

This action appears only in the context menu, and context menus are
inherently contextual: they should only show things relevant to what was
right-clicked. Therefore it never makes sense to have disabled items in
a context menu; they should be hidden instead.

This commit does that for the Undo action, only showing it in the
context menu when it is contextually relevant.
parent c826f447
Pipeline #126872 passed with stage
in 4 minutes and 58 seconds
......@@ -1640,9 +1640,9 @@ void FolderModel::createActions()
QAction *copy = KStandardAction::copy(this, &FolderModel::copy, this);
QAction *undo = KStandardAction::undo(manager, &KIO::FileUndoManager::undo, this);
undo->setEnabled(manager->isUndoAvailable());
undo->setVisible(manager->isUndoAvailable());
undo->setShortcutContext(Qt::WidgetShortcut);
connect(manager, SIGNAL(undoAvailable(bool)), undo, SLOT(setEnabled(bool)));
connect(manager, SIGNAL(undoAvailable(bool)), undo, SLOT(setVisible(bool)));
connect(manager, &KIO::FileUndoManager::undoTextChanged, this, &FolderModel::undoTextChanged);
QAction *paste = KStandardAction::paste(this, &FolderModel::paste, this);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment