diff --git a/ftl/core/undo.ftl b/ftl/core/undo.ftl index ac2a2af65..49c64bc49 100644 --- a/ftl/core/undo.ftl +++ b/ftl/core/undo.ftl @@ -1,3 +1,5 @@ +undo-undo = Undo +undo-redo = Redo # eg "Undo Answer Card" undo-undo-action = Undo { $val } # eg "Answer Card Undone" @@ -5,5 +7,4 @@ undo-action-undone = { $action } Undone undo-redo-action = Redo { $action } undo-action-redone = { $action } Redone undo-answer-card = Answer Card -undo-undo = Undo -undo-redo = Redo +undo-unbury-unsuspend = Unbury/Unsuspend diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 0506ff6ca..9f1f40356 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -505,7 +505,7 @@ class Browser(QMainWindow): qconnect(f.actionReposition.triggered, self.reposition) qconnect(f.action_set_due_date.triggered, self.set_due_date) qconnect(f.action_forget.triggered, self.forget_cards) - qconnect(f.actionToggle_Suspend.triggered, self.onSuspend) + qconnect(f.actionToggle_Suspend.triggered, self.suspend_selected_cards) qconnect(f.actionRed_Flag.triggered, lambda: self.onSetFlag(1)) qconnect(f.actionOrange_Flag.triggered, lambda: self.onSetFlag(2)) qconnect(f.actionGreen_Flag.triggered, lambda: self.onSetFlag(3)) @@ -1255,14 +1255,14 @@ where id in %s""" # Suspending ###################################################################### - def isSuspended(self) -> bool: + def current_card_is_suspended(self) -> bool: return bool(self.card and self.card.queue == QUEUE_TYPE_SUSPENDED) - def onSuspend(self) -> None: - self.editor.saveNow(self._onSuspend) + def suspend_selected_cards(self) -> None: + self.editor.saveNow(self._suspend_selected_cards) - def _onSuspend(self) -> None: - want_suspend = not self.isSuspended() + def _suspend_selected_cards(self) -> None: + want_suspend = not self.current_card_is_suspended() c = self.selectedCards() if want_suspend: self.col.sched.suspend_cards(c) diff --git a/rslib/src/collection/op.rs b/rslib/src/collection/op.rs index 84e40c71e..c383f52d7 100644 --- a/rslib/src/collection/op.rs +++ b/rslib/src/collection/op.rs @@ -9,6 +9,7 @@ pub enum CollectionOp { AnswerCard, Bury, Suspend, + UnburyUnsuspend, } impl Collection { @@ -18,6 +19,7 @@ impl Collection { CollectionOp::AnswerCard => TR::UndoAnswerCard, CollectionOp::Bury => TR::StudyingBury, CollectionOp::Suspend => TR::StudyingSuspend, + CollectionOp::UnburyUnsuspend => TR::UndoUnburyUnsuspend, }; self.i18n.tr(key).to_string() diff --git a/rslib/src/scheduler/bury_and_suspend.rs b/rslib/src/scheduler/bury_and_suspend.rs index 2d5af0c43..b3f705239 100644 --- a/rslib/src/scheduler/bury_and_suspend.rs +++ b/rslib/src/scheduler/bury_and_suspend.rs @@ -69,7 +69,8 @@ impl Collection { } pub fn unbury_or_unsuspend_cards(&mut self, cids: &[CardID]) -> Result<()> { - self.transact(None, |col| { + self.transact(Some(CollectionOp::UnburyUnsuspend), |col| { + col.clear_study_queues(); col.storage.set_search_table_to_card_ids(cids, false)?; col.unsuspend_or_unbury_searched_cards() })