| 398 | } |
| 399 | |
| 400 | void MainWindow::showContextMenu(const QPoint &pos) { |
| 401 | auto idx = m_tree->indexAt(pos); |
| 402 | if (!idx.isValid()) |
| 403 | return; |
| 404 | |
| 405 | QString name = m_model->deviceField(idx, "name").toString(); |
| 406 | if (name.isEmpty()) |
| 407 | return; |
| 408 | |
| 409 | m_tree->setCurrentIndex(idx); |
| 410 | |
| 411 | QMenu menu(this); |
| 412 | |
| 413 | menu.addAction("Update driver software...", [this, idx] { |
| 414 | QString n = m_model->deviceField(idx, "name").toString(); |
| 415 | UpdateDriverDialog dlg(n, this); |
| 416 | dlg.exec(); |
| 417 | }); |
| 418 | |
| 419 | auto *disableAct = menu.addAction( |
| 420 | m_actDisable->text(), |
| 421 | this, &MainWindow::disableCurrentDevice); |
| 422 | disableAct->setEnabled(m_actDisable->isEnabled()); |
| 423 | |
| 424 | auto *uninstallAct = menu.addAction("Uninstall device", |
| 425 | this, &MainWindow::uninstallCurrentDevice); |
| 426 | uninstallAct->setEnabled(m_actUninstall->isEnabled()); |
| 427 | |
| 428 | menu.addSeparator(); |
| 429 | |
| 430 | menu.addAction("Scan for hardware changes", |
| 431 | this, &MainWindow::refresh); |
| 432 | |
| 433 | menu.addSeparator(); |
| 434 | |
| 435 | menu.addAction("Properties", this, &MainWindow::showProperties); |
| 436 | |
| 437 | menu.exec(m_tree->viewport()->mapToGlobal(pos)); |
| 438 | } |
| 439 | |
| 440 | QModelIndex MainWindow::findDevice(const QString &name, |
| 441 | const QString &driver) const { |
nothing calls this directly
no test coverage detected