From c656aae3d5f7b853d6e0cc139a79ce43572b1581 Mon Sep 17 00:00:00 2001 From: nagisml Date: Thu, 15 Oct 2026 21:29:04 +0200 Subject: [PATCH] GSAK import: drop separate filter-import menu entry, explain file types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File → Import from GSAK Database already offers the saved GSAK filters (and user locations) whenever it finds a gsak.db3: inside a backup .zip, next to a chosen sqlite.db3, or chosen on its own. The separate File → Import GSAK Filters… entry did the same thing a second way, so it is removed. GsakFilterImportDialog stays, because the GSAK import still uses it for the filter step. - mainwindow: remove _act_gsak_filter_import and _open_gsak_filter_import_dialog - gsak_import_dialog: add an intro hint explaining what a backup .zip, a single sqlite.db3 and gsak.db3 alone each import - lang (all 11): add gsak_import_intro, drop action_gsak_filter_import - docs: filters.md and getting-started.md point to the GSAK import - e2e test: drive the filter import through the GSAK import with a bare gsak.db3; check that the old menu entry is gone and that gsak.db3 alone offers only filters and locations --- docs/filters.md | 8 ++- docs/getting-started.md | 2 +- src/opensak/gui/dialogs/gsak_import_dialog.py | 6 +++ src/opensak/gui/mainwindow.py | 16 ------ src/opensak/lang/cs.py | 2 +- src/opensak/lang/da.py | 2 +- src/opensak/lang/de.py | 2 +- src/opensak/lang/de_CH.py | 2 +- src/opensak/lang/en.py | 2 +- src/opensak/lang/es.py | 2 +- src/opensak/lang/fr.py | 2 +- src/opensak/lang/nl.py | 2 +- src/opensak/lang/pl.py | 2 +- src/opensak/lang/pt.py | 2 +- src/opensak/lang/se.py | 2 +- .../e2e-tests/test_e2e_gsak_filter_import.py | 49 ++++++++++++------- 16 files changed, 56 insertions(+), 47 deletions(-) diff --git a/docs/filters.md b/docs/filters.md index 9aa3214b..13a3a63e 100644 --- a/docs/filters.md +++ b/docs/filters.md @@ -466,9 +466,13 @@ Once you have set up a useful combination, save it so you can reload it in one c ## Importing GSAK's saved filters -**File → Import GSAK Filters…** turns the filters you saved in GSAK into OpenSAK filter profiles. It is the companion of *Import from GSAK Database*: that one imports caches out of a cache database (`sqlite.db3`), this one imports filters out of GSAK's settings database (`gsak.db3`, normally `%AppData%\GSAK\gsak.db3`). A GSAK backup `.zip` works too — the `gsak.db3` inside it is found automatically. +**File → Import from GSAK Database…** also turns the filters you saved in GSAK into OpenSAK filter profiles. The filters live in GSAK's settings database (`gsak.db3`, normally `%AppData%\GSAK\gsak.db3`), and the import offers them — with the **Also import the saved GSAK filters** box ticked — whenever it finds that file: -Pick the file, tick the filters you want (all of them are ticked to begin with; the search box narrows the list, and **Select all / Select none** apply to what the search currently shows), and press **Start import**. Existing profiles of the same name are kept and reported as skipped unless you tick **Overwrite filter profiles that already exist**. +- **A GSAK backup `.zip`**: every database in the backup is listed, and the `gsak.db3` inside it supplies the filters and user locations. +- **A single `sqlite.db3`**: that database is imported; the filters are offered too when a `gsak.db3` sits in the GSAK folder the database belongs to. +- **`gsak.db3` itself**: no caches are imported, only the saved filters and user locations. + +After the caches (if any) are imported, the filter list opens with the file already chosen. Tick the filters you want (all of them are ticked to begin with; the search box narrows the list, and **Select all / Select none** apply to what the search currently shows), and press **Start import**. Existing profiles of the same name are kept and reported as skipped unless you tick **Overwrite filter profiles that already exist**. ### Where each GSAK condition ends up diff --git a/docs/getting-started.md b/docs/getting-started.md index e4c5c929..b400c5ae 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -78,7 +78,7 @@ OpenSAK works with standard **GPX files** and **Pocket Query ZIP files** — the If your Pocket Queries arrive by e-mail, OpenSAK can fetch them straight from your mailbox. Set up the mailbox under **Settings → Settings… → PQ Email**, then use **File → Check for PQ Email…**. The password is kept in your operating system's keyring, never in plain text. ### Coming from GSAK -You can import a GSAK database directly with **File → Import from GSAK Database…** — including personal notes, corrected coordinates, child waypoints, attributes and the full log history. Point it at a GSAK backup `.zip` to see every database in the backup and import the ones you pick, each as its own OpenSAK database. **File → Import GSAK Filters…** turns your saved GSAK filters into OpenSAK filter profiles. OpenSAK also uses the same GPX/PQ format as GSAK, so your Pocket Queries import as usual. +You can import a GSAK database directly with **File → Import from GSAK Database…** — including personal notes, corrected coordinates, child waypoints, attributes and the full log history. Point it at a GSAK backup `.zip` to see every database in the backup and import the ones you pick, each as its own OpenSAK database. The same import also turns your saved GSAK filters and user locations (from `gsak.db3`) into OpenSAK filter profiles and home locations — pick a backup, or `gsak.db3` on its own if you only want those. OpenSAK also uses the same GPX/PQ format as GSAK, so your Pocket Queries import as usual. --- diff --git a/src/opensak/gui/dialogs/gsak_import_dialog.py b/src/opensak/gui/dialogs/gsak_import_dialog.py index b3ea3e2c..326ba718 100644 --- a/src/opensak/gui/dialogs/gsak_import_dialog.py +++ b/src/opensak/gui/dialogs/gsak_import_dialog.py @@ -263,6 +263,12 @@ def _setup_ui(self) -> None: layout = QVBoxLayout(self) layout.setSpacing(10) + # What each kind of file brings in: backup, single sqlite.db3, gsak.db3. + intro = QLabel(tr("gsak_import_intro")) + intro.setWordWrap(True) + intro.setStyleSheet(hint_style(font_size=None)) + layout.addWidget(intro) + file_lbl = QLabel(tr("gsak_import_select_file_label")) layout.addWidget(file_lbl) diff --git a/src/opensak/gui/mainwindow.py b/src/opensak/gui/mainwindow.py index aca181a9..464649ae 100644 --- a/src/opensak/gui/mainwindow.py +++ b/src/opensak/gui/mainwindow.py @@ -395,10 +395,6 @@ def _setup_menu(self) -> None: self._act_gsak_import.triggered.connect(self._open_gsak_import_dialog) file_menu.addAction(self._act_gsak_import) - self._act_gsak_filter_import = QAction(tr("action_gsak_filter_import"), self) - self._act_gsak_filter_import.triggered.connect(self._open_gsak_filter_import_dialog) - file_menu.addAction(self._act_gsak_filter_import) - self._act_pq_email_check = QAction(tr("action_pq_email_check"), self) self._act_pq_email_check.triggered.connect(self._open_pq_email_check_dialog) file_menu.addAction(self._act_pq_email_check) @@ -2133,18 +2129,6 @@ def _on_home_points_imported(self) -> None: recalculate_distances(s.home_lat, s.home_lon) self._refresh_cache_list() - def _open_gsak_filter_import_dialog(self) -> None: - """Import GSAK's saved filters as OpenSAK filter profiles. - - Unlike the cache import next to it this touches no cache data, so the - cache list and map are left alone — only the toolbar's profile - dropdown has to pick up the new profiles. - """ - from opensak.gui.dialogs.gsak_filter_import_dialog import GsakFilterImportDialog - dlg = GsakFilterImportDialog(self) - dlg.import_completed.connect(self._on_filter_profiles_imported) - dlg.exec() - def _on_filter_profiles_imported(self) -> None: self._populate_filter_profile_combo(select_name=self._active_filter_name or None) diff --git a/src/opensak/lang/cs.py b/src/opensak/lang/cs.py index 07125758..d3cb9663 100644 --- a/src/opensak/lang/cs.py +++ b/src/opensak/lang/cs.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Importovat z databáze GSAK…", "gsak_import_dialog_title": "Import z databáze GSAK", "gsak_import_select_file_label": "Vyberte zálohu GSAK (.zip) nebo soubor databáze (.db3):", + "gsak_import_intro": "Záloha GSAK (.zip) zobrazí všechny databáze, které obsahuje, a nabídne také import uložených filtrů a uživatelských míst z jejího gsak.db3. Jednotlivý soubor databáze (sqlite.db3) importuje pouze tuto databázi; filtry a místa se nabídnou také, pokud se v příslušné složce GSAK najde gsak.db3. Pokud zvolíte samotný gsak.db3, neimportují se žádné keše, pouze uložené filtry a uživatelská místa.", "gsak_import_browse_title": "Vybrat zálohu nebo soubor GSAK", "gsak_import_file_filter": "Záloha nebo databáze GSAK (*.zip *.db3);;Všechny soubory (*)", "gsak_import_extracting": "Rozbaluji {name}…", @@ -1703,7 +1704,6 @@ "file_locations_kind_appimage_icon": "Ikona v nabídce aplikací", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importovat &filtry z GSAK…", "gsak_filter_import_dialog_title": "Import filtrů z GSAK", "gsak_filter_import_select_file_label": "Vyberte databázi nastavení GSAK (gsak.db3) nebo zálohu (.zip):", "gsak_filter_import_browse_title": "Vybrat gsak.db3", diff --git a/src/opensak/lang/da.py b/src/opensak/lang/da.py index 20722f82..22134d5d 100644 --- a/src/opensak/lang/da.py +++ b/src/opensak/lang/da.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Importer fra GSAK-database…", "gsak_import_dialog_title": "Importer fra GSAK-database", "gsak_import_select_file_label": "Vælg en GSAK-backup (.zip) eller databasefil (.db3):", + "gsak_import_intro": "En GSAK-backup (.zip) viser alle de databaser, den indeholder, og tilbyder også at importere de gemte filtre og brugerplaceringer fra dens gsak.db3. En enkelt databasefil (sqlite.db3) importerer kun den database; filtre og placeringer tilbydes også, hvis der findes en gsak.db3 i den GSAK-mappe, den hører til. Vælger du selve gsak.db3, importeres ingen cacher, kun de gemte filtre og brugerplaceringer.", "gsak_import_browse_title": "Vælg GSAK-backup eller databasefil", "gsak_import_file_filter": "GSAK-backup eller database (*.zip *.db3);;Alle filer (*)", "gsak_import_extracting": "Udpakker {name}…", @@ -1707,7 +1708,6 @@ "file_locations_kind_appimage_icon": "Ikon i programmenuen", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importér GSAK-&filtre…", "gsak_filter_import_dialog_title": "Importér GSAK-filtre", "gsak_filter_import_select_file_label": "Vælg GSAK's indstillingsdatabase (gsak.db3) eller en backup (.zip):", "gsak_filter_import_browse_title": "Vælg gsak.db3", diff --git a/src/opensak/lang/de.py b/src/opensak/lang/de.py index c403f292..93c082e1 100644 --- a/src/opensak/lang/de.py +++ b/src/opensak/lang/de.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Aus GSAK-Datenbank importieren…", "gsak_import_dialog_title": "Aus GSAK-Datenbank importieren", "gsak_import_select_file_label": "Wählen Sie eine GSAK-Sicherung (.zip) oder Datenbankdatei (.db3):", + "gsak_import_intro": "Eine GSAK-Sicherung (.zip) listet alle enthaltenen Datenbanken auf und bietet zusätzlich an, die gespeicherten Filter und Benutzerstandorte aus ihrer gsak.db3 zu importieren. Eine einzelne Datenbankdatei (sqlite.db3) importiert nur diese Datenbank; Filter und Standorte werden ebenfalls angeboten, wenn im zugehörigen GSAK-Ordner eine gsak.db3 gefunden wird. Wird die gsak.db3 selbst gewählt, werden keine Caches importiert, nur die gespeicherten Filter und Benutzerstandorte.", "gsak_import_browse_title": "GSAK-Sicherung oder Datenbankdatei auswählen", "gsak_import_file_filter": "GSAK-Sicherung oder Datenbank (*.zip *.db3);;Alle Dateien (*)", "gsak_import_extracting": "{name} wird entpackt…", @@ -1708,7 +1709,6 @@ "file_locations_kind_appimage_icon": "Symbol im Anwendungsmenü", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "GSAK-&Filter importieren…", "gsak_filter_import_dialog_title": "GSAK-Filter importieren", "gsak_filter_import_select_file_label": "GSAK-Einstellungsdatenbank (gsak.db3) oder Backup (.zip) auswählen:", "gsak_filter_import_browse_title": "gsak.db3 auswählen", diff --git a/src/opensak/lang/de_CH.py b/src/opensak/lang/de_CH.py index 3c9eede8..b5f190a0 100644 --- a/src/opensak/lang/de_CH.py +++ b/src/opensak/lang/de_CH.py @@ -289,6 +289,7 @@ "action_gsak_import": "&Aus GSAK-Datenbank importieren…", "gsak_import_dialog_title": "Aus GSAK-Datenbank importieren", "gsak_import_select_file_label": "Wählen Sie eine GSAK-Sicherung (.zip) oder Datenbankdatei (.db3):", + "gsak_import_intro": "Eine GSAK-Sicherung (.zip) listet alle enthaltenen Datenbanken auf und bietet zusätzlich an, die gespeicherten Filter und Benutzerstandorte aus ihrer gsak.db3 zu importieren. Eine einzelne Datenbankdatei (sqlite.db3) importiert nur diese Datenbank; Filter und Standorte werden ebenfalls angeboten, wenn im zugehörigen GSAK-Ordner eine gsak.db3 gefunden wird. Wird die gsak.db3 selbst gewählt, werden keine Caches importiert, nur die gespeicherten Filter und Benutzerstandorte.", "gsak_import_browse_title": "GSAK-Sicherung oder Datenbankdatei auswählen", "gsak_import_file_filter": "GSAK-Sicherung oder Datenbank (*.zip *.db3);;Alle Dateien (*)", "gsak_import_extracting": "{name} wird entpackt…", @@ -1709,7 +1710,6 @@ "file_locations_kind_appimage_icon": "Symbol im Anwendungsmenü", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "GSAK-&Filter importieren…", "gsak_filter_import_dialog_title": "GSAK-Filter importieren", "gsak_filter_import_select_file_label": "GSAK-Einstellungsdatenbank (gsak.db3) oder Backup (.zip) auswählen:", "gsak_filter_import_browse_title": "gsak.db3 auswählen", diff --git a/src/opensak/lang/en.py b/src/opensak/lang/en.py index 7f2e2cdb..b2a630f0 100644 --- a/src/opensak/lang/en.py +++ b/src/opensak/lang/en.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Import from GSAK Database…", "gsak_import_dialog_title": "Import from GSAK Database", "gsak_import_select_file_label": "Select a GSAK backup (.zip) or database file (.db3):", + "gsak_import_intro": "A GSAK backup (.zip) lists all the databases it holds and also offers to import the saved filters and user locations from its gsak.db3. A single database file (sqlite.db3) imports just that database; its filters and locations are offered too if gsak.db3 is found in the GSAK folder it belongs to. Choosing gsak.db3 itself imports no caches, only the saved filters and user locations.", "gsak_import_browse_title": "Select GSAK backup or database file", "gsak_import_file_filter": "GSAK backup or database (*.zip *.db3);;All files (*)", "gsak_import_extracting": "Extracting {name}…", @@ -1706,7 +1707,6 @@ "file_locations_kind_appimage_icon": "Application menu icon", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Import GSAK &Filters…", "gsak_filter_import_dialog_title": "Import GSAK Filters", "gsak_filter_import_select_file_label": "Select GSAK's settings database (gsak.db3) or a backup (.zip):", "gsak_filter_import_browse_title": "Select gsak.db3", diff --git a/src/opensak/lang/es.py b/src/opensak/lang/es.py index c137d744..2754787e 100644 --- a/src/opensak/lang/es.py +++ b/src/opensak/lang/es.py @@ -290,6 +290,7 @@ "action_gsak_import": "&Importar desde base de datos GSAK…", "gsak_import_dialog_title": "Importar desde base de datos GSAK", "gsak_import_select_file_label": "Selecciona una copia de seguridad de GSAK (.zip) o un archivo de base de datos (.db3):", + "gsak_import_intro": "Una copia de seguridad de GSAK (.zip) muestra todas las bases de datos que contiene y ofrece además importar los filtros guardados y las ubicaciones de usuario de su gsak.db3. Un único archivo de base de datos (sqlite.db3) importa solo esa base de datos; sus filtros y ubicaciones también se ofrecen si se encuentra gsak.db3 en la carpeta de GSAK a la que pertenece. Si eliges el propio gsak.db3, no se importa ningún caché, solo los filtros guardados y las ubicaciones de usuario.", "gsak_import_browse_title": "Seleccionar copia de seguridad o base de datos de GSAK", "gsak_import_file_filter": "Copia de seguridad o base de datos de GSAK (*.zip *.db3);;Todos los archivos (*)", "gsak_import_extracting": "Extrayendo {name}…", @@ -1708,7 +1709,6 @@ "file_locations_kind_appimage_icon": "Icono del menú de aplicaciones", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importar &filtros de GSAK…", "gsak_filter_import_dialog_title": "Importar filtros de GSAK", "gsak_filter_import_select_file_label": "Elige la base de configuración de GSAK (gsak.db3) o una copia (.zip):", "gsak_filter_import_browse_title": "Elegir gsak.db3", diff --git a/src/opensak/lang/fr.py b/src/opensak/lang/fr.py index bf37f171..366473f2 100644 --- a/src/opensak/lang/fr.py +++ b/src/opensak/lang/fr.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Importer depuis une base GSAK…", "gsak_import_dialog_title": "Importer depuis une base GSAK", "gsak_import_select_file_label": "Sélectionnez une sauvegarde GSAK (.zip) ou un fichier de base de données (.db3) :", + "gsak_import_intro": "Une sauvegarde GSAK (.zip) liste toutes les bases de données qu'elle contient et propose aussi d'importer les filtres enregistrés et les emplacements utilisateur de son gsak.db3. Un fichier de base de données seul (sqlite.db3) n'importe que cette base ; ses filtres et emplacements sont aussi proposés si un gsak.db3 se trouve dans le dossier GSAK correspondant. Choisir gsak.db3 lui-même n'importe aucune cache, seulement les filtres enregistrés et les emplacements utilisateur.", "gsak_import_browse_title": "Sélectionner une sauvegarde ou un fichier GSAK", "gsak_import_file_filter": "Sauvegarde ou base GSAK (*.zip *.db3);;Tous les fichiers (*)", "gsak_import_extracting": "Extraction de {name}…", @@ -1708,7 +1709,6 @@ "file_locations_kind_appimage_icon": "Icône du menu des applications", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importer les &filtres GSAK…", "gsak_filter_import_dialog_title": "Importer les filtres GSAK", "gsak_filter_import_select_file_label": "Choisissez la base de configuration GSAK (gsak.db3) ou une sauvegarde (.zip) :", "gsak_filter_import_browse_title": "Choisir gsak.db3", diff --git a/src/opensak/lang/nl.py b/src/opensak/lang/nl.py index d97b155c..b89d56ef 100644 --- a/src/opensak/lang/nl.py +++ b/src/opensak/lang/nl.py @@ -291,6 +291,7 @@ "action_gsak_import": "&Importeren uit GSAK-database…", "gsak_import_dialog_title": "Importeren uit GSAK-database", "gsak_import_select_file_label": "Selecteer een GSAK-back-up (.zip) of databasebestand (.db3):", + "gsak_import_intro": "Een GSAK-back-up (.zip) toont alle databases die erin zitten en biedt ook aan de opgeslagen filters en gebruikerslocaties uit de bijbehorende gsak.db3 te importeren. Eén databasebestand (sqlite.db3) importeert alleen die database; de filters en locaties worden ook aangeboden als er een gsak.db3 in de bijbehorende GSAK-map staat. Kies je gsak.db3 zelf, dan worden geen caches geïmporteerd, alleen de opgeslagen filters en gebruikerslocaties.", "gsak_import_browse_title": "Selecteer GSAK-back-up of databasebestand", "gsak_import_file_filter": "GSAK-back-up of database (*.zip *.db3);;Alle bestanden (*)", "gsak_import_extracting": "Bezig met uitpakken van {name}…", @@ -1705,7 +1706,6 @@ "file_locations_kind_appimage_icon": "Pictogram in het programmamenu", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "GSAK-&filters importeren…", "gsak_filter_import_dialog_title": "GSAK-filters importeren", "gsak_filter_import_select_file_label": "Kies GSAK's instellingendatabase (gsak.db3) of een back-up (.zip):", "gsak_filter_import_browse_title": "gsak.db3 kiezen", diff --git a/src/opensak/lang/pl.py b/src/opensak/lang/pl.py index 913182d3..481285ac 100644 --- a/src/opensak/lang/pl.py +++ b/src/opensak/lang/pl.py @@ -290,6 +290,7 @@ "action_gsak_import": "&Importuj z bazy danych GSAK…", "gsak_import_dialog_title": "Import z bazy danych GSAK", "gsak_import_select_file_label": "Wybierz kopię zapasową GSAK (.zip) lub plik bazy danych (.db3):", + "gsak_import_intro": "Kopia zapasowa GSAK (.zip) pokazuje wszystkie zawarte w niej bazy danych i proponuje też import zapisanych filtrów i lokalizacji użytkownika z jej pliku gsak.db3. Pojedynczy plik bazy danych (sqlite.db3) importuje tylko tę bazę; filtry i lokalizacje są również proponowane, jeśli w odpowiadającym jej folderze GSAK znajduje się gsak.db3. Wybranie samego gsak.db3 nie importuje żadnych skrzynek, tylko zapisane filtry i lokalizacje użytkownika.", "gsak_import_browse_title": "Wybierz kopię zapasową GSAK lub plik bazy danych", "gsak_import_file_filter": "Kopia zapasowa lub baza danych GSAK (*.zip *.db3);;Wszystkie pliki (*)", "gsak_import_extracting": "Rozpakowywanie {name}…", @@ -1708,7 +1709,6 @@ "file_locations_kind_appimage_icon": "Ikona w menu aplikacji", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importuj &filtry GSAK…", "gsak_filter_import_dialog_title": "Import filtrów GSAK", "gsak_filter_import_select_file_label": "Wybierz bazę ustawień GSAK (gsak.db3) lub kopię zapasową (.zip):", "gsak_filter_import_browse_title": "Wybierz gsak.db3", diff --git a/src/opensak/lang/pt.py b/src/opensak/lang/pt.py index 6cf3edee..72ad2b1a 100644 --- a/src/opensak/lang/pt.py +++ b/src/opensak/lang/pt.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Importar de base de dados GSAK…", "gsak_import_dialog_title": "Importar de base de dados GSAK", "gsak_import_select_file_label": "Selecione uma cópia de segurança GSAK (.zip) ou ficheiro de base de dados (.db3):", + "gsak_import_intro": "Uma cópia de segurança GSAK (.zip) lista todas as bases de dados que contém e oferece também importar os filtros guardados e as localizações do utilizador do seu gsak.db3. Um único ficheiro de base de dados (sqlite.db3) importa apenas essa base de dados; os filtros e localizações também são oferecidos se for encontrado um gsak.db3 na pasta GSAK a que pertence. Escolher o próprio gsak.db3 não importa caches, apenas os filtros guardados e as localizações do utilizador.", "gsak_import_browse_title": "Selecionar cópia de segurança ou ficheiro GSAK", "gsak_import_file_filter": "Cópia de segurança ou base de dados GSAK (*.zip *.db3);;Todos os ficheiros (*)", "gsak_import_extracting": "A extrair {name}…", @@ -1708,7 +1709,6 @@ "file_locations_kind_appimage_icon": "Ícone no menu de aplicações", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importar &filtros do GSAK…", "gsak_filter_import_dialog_title": "Importar filtros do GSAK", "gsak_filter_import_select_file_label": "Escolha a base de definições do GSAK (gsak.db3) ou uma cópia (.zip):", "gsak_filter_import_browse_title": "Escolher gsak.db3", diff --git a/src/opensak/lang/se.py b/src/opensak/lang/se.py index d546200c..84ba1ce5 100644 --- a/src/opensak/lang/se.py +++ b/src/opensak/lang/se.py @@ -288,6 +288,7 @@ "action_gsak_import": "&Importera från GSAK-databas…", "gsak_import_dialog_title": "Importera från GSAK-databas", "gsak_import_select_file_label": "Välj en GSAK-säkerhetskopia (.zip) eller databasfil (.db3):", + "gsak_import_intro": "En GSAK-säkerhetskopia (.zip) visar alla databaser den innehåller och erbjuder även att importera de sparade filtren och användarplatserna från dess gsak.db3. En enskild databasfil (sqlite.db3) importerar bara den databasen; filter och platser erbjuds också om en gsak.db3 finns i den GSAK-mapp den tillhör. Väljer du själva gsak.db3 importeras inga cacher, bara de sparade filtren och användarplatserna.", "gsak_import_browse_title": "Välj GSAK-säkerhetskopia eller databasfil", "gsak_import_file_filter": "GSAK-säkerhetskopia eller databas (*.zip *.db3);;Alla filer (*)", "gsak_import_extracting": "Packar upp {name}…", @@ -1707,7 +1708,6 @@ "file_locations_kind_appimage_icon": "Ikon i programmenyn", # ── GSAK filter import ──────────────────────────────────────────────────── - "action_gsak_filter_import": "Importera GSAK-&filter…", "gsak_filter_import_dialog_title": "Importera GSAK-filter", "gsak_filter_import_select_file_label": "Välj GSAK:s inställningsdatabas (gsak.db3) eller en säkerhetskopia (.zip):", "gsak_filter_import_browse_title": "Välj gsak.db3", diff --git a/tests/e2e-tests/test_e2e_gsak_filter_import.py b/tests/e2e-tests/test_e2e_gsak_filter_import.py index d3a13e0d..f2fc0837 100644 --- a/tests/e2e-tests/test_e2e_gsak_filter_import.py +++ b/tests/e2e-tests/test_e2e_gsak_filter_import.py @@ -1,5 +1,6 @@ # tests/e2e-tests/test_e2e_gsak_filter_import.py — importing GSAK's saved -# filters from the File menu, all the way to a usable filter profile. +# filters through File → Import from GSAK Database, all the way to a usable +# filter profile. import sqlite3 from pathlib import Path @@ -34,31 +35,45 @@ def gsak_db(tmp_path) -> Path: def _open_dialog(window, monkeypatch, gsak_db, profiles_dir): - """Open the File-menu dialog with the file already chosen.""" + """Choose gsak.db3 in the GSAK import and run it (filters only) — the + filter dialog it hands over to comes back with the file already chosen.""" from opensak.gui.dialogs import gsak_filter_import_dialog as fdlg + from opensak.gui.dialogs import gsak_import_dialog as idlg monkeypatch.setattr("opensak.config.get_app_data_dir", lambda: profiles_dir) opened = {} + monkeypatch.setattr(idlg.GsakImportDialog, "exec", + lambda self: opened.setdefault("import", self)) monkeypatch.setattr(fdlg.GsakFilterImportDialog, "exec", lambda self: opened.setdefault("dlg", self)) - monkeypatch.setattr(fdlg.QFileDialog, "getOpenFileName", - lambda *a, **k: (str(gsak_db), "f")) - window._act_gsak_filter_import.trigger() - dlg = opened["dlg"] - dlg._browse() - return dlg + window._act_gsak_import.trigger() + imp = opened["import"] + imp.set_path(gsak_db) + imp._locations_cb.setChecked(False) + imp._start_import() + return opened["dlg"] class TestGsakFilterImportE2E: - def test_menu_action_sits_next_to_the_database_import(self, empty_window): - from PySide6.QtWidgets import QMenu + def test_no_separate_menu_action_any_more(self, empty_window): + # The GSAK import covers it: a backup or gsak.db3 offers the filters. + assert not hasattr(empty_window, "_act_gsak_filter_import") - action = empty_window._act_gsak_filter_import - assert action.text() != "action_gsak_filter_import" # translated - menu = next(o for o in action.associatedObjects() if isinstance(o, QMenu)) - actions = menu.actions() - assert actions.index(action) == \ - actions.index(empty_window._act_gsak_import) + 1 + def test_gsak_db3_alone_offers_only_filters_and_locations( + self, empty_window, monkeypatch, gsak_db + ): + from opensak.gui.dialogs import gsak_import_dialog as idlg + + opened = {} + monkeypatch.setattr(idlg.GsakImportDialog, "exec", + lambda self: opened.setdefault("import", self)) + empty_window._act_gsak_import.trigger() + imp = opened["import"] + imp.set_path(gsak_db) + assert imp._table.rowCount() == 0 + assert not imp._filters_cb.isHidden() and imp._filters_cb.isChecked() + assert not imp._locations_cb.isHidden() + assert imp._import_btn.isEnabled() def test_import_writes_profiles_the_filter_dialog_can_load( self, empty_window, tmp_path, monkeypatch, gsak_db, qtbot @@ -129,8 +144,8 @@ def test_imported_profile_appears_in_the_toolbar_dropdown( self, empty_window, tmp_path, monkeypatch, gsak_db, qtbot ): profiles_dir = tmp_path / "appdata" + # The GSAK import passes import_completed on to the main window. dlg = _open_dialog(empty_window, monkeypatch, gsak_db, profiles_dir) - dlg.import_completed.connect(empty_window._on_filter_profiles_imported) with qtbot.waitSignal(dlg.import_completed, timeout=10_000): dlg._start_import() qtbot.waitUntil(lambda: dlg._worker is None, timeout=10_000)