diff --git a/app.go b/app.go index 448a1df..8e396c2 100644 --- a/app.go +++ b/app.go @@ -1806,6 +1806,61 @@ func (a *App) SaveMySQLSettings(s MySQLSettings) error { return a.switchLogbook(p) } +// RenameLogbook copies the ACTIVE profile's SQLite logbook to dest (with its +// QSOs), repoints the profile at it and switches the live logbook — no restart. +// Unlike "choose a dedicated file" (which points at a fresh/empty file), this +// carries the data across. The old file is deleted only when it was this +// profile's OWN dedicated file; the shared default logbook.db is left in place +// (other profiles may use it). Errors if the logbook is MySQL. +func (a *App) RenameLogbook(dest string) error { + dest = strings.TrimSpace(dest) + if dest == "" { + return fmt.Errorf("no destination given") + } + p, err := a.profiles.Active(a.ctx) + if err != nil { + return fmt.Errorf("no active profile: %w", err) + } + if p.DB.Backend == "mysql" { + return fmt.Errorf("this profile's logbook is MySQL — no file to rename") + } + old := strings.TrimSpace(p.DB.Path) + wasDedicated := old != "" + if old == "" { + old = a.logbookPath + } + if old == "" || a.logDb == nil { + return fmt.Errorf("no logbook file to rename") + } + if strings.EqualFold(filepath.Clean(dest), filepath.Clean(old)) { + return fmt.Errorf("that is already the current logbook name") + } + if _, err := os.Stat(dest); err == nil { + return fmt.Errorf("a file already exists at %s — pick a new name", dest) + } + if err := os.MkdirAll(filepath.Dir(dest), 0o755); err != nil { + return fmt.Errorf("create folder: %w", err) + } + safe := strings.ReplaceAll(dest, "'", "''") + if _, err := a.logDb.ExecContext(a.ctx, "VACUUM INTO '"+safe+"'"); err != nil { + return fmt.Errorf("copy logbook: %w", err) + } + p.DB.Backend = "sqlite" + p.DB.Path = dest + if err := a.profiles.SetDB(a.ctx, p.ID, p.DB); err != nil { + return err + } + if err := a.switchLogbook(p); err != nil { // opens dest, closes the old conn + return err + } + if wasDedicated { + for _, f := range []string{old, old + "-wal", old + "-shm"} { + _ = os.Remove(f) + } + } + return nil +} + // TestMySQLConnection pings the shared MySQL database with the given settings // (no migrations) so the user can validate connectivity from the UI. func (a *App) TestMySQLConnection(s MySQLSettings) error { diff --git a/changelog.json b/changelog.json index 3633e03..db31611 100644 --- a/changelog.json +++ b/changelog.json @@ -3,7 +3,7 @@ "version": "0.20.12", "date": "2026-07-24", "en": [ - "Your QSOs and your settings now live in separate files: settings + profiles stay in the settings database, while contacts go to a dedicated logbook file (existing logs are migrated automatically, originals kept as a backup). A profile can also point at its own logbook file — ideal for a visiting operator, whose contacts stay out of your log without ever touching your settings or profiles. The Database panel now clearly shows the two, with an 'Open folder' shortcut.", + "Your QSOs and your settings now live in separate files: settings + profiles stay in the settings database, while contacts go to a dedicated logbook file (existing logs are migrated automatically, originals kept as a backup). A profile can also point at its own logbook file — ideal for a visiting operator, whose contacts stay out of your log without ever touching your settings or profiles. The Database panel now clearly shows the two, with an 'Open folder' shortcut, and a logbook file can be renamed/relocated (its QSOs move with it).", "Fixed a motorized-antenna bug that could leave a FlexRadio permanently unable to transmit (‘Interlock is preventing transmission’). With a SteppIR whose status frequency reads intermittently (it flipped between the commanded frequency and its home value), the ‘follow the rig’ loop re-sent a tune command on almost every poll, and each command re-armed the ‘block TX while the antenna moves’ window — so the interlock never released. The follow loop now keys its deadband off the rig’s frequency (only re-tuning when the RADIO actually QSYs), immune to a flaky antenna status. Also dropped an ‘interlock set reason=’ command that SmartSDR rejects (it’s read-only) and only produced a harmless error line — the transmit-inhibit itself is unchanged and still holds TX safely while the elements move. New: a SteppIR ‘Tunable range’ setting (Settings → Hardware → Antenna, default 13–54 MHz = 20 m–6 m) — on a band outside it OpsLog leaves the antenna and TX completely alone, so tuning to 30 m on a 20 m–6 m SteppIR no longer tries to move it or touches the interlock.", "New built-in award: The Helvetia 26 Award (H26) — the 26 cantons of Switzerland (USKA), matched from the QSO's address or QTH on HF. Each canton also recognises its main cities (Genève, Lausanne, Zürich, Bellinzona…), since operators rarely write the canton itself.", "FlexRadio panel: the RECEIVE card is shorter again. All the noise controls added recently made it tower, so only the everyday ones — NB, NR, ANF — now stay visible; WNB and the SmartSDR v4 DSP block (NRL/NRS/NRF/ANFL and the AI/FFT RNN & ANFT) tuck behind a 'DSP' button you expand when you need them. The button carries a dot and highlights when one of the hidden controls is switched on, so nothing active is ever out of sight, and its open/closed state is remembered.", @@ -17,7 +17,7 @@ "Fixed the colour theme sometimes resetting to light after an update/relaunch: an update can clear the WebView's localStorage, and the fallback that restores the theme from the local settings database gave up after ~2.4s — occasionally too soon during the brief startup window before that store is ready. It now keeps retrying until the store actually answers, so a dark theme is reliably restored." ], "fr": [ - "Tes QSO et tes réglages sont désormais dans des fichiers séparés : réglages + profils dans la base de réglages, contacts dans un fichier journal dédié (les journaux existants sont migrés automatiquement, les originaux gardés en sauvegarde). Un profil peut aussi pointer vers son propre fichier journal — idéal pour un opérateur de passage, dont les contacts restent hors de ton journal sans jamais toucher tes réglages ni profils. Le panneau Base de données montre maintenant clairement les deux, avec un raccourci « Ouvrir le dossier ».", + "Tes QSO et tes réglages sont désormais dans des fichiers séparés : réglages + profils dans la base de réglages, contacts dans un fichier journal dédié (les journaux existants sont migrés automatiquement, les originaux gardés en sauvegarde). Un profil peut aussi pointer vers son propre fichier journal — idéal pour un opérateur de passage, dont les contacts restent hors de ton journal sans jamais toucher tes réglages ni profils. Le panneau Base de données montre maintenant clairement les deux, avec un raccourci « Ouvrir le dossier », et un fichier journal peut être renommé/déplacé (ses QSO le suivent).", "Correction d'un bug d'antenne motorisée qui pouvait laisser un FlexRadio définitivement incapable d'émettre (« Interlock is preventing transmission »). Avec une SteppIR dont la fréquence de statut se lit par intermittence (elle alternait entre la fréquence commandée et sa valeur de repos), la boucle de suivi renvoyait un ordre d'accord à presque chaque cycle, et chaque ordre réarmait la fenêtre « bloquer l'émission pendant que l'antenne bouge » — l'interlock ne se relâchait donc jamais. La boucle de suivi se base maintenant sur la fréquence de la RADIO (elle ne réaccorde que quand le poste change réellement de fréquence), insensible à un statut d'antenne erratique. Retrait aussi d'une commande « interlock set reason= » que SmartSDR refuse (champ en lecture seule) et qui ne produisait qu'une ligne d'erreur sans effet — l'inhibition d'émission elle-même est inchangée et protège toujours pendant le mouvement des éléments. Nouveau : un réglage « Plage accordable » pour la SteppIR (Réglages → Matériel → Antenne, défaut 13-54 MHz = 20 m-6 m) — sur une bande hors de cette plage, OpsLog laisse totalement l'antenne et l'émission tranquilles, donc passer sur 30 m avec une SteppIR 20 m-6 m ne tente plus de la bouger ni ne touche à l'interlock.", "Nouveau diplôme intégré : The Helvetia 26 Award (H26) — les 26 cantons de Suisse (USKA), reconnus depuis l'adresse ou le QTH du QSO en HF. Chaque canton reconnaît aussi ses principales villes (Genève, Lausanne, Zürich, Bellinzone…), car les opérateurs écrivent rarement le canton lui-même.", "Panneau FlexRadio : la carte RÉCEPTION est de nouveau plus compacte. Tous les contrôles de bruit ajoutés récemment la faisaient s'allonger, donc seuls ceux du quotidien — NB, NR, ANF — restent visibles ; le WNB et le bloc DSP SmartSDR v4 (NRL/NRS/NRF/ANFL ainsi que RNN & ANFT IA/FFT) se replient derrière un bouton « DSP » que tu déplies au besoin. Le bouton porte un point et s'illumine quand l'un des contrôles masqués est activé, pour ne jamais perdre de vue quelque chose d'actif, et son état ouvert/fermé est mémorisé.", diff --git a/frontend/src/components/SettingsModal.tsx b/frontend/src/components/SettingsModal.tsx index 0994b05..23ca27e 100644 --- a/frontend/src/components/SettingsModal.tsx +++ b/frontend/src/components/SettingsModal.tsx @@ -29,7 +29,7 @@ import { ConnectClusterServer, DisconnectClusterServer, ConnectAllClusters, DisconnectAllClusters, GetClusterStatus, GetBackupSettings, SaveBackupSettings, RunBackupNow, PickBackupFolder, - GetDatabaseSettings, PickOpenDatabase, PickSaveDatabase, OpenDatabase, MoveDatabase, ResetDatabaseToDefault, RestartApp, CreateDatabase, RenameDatabase, RevealDataFolder, + GetDatabaseSettings, PickOpenDatabase, PickSaveDatabase, OpenDatabase, MoveDatabase, ResetDatabaseToDefault, RestartApp, CreateDatabase, RenameDatabase, RevealDataFolder, RenameLogbook, GetMySQLSettings, SaveMySQLSettings, TestMySQLConnection, GetDBBackendStatus, GetAutostartPrograms, SaveAutostartPrograms, BrowseExecutable, LaunchAutostartProgram, GetTelemetryEnabled, SetTelemetryEnabled, @@ -4308,6 +4308,17 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan } catch (e: any) { setErr(String(e?.message ?? e)); } } function revealFolder() { RevealDataFolder().catch((e: any) => setErr(String(e?.message ?? e))); } + // Rename/relocate THIS profile's logbook, carrying the QSOs across. + async function renameLogbook() { + try { + const p = await PickSaveDatabase(); + if (!p) return; + await RenameLogbook(p); + setMysqlField({ enabled: false, sqlite_path: p }); + setRestartMsg(t('db.logbookRenamed')); + await refreshBackend(); + } catch (e: any) { setErr(String(e?.message ?? e)); } + } // Switching the logbook backend applies immediately (no restart): the local // SQLite file always stays the config store; only the QSO logbook moves. function useLocalLogbook() { @@ -4423,6 +4434,7 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan