undo unbury/unsuspend
This commit is contained in:
parent
77e4526718
commit
105ce94dd4
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user