mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Prevent creation of empty saved searches
This commit is contained in:
		
							parent
							
								
									4f6ec55b2e
								
							
						
					
					
						commit
						57ee4a0fb6
					
				@ -332,6 +332,10 @@ class SavedSearchBox(QComboBox): # {{{
 | 
				
			|||||||
        name = unicode(self.currentText())
 | 
					        name = unicode(self.currentText())
 | 
				
			||||||
        if not name.strip():
 | 
					        if not name.strip():
 | 
				
			||||||
            name = unicode(self.search_box.text()).replace('"', '')
 | 
					            name = unicode(self.search_box.text()).replace('"', '')
 | 
				
			||||||
 | 
					        if not (name and self.search_box.text()):
 | 
				
			||||||
 | 
					            error_dialog(self, _('Create saved search'),
 | 
				
			||||||
 | 
					                         _('There is no search to save'), show=True)
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
        saved_searches().delete(name)
 | 
					        saved_searches().delete(name)
 | 
				
			||||||
        saved_searches().add(name, unicode(self.search_box.text()))
 | 
					        saved_searches().add(name, unicode(self.search_box.text()))
 | 
				
			||||||
        # now go through an initialization cycle to ensure that the combobox has
 | 
					        # now go through an initialization cycle to ensure that the combobox has
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user