fix: fix disabled trash undo action

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-30 18:37:03 +01:00
parent 87b0d3fe11
commit b4be28b9bb
No known key found for this signature in database
GPG Key ID: C10411294912A422

View File

@ -1134,11 +1134,6 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup())); connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup()));
actions.append(actionDeleteGroup); actions.append(actionDeleteGroup);
} }
QAction *actionUndoTrashInstance = new QAction("Undo last trash instance", this);
connect(actionUndoTrashInstance, SIGNAL(triggered(bool)), SLOT(undoTrashInstance()));
actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
actions.append(actionUndoTrashInstance);
} }
QMenu myMenu; QMenu myMenu;
myMenu.addActions(actions); myMenu.addActions(actions);
@ -1834,6 +1829,7 @@ void MainWindow::deleteGroup()
void MainWindow::undoTrashInstance() void MainWindow::undoTrashInstance()
{ {
APPLICATION->instances()->undoTrashInstance(); APPLICATION->instances()->undoTrashInstance();
ui->actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
} }
void MainWindow::on_actionViewInstanceFolder_triggered() void MainWindow::on_actionViewInstanceFolder_triggered()
@ -1940,6 +1936,7 @@ void MainWindow::on_actionDeleteInstance_triggered()
auto id = m_selectedInstance->id(); auto id = m_selectedInstance->id();
if (APPLICATION->instances()->trashInstance(id)) { if (APPLICATION->instances()->trashInstance(id)) {
ui->actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
return; return;
} }