mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-10-31 02:27:01 -04:00 
			
		
		
		
	Add config option to ask for confirmation on deletes
This commit is contained in:
		
							parent
							
								
									57de47dbee
								
							
						
					
					
						commit
						60263f3643
					
				| @ -47,6 +47,8 @@ loader.close() | ||||
| os.chmod(loader_path, 0700) | ||||
| os.environ['PYTHONHOME']        = resources_dir | ||||
| os.environ['FC_CONFIG_DIR']     = os.path.join(resources_dir, 'fonts') | ||||
| os.environ['MAGICK_HOME']       = os.path.join(frameworks_dir, 'ImageMagick') | ||||
| os.environ['DYLD_LIBRARY_PATH'] = os.path.join(frameworks_dir, 'ImageMagick', 'lib') | ||||
| os.execv(loader_path, sys.argv) | ||||
|     ''' | ||||
|     CHECK_SYMLINKS_PRESCRIPT = \ | ||||
| @ -325,6 +327,8 @@ def main(): | ||||
|                                         'NSHumanReadableCopyright':'Copyright 2008, Kovid Goyal', | ||||
|                                         'LSEnvironment':{ | ||||
|                                                          'FC_CONFIG_DIR':'@executable_path/../Resources/fonts', | ||||
|                                                          'MAGICK_HOME':'@executable_path/../Frameworks/ImageMagick', | ||||
|                                                          'DYLD_LIBRARY_PATH':'@executable_path/../Frameworks/ImageMagick/lib', | ||||
|                                                          } | ||||
|                                        }, | ||||
|                       }, | ||||
|  | ||||
| @ -67,6 +67,7 @@ class ConfigDialog(QDialog, Ui_Dialog): | ||||
|         single_format = settings.get('save to disk single format', 'lrf') | ||||
|         self.single_format.setCurrentIndex(BOOK_EXTENSIONS.index(single_format)) | ||||
|         self.cover_browse.setValue(settings.get('cover flow queue length', 6)) | ||||
|         self.confirm_delete.setChecked(settings.get('confirm delete', False)) | ||||
|          | ||||
|     def compact(self, toggled): | ||||
|         d = Vacuum(self, self.db) | ||||
| @ -96,6 +97,7 @@ class ConfigDialog(QDialog, Ui_Dialog): | ||||
|         self.final_columns = [self.columns.item(i).checkState() == Qt.Checked for i in range(self.columns.count())] | ||||
|         settings.set('toolbar icon size', self.ICON_SIZES[self.toolbar_button_size.currentIndex()]) | ||||
|         settings.set('show text in toolbar', bool(self.show_toolbar_text.isChecked())) | ||||
|         settings.set('confirm delete', bool(self.confirm_delete.isChecked())) | ||||
|         pattern = self.filename_pattern.commit() | ||||
|         settings.set('filename pattern', pattern) | ||||
|         settings.set('save to disk single format', BOOK_EXTENSIONS[self.single_format.currentIndex()]) | ||||
|  | ||||
| @ -83,7 +83,7 @@ | ||||
|           <x>0</x> | ||||
|           <y>0</y> | ||||
|           <width>595</width> | ||||
|           <height>638</height> | ||||
|           <height>640</height> | ||||
|          </rect> | ||||
|         </property> | ||||
|         <layout class="QVBoxLayout" name="verticalLayout" > | ||||
| @ -156,6 +156,13 @@ | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <widget class="QCheckBox" name="confirm_delete" > | ||||
|            <property name="text" > | ||||
|             <string>Ask for &confirmation before deleting files</string> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <layout class="QGridLayout" name="gridLayout_2" > | ||||
|            <item row="0" column="0" > | ||||
|  | ||||
| @ -534,6 +534,12 @@ class Main(MainWindow, Ui_MainWindow): | ||||
|         rows = view.selectionModel().selectedRows() | ||||
|         if not rows or len(rows) == 0: | ||||
|             return | ||||
|         if Settings().get('confirm delete', False): | ||||
|             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: | ||||
|             view.model().delete_books(rows) | ||||
|         else: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user