mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
EditDialog: Show warning when editing binary data in text mode
This commit is contained in:
@@ -144,12 +144,14 @@ void EditDialog::hexDataChanged()
|
||||
|
||||
void EditDialog::checkDataType()
|
||||
{
|
||||
// Check if data is text only
|
||||
ui->comboEditor->setVisible(true);
|
||||
|
||||
// Check if data is text only
|
||||
if(QString(hexEdit->data()).toUtf8() == hexEdit->data()) // Any proper way??
|
||||
{
|
||||
ui->editorStack->setCurrentIndex(0);
|
||||
|
||||
ui->labelBinayWarning->setVisible(false);
|
||||
ui->labelType->setText(tr("Type of data currently in cell: Text / Numeric"));
|
||||
ui->labelSize->setText(tr("%n char(s)", "", hexEdit->data().length()));
|
||||
} else {
|
||||
@@ -168,6 +170,7 @@ void EditDialog::checkDataType()
|
||||
} else {
|
||||
// It's not. So it's probably some random binary data.
|
||||
|
||||
ui->labelBinayWarning->setVisible(true);
|
||||
ui->labelType->setText(tr("Type of data currently in cell: Binary"));
|
||||
ui->labelSize->setText(tr("%n byte(s)", "", hexEdit->data().length()));
|
||||
}
|
||||
|
||||
@@ -89,13 +89,26 @@
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QTextEdit" name="editorText">
|
||||
<property name="whatsThis">
|
||||
<string>This area displays information about the data present in this database cell</string>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelBinayWarning">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#c00000;">Warning: Editing binary content in text mode may result in corrupted data!</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="editorText">
|
||||
<property name="whatsThis">
|
||||
<string>This area displays information about the data present in this database cell</string>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="editorBinary"/>
|
||||
<widget class="QScrollArea" name="editorImageScrollArea">
|
||||
|
||||
Reference in New Issue
Block a user