Fix songs with no text being saved

Fixes: https://launchpad.net/bugs/691952
This commit is contained in:
Tim Bentley 2010-12-18 17:28:50 +00:00
parent 6b760003d0
commit 47ac10f413
1 changed files with 11 additions and 2 deletions

View File

@ -29,7 +29,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib import VerseType, translate
from editversedialog import Ui_EditVerseDialog
@ -159,3 +159,12 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse),
text)
return text
def accept(self):
if len(unicode(self.getVerse()[0])) == 0:
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm',
'You need to type some text in to the verse.'))
return False
QtGui.QDialog.accept(self)