EditDialog: Don't update the DB when no changes were made

Even when clicking the OK button don't write to the database when no
changes were made.
This commit is contained in:
Martin Kleusberg
2013-03-17 13:07:57 +01:00
parent 66b1a62fa4
commit 57f4d996ca
2 changed files with 5 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ void EditDialog::reset()
ui->editorText->setFocus();
ui->editorImage->clear();
hexEdit->setData(QByteArray());
oldData = "";
checkDataType();
}
@@ -49,6 +50,7 @@ void EditDialog::loadText(const QByteArray& data, int row, int col)
{
curRow = row;
curCol = col;
oldData = data;
ui->editorText->setPlainText(data);
ui->editorText->setFocus();
@@ -113,7 +115,8 @@ void EditDialog::clearData()
void EditDialog::accept()
{
emit updateRecordText(curRow, curCol, hexEdit->data());
if(hexEdit->data() != oldData)
emit updateRecordText(curRow, curCol, hexEdit->data());
emit goingAway();
}