finished work on restoring current search methods

This commit is contained in:
Andreas Preikschat 2011-04-15 14:55:56 +02:00
parent 77559e0210
commit 14a2e8e4c2
4 changed files with 17 additions and 12 deletions

View File

@ -122,6 +122,7 @@ class SearchEdit(QtGui.QLineEdit):
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):

View File

@ -99,12 +99,6 @@ class BibleMediaItem(MediaManagerItem):
self.quickSearchEdit = SearchEdit(self.quickTab)
self.quickSearchEdit.setObjectName(u'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.quickLayoutLabel = QtGui.QLabel(self.quickTab)
self.quickLayoutLabel.setObjectName(u'quickClearLabel')
@ -295,7 +289,15 @@ class BibleMediaItem(MediaManagerItem):
self.settingsSection + u'/quick bible', QtCore.QVariant(
self.quickVersionComboBox.currentText())).toString()
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()
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
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.QVariant(self.quickVersionComboBox.currentText()))
books = []

View File

@ -155,14 +155,13 @@ class SongMediaItem(MediaManagerItem):
SongStrings.Authors),
(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])
self.configUpdated()
def onSearchTextButtonClick(self):
# Save the current search type to the config. so it can be restored.
# Save the current search type to the configuration.
QtCore.QSettings().setValue(u'%s/last search type' %
self.settingsSection,
QtCore.QVariant(self.searchTextEdit.currentSearchType()))

View File

@ -70,8 +70,6 @@ class SongsPlugin(Plugin):
action_list.add_action(self.SongImportItem, UiStrings.Import)
action_list.add_action(self.SongExportItem, UiStrings.Export)
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):
"""