Fixed bug1222534 by using userData rather than relying on a translated string.

bzr-revno: 2176
This commit is contained in:
Philip Ridout 2013-12-07 19:57:48 +00:00 committed by Tim Bentley
commit 1039c5ace8

View File

@ -153,7 +153,7 @@ class PresentationMediaItem(MediaManagerItem):
if self.controllers[item].enabled(): if self.controllers[item].enabled():
self.displayTypeComboBox.addItem(item) self.displayTypeComboBox.addItem(item)
if self.displayTypeComboBox.count() > 1: if self.displayTypeComboBox.count() > 1:
self.displayTypeComboBox.insertItem(0, self.Automatic) self.displayTypeComboBox.insertItem(0, self.Automatic, userData=u'automatic')
self.displayTypeComboBox.setCurrentIndex(0) self.displayTypeComboBox.setCurrentIndex(0)
if Settings().value(self.settingsSection + u'/override app', if Settings().value(self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
@ -277,13 +277,13 @@ class PresentationMediaItem(MediaManagerItem):
service_item.shortname = unicode(self.displayTypeComboBox.currentText()) service_item.shortname = unicode(self.displayTypeComboBox.currentText())
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay) service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay) service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
shortname = service_item.shortname if not service_item.shortname:
if not shortname:
return False return False
for bitem in items: for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename): if os.path.exists(filename):
if shortname == self.Automatic: if self.displayTypeComboBox.itemData(
self.displayTypeComboBox.currentIndex()) == u'automatic':
service_item.shortname = self.findControllerByType(filename) service_item.shortname = self.findControllerByType(filename)
if not service_item.shortname: if not service_item.shortname:
return False return False