* @brief Asks the user to confirm before deleting a session. */
| 639 | * @brief Asks the user to confirm before deleting a session. |
| 640 | */ |
| 641 | void Sessions::DatabaseManager::confirmDeleteSession(int sessionId) |
| 642 | { |
| 643 | if (m_locked) { |
| 644 | Misc::Utilities::showMessageBox( |
| 645 | tr("Session file locked"), |
| 646 | tr("Unlock the session file before deleting recorded sessions."), |
| 647 | QMessageBox::Information); |
| 648 | return; |
| 649 | } |
| 650 | |
| 651 | const auto meta = sessionMetadata(sessionId); |
| 652 | const auto title = meta.value("started_at").toString(); |
| 653 | |
| 654 | const int choice = Misc::Utilities::showMessageBox( |
| 655 | tr("Delete session from %1?").arg(title), |
| 656 | tr("All readings and raw data for this session are permanently removed."), |
| 657 | QMessageBox::Warning, |
| 658 | tr("Delete Session"), |
| 659 | QMessageBox::Yes | QMessageBox::Cancel, |
| 660 | QMessageBox::Cancel); |
| 661 | |
| 662 | if (choice == QMessageBox::Yes) |
| 663 | deleteSession(sessionId); |
| 664 | } |
| 665 | |
| 666 | /** |
| 667 | * @brief Hands the selected session off to the SQLite player for replay. |