forked from openlp/openlp
Prevent topic and author duplication in songs
bzr-revno: 954
This commit is contained in:
commit
a00dbc337c
@ -304,10 +304,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
elif item > 0:
|
elif item > 0:
|
||||||
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0]
|
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0]
|
||||||
author = self.songmanager.get_object(Author, item_id)
|
author = self.songmanager.get_object(Author, item_id)
|
||||||
self.song.authors.append(author)
|
if author in self.song.authors:
|
||||||
author_item = QtGui.QListWidgetItem(unicode(author.display_name))
|
QtGui.QMessageBox.warning(self,
|
||||||
author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
translate('SongsPlugin.EditSongForm', 'Error'),
|
||||||
self.AuthorsListView.addItem(author_item)
|
translate('SongsPlugin.EditSongForm', 'This author is '
|
||||||
|
'already in the list.'))
|
||||||
|
else:
|
||||||
|
self.song.authors.append(author)
|
||||||
|
author_item = QtGui.QListWidgetItem(unicode(
|
||||||
|
author.display_name))
|
||||||
|
author_item.setData(QtCore.Qt.UserRole,
|
||||||
|
QtCore.QVariant(author.id))
|
||||||
|
self.AuthorsListView.addItem(author_item)
|
||||||
self.AuthorsSelectionComboItem.setCurrentIndex(0)
|
self.AuthorsSelectionComboItem.setCurrentIndex(0)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.warning(self,
|
QtGui.QMessageBox.warning(self,
|
||||||
@ -355,10 +363,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
elif item > 0:
|
elif item > 0:
|
||||||
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0]
|
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0]
|
||||||
topic = self.songmanager.get_object(Topic, item_id)
|
topic = self.songmanager.get_object(Topic, item_id)
|
||||||
self.song.topics.append(topic)
|
if topic in self.song.topics:
|
||||||
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
QtGui.QMessageBox.warning(self,
|
||||||
topic_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
translate('SongsPlugin.EditSongForm', 'Error'),
|
||||||
self.TopicsListView.addItem(topic_item)
|
translate('SongsPlugin.EditSongForm', 'This topic is '
|
||||||
|
'already in the list.'))
|
||||||
|
else:
|
||||||
|
self.song.topics.append(topic)
|
||||||
|
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
||||||
|
topic_item.setData(QtCore.Qt.UserRole,
|
||||||
|
QtCore.QVariant(topic.id))
|
||||||
|
self.TopicsListView.addItem(topic_item)
|
||||||
self.SongTopicCombo.setCurrentIndex(0)
|
self.SongTopicCombo.setCurrentIndex(0)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.warning(self,
|
QtGui.QMessageBox.warning(self,
|
||||||
|
Loading…
Reference in New Issue
Block a user