mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
don't attempt to delete if no notes selected
This commit is contained in:
parent
3c9f854983
commit
6a32d870cf
1 changed files with 4 additions and 1 deletions
|
@ -901,10 +901,13 @@ where id in %s""" % ids2str(sf))
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def deleteNotes(self):
|
def deleteNotes(self):
|
||||||
|
nids = self.selectedNotes()
|
||||||
|
if not nids:
|
||||||
|
return
|
||||||
self.mw.checkpoint(_("Delete Notes"))
|
self.mw.checkpoint(_("Delete Notes"))
|
||||||
self.model.beginReset()
|
self.model.beginReset()
|
||||||
oldRow = self.form.tableView.selectionModel().currentIndex().row()
|
oldRow = self.form.tableView.selectionModel().currentIndex().row()
|
||||||
self.col.remNotes(self.selectedNotes())
|
self.col.remNotes(nids)
|
||||||
self.onSearch(reset=False)
|
self.onSearch(reset=False)
|
||||||
if len(self.model.cards):
|
if len(self.model.cards):
|
||||||
new = min(oldRow, len(self.model.cards) - 1)
|
new = min(oldRow, len(self.model.cards) - 1)
|
||||||
|
|
Loading…
Reference in a new issue