Fix #2807 ("Reset Quick Search" button does not reset the status of the tag toggle switches)

This commit is contained in:
Kovid Goyal 2009-07-27 14:47:04 -06:00
parent 9bc7b7feed
commit 1b39011adf
3 changed files with 10 additions and 0 deletions

View File

@ -1128,6 +1128,7 @@ class SearchBox(QLineEdit):
self.home(False)
self.initial_state = True
self.setStyleSheet("background-color: white")
self.emit(SIGNAL('cleared()'))
def clear(self):
self.clear_to_help()

View File

@ -456,6 +456,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
SIGNAL('count_changed(int)'), self.location_view.count_changed)
self.connect(self.library_view.model(), SIGNAL('count_changed(int)'),
self.tags_view.recount)
self.connect(self.search, SIGNAL('cleared()'), self.tags_view.clear)
self.library_view.model().count_changed()
########################### Cover Flow ################################
self.cover_flow = None

View File

@ -36,6 +36,9 @@ class TagsView(QTreeView):
self.emit(SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
self._model.tokens(), self.match_all.isChecked())
def clear(self):
self.model().clear_state()
def recount(self, *args):
ci = self.currentIndex()
if not ci.isValid():
@ -119,6 +122,11 @@ class TagsModel(QStandardItemModel):
self._data[category], self.cmap[r], self.bold_font, self.icon_map))
#self.reset()
def clear_state(self):
for category in self._data.values():
for tag in category:
tag.state = 0
self.refresh()
def reinit(self, *args, **kwargs):
if not self.ignore_next_search: