Fix satellite QSO data handling and UI initialization order - #1118
Merged
Conversation
QSO::setSatName() cleared satName but never touched propMode, so editing a SAT QSO and removing its satellite left propMode == "SAT" with an empty satName. QSO::setPropMode() now also rejects "SAT" when no satellite name is set, so the invariant holds regardless of call order (UI, ADIF import, etc). In the Satellite tab, selecting "Other" now enables the satellite name field even while editing an existing QSO (previously blocked by the "modifying" guard), and leaving it blank saves the satellite name as the translatable "Unknown" instead of clearing propMode. Closes #1117
Selecting "Other" in the Satellite tab now immediately fills the name field with a translatable "Unknown" shown in red, so the user notices it needs editing, instead of only substituting it silently at save time. Picking a real satellite or "No-SAT" clears and disables the field again. The red highlight clears as soon as the user types over it. Moved the widget's flag/palette initialization before createUI()/ populateSatComboBox() in the constructor, since populating the combo box can synchronously trigger the same slot that now depends on them.
DataProxy_SQLite::bindQSOValues() only bound :sat_mode/:sat_name when the QSO's propagation mode was SAT. m_insertQuery and m_updateQuery are prepared once and reused for every save, so a placeholder left unbound keeps whatever value was bound the last time that query object executed. Editing a SAT QSO down to "No-SAT" (or "Other" then back) produced a QSO object with an empty satName/satMode, but the save silently skipped rebinding those placeholders, so the previous value (from this QSO, or potentially a different one saved earlier in the session) stayed in the row. Bind both fields unconditionally.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
This PR fixes several issues related to satellite QSO handling and UI initialization:
UI Initialization Order: Move
createUI()andpopulateSatComboBox()calls to after palette and flag initialization to prevent crashes when the combo box change handler fires synchronously.Satellite Name Field Management: Improve the "Other" satellite name field behavior to always reflect the current selection state, allowing users to edit the satellite name even while modifying existing QSOs.
Database Consistency: Ensure satellite mode and name are always bound to prepared queries, preventing stale data from persisting when a QSO changes from SAT to non-SAT propagation mode.
Data Validation: Add validation to prevent SAT propagation mode from being set without a satellite name, and clear the propagation mode when a satellite name is removed.
Key Changes
mainwindowsattab.cpp:
createUI()andpopulateSatComboBox()calls after palette initialization with explanatory commentslotSatNameComboBoxChanged()to handle "Other" satellite field state upfront, before early returnsslotSatNameTextChanged()to clear the red highlight when user typesgetSatName()to return "Unknown" instead of empty string when "Other" is selected but no name entereddataproxy_sqlite.cpp:
bindQSOValues()to always bindsat_modeandsat_nameparameters, even when not SAT propagation mode, preventing stale database values from previous QSOsqso.cpp:
setPropMode()to reject SAT mode when satellite name is emptysetSatName()to clear propagation mode when satellite name is clearedNotable Implementation Details
https://claude.ai/code/session_0168ZBpozDiJyhPUtW5YvQzb