* @brief Confirms the runtime-mode shortcut's project file exists; prompts cleanup if missing. */
| 569 | * @brief Confirms the runtime-mode shortcut's project file exists; prompts cleanup if missing. |
| 570 | */ |
| 571 | bool CLI::verifyShortcutProject() const |
| 572 | { |
| 573 | if (!runtimeMode() || !m_parser.isSet(m_opts.projectOpt)) |
| 574 | return true; |
| 575 | |
| 576 | const QString projectPath = m_parser.value(m_opts.projectOpt); |
| 577 | if (QFileInfo::exists(projectPath)) |
| 578 | return true; |
| 579 | |
| 580 | const QString shortcutPath = |
| 581 | m_parser.isSet(m_opts.shortcutPathOpt) ? m_parser.value(m_opts.shortcutPathOpt) : QString(); |
| 582 | |
| 583 | QMessageBox box; |
| 584 | box.setIcon(QMessageBox::Warning); |
| 585 | box.setWindowTitle(QObject::tr("Project file not found")); |
| 586 | box.setText(QObject::tr("The project file referenced by this shortcut " |
| 587 | "could not be found:\n\n%1") |
| 588 | .arg(projectPath)); |
| 589 | box.setInformativeText(QObject::tr("Would you like to delete this shortcut?")); |
| 590 | |
| 591 | QAbstractButton* deleteBtn = nullptr; |
| 592 | if (!shortcutPath.isEmpty()) |
| 593 | deleteBtn = box.addButton(QObject::tr("Delete Shortcut"), QMessageBox::DestructiveRole); |
| 594 | |
| 595 | box.addButton(QObject::tr("Quit"), QMessageBox::RejectRole); |
| 596 | box.exec(); |
| 597 | |
| 598 | if (deleteBtn != nullptr && box.clickedButton() == deleteBtn) |
| 599 | Misc::ShortcutGenerator::instance().deleteShortcut(shortcutPath); |
| 600 | |
| 601 | return false; |
| 602 | } |
| 603 | |
| 604 | /** |
| 605 | * @brief Splits a comma-separated taskbar pin list into a trimmed QStringList. |
no test coverage detected