diff --git a/client/src/locales/en-US.json b/client/src/locales/en-US.json index 223ebecaf25..7d4d7b5cc7e 100644 --- a/client/src/locales/en-US.json +++ b/client/src/locales/en-US.json @@ -2718,6 +2718,7 @@ }, "fileViewers": { "openWithDefault": "Open with default app", + "cancel": "Cancel", "details": "Details", "copyLink": "Copy link", "openInEditor": "Edit", @@ -2736,6 +2737,7 @@ }, "informationEditDownload": "If you want to edit this file, you can download it and open it locally on your device.", "informationPreviewDownload": "If you want to preview this file, you can download it and open it locally on your device.", + "informationPreviewDefaultApp": "If you want to preview this file, you can open it with your system default application.", "unknownFileExtension": "This file type extension could not be identified. Please check that it's correctly written (.txt, .pdf, .doc, etc.).", "noContentFileType": "Could not open this file in the Parsec editor as its type could not be identified.", "noFolderPreview": "Cannot preview folders.", diff --git a/client/src/locales/fr-FR.json b/client/src/locales/fr-FR.json index 4c63bf418d1..95b50487790 100644 --- a/client/src/locales/fr-FR.json +++ b/client/src/locales/fr-FR.json @@ -2717,6 +2717,7 @@ }, "fileViewers": { "openWithDefault": "Ouvrir avec l'app par défaut", + "cancel": "Annuler", "details": "Détails", "copyLink": "Copier le lien", "openInEditor": "Éditer", @@ -2734,7 +2735,8 @@ "editionNotAvailable": "L'édition de documents n'est pas disponible" }, "informationEditDownload": "Si vous souhaitez modifier ce fichier, vous pouvez le télécharger et l'ouvrir localement sur votre appareil.", - "informationPreviewDownload": "Si vous souhaitez prévisualiser ce fichier, vous pouvez le faire dans Parsec ou le télécharger pour l'ouvrir localement sur votre appareil.", + "informationPreviewDownload": "Si vous souhaitez prévisualiser ce fichier, vous pouvez le télécharger pour l'ouvrir localement sur votre appareil.", + "informationPreviewDefaultApp": "Si vous souhaitez visualiser ce fichier, vous pouvez l'ouvrir dans l'application par défaut de votre système.", "unknownFileExtension": "L'extension de ce fichier n'a pas pu être reconnue. Veuillez vérifier qu'elle est correctement écrite (.txt, .pdf, .doc, etc.).", "noContentFileType": "Impossible d'ouvrir ce fichier, son type n'ayant pas pu être reconnu dans l'éditeur de Parsec.", "noFolderPreview": "Impossible d'afficher l'aperçu d'un dossier.", diff --git a/client/src/services/pathOpener.ts b/client/src/services/pathOpener.ts index dc4ea7e5526..ea23a50673a 100644 --- a/client/src/services/pathOpener.ts +++ b/client/src/services/pathOpener.ts @@ -22,7 +22,7 @@ import { Information, InformationLevel, InformationManager, PresentationMode } f import { recentDocumentManager } from '@/services/recentDocuments'; import { FileHandlerMode } from '@/views/files/handler'; import { DateTime } from 'luxon'; -import { Base64 } from 'megashark-lib'; +import { Answer, askQuestion, Base64 } from 'megashark-lib'; import { Ref, ref } from 'vue'; const currentlyOpening = ref(false); @@ -252,7 +252,13 @@ async function openPath( if (contentType.type === FileContentType.Unknown) { // Couldn't detect the file type, try with the system if allowed/available, otherwise display a message if (isDesktop() && !options.disallowSystem) { - await _openWithSystem(workspaceHandle, entry, informationManager); + const answer = await askQuestion('fileViewers.errors.titles.unsupportedFileType', 'fileViewers.errors.informationPreviewDefaultApp', { + yesText: 'fileViewers.openWithDefault', + noText: 'fileViewers.cancel', + }); + if (answer === Answer.Yes) { + await _openWithSystem(workspaceHandle, entry, informationManager); + } } else { await informationManager.present( new Information({ @@ -269,7 +275,13 @@ async function openPath( if ((entry as any).size > OPEN_FILE_SIZE_LIMIT) { // Too big to open, display try with the system if allowed/available, otherwise display a message if (isDesktop() && !options.disallowSystem) { - await _openWithSystem(workspaceHandle, entry, informationManager); + const answer = await askQuestion('fileViewers.errors.titles.fileTooBig', 'fileViewers.errors.informationPreviewDefaultApp', { + yesText: 'fileViewers.openWithDefault', + noText: 'fileViewers.cancel', + }); + if (answer === Answer.Yes) { + await _openWithSystem(workspaceHandle, entry, informationManager); + } } else { await informationManager.present( new Information({