7 Module implementing the Network configuration page. |
7 Module implementing the Network configuration page. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import QVariant, pyqtSlot |
12 from PyQt4.QtCore import pyqtSlot |
13 from PyQt4.QtGui import QFileDialog |
13 from PyQt4.QtGui import QFileDialog |
14 |
14 |
15 from E4Gui.E4Completers import E4DirCompleter |
15 from E4Gui.E4Completers import E4DirCompleter |
16 |
16 |
17 from ConfigurationPageBase import ConfigurationPageBase |
17 from ConfigurationPageBase import ConfigurationPageBase |
32 self.setupUi(self) |
32 self.setupUi(self) |
33 self.setObjectName("NetworkPage") |
33 self.setObjectName("NetworkPage") |
34 |
34 |
35 self.downloadDirCompleter = E4DirCompleter(self.downloadDirEdit) |
35 self.downloadDirCompleter = E4DirCompleter(self.downloadDirEdit) |
36 |
36 |
37 self.proxyTypeCombo.addItem(self.trUtf8("Transparent HTTP"), QVariant(0)) |
37 self.proxyTypeCombo.addItem(self.trUtf8("Transparent HTTP"), 0) |
38 self.proxyTypeCombo.addItem(self.trUtf8("Caching HTTP"), QVariant(1)) |
38 self.proxyTypeCombo.addItem(self.trUtf8("Caching HTTP"), 1) |
39 self.proxyTypeCombo.addItem(self.trUtf8("Socks5"), QVariant(2)) |
39 self.proxyTypeCombo.addItem(self.trUtf8("Socks5"), 2) |
40 |
40 |
41 # set initial values |
41 # set initial values |
42 self.downloadDirEdit.setText(Preferences.getUI("DownloadPath")) |
42 self.downloadDirEdit.setText(Preferences.getUI("DownloadPath")) |
43 self.requestFilenameCheckBox.setChecked( |
43 self.requestFilenameCheckBox.setChecked( |
44 Preferences.getUI("RequestDownloadFilename")) |
44 Preferences.getUI("RequestDownloadFilename")) |
45 |
45 |
46 self.proxyGroup.setChecked(\ |
46 self.proxyGroup.setChecked(\ |
47 Preferences.getUI("UseProxy")) |
47 Preferences.getUI("UseProxy")) |
48 self.proxyTypeCombo.setCurrentIndex(self.proxyTypeCombo.findData(\ |
48 self.proxyTypeCombo.setCurrentIndex(self.proxyTypeCombo.findData(\ |
49 QVariant(Preferences.getUI("ProxyType")))) |
49 Preferences.getUI("ProxyType"))) |
50 self.proxyHostEdit.setText(\ |
50 self.proxyHostEdit.setText(\ |
51 Preferences.getUI("ProxyHost")) |
51 Preferences.getUI("ProxyHost")) |
52 self.proxyUserEdit.setText(\ |
52 self.proxyUserEdit.setText(\ |
53 Preferences.getUI("ProxyUser")) |
53 Preferences.getUI("ProxyUser")) |
54 self.proxyPasswordEdit.setText(\ |
54 self.proxyPasswordEdit.setText(\ |
61 Public slot to save the Application configuration. |
61 Public slot to save the Application configuration. |
62 """ |
62 """ |
63 Preferences.setUI("DownloadPath", |
63 Preferences.setUI("DownloadPath", |
64 self.downloadDirEdit.text()) |
64 self.downloadDirEdit.text()) |
65 Preferences.setUI("RequestDownloadFilename", |
65 Preferences.setUI("RequestDownloadFilename", |
66 int(self.requestFilenameCheckBox.isChecked())) |
66 self.requestFilenameCheckBox.isChecked()) |
67 |
67 |
68 Preferences.setUI("UseProxy", |
68 Preferences.setUI("UseProxy", |
69 int(self.proxyGroup.isChecked())) |
69 self.proxyGroup.isChecked()) |
70 Preferences.setUI("ProxyType", |
70 Preferences.setUI("ProxyType", |
71 self.proxyTypeCombo.itemData(self.proxyTypeCombo.currentIndex()).toInt()[0]) |
71 self.proxyTypeCombo.itemData(self.proxyTypeCombo.currentIndex())) |
72 Preferences.setUI("ProxyHost", |
72 Preferences.setUI("ProxyHost", |
73 self.proxyHostEdit.text()) |
73 self.proxyHostEdit.text()) |
74 Preferences.setUI("ProxyUser", |
74 Preferences.setUI("ProxyUser", |
75 self.proxyUserEdit.text()) |
75 self.proxyUserEdit.text()) |
76 Preferences.setUI("ProxyPassword", |
76 Preferences.setUI("ProxyPassword", |