mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When copying to library and deleting after copy, do not place deleted files in recycle bin, as this is redundant and slow (they have already been copied into another library)
This commit is contained in:
parent
73583f616b
commit
3f0fee00a5
@ -216,7 +216,8 @@ class CopyToLibraryAction(InterfaceAction):
|
||||
if ci.isValid():
|
||||
row = ci.row()
|
||||
|
||||
v.model().delete_books_by_id(self.worker.processed)
|
||||
v.model().delete_books_by_id(self.worker.processed,
|
||||
permanent=True)
|
||||
self.gui.iactions['Remove Books'].library_ids_deleted(
|
||||
self.worker.processed, row)
|
||||
|
||||
|
@ -220,16 +220,15 @@ class BooksModel(QAbstractTableModel): # {{{
|
||||
self.count_changed()
|
||||
self.reset()
|
||||
|
||||
def delete_books(self, indices):
|
||||
def delete_books(self, indices, permanent=False):
|
||||
ids = map(self.id, indices)
|
||||
for id in ids:
|
||||
self.db.delete_book(id, notify=False)
|
||||
self.books_deleted()
|
||||
self.delete_books_by_id(ids, permanent=permanent)
|
||||
return ids
|
||||
|
||||
def delete_books_by_id(self, ids):
|
||||
def delete_books_by_id(self, ids, permanent=False):
|
||||
for id in ids:
|
||||
self.db.delete_book(id)
|
||||
self.db.delete_book(id, permanent=permanent, do_clean=False)
|
||||
self.db.clean()
|
||||
self.books_deleted()
|
||||
|
||||
def books_added(self, num):
|
||||
|
@ -1425,7 +1425,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
opath = self.format_abspath(book_id, nfmt, index_is_id=True)
|
||||
return fmt if opath is None else nfmt
|
||||
|
||||
def delete_book(self, id, notify=True, commit=True, permanent=False):
|
||||
def delete_book(self, id, notify=True, commit=True, permanent=False,
|
||||
do_clean=True):
|
||||
'''
|
||||
Removes book from the result cache and the underlying database.
|
||||
If you set commit to False, you must call clean() manually afterwards
|
||||
@ -1442,7 +1443,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
self.conn.execute('DELETE FROM books WHERE id=?', (id,))
|
||||
if commit:
|
||||
self.conn.commit()
|
||||
self.clean()
|
||||
if do_clean:
|
||||
self.clean()
|
||||
self.data.books_deleted([id])
|
||||
if notify:
|
||||
self.notify('delete', [id])
|
||||
|
Loading…
x
Reference in New Issue
Block a user