From 6ad2417804b130ff1570a1b2463c4a0382bc0a89 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 27 Jul 2018 02:22:48 -0400 Subject: [PATCH] Remove station from heard list --- mainwindow.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 6f49ab1..b2fe907 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1078,8 +1078,18 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, auto clearAction4 = new QAction(QIcon::fromTheme("edit-clear"), QString("Clear"), ui->tableWidgetCalls); connect(clearAction4, &QAction::triggered, this, [this](){ this->on_clearAction_triggered(ui->tableWidgetCalls); }); + auto removeStation = new QAction(QString("Remove Station"), ui->tableWidgetCalls); + connect(removeStation, &QAction::triggered, this, [this](){ + QString selectedCall = callsignSelected(); + if(!selectedCall.isEmpty() && m_callActivity.contains(selectedCall)){ + m_callActivity.remove(selectedCall); + displayActivity(true); + } + }); + + ui->tableWidgetCalls->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->tableWidgetCalls, &QTableWidget::customContextMenuRequested, this, [this, clearAction4, clearActionAll](QPoint const &point){ + connect(ui->tableWidgetCalls, &QTableWidget::customContextMenuRequested, this, [this, clearAction4, clearActionAll, removeStation](QPoint const &point){ QMenu * menu = new QMenu(ui->tableWidgetCalls); QString selectedCall = callsignSelected(); @@ -1092,6 +1102,12 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, directedMenu->setDisabled(missingCallsign); buildQueryMenu(directedMenu); + menu->addSeparator(); + + removeStation->setDisabled(missingCallsign || callsignSelected() == "ALLCALL"); + menu->addAction(removeStation); + + menu->addSeparator(); menu->addAction(clearAction4); menu->addAction(clearActionAll);