When deleting custom recipes, use recycle bin

Fixes #1186142 [Recipe deleted without option to cancel deletion](https://bugs.launchpad.net/calibre/+bug/1186142)
This commit is contained in:
Kovid Goyal 2013-05-31 12:39:13 +05:30
parent 9a0d88dffa
commit 0fbba2966c

View File

@ -16,6 +16,7 @@ from lxml.builder import ElementMaker
from calibre import browser, force_unicode from calibre import browser, force_unicode
from calibre.utils.date import parse_date, now as nowf, utcnow, tzlocal, \ from calibre.utils.date import parse_date, now as nowf, utcnow, tzlocal, \
isoformat, fromordinal isoformat, fromordinal
from calibre.utils.recycle_bin import delete_file
NS = 'http://calibre-ebook.com/recipe_collection' NS = 'http://calibre-ebook.com/recipe_collection'
E = ElementMaker(namespace=NS, nsmap={None:NS}) E = ElementMaker(namespace=NS, nsmap={None:NS})
@ -167,7 +168,7 @@ def remove_custom_recipe(id_):
fname = existing[1] fname = existing[1]
del custom_recipes[id_] del custom_recipes[id_]
try: try:
os.remove(os.path.join(bdir, fname)) delete_file(os.path.join(bdir, fname))
except: except:
pass pass
@ -526,6 +527,3 @@ class SchedulerConfig(object):
self.schedule_recipe(recipe, typ, schedule, self.schedule_recipe(recipe, typ, schedule,
last_downloaded=r['last_downloaded']) last_downloaded=r['last_downloaded'])