Read &metadata from files
diff --git a/src/calibre/gui2/dialogs/confirm_delete.py b/src/calibre/gui2/dialogs/confirm_delete.py
new file mode 100644
index 0000000000..08db53e9a7
--- /dev/null
+++ b/src/calibre/gui2/dialogs/confirm_delete.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+__license__ = 'GPL v3'
+__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
+__docformat__ = 'restructuredtext en'
+
+from calibre.gui2 import dynamic
+from calibre.gui2.dialogs.confirm_delete_ui import Ui_Dialog
+from PyQt4.Qt import QDialog, SIGNAL
+
+def _config_name(name):
+ return name + '_again'
+
+class Dialog(QDialog, Ui_Dialog):
+
+ def __init__(self, msg, name, parent):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.msg.setText(msg)
+ self.name = name
+ self.connect(self.again, SIGNAL('stateChanged(int)'), self.toggle)
+
+
+ def toggle(self, x):
+ dynamic[_config_name(self.name)] = self.again.isChecked()
+
+def confirm(msg, name, parent=None):
+ if not dynamic.get(_config_name(name), True):
+ return True
+ d = Dialog(msg, name, parent)
+ return d.exec_() == d.Accepted
\ No newline at end of file
diff --git a/src/calibre/gui2/dialogs/confirm_delete.ui b/src/calibre/gui2/dialogs/confirm_delete.ui
new file mode 100644
index 0000000000..1ee4cb79d9
--- /dev/null
+++ b/src/calibre/gui2/dialogs/confirm_delete.ui
@@ -0,0 +1,100 @@
+
+ Dialog
+
+
+
+ 0
+ 0
+ 439
+ 300
+
+
+
+ Are you sure?
+
+
+
+ :/images/dialog_warning.svg:/images/dialog_warning.svg
+
+
+ -
+
+
-
+
+
+ :/images/dialog_warning.svg
+
+
+
+ -
+
+
+ TextLabel
+
+
+ true
+
+
+
+
+
+ -
+
+
+ &Show this warning again
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ Dialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ Dialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py
index abf0aed0fa..0385d7f57f 100644
--- a/src/calibre/gui2/main.py
+++ b/src/calibre/gui2/main.py
@@ -49,6 +49,7 @@ from calibre.library.database2 import LibraryDatabase2, CoverCache
from calibre.parallel import JobKilled
from calibre.utils.filenames import ascii_filename
from calibre.gui2.widgets import WarningDialog
+from calibre.gui2.dialogs.confirm_delete import confirm
class Main(MainWindow, Ui_MainWindow):
@@ -758,13 +759,9 @@ class Main(MainWindow, Ui_MainWindow):
rows = view.selectionModel().selectedRows()
if not rows or len(rows) == 0:
return
- if config['confirm_delete']:
- d = question_dialog(self, _('Confirm delete'),
- _('Are you sure you want to delete these %d books?')%len(rows))
- if d.exec_() != QMessageBox.Yes:
- return
-
if self.stack.currentIndex() == 0:
+ if not confirm(''+_('The selected books will be permanently deleted and the files removed from your computer. Are you sure?')+'
', 'library_delete_books', self):
+ return
view.model().delete_books(rows)
else:
view = self.memory_view if self.stack.currentIndex() == 1 else self.card_view