Added feature to store a message locally for another station to retrieve from you later
This commit is contained in:
parent
bb348763fb
commit
35cfbbc2e5
@ -1425,6 +1425,31 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
mw->show();
|
mw->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto localMessageAction = new QAction(QString("Store Message..."), ui->tableWidgetCalls);
|
||||||
|
connect(localMessageAction, &QAction::triggered, this, [this](){
|
||||||
|
QString selectedCall = callsignSelected();
|
||||||
|
if(selectedCall.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto m = new MessageReplyDialog(this);
|
||||||
|
m->setWindowTitle("Message");
|
||||||
|
m->setLabel(QString("Store this message locally for %1:").arg(selectedCall));
|
||||||
|
if(m->exec() != QMessageBox::Accepted){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandDetail d = {};
|
||||||
|
d.cmd = " MSG";
|
||||||
|
d.to = selectedCall;
|
||||||
|
d.from = m_config.my_callsign();
|
||||||
|
d.relayPath = d.from;
|
||||||
|
d.text = m->textValue();
|
||||||
|
d.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
|
||||||
|
|
||||||
|
addCommandToStorage("STORE", d);
|
||||||
|
});
|
||||||
|
|
||||||
ui->tableWidgetCalls->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->tableWidgetCalls->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->tableWidgetCalls->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, [this](QPoint const &point){
|
connect(ui->tableWidgetCalls->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, [this](QPoint const &point){
|
||||||
QMenu * menu = new QMenu(ui->tableWidgetCalls);
|
QMenu * menu = new QMenu(ui->tableWidgetCalls);
|
||||||
@ -1435,7 +1460,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
});
|
});
|
||||||
|
|
||||||
ui->tableWidgetCalls->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->tableWidgetCalls->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->tableWidgetCalls, &QTableWidget::customContextMenuRequested, this, [this, logAction, historyAction, clearAction4, clearActionAll, addStation, removeStation](QPoint const &point){
|
connect(ui->tableWidgetCalls, &QTableWidget::customContextMenuRequested, this, [this, logAction, historyAction, localMessageAction, clearAction4, clearActionAll, addStation, removeStation](QPoint const &point){
|
||||||
QMenu * menu = new QMenu(ui->tableWidgetCalls);
|
QMenu * menu = new QMenu(ui->tableWidgetCalls);
|
||||||
|
|
||||||
ui->tableWidgetRXAll->selectionModel()->clearSelection();
|
ui->tableWidgetRXAll->selectionModel()->clearSelection();
|
||||||
@ -1462,6 +1487,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
menu->addAction(historyAction);
|
menu->addAction(historyAction);
|
||||||
historyAction->setDisabled(missingCallsign || isAllCall || isGroupCall || !hasMessageHistory(selectedCall));
|
historyAction->setDisabled(missingCallsign || isAllCall || isGroupCall || !hasMessageHistory(selectedCall));
|
||||||
|
|
||||||
|
menu->addAction(localMessageAction);
|
||||||
|
localMessageAction->setDisabled(missingCallsign || isAllCall || isGroupCall);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
auto savedMenu = menu->addMenu("Saved messages...");
|
auto savedMenu = menu->addMenu("Saved messages...");
|
||||||
@ -10054,7 +10082,7 @@ void MainWindow::processCommandActivity() {
|
|||||||
|
|
||||||
qDebug() << "storing message to" << to << ":" << text;
|
qDebug() << "storing message to" << to << ":" << text;
|
||||||
|
|
||||||
addCommandToInboxStorage("STORE", cd);
|
addCommandToStorage("STORE", cd);
|
||||||
|
|
||||||
// we haven't replaced the from with the relay path, so we have to use it for the ack if there is one
|
// we haven't replaced the from with the relay path, so we have to use it for the ack if there is one
|
||||||
reply = QString("%1 ACK").arg(calls.length() > 1 ? d.relayPath : d.from);
|
reply = QString("%1 ACK").arg(calls.length() > 1 ? d.relayPath : d.from);
|
||||||
@ -10378,10 +10406,10 @@ int MainWindow::addCommandToMyInbox(CommandDetail d){
|
|||||||
m_rxInboxCountCache[d.from] = m_rxInboxCountCache.value(d.from, 0) + 1;
|
m_rxInboxCountCache[d.from] = m_rxInboxCountCache.value(d.from, 0) + 1;
|
||||||
|
|
||||||
// add it to my unread inbox
|
// add it to my unread inbox
|
||||||
return addCommandToInboxStorage("UNREAD", d);
|
return addCommandToStorage("UNREAD", d);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MainWindow::addCommandToInboxStorage(QString type, CommandDetail d){
|
int MainWindow::addCommandToStorage(QString type, CommandDetail d){
|
||||||
// inbox:
|
// inbox:
|
||||||
auto inbox = Inbox(inboxPath());
|
auto inbox = Inbox(inboxPath());
|
||||||
if(!inbox.open()){
|
if(!inbox.open()){
|
||||||
|
@ -954,7 +954,7 @@ private:
|
|||||||
void refreshInboxCounts();
|
void refreshInboxCounts();
|
||||||
bool hasMessageHistory(QString call);
|
bool hasMessageHistory(QString call);
|
||||||
int addCommandToMyInbox(CommandDetail d);
|
int addCommandToMyInbox(CommandDetail d);
|
||||||
int addCommandToInboxStorage(QString type, CommandDetail d);
|
int addCommandToStorage(QString type, CommandDetail d);
|
||||||
int getNextMessageIdForCallsign(QString callsign);
|
int getNextMessageIdForCallsign(QString callsign);
|
||||||
QStringList parseRelayPathCallsigns(QString from, QString text);
|
QStringList parseRelayPathCallsigns(QString from, QString text);
|
||||||
void processAlertReplyForCommand(CommandDetail d, QString from, QString cmd);
|
void processAlertReplyForCommand(CommandDetail d, QString from, QString cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user