diff --git a/src/ui/form/opt/optionscontroller.cpp b/src/ui/form/opt/optionscontroller.cpp index 2f2bed2b..21fab18b 100644 --- a/src/ui/form/opt/optionscontroller.cpp +++ b/src/ui/form/opt/optionscontroller.cpp @@ -177,11 +177,20 @@ void OptionsController::importBackup() if (confManager()->importBackup(path)) { windowManager()->showInfoDialog(tr("Backup Imported Successfully")); + windowManager()->restart(); } else { windowManager()->showErrorBox(tr("Cannot Import Backup")); } } +void OptionsController::confirmImportBackup() +{ + windowManager()->showConfirmBox([&] { importBackup(); }, + tr("Program will be restarted after successful import. Continue?\n\n" + "Make sure that you have a fresh backup."), + tr("Import Backup")); +} + void OptionsController::closeWindow() { windowManager()->closeOptionsWindow(); diff --git a/src/ui/form/opt/optionscontroller.h b/src/ui/form/opt/optionscontroller.h index 975ac8ed..77843b78 100644 --- a/src/ui/form/opt/optionscontroller.h +++ b/src/ui/form/opt/optionscontroller.h @@ -48,6 +48,7 @@ public slots: void exportBackup(); void importBackup(); + void confirmImportBackup(); void closeWindow(); diff --git a/src/ui/form/opt/pages/optmainpage.cpp b/src/ui/form/opt/pages/optmainpage.cpp index f51e8fc4..c0b8e9be 100644 --- a/src/ui/form/opt/pages/optmainpage.cpp +++ b/src/ui/form/opt/pages/optmainpage.cpp @@ -130,7 +130,7 @@ void OptMainPage::setupBackup() m_actImport = backupMenu->addAction(IconCache::icon(":/icons/folder.png"), QString()); connect(m_actExport, &QAction::triggered, ctrl(), &OptionsController::exportBackup); - connect(m_actImport, &QAction::triggered, ctrl(), &OptionsController::importBackup); + connect(m_actImport, &QAction::triggered, ctrl(), &OptionsController::confirmImportBackup); m_btBackup = new QPushButton(); m_btBackup->setMenu(backupMenu);