forked from openlp/openlp
parent
3c8b6d5467
commit
77559e0210
@ -110,6 +110,20 @@ class SearchEdit(QtGui.QLineEdit):
|
||||
"""
|
||||
return self._currentSearchType
|
||||
|
||||
def setCurrentSearchType(self, identifier):
|
||||
"""
|
||||
Set a new current search type.
|
||||
|
||||
``identifier``
|
||||
The search type identifier (int).
|
||||
"""
|
||||
menu = self.menuButton.menu()
|
||||
for action in menu.actions():
|
||||
if identifier == action.data().toInt()[0]:
|
||||
self.menuButton.setDefaultAction(action)
|
||||
self._currentSearchType = identifier
|
||||
return True
|
||||
|
||||
def setSearchTypes(self, items):
|
||||
"""
|
||||
A list of tuples to be used in the search type menu. The first item in
|
||||
|
@ -156,8 +156,17 @@ class SongMediaItem(MediaManagerItem):
|
||||
(SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes)
|
||||
])
|
||||
self.configUpdated()
|
||||
# FIXME: Saved search type need to be considered when loading the list.
|
||||
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||
u'%s/last search type' % self.settingsSection,
|
||||
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
|
||||
|
||||
def onSearchTextButtonClick(self):
|
||||
# Save the current search type to the config. so it can be restored.
|
||||
QtCore.QSettings().setValue(u'%s/last search type' %
|
||||
self.settingsSection,
|
||||
QtCore.QVariant(self.searchTextEdit.currentSearchType()))
|
||||
# Reload the list considering the new search type.
|
||||
search_keywords = unicode(self.searchTextEdit.displayText())
|
||||
search_results = []
|
||||
search_type = self.searchTextEdit.currentSearchType()
|
||||
|
Loading…
Reference in New Issue
Block a user