Added the rest of the validation and tested that it all works.

This commit is contained in:
Raoul Snyman 2009-07-26 10:36:57 +02:00
parent 7eac26d98a
commit 1915f93b6e
3 changed files with 23 additions and 2 deletions

View File

@ -74,11 +74,12 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.FirstNameEdit.setFocus()
return False
if self.LastNameEdit.text() == u'':
elif self.LastNameEdit.text() == u'':
QtGui.QMessageBox.critical(self,
translate(u'AuthorsDialog', u'Error'),
translate(u'AuthorsDialog', u'You need to type in the last name of the author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.LastNameEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)

View File

@ -39,3 +39,13 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
self.NameEdit.setFocus()
return QtGui.QDialog.exec_(self)
def accept(self):
if self.NameEdit.text() == u'':
QtGui.QMessageBox.critical(self,
translate(u'SongBookDialog', u'Error'),
translate(u'SongBookDialog', u'You need to type in a book name!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.NameEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)

View File

@ -37,3 +37,13 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
self.NameEdit.setFocus()
return QtGui.QDialog.exec_(self)
def accept(self):
if self.NameEdit.text() == u'':
QtGui.QMessageBox.critical(self,
translate(u'SongBookDialog', u'Error'),
translate(u'SongBookDialog', u'You need to type in a topic name!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.NameEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)