12 |
12 |
13 from PyQt6.QtCore import QModelIndex, pyqtSignal, QUrl |
13 from PyQt6.QtCore import QModelIndex, pyqtSignal, QUrl |
14 from PyQt6.QtGui import QDesktopServices |
14 from PyQt6.QtGui import QDesktopServices |
15 from PyQt6.QtWidgets import QDialog, QMenu |
15 from PyQt6.QtWidgets import QDialog, QMenu |
16 |
16 |
17 from E5Gui import E5MessageBox |
17 from E5Gui import EricMessageBox |
18 |
18 |
19 from .ProjectBrowserModel import ( |
19 from .ProjectBrowserModel import ( |
20 ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem, |
20 ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem, |
21 ProjectBrowserDirectoryItem, ProjectBrowserOthersType |
21 ProjectBrowserDirectoryItem, ProjectBrowserOthersType |
22 ) |
22 ) |
268 """ |
268 """ |
269 itmList = self.getSelectedItems() |
269 itmList = self.getSelectedItems() |
270 if itmList: |
270 if itmList: |
271 mimetype = Utilities.MimeTypes.mimeType(itmList[0].fileName()) |
271 mimetype = Utilities.MimeTypes.mimeType(itmList[0].fileName()) |
272 if mimetype is None: |
272 if mimetype is None: |
273 E5MessageBox.warning( |
273 EricMessageBox.warning( |
274 self, |
274 self, |
275 self.tr("Show Mime-Type"), |
275 self.tr("Show Mime-Type"), |
276 self.tr("""The mime type of the file could not be""" |
276 self.tr("""The mime type of the file could not be""" |
277 """ determined.""")) |
277 """ determined.""")) |
278 elif mimetype.split("/")[0] == "text": |
278 elif mimetype.split("/")[0] == "text": |
279 E5MessageBox.information( |
279 EricMessageBox.information( |
280 self, |
280 self, |
281 self.tr("Show Mime-Type"), |
281 self.tr("Show Mime-Type"), |
282 self.tr("""The file has the mime type <b>{0}</b>.""") |
282 self.tr("""The file has the mime type <b>{0}</b>.""") |
283 .format(mimetype)) |
283 .format(mimetype)) |
284 else: |
284 else: |
285 textMimeTypesList = Preferences.getUI("TextMimeTypes") |
285 textMimeTypesList = Preferences.getUI("TextMimeTypes") |
286 if mimetype in textMimeTypesList: |
286 if mimetype in textMimeTypesList: |
287 E5MessageBox.information( |
287 EricMessageBox.information( |
288 self, |
288 self, |
289 self.tr("Show Mime-Type"), |
289 self.tr("Show Mime-Type"), |
290 self.tr("""The file has the mime type <b>{0}</b>.""") |
290 self.tr("""The file has the mime type <b>{0}</b>.""") |
291 .format(mimetype)) |
291 .format(mimetype)) |
292 else: |
292 else: |
293 ok = E5MessageBox.yesNo( |
293 ok = EricMessageBox.yesNo( |
294 self, |
294 self, |
295 self.tr("Show Mime-Type"), |
295 self.tr("Show Mime-Type"), |
296 self.tr("""The file has the mime type <b>{0}</b>.""" |
296 self.tr("""The file has the mime type <b>{0}</b>.""" |
297 """<br/> Shall it be added to the list of""" |
297 """<br/> Shall it be added to the list of""" |
298 """ text mime types?""").format(mimetype)) |
298 """ text mime types?""").format(mimetype)) |