Skip to content

Add read-only SQL Query dialog with syntax highlighting and export#991

Open
aa5sh wants to merge 1 commit intofoldynl:masterfrom
aa5sh:ReportViewer
Open

Add read-only SQL Query dialog with syntax highlighting and export#991
aa5sh wants to merge 1 commit intofoldynl:masterfrom
aa5sh:ReportViewer

Conversation

@aa5sh
Copy link
Copy Markdown

@aa5sh aa5sh commented Apr 2, 2026

Adds a new SQL Query dialog accessible via Logbook → SQL Query... that allows users to run custom read-only queries directly against the qlog.db SQLite database

  • The editor enforces safety at the application level — only SELECT and WITH … SELECT (CTE) queries are permitted; INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, ATTACH, DETACH, PRAGMA, VACUUM, and similar statements are blocked before execution
  • Syntax highlighting adapts to the active light/dark theme, coloring keywords, built-in functions, string literals, numbers, comments, and known schema identifiers (tables and columns) each in a distinct color
  • Intellisense-style autocomplete (Ctrl+Space, or auto-triggered after 2+ characters) offers completions for SQL keywords, built-in functions, and every table name and column name read live from the database schema
  • Results are displayed in a sortable, resizable table; query execution time and row count are shown in the status bar
  • Export results as TXT (tab-separated), CSV, or ADIF — the ADIF path fetches full contact records by id and routes them through the existing ExportDialog, giving identical output to the LogbookWidget right-click export
  • Queries can be opened and saved as plain .sql files for easy sharing; last-used directory is remembered across sessions
  • Editor supports F5 or Ctrl+Return to run, and the splitter position and window geometry are persisted between uses
image

Introduce a read-only SQL Query dialog and SQL syntax highlighter. Adds new UI and implementation files (ui/SqlQueryDialog.{cpp,h,ui} and ui/component/SqlHighlighter.{cpp,h}), updates QLog.pro to include them, and wires a new menu action in MainWindow (showSqlQuery). The dialog provides syntax highlighting, schema-aware autocomplete, keyboard shortcuts (F5 / Ctrl+Return / Ctrl+Space), safety checks to allow only read-only SELECT/CTE queries, and export options (TXT/CSV/ADIF). ADIF export reuses the existing ExportDialog path and dialog geometry/last-dir are persisted via QSettings.
@foldynl foldynl moved this to In Progress in v0.50.0 Roadmap Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants