34 FilenameRole = Qt.ItemDataRole.UserRole |
34 FilenameRole = Qt.ItemDataRole.UserRole |
35 UrlRole = Qt.ItemDataRole.UserRole + 1 |
35 UrlRole = Qt.ItemDataRole.UserRole + 1 |
36 DocumentationDirRole = Qt.ItemDataRole.UserRole + 2 |
36 DocumentationDirRole = Qt.ItemDataRole.UserRole + 2 |
37 LocalesRole = Qt.ItemDataRole.UserRole + 3 |
37 LocalesRole = Qt.ItemDataRole.UserRole + 3 |
38 |
38 |
39 def __init__(self, writeableDirectories, parent=None): |
39 def __init__( |
|
40 self, |
|
41 writeableDirectories, |
|
42 enforceUnencryptedDownloads=False, |
|
43 parent=None, |
|
44 ): |
40 """ |
45 """ |
41 Constructor |
46 Constructor |
42 |
47 |
43 @param writeableDirectories list of writable directories |
48 @param writeableDirectories list of writable directories |
44 @type list of str |
49 @type list of str |
45 @param parent reference to the parent widget |
50 @param enforceUnencryptedDownloads flag indicating to perform unencrypted |
46 @type QWidget |
51 downloads (defaults to False) |
|
52 @type bool (optional) |
|
53 @param parent reference to the parent widget (defaults to None) |
|
54 @type QWidget (optional) |
47 """ |
55 """ |
48 super().__init__(parent) |
56 super().__init__(parent) |
49 self.setupUi(self) |
57 self.setupUi(self) |
|
58 |
|
59 self.__enforceUnencryptedDownloads = enforceUnencryptedDownloads |
50 |
60 |
51 self.__refreshButton = self.buttonBox.addButton( |
61 self.__refreshButton = self.buttonBox.addButton( |
52 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole |
62 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole |
53 ) |
63 ) |
54 self.__installButton = self.buttonBox.addButton( |
64 self.__installButton = self.buttonBox.addButton( |
174 """ |
184 """ |
175 self.dictionariesList.clear() |
185 self.dictionariesList.clear() |
176 self.downloadProgress.setValue(0) |
186 self.downloadProgress.setValue(0) |
177 |
187 |
178 url = self.dictionariesUrlEdit.text() |
188 url = self.dictionariesUrlEdit.text() |
179 if Preferences.getWebBrowser("ForceHttpDictionaryDownload"): |
189 if ( |
|
190 self.__enforceUnencryptedDownloads |
|
191 or Preferences.getWebBrowser("ForceHttpDictionaryDownload") |
|
192 ): |
180 url = url.replace("https://", "http://") |
193 url = url.replace("https://", "http://") |
181 |
194 |
182 if self.__online: |
195 if self.__online: |
183 self.__refreshButton.setEnabled(False) |
196 self.__refreshButton.setEnabled(False) |
184 self.__installButton.setEnabled(False) |
197 self.__installButton.setEnabled(False) |
371 Private slot to download a dictionary. |
384 Private slot to download a dictionary. |
372 """ |
385 """ |
373 if self.__online: |
386 if self.__online: |
374 if self.__dictionariesToDownload: |
387 if self.__dictionariesToDownload: |
375 url = self.__dictionariesToDownload.pop(0) |
388 url = self.__dictionariesToDownload.pop(0) |
376 if Preferences.getWebBrowser("ForceHttpDictionaryDownload"): |
389 if ( |
|
390 self.__enforceUnencryptedDownloads |
|
391 or Preferences.getWebBrowser("ForceHttpDictionaryDownload") |
|
392 ): |
377 url = url.replace("https://", "http://") |
393 url = url.replace("https://", "http://") |
378 self.statusLabel.setText(url) |
394 self.statusLabel.setText(url) |
379 |
395 |
380 self.__downloadCancelled = False |
396 self.__downloadCancelled = False |
381 |
397 |