Fixed bug-789102. "Editing song via service and saving it, highlights it in media manager"

bzr-revno: 1607
Fixes: https://launchpad.net/bugs/789102
This commit is contained in:
Stevan Pettit 2011-06-03 07:20:56 +02:00 committed by Andreas Preikschat
commit a10038991b
5 changed files with 24 additions and 14 deletions

View File

@ -454,7 +454,8 @@ class MediaManagerItem(QtGui.QWidget):
"""
if QtCore.QSettings().value(u'advanced/single click preview',
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
and self.listView.selectedIndexes():
and self.listView.selectedIndexes() \
and self.auto_select_id == -1:
self.onPreviewClick(True)
def onPreviewClick(self, keepFocus=False):

View File

@ -115,7 +115,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
def accept(self):
log.debug(u'accept')
if self.saveCustom():
Receiver.send_message(u'custom_load_list')
QtGui.QDialog.accept(self)
def saveCustom(self):

View File

@ -109,7 +109,7 @@ class CustomMediaItem(MediaManagerItem):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_load_list'), self.initialise)
QtCore.SIGNAL(u'custom_load_list'), self.loadList)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
@ -129,14 +129,6 @@ class CustomMediaItem(MediaManagerItem):
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
u'%s/last search type' % self.settingsSection,
QtCore.QVariant(CustomSearch.Titles)).toInt()[0])
# Called to redisplay the custom list screen edith from a search
# or from the exit of the Custom edit dialog. If remote editing is
# active trigger it and clean up so it will not update again.
if self.remoteTriggered == u'L':
self.onAddClick()
if self.remoteTriggered == u'P':
self.onPreviewClick()
self.onRemoteEditClear()
def loadList(self, custom_slides):
# Sort out what custom we want to select after loading the list.
@ -155,11 +147,20 @@ class CustomMediaItem(MediaManagerItem):
if custom_slide.id == self.auto_select_id:
self.listView.setCurrentItem(custom_name)
self.auto_select_id = -1
# Called to redisplay the custom list screen edith from a search
# or from the exit of the Custom edit dialog. If remote editing is
# active trigger it and clean up so it will not update again.
if self.remoteTriggered == u'L':
self.onAddClick()
if self.remoteTriggered == u'P':
self.onPreviewClick()
self.onRemoteEditClear()
def onNewClick(self):
self.edit_custom_form.loadCustom(0)
self.edit_custom_form.exec_()
self.initialise()
self.onClearTextButtonClick()
self.onSelectionChange()
def onRemoteEditClear(self):
self.remoteTriggered = None
@ -179,6 +180,8 @@ class CustomMediaItem(MediaManagerItem):
self.remoteTriggered = remote_type
self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P'))
self.edit_custom_form.exec_()
self.auto_select_id = -1
self.onSearchTextButtonClick()
def onEditClick(self):
"""
@ -189,7 +192,8 @@ class CustomMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_custom_form.loadCustom(item_id, False)
self.edit_custom_form.exec_()
self.initialise()
self.auto_select_id = -1
self.onSearchTextButtonClick()
def onDeleteClick(self):
"""

View File

@ -696,7 +696,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.clearCaches()
if self._validate_song():
self.saveSong()
Receiver.send_message(u'songs_load_list')
self.song = None
QtGui.QDialog.accept(self)

View File

@ -300,6 +300,9 @@ class SongMediaItem(MediaManagerItem):
log.debug(u'onNewClick')
self.edit_song_form.newSong()
self.edit_song_form.exec_()
self.onClearTextButtonClick()
self.onSelectionChange()
self.auto_select_id = -1
def onSongMaintenanceClick(self):
self.song_maintenance_form.exec_()
@ -324,6 +327,8 @@ class SongMediaItem(MediaManagerItem):
self.remoteTriggered = remote_type
self.edit_song_form.loadSong(song_id, (remote_type == u'P'))
self.edit_song_form.exec_()
self.auto_select_id = -1
self.onSongListLoad()
def onEditClick(self):
"""
@ -335,6 +340,8 @@ class SongMediaItem(MediaManagerItem):
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_song_form.loadSong(item_id, False)
self.edit_song_form.exec_()
self.auto_select_id = -1
self.onSongListLoad()
self.editItem = None
def onDeleteClick(self):