src/eric7/Utilities/MimeTypes.py

branch
eric7
changeset 9894
8f0da84f216f
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
--- a/src/eric7/Utilities/MimeTypes.py	Tue Mar 14 13:31:34 2023 +0100
+++ b/src/eric7/Utilities/MimeTypes.py	Tue Mar 14 16:52:16 2023 +0100
@@ -46,8 +46,22 @@
             )
         )
     else:
-        return mimetype.split("/")[0] == "text" or mimetype in Preferences.getUI(
-            "TextMimeTypes"
+        return (
+            mimetype.split("/")[0] == "text"
+            or mimetype in Preferences.getUI("TextMimeTypes")
+            or EricMessageBox.yesNo(
+                None,
+                QCoreApplication.translate("MimeTypes", "Open File"),
+                QCoreApplication.translate(
+                    "MimeTypes",
+                    "<p>The file <b>{0}</b> has the mime type <b>{1}</b>. This type"
+                    " is not recognized as being text to be opened in eric. Is this"
+                    " an editable text file?</p>"
+                    "<p><b>Note:</b> You may suppress this question by adding an"
+                    " entry to the list of known text file types on the"
+                    " <b>MimeTypes</b> configuration page.</p>",
+                ).format(filename, mimetype),
+            )
         )
 
 

eric ide

mercurial