gui: mainwindow: Add checkbox to remove current database

This commit is contained in:
Albert S. 2022-08-14 10:41:31 +02:00
parent d900d58f26
commit 47d0440ffb
2 changed files with 18 additions and 0 deletions

View File

@ -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();

View File

@ -532,6 +532,13 @@
<item>
<widget class="QLineEdit" name="txtSettingDatabasePath"/>
</item>
<item>
<widget class="QCheckBox" name="chkRemoveOldDb">
<property name="text">
<string>Remove old database on save</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>