From 47d0440ffb032dd6bbad8520e8c7bc14464c2c4c Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 14 Aug 2022 10:41:31 +0200 Subject: [PATCH] gui: mainwindow: Add checkbox to remove current database --- gui/mainwindow.cpp | 11 +++++++++++ gui/mainwindow.ui | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 2714f97..bb6f59d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -408,6 +408,17 @@ void MainWindow::initSettingsTabs() void MainWindow::saveSettings() { + if(ui->chkRemoveOldDb->isChecked()) + { + bool result = QFile::remove(Common::databasePath()); + if(!result) + { + QMessageBox::critical(this, "Error removing database", + "Failed to remove old database. Settings not saved."); + return; + } + } + QSettings settings; QString pdfViewerCmd = ui->txtSettingPdfPreviewerCmd->text(); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 2d707a6..24a98ac 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -532,6 +532,13 @@ + + + + Remove old database on save + + +