mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Do not ignore error when inserting rows in 'Duplicate record'
That avoids overwriting existing record as reported in issue #1255. This doesn't improve the underlying situation, that is inserting empty rows before duplicating the content. But it is safer to not ignore the error in the initial row insertion.
This commit is contained in:
@@ -192,7 +192,7 @@ void MainWindow::init()
|
||||
connect(dittoRecordShortcut, &QShortcut::activated, [this]() {
|
||||
int currentRow = ui->dataTable->currentIndex().row();
|
||||
auto row = m_browseTableModel->dittoRecord(currentRow);
|
||||
ui->dataTable->setCurrentIndex(row);
|
||||
duplicateRecord(currentRow);
|
||||
});
|
||||
|
||||
// Add menu item for log dock
|
||||
@@ -2450,7 +2450,7 @@ void MainWindow::showRecordPopupMenu(const QPoint& pos)
|
||||
popupRecordMenu.addAction(action);
|
||||
|
||||
connect(action, &QAction::triggered, [&]() {
|
||||
m_browseTableModel->dittoRecord(row);
|
||||
duplicateRecord(row);
|
||||
});
|
||||
|
||||
popupRecordMenu.exec(ui->dataTable->verticalHeader()->mapToGlobal(pos));
|
||||
@@ -2767,3 +2767,12 @@ void MainWindow::saveFilterAsView()
|
||||
else
|
||||
QMessageBox::information(this, qApp->applicationName(), tr("There is no filter set for this table. View will not be created."));
|
||||
}
|
||||
|
||||
void MainWindow::duplicateRecord(int currentRow)
|
||||
{
|
||||
auto row = m_browseTableModel->dittoRecord(currentRow);
|
||||
if (row.isValid())
|
||||
ui->dataTable->setCurrentIndex(row);
|
||||
else
|
||||
QMessageBox::warning(this, qApp->applicationName(), db.lastError());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user