* @brief Prompts the user to pick a .db file from the SQLite workspace folder. */
| 423 | * @brief Prompts the user to pick a .db file from the SQLite workspace folder. |
| 424 | */ |
| 425 | void Sessions::DatabaseManager::openDatabase() |
| 426 | { |
| 427 | auto* dialog = new QFileDialog(qApp->activeWindow(), |
| 428 | tr("Open Session File"), |
| 429 | Misc::WorkspaceManager::instance().path("Session Databases"), |
| 430 | tr("Session files (*.db)")); |
| 431 | |
| 432 | dialog->setFileMode(QFileDialog::ExistingFile); |
| 433 | dialog->setAttribute(Qt::WA_DeleteOnClose); |
| 434 | |
| 435 | connect(dialog, &QFileDialog::fileSelected, this, [this](const QString& path) { |
| 436 | if (path.isEmpty()) |
| 437 | return; |
| 438 | |
| 439 | QMetaObject::invokeMethod(this, [this, path]() { openDatabase(path); }, Qt::QueuedConnection); |
| 440 | }); |
| 441 | dialog->open(); |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * @brief Dispatches an asynchronous open + initial cache fetch to the worker. |
nothing calls this directly
no test coverage detected