WebBrowser/Download/DownloadItem.py

changeset 5033
d1c2651060ec
parent 4917
682750cc7bd5
child 5194
4750c83cc718
diff -r 0b060e23930f -r d1c2651060ec WebBrowser/Download/DownloadItem.py
--- a/WebBrowser/Download/DownloadItem.py	Wed Jul 13 08:48:54 2016 +0200
+++ b/WebBrowser/Download/DownloadItem.py	Wed Jul 13 09:44:59 2016 +0200
@@ -136,35 +136,41 @@
             self.__originalFileName = originalFileName
             ask = True
         self.__autoOpen = False
-        from .DownloadAskActionDialog import DownloadAskActionDialog
-        url = self.__downloadItem.url()
-        mimetype = Utilities.MimeTypes.mimeType(originalFileName)
-        dlg = DownloadAskActionDialog(
-            QFileInfo(originalFileName).fileName(),
-            mimetype,
-            "{0}://{1}".format(url.scheme(), url.authority()),
-            self)
-        if dlg.exec_() == QDialog.Rejected or dlg.getAction() == "cancel":
-            self.progressBar.setVisible(False)
-            self.on_stopButton_clicked()
-            self.filenameLabel.setText(
-                self.tr("Download canceled: {0}").format(
-                    QFileInfo(defaultFileName).fileName()))
-            self.__canceledFileSelect = True
-            return
         
-        if dlg.getAction() == "scan":
-            self.__mainWindow.requestVirusTotalScan(url)
+        if not originalFileName.lower().endswith(".mhtml"):
+            from .DownloadAskActionDialog import DownloadAskActionDialog
+            url = self.__downloadItem.url()
+            mimetype = Utilities.MimeTypes.mimeType(originalFileName)
+            dlg = DownloadAskActionDialog(
+                QFileInfo(originalFileName).fileName(),
+                mimetype,
+                "{0}://{1}".format(url.scheme(), url.authority()),
+                self)
             
-            self.progressBar.setVisible(False)
-            self.on_stopButton_clicked()
-            self.filenameLabel.setText(
-                self.tr("VirusTotal scan scheduled: {0}").format(
-                    QFileInfo(defaultFileName).fileName()))
-            self.__canceledFileSelect = True
-            return
+            if dlg.exec_() == QDialog.Rejected or dlg.getAction() == "cancel":
+                self.progressBar.setVisible(False)
+                self.on_stopButton_clicked()
+                self.filenameLabel.setText(
+                    self.tr("Download canceled: {0}").format(
+                        QFileInfo(defaultFileName).fileName()))
+                self.__canceledFileSelect = True
+                return
+            
+            if dlg.getAction() == "scan":
+                self.__mainWindow.requestVirusTotalScan(url)
+                
+                self.progressBar.setVisible(False)
+                self.on_stopButton_clicked()
+                self.filenameLabel.setText(
+                    self.tr("VirusTotal scan scheduled: {0}").format(
+                        QFileInfo(defaultFileName).fileName()))
+                self.__canceledFileSelect = True
+                return
         
-        self.__autoOpen = dlg.getAction() == "open"
+            self.__autoOpen = dlg.getAction() == "open"
+        else:
+            self.__autoOpen = False
+        
         if PYQT_VERSION_STR >= "5.0.0":
             from PyQt5.QtCore import QStandardPaths
             tempLocation = QStandardPaths.standardLocations(

eric ide

mercurial