mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-01 15:24:13 +02:00
Add read-only enforcement, preview, import/export to custom SQL reports
Refs discussion #886: a saved-report manager built on custom SQL and nomenclature.json. Most of what was asked for already existed -- Projet > Exporter au format CSV already builds/saves/reuses named SELECT queries via ElementQueryWidget and nomenclature.json, and Projet > Ajouter une nomenclature already inserts one into a folio. This fills the three real gaps. - projectDataBase::isReadOnlySelect() rejects anything that isn't a single SELECT/WITH statement. Checked in newQuery() itself, the one choke point every query path already goes through -- including a query loaded from a saved nomenclature/summary table's <query> element on project open, not just the dialog's own custom-SQL box. ElementQueryWidget shows the same check live as you type, and BOMExportDialog surfaces it before running or exporting anything. - BOMExportDialog gains a Preview button + table (QSqlQueryModel), so a report can be checked on screen before committing to a CSV file. - ElementQueryWidget gains Importer.../Exporter... buttons that read/write nomenclature.json's saved reports as a JSON file, so a report can be handed to a colleague or another install. Import asks before overwriting a locally-saved report of the same name. Verified: Qt 6.10.2, builds clean, ctest 8/8. Drove the real dialog through Xvfb: typed "DROP TABLE element" into the custom-SQL box and got the inline warning immediately, then confirmed Preview also refuses it with a "Requête refusée" dialog rather than running it. Preview against the real default query returned live column headers and a row. Export opens a save dialog without crashing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -388,6 +388,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="m_import_reports_pb">
|
||||
<property name="toolTip">
|
||||
<string>Importer des rapports depuis un fichier</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Importer...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="m_export_reports_pb">
|
||||
<property name="toolTip">
|
||||
<string>Exporter tous les rapports enregistrés vers un fichier</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exporter...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -429,6 +449,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_query_warning_label">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
||||
Reference in New Issue
Block a user