16 |
16 |
17 class DownloadAskActionDialog(QDialog, Ui_DownloadAskActionDialog): |
17 class DownloadAskActionDialog(QDialog, Ui_DownloadAskActionDialog): |
18 """ |
18 """ |
19 Class implementing a dialog to ask for a download action. |
19 Class implementing a dialog to ask for a download action. |
20 """ |
20 """ |
|
21 |
21 def __init__(self, fileName, mimeType, baseUrl, parent=None): |
22 def __init__(self, fileName, mimeType, baseUrl, parent=None): |
22 """ |
23 """ |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param fileName file name (string) |
26 @param fileName file name (string) |
26 @param mimeType mime type (string) |
27 @param mimeType mime type (string) |
27 @param baseUrl URL (string) |
28 @param baseUrl URL (string) |
28 @param parent reference to the parent widget (QWidget) |
29 @param parent reference to the parent widget (QWidget) |
29 """ |
30 """ |
30 super().__init__(parent) |
31 super().__init__(parent) |
31 self.setupUi(self) |
32 self.setupUi(self) |
32 |
33 |
33 self.infoLabel.setText("<b>{0}</b>".format(fileName)) |
34 self.infoLabel.setText("<b>{0}</b>".format(fileName)) |
34 self.typeLabel.setText(mimeType) |
35 self.typeLabel.setText(mimeType) |
35 self.siteLabel.setText(baseUrl) |
36 self.siteLabel.setText(baseUrl) |
36 |
37 |
37 if ( |
38 if ( |
38 not Preferences.getWebBrowser("VirusTotalEnabled") or |
39 not Preferences.getWebBrowser("VirusTotalEnabled") |
39 Preferences.getWebBrowser("VirusTotalServiceKey") == "" |
40 or Preferences.getWebBrowser("VirusTotalServiceKey") == "" |
40 ): |
41 ): |
41 self.scanButton.setHidden(True) |
42 self.scanButton.setHidden(True) |
42 |
43 |
43 msh = self.minimumSizeHint() |
44 msh = self.minimumSizeHint() |
44 self.resize(max(self.width(), msh.width()), msh.height()) |
45 self.resize(max(self.width(), msh.width()), msh.height()) |
45 |
46 |
46 def getAction(self): |
47 def getAction(self): |
47 """ |
48 """ |
48 Public method to get the selected action. |
49 Public method to get the selected action. |
49 |
50 |
50 @return selected action ("save", "open", "scan" or "cancel") |
51 @return selected action ("save", "open", "scan" or "cancel") |
51 """ |
52 """ |
52 if self.openButton.isChecked(): |
53 if self.openButton.isChecked(): |
53 return "open" |
54 return "open" |
54 elif self.scanButton.isChecked(): |
55 elif self.scanButton.isChecked(): |