forked from openlp/openlp
- remember the search type which was used before OpenLP was closed and restore it on startup (Bug #746243)
bzr-revno: 1465 Fixes: https://launchpad.net/bugs/746243
This commit is contained in:
commit
84fdb9bb0a
@ -110,6 +110,21 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
"""
|
"""
|
||||||
return self._currentSearchType
|
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
|
||||||
|
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
|
||||||
|
return True
|
||||||
|
|
||||||
def setSearchTypes(self, items):
|
def setSearchTypes(self, items):
|
||||||
"""
|
"""
|
||||||
A list of tuples to be used in the search type menu. The first item in
|
A list of tuples to be used in the search type menu. The first item in
|
||||||
|
@ -99,12 +99,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.quickSearchEdit = SearchEdit(self.quickTab)
|
self.quickSearchEdit = SearchEdit(self.quickTab)
|
||||||
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
|
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
|
||||||
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
|
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
|
||||||
self.quickSearchEdit.setSearchTypes([
|
|
||||||
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
|
|
||||||
translate('BiblesPlugin.MediaItem', 'Scripture Reference')),
|
|
||||||
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
|
|
||||||
translate('BiblesPlugin.MediaItem', 'Text Search'))
|
|
||||||
])
|
|
||||||
self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
|
self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
|
||||||
self.quickLayoutLabel = QtGui.QLabel(self.quickTab)
|
self.quickLayoutLabel = QtGui.QLabel(self.quickTab)
|
||||||
self.quickLayoutLabel.setObjectName(u'quickClearLabel')
|
self.quickLayoutLabel.setObjectName(u'quickClearLabel')
|
||||||
@ -295,7 +289,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.settingsSection + u'/quick bible', QtCore.QVariant(
|
self.settingsSection + u'/quick bible', QtCore.QVariant(
|
||||||
self.quickVersionComboBox.currentText())).toString()
|
self.quickVersionComboBox.currentText())).toString()
|
||||||
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
||||||
self.updateAutoCompleter()
|
self.quickSearchEdit.setSearchTypes([
|
||||||
|
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
|
||||||
|
translate('BiblesPlugin.MediaItem', 'Scripture Reference')),
|
||||||
|
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
|
||||||
|
translate('BiblesPlugin.MediaItem', 'Text Search'))
|
||||||
|
])
|
||||||
|
self.quickSearchEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||||
|
u'%s/last search type' % self.settingsSection,
|
||||||
|
QtCore.QVariant(BibleSearch.Reference)).toInt()[0])
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
log.debug(u'bible manager initialise complete')
|
log.debug(u'bible manager initialise complete')
|
||||||
|
|
||||||
@ -386,6 +388,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
completion depends on the bible. It is only updated when we are doing a
|
completion depends on the bible. It is only updated when we are doing a
|
||||||
reference search, otherwise the auto completion list is removed.
|
reference search, otherwise the auto completion list is removed.
|
||||||
"""
|
"""
|
||||||
|
# Save the current search type to the configuration.
|
||||||
|
QtCore.QSettings().setValue(u'%s/last search type' %
|
||||||
|
self.settingsSection,
|
||||||
|
QtCore.QVariant(self.quickSearchEdit.currentSearchType()))
|
||||||
|
# Save the current bible to the configuration.
|
||||||
QtCore.QSettings().setValue(self.settingsSection + u'/quick bible',
|
QtCore.QSettings().setValue(self.settingsSection + u'/quick bible',
|
||||||
QtCore.QVariant(self.quickVersionComboBox.currentText()))
|
QtCore.QVariant(self.quickVersionComboBox.currentText()))
|
||||||
books = []
|
books = []
|
||||||
|
@ -155,9 +155,17 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
SongStrings.Authors),
|
SongStrings.Authors),
|
||||||
(SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes)
|
(SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes)
|
||||||
])
|
])
|
||||||
|
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||||
|
u'%s/last search type' % self.settingsSection,
|
||||||
|
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
|
|
||||||
def onSearchTextButtonClick(self):
|
def onSearchTextButtonClick(self):
|
||||||
|
# Save the current search type to the configuration.
|
||||||
|
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_keywords = unicode(self.searchTextEdit.displayText())
|
||||||
search_results = []
|
search_results = []
|
||||||
search_type = self.searchTextEdit.currentSearchType()
|
search_type = self.searchTextEdit.currentSearchType()
|
||||||
|
@ -70,8 +70,6 @@ class SongsPlugin(Plugin):
|
|||||||
action_list.add_action(self.SongImportItem, UiStrings.Import)
|
action_list.add_action(self.SongImportItem, UiStrings.Import)
|
||||||
action_list.add_action(self.SongExportItem, UiStrings.Export)
|
action_list.add_action(self.SongExportItem, UiStrings.Export)
|
||||||
action_list.add_action(self.toolsReindexItem, UiStrings.Tools)
|
action_list.add_action(self.toolsReindexItem, UiStrings.Tools)
|
||||||
self.mediaItem.displayResultsSong(
|
|
||||||
self.manager.get_all_objects(Song, order_by_ref=Song.search_title))
|
|
||||||
|
|
||||||
def addImportMenuItem(self, import_menu):
|
def addImportMenuItem(self, import_menu):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user