← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/songs-notsamename into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/songs-notsamename into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/songs-notsamename/+merge/44712

Added an extra check no to let song with already existing name be saved. Thanks to o123hallo for giving me good advice.
-- 
https://code.launchpad.net/~mahfiaz/openlp/songs-notsamename/+merge/44712
Your team OpenLP Core is requested to review the proposed merge of lp:~mahfiaz/openlp/songs-notsamename into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-12-21 19:49:02 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-12-26 22:11:53 +0000
@@ -536,6 +536,15 @@
                 translate('SongsPlugin.EditSongForm',
                 'You need to type in a song title.'))
             return False
+        if self.manager.get_object_filtered(Song, Song.title == \
+                unicode(self.TitleEditItem.displayText())) != None:
+            self.SongTabWidget.setCurrentIndex(0)
+            self.TitleEditItem.setFocus()
+            QtGui.QMessageBox.critical(self,
+                translate('SongsPlugin.EditSongForm', 'Error'),
+                translate('SongsPlugin.EditSongForm',
+                'You already have a song with exactly the same name.'))
+            return False
         if self.VerseListWidget.rowCount() == 0:
             self.SongTabWidget.setCurrentIndex(0)
             self.VerseListWidget.setFocus()


Follow ups