mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-10-31 18:47:02 -04:00 
			
		
		
		
	Only create a search-based VL if there is something in the search box.
This commit is contained in:
		
							parent
							
								
									554c937a76
								
							
						
					
					
						commit
						b04b8d72a8
					
				| @ -188,8 +188,8 @@ class CreateVirtualLibrary(QDialog):  # {{{ | |||||||
|             db = self.gui.library_view.model().db |             db = self.gui.library_view.model().db | ||||||
|             recs = db.data.search_getting_ids('', v, use_virtual_library=False) |             recs = db.data.search_getting_ids('', v, use_virtual_library=False) | ||||||
|         except ParseException as e: |         except ParseException as e: | ||||||
|             error_dialog(self.gui, _('Invalid search string'), |             error_dialog(self.gui, _('Invalid search'), | ||||||
|                          _('The search string is not a valid search expression'), |                          _('The search in the search box is not valid'), | ||||||
|                          det_msg=e.msg, show=True) |                          det_msg=e.msg, show=True) | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
| @ -306,15 +306,23 @@ class SearchRestrictionMixin(object): | |||||||
|             db.data.set_base_restriction('') |             db.data.set_base_restriction('') | ||||||
|             db.data.set_base_restriction_name('') |             db.data.set_base_restriction_name('') | ||||||
|         elif library == '*': |         elif library == '*': | ||||||
|             if not _build_full_search_string(self): |             if not self.search.current_text: | ||||||
|                 error_dialog(self, _('No search'), |                 error_dialog(self, _('No search'), | ||||||
|                      _('There is no current search to use'), show=True) |                      _('There is no current search to use'), show=True) | ||||||
|                 return |                 return | ||||||
| 
 | 
 | ||||||
|             self.search_based_vl = _build_full_search_string(self) |             txt = _build_full_search_string(self) | ||||||
|             db.data.set_base_restriction(self.search_based_vl) |             try: | ||||||
|             self.search_based_vl_name = self._trim_restriction_name( |                 db.data.search_getting_ids('', txt, use_virtual_library=False) | ||||||
|                                      '*' + self.search_based_vl) |             except ParseException as e: | ||||||
|  |                 error_dialog(self, _('Invalid search'), | ||||||
|  |                              _('The search in the search box is not valid'), | ||||||
|  |                              det_msg=e.msg, show=True) | ||||||
|  |                 return | ||||||
|  | 
 | ||||||
|  |             self.search_based_vl = txt | ||||||
|  |             db.data.set_base_restriction(txt) | ||||||
|  |             self.search_based_vl_name = self._trim_restriction_name('*' + txt) | ||||||
|             db.data.set_base_restriction_name(self.search_based_vl_name) |             db.data.set_base_restriction_name(self.search_based_vl_name) | ||||||
|         elif library == self.search_based_vl_name: |         elif library == self.search_based_vl_name: | ||||||
|             db.data.set_base_restriction(self.search_based_vl) |             db.data.set_base_restriction(self.search_based_vl) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Charles Haley
						Charles Haley