mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ signals:
|
||||
private:
|
||||
Ui::EditDialog* ui;
|
||||
QHexEdit* hexEdit;
|
||||
QByteArray oldData;
|
||||
int curCol;
|
||||
int curRow;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user