Rework the kinda broken add record button

Now it should always be possible to add a new record,
no matter how the table is defined or what the new data default is.
The default new data setting will be removed in the next commit.
This commit is contained in:
Peinthor Rene
2013-03-24 21:26:01 +01:00
parent d08f57c772
commit d7d6a861b2
3 changed files with 23 additions and 27 deletions

View File

@@ -367,11 +367,14 @@ void MainWindow::closeEvent( QCloseEvent* event )
void MainWindow::addRecord()
{
if (db.addRecord()){
if (db.addRecord(db.curBrowseTableName))
{
populateTable(db.curBrowseTableName);
//added record will be the last one in view
updateTableView(db.getRecordCount()-1);
}else{
}
else
{
QMessageBox::information( this, QApplication::applicationName(),
tr("Error adding record, make sure a table is selected.\n\n"
"If the table contain fields declared as NOT NULL\n"