Updated author validation to validate the display name as well.

This commit is contained in:
Raoul Snyman 2009-07-26 12:02:18 +02:00
parent 1915f93b6e
commit 67f4669df2
1 changed files with 13 additions and 0 deletions

View File

@ -81,5 +81,18 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.LastNameEdit.setFocus()
return False
elif self.DisplayEdit.text() == u'':
if QtGui.QMessageBox.critical(self,
translate(u'AuthorsDialog', u'Error'),
translate(u'AuthorsDialog', u'You haven\'t set a display name for the author, would you like me to combine the first and last names for you?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
) == QtGui.QMessageBox.Yes:
self.DisplayEdit.setText(self.FirstNameEdit.text() + \
u' ' + self.LastNameEdit.text())
return QtGui.QDialog.accept(self)
else:
self.DisplayEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)