From a1c2b8adefa5044c5d86dcd23eac8fc54c349be6 Mon Sep 17 00:00:00 2001
From: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
Date: Mon, 21 Oct 2024 09:58:59 -0400
Subject: [PATCH] account_archive: unify archive file type

When creating an account archive, there would be no default
suffix. Then, when importing the archives, we would filter
for .gz files by name. The goal is to implement a .jami
file extension for archives across all platforms.

Todo: implement custom MIME type for custom icons.

GitLab: #1256
Change-Id: I202ae5670c928f35b0eaf711abf7249ec3f304b9
---
 src/app/mainview/components/BackupTipBox.qml           | 3 ++-
 src/app/net/jami/Constants/JamiStrings.qml             | 2 +-
 src/app/settingsview/components/ManageAccountPage.qml  | 5 +++--
 src/app/wizardview/components/ImportFromBackupPage.qml | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/app/mainview/components/BackupTipBox.qml b/src/app/mainview/components/BackupTipBox.qml
index 28b4787e1..54561cd1e 100644
--- a/src/app/mainview/components/BackupTipBox.qml
+++ b/src/app/mainview/components/BackupTipBox.qml
@@ -119,7 +119,8 @@ Item {
                             "title": JamiStrings.backupAccountHere,
                             "fileMode": JamiFileDialog.SaveFile,
                             "folder": StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/Desktop",
-                            "nameFilters": [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles]
+                            "nameFilters": [JamiStrings.jamiAccountFiles, JamiStrings.allFiles],
+                            "defaultSuffix": ".jac"
                         });
                     dlg.fileAccepted.connect(function (file) {
                             // Is there password? If so, go to password dialog, else, go to following directly
diff --git a/src/app/net/jami/Constants/JamiStrings.qml b/src/app/net/jami/Constants/JamiStrings.qml
index 663b411f9..99b71d058 100644
--- a/src/app/net/jami/Constants/JamiStrings.qml
+++ b/src/app/net/jami/Constants/JamiStrings.qml
@@ -216,7 +216,7 @@ Item {
     property string backupAccountBtn: qsTr("Back up account")
     property string success: qsTr("Success")
     property string error: qsTr("Error")
-    property string jamiArchiveFiles: qsTr("Jami archive files (*.gz)")
+    property string jamiAccountFiles: qsTr("Jami account (*.jac)")
     property string allFiles: qsTr("All files (*)")
 
     // ContactItemDelegate
diff --git a/src/app/settingsview/components/ManageAccountPage.qml b/src/app/settingsview/components/ManageAccountPage.qml
index 759e8324f..dd3636556 100644
--- a/src/app/settingsview/components/ManageAccountPage.qml
+++ b/src/app/settingsview/components/ManageAccountPage.qml
@@ -349,8 +349,9 @@ SettingsPageBase {
                             "title": JamiStrings.backupAccountHere,
                             "fileMode": FileDialog.SaveFile,
                             "folder": StandardPaths.writableLocation(StandardPaths.DesktopLocation),
-                            "nameFilters": [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles]
-                        });
+                            "nameFilters": [JamiStrings.jamiAccountFiles, JamiStrings.allFiles],
+                            "defaultSuffix": ".jac"
+                        })
                     dlg.fileAccepted.connect(function (file) {
                             // is there password? If so, go to password dialog, else, go to following directly
                             var exportPath = UtilsAdapter.getAbsPath(file.toString());
diff --git a/src/app/wizardview/components/ImportFromBackupPage.qml b/src/app/wizardview/components/ImportFromBackupPage.qml
index b3fcb272f..50bdefb3b 100644
--- a/src/app/wizardview/components/ImportFromBackupPage.qml
+++ b/src/app/wizardview/components/ImportFromBackupPage.qml
@@ -133,7 +133,7 @@ Rectangle {
                         "title": JamiStrings.openFile,
                         "fileMode": JamiFileDialog.OpenFile,
                         "folder": StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/Desktop",
-                        "nameFilters": [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles]
+                        "nameFilters": [JamiStrings.jamiAccountFiles, JamiStrings.allFiles]
                     });
                 dlg.fileAccepted.connect(function (file) {
                         filePath = file;
-- 
GitLab