From 20c41cf45bef2ead8e7775dcf33f247efd815eb6 Mon Sep 17 00:00:00 2001
From: Uwe Risse <dg2ycb@gmx.de>
Date: Sat, 3 Feb 2024 15:44:02 +0100
Subject: [PATCH 1/7] Don't write <my_gridsquare> ADIF tag when myGrid is
 empty.

---
 logbook/logbook.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/logbook/logbook.cpp b/logbook/logbook.cpp
index 411d6240c..2d4340299 100644
--- a/logbook/logbook.cpp
+++ b/logbook/logbook.cpp
@@ -101,7 +101,7 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
   t += " <band:" + QString::number(band.size()) + ">" + band;
   t += " <freq:" + QString::number(strDialFreq.size()) + ">" + strDialFreq;
   t += " <station_callsign:" + QString::number(myCall.size()) + ">" + myCall;
-  t += " <my_gridsquare:" + QString::number(myGrid.size()) + ">" + myGrid;
+  if(myGrid!="") t += " <my_gridsquare:" + QString::number(myGrid.size()) + ">" + myGrid;
   if(txPower!="") t += " <tx_pwr:" + QString::number(txPower.size()) + ">" + txPower;
   if(comments!="") t += " <comment:" + QString::number(comments.size()) + ">" + comments;
   if(name!="") t += " <name:" + QString::number(name.size()) + ">" + name;

From 98e48e00d33a4c554d9f6efb8956b86ea9525fcc Mon Sep 17 00:00:00 2001
From: Steven Franke <s.j.franke@icloud.com>
Date: Mon, 5 Feb 2024 08:52:57 -0600
Subject: [PATCH 2/7] Only hash the callsign of stations that we are hearing.

---
 lib/77bit/packjt77.f90 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90
index 5729cee06..47cd3b6bb 100644
--- a/lib/77bit/packjt77.f90
+++ b/lib/77bit/packjt77.f90
@@ -474,13 +474,17 @@ subroutine unpack77(c77,nrx,msg,unpk77_success)
         i=index(call_1,' ')
         if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.1) call_1(i:i+1)='/R'
         if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.2) call_1(i:i+1)='/P'
-        if(i.ge.4) call add_call_to_recent_calls(call_1)
+        if(i.ge.4) call add_call_to_recent_calls(call_1) 
      endif
      if(index(call_2,'<').le.0) then
         i=index(call_2,' ')
         if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.1) call_2(i:i+1)='/R'
         if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.2) call_2(i:i+1)='/P'
-        if(i.ge.4) call add_call_to_recent_calls(call_2)
+        if(i.ge.4) then
+           call add_call_to_recent_calls(call_2)
+! only hash the "from" call
+           call save_hash_call(call_2,ndum10,ndum12,ndum22)
+        endif
      endif
      if(igrid4.le.MAXGRID4) then
         call to_grid4(igrid4,grid4,unpkg4_success)
@@ -560,6 +564,7 @@ subroutine unpack77(c77,nrx,msg,unpk77_success)
         call_1=call_3          
         call_2=adjustl(c11)//'  '
         call add_call_to_recent_calls(call_2)
+        call save_hash_call(call_2,ndum10,ndum12,ndum22)
         if(nrx.eq.1 .and.                        &  
            dxcall13_set .and. mycall13_set .and. & 
            call_2.eq.dxcall13 .and.              &
@@ -1540,7 +1545,7 @@ subroutine add_call_to_recent_calls(callsign)
   endif
 
 ! Make sure that callsign is hashed
-  call save_hash_call(callsign,n10,n12,n22)
+!  call save_hash_call(callsign,n10,n12,n22) ! commented out - do this in the calling routine:
 
   return
 end subroutine add_call_to_recent_calls

From 3611f07ad63cee539f1a618b03d7481791dc3f9d Mon Sep 17 00:00:00 2001
From: Uwe Risse <dg2ycb@gmx.de>
Date: Mon, 5 Feb 2024 16:50:22 +0100
Subject: [PATCH 3/7] Enable Tx by double-clicking on a combined message on
 standard FT8 sub-bands is no longer permitted, as 10-bit hash collisions are
 too likely.

---
 widgets/mainwindow.cpp | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 639dc174a..2a4ca827d 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -5531,8 +5531,31 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
     return;
   }
   DecodedText message {cursor.block().text().trimmed().left(61).remove("TU; ")};
-  m_bDoubleClicked = true;
-  processMessage (message, modifiers);
+  if(message.string().contains(";") && message.string().contains("<")) {
+    QVector<qint32> ft8Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000};
+    for(int i=0; i<ft8Freq.length()-1; i++) {
+        int kHzdiff=m_freqNominal - ft8Freq[i];
+        if(qAbs(kHzdiff) < 3000 ) {
+        m_bTxTime=false;
+        if (m_auto) auto_tx_mode (false);
+        if (m_tune) stop_tuning();
+        auto const& msg2 = tr("Double-clicking on combined messages\n"
+                              "not allowed on the standard FT8 sub-bands.\n\n"
+                              "First verify that the displayed <callsign>\n"
+                              "is not a decoding artefact.");
+        QTimer::singleShot (0, [=] {               // don't block guiUpdate
+          MessageBox::warning_message (this, tr ("Potential hash collision"), msg2);
+        });
+        break;
+      } else {
+          m_bDoubleClicked = true;
+          processMessage (message, modifiers);
+      }
+    }
+  } else {
+      m_bDoubleClicked = true;
+      processMessage (message, modifiers);
+  }
 }
 
 void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifiers modifiers)

From 3882953f51b799ba0b4e6ac07ca1f656c03cf270 Mon Sep 17 00:00:00 2001
From: Uwe Risse <dg2ycb@gmx.de>
Date: Mon, 5 Feb 2024 17:01:03 +0100
Subject: [PATCH 4/7] Disable the popup message for now.

---
 widgets/mainwindow.cpp | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 2a4ca827d..0bda00ee3 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -5539,13 +5539,11 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
         m_bTxTime=false;
         if (m_auto) auto_tx_mode (false);
         if (m_tune) stop_tuning();
-        auto const& msg2 = tr("Double-clicking on combined messages\n"
-                              "not allowed on the standard FT8 sub-bands.\n\n"
-                              "First verify that the displayed <callsign>\n"
-                              "is not a decoding artefact.");
-        QTimer::singleShot (0, [=] {               // don't block guiUpdate
-          MessageBox::warning_message (this, tr ("Potential hash collision"), msg2);
-        });
+//        auto const& msg2 = tr("Double-clicking on combined messages\n"
+//                              "not allowed on the standard FT8 sub-bands.");
+//        QTimer::singleShot (0, [=] {               // don't block guiUpdate
+//          MessageBox::warning_message (this, tr ("Potential hash collision"), msg2);
+//        });
         break;
       } else {
           m_bDoubleClicked = true;

From ffe1d11e995146c4f780bd6c35277239c1f8bf1a Mon Sep 17 00:00:00 2001
From: Uwe Risse <dg2ycb@gmx.de>
Date: Tue, 6 Feb 2024 11:06:33 +0100
Subject: [PATCH 5/7] Don't fill DX Call box and Std Msgs when double-clicking
 on a combined message and we are on standard FT8 sub-bands.

---
 widgets/mainwindow.cpp | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 0bda00ee3..153ad6f06 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -5515,21 +5515,6 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
   } else {
     cursor=ui->decodedTextBrowser2->textCursor();
   }
-
-  if(modifiers==(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)) {
-    //### What was the purpose of this ???  ###
-    cursor.setPosition(0);
-  } else {
-    cursor.setPosition(cursor.selectionStart());
-  }
-
-  if(SpecOp::FOX==m_specOp and m_decodedText2) {
-    if(m_houndQueue.count()<10 and m_nSortedHounds>0) {
-      QString t=cursor.block().text();
-      selectHound(t, modifiers==(Qt::AltModifier));  // alt double-click gets put at top of queue
-    }
-    return;
-  }
   DecodedText message {cursor.block().text().trimmed().left(61).remove("TU; ")};
   if(message.string().contains(";") && message.string().contains("<")) {
     QVector<qint32> ft8Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000};
@@ -5544,16 +5529,26 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
 //        QTimer::singleShot (0, [=] {               // don't block guiUpdate
 //          MessageBox::warning_message (this, tr ("Potential hash collision"), msg2);
 //        });
-        break;
-      } else {
-          m_bDoubleClicked = true;
-          processMessage (message, modifiers);
-      }
+        return;
+        }
     }
-  } else {
-      m_bDoubleClicked = true;
-      processMessage (message, modifiers);
   }
+  if(modifiers==(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)) {
+    //### What was the purpose of this ???  ###
+    cursor.setPosition(0);
+  } else {
+    cursor.setPosition(cursor.selectionStart());
+  }
+
+  if(SpecOp::FOX==m_specOp and m_decodedText2) {
+    if(m_houndQueue.count()<10 and m_nSortedHounds>0) {
+      QString t=cursor.block().text();
+      selectHound(t, modifiers==(Qt::AltModifier));  // alt double-click gets put at top of queue
+    }
+    return;
+  }
+  m_bDoubleClicked = true;
+  processMessage (message, modifiers);
 }
 
 void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifiers modifiers)

From c228b6fe183c4ecac9c39a403751b2ce58f3a6e2 Mon Sep 17 00:00:00 2001
From: Uwe Risse <dg2ycb@gmx.de>
Date: Tue, 6 Feb 2024 16:13:40 +0100
Subject: [PATCH 6/7] Disable double-clicking on combined messages also for the
 standard FT4 sub-bands.

---
 widgets/mainwindow.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 153ad6f06..77bf94893 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -5517,9 +5517,9 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
   }
   DecodedText message {cursor.block().text().trimmed().left(61).remove("TU; ")};
   if(message.string().contains(";") && message.string().contains("<")) {
-    QVector<qint32> ft8Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000};
-    for(int i=0; i<ft8Freq.length()-1; i++) {
-        int kHzdiff=m_freqNominal - ft8Freq[i];
+    QVector<qint32> Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000,3575000,7047500,10140000,14080000,18104000,21140000,24919000,28180000,50318000};
+    for(int i=0; i<Freq.length()-1; i++) {
+        int kHzdiff=m_freqNominal - Freq[i];
         if(qAbs(kHzdiff) < 3000 ) {
         m_bTxTime=false;
         if (m_auto) auto_tx_mode (false);

From ae17011aa4cf0f97e8594970228097c5b474f5bb Mon Sep 17 00:00:00 2001
From: Joe Taylor <joe@princeton.edu>
Date: Wed, 28 Feb 2024 13:58:23 -0500
Subject: [PATCH 7/7] Alt+A to clear the Active Stations window in Q65 mode
 (for QMAP).

---
 widgets/mainwindow.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 77bf94893..ae8766572 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -2251,6 +2251,13 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
   bool bAltF1F6=m_config.alternate_bindings();
   switch(e->key())
     {
+  case Qt::Key_A:
+    if(m_mode=="Q65" && e->modifiers() & Qt::AltModifier) {
+      m_EMECall.clear();
+      qmapcom.ndecodes=0;
+      readWidebandDecodes();
+    }
+  return;
   case Qt::Key_B:
     if(m_mode=="FT4" && e->modifiers() & Qt::AltModifier) {
       on_pbBestSP_clicked();
@@ -3259,6 +3266,7 @@ void MainWindow::on_actionKeyboard_shortcuts_triggered()
   <tr><td><b>Ctrl+Shift+F12 </b></td><td>Move dial frequency up 1000 Hz</td></tr>
   <tr><td><b>Alt+1-6  </b></td><td>Set now transmission to this number on Tab 1</td></tr>
   <tr><td><b>Ctl+1-6  </b></td><td>Set next transmission to this number on Tab 1</td></tr>
+  <tr><td><b>Alt+A    </b></td><td>Clear Active Stations for QMAP</td></tr>
   <tr><td><b>Alt+B    </b></td><td>Toggle "Best S+P" status</td></tr>
   <tr><td><b>Alt+C    </b></td><td>Toggle "Call 1st" checkbox</td></tr>
   <tr><td><b>Alt+D    </b></td><td>Decode again at QSO frequency</td></tr>