mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-10-30 10:12:25 -04:00 
			
		
		
		
	Fix merge_metadata to not overwrite non-text fields ('bool', 'int', 'float', 'rating', 'datetime') that have a value of zero/false instead of none.
Change the delegate for custom numeric columns to permit setting a value to undefined when editing on the library view.
This commit is contained in:
		
							parent
							
								
									6ee00a041e
								
							
						
					
					
						commit
						e4e5eb36e7
					
				| @ -418,7 +418,7 @@ class EditMetadataAction(InterfaceAction): | ||||
|                     db.set_custom(dest_id, dest_value, num=colnum) | ||||
|               if db.field_metadata[key]['datatype'] in \ | ||||
|                 ('bool', 'int', 'float', 'rating', 'datetime') \ | ||||
|                 and not dest_value: | ||||
|                 and dest_value is None: | ||||
|                 db.set_custom(dest_id, src_value, num=colnum) | ||||
|               if db.field_metadata[key]['datatype'] == 'series' \ | ||||
|                 and not dest_value: | ||||
|  | ||||
| @ -310,6 +310,12 @@ class CcNumberDelegate(QStyledItemDelegate): # {{{ | ||||
|             editor.setDecimals(2) | ||||
|         return editor | ||||
| 
 | ||||
|     def setModelData(self, editor, model, index): | ||||
|         val = editor.value() | ||||
|         if val == editor.minimum(): | ||||
|             val = None | ||||
|         model.setData(index, QVariant(val), Qt.EditRole) | ||||
| 
 | ||||
|     def setEditorData(self, editor, index): | ||||
|         m = index.model() | ||||
|         val = m.db.data[index.row()][m.custom_columns[m.column_map[index.column()]]['rec_index']] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Charles Haley
						Charles Haley