From 401bf9d4dd37310f6fc4bd81b21300679e52bec9 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck F4FXL - KC3FRA Date: Tue, 23 Apr 2019 09:21:40 +0200 Subject: [PATCH] Fixes missing or empty CCS_Hosts.txt preventing to save the configuration. - Add error message so as to not leave user in the dark. - Allow saving configuration when CCS_hosts.txt is empty/missing and CCS is disabled --- GUICommon/DCSSet.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GUICommon/DCSSet.cpp b/GUICommon/DCSSet.cpp index 6339de8..730bfa3 100644 --- a/GUICommon/DCSSet.cpp +++ b/GUICommon/DCSSet.cpp @@ -21,6 +21,7 @@ #include "Defs.h" #include +#include const unsigned int CONTROL_WIDTH = 130U; @@ -109,12 +110,14 @@ bool CDCSSet::Validate() if (n == wxNOT_FOUND) return false; - n = m_ccsEnabled->GetCurrentSelection(); - if (n == wxNOT_FOUND) - return false; + bool ccsEnabled = m_ccsEnabled->GetCurrentSelection() == 1; + bool ccsHostSelected = m_ccsHosts->GetCurrentSelection() != wxNOT_FOUND; - if (m_ccsHosts->GetCurrentSelection() == wxNOT_FOUND) + if (ccsEnabled && !ccsHostSelected) { + wxMessageDialog dialog(this, _("CCS is enabled and no CCS host has been selected. Either disable CCS or select a CCS host."), m_title + _(" Error"), wxICON_ERROR); + dialog.ShowModal(); return false; + } return true; }