7 Module implementing a dialog to configure the offline storage. |
7 Module implementing a dialog to configure the offline storage. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSlot |
10 from PyQt4.QtCore import pyqtSlot |
11 from PyQt4.QtGui import QDialog |
11 from PyQt4.QtGui import QDialog |
|
12 from PyQt4.QtWebKit import QWebSettings |
12 |
13 |
13 from .WebDatabasesDialog import WebDatabasesDialog |
14 from .WebDatabasesDialog import WebDatabasesDialog |
14 from .Ui_OfflineStorageConfigDialog import Ui_OfflineStorageConfigDialog |
15 from .Ui_OfflineStorageConfigDialog import Ui_OfflineStorageConfigDialog |
15 |
16 |
16 import Preferences |
17 import Preferences |
30 |
31 |
31 self.databaseEnabledCheckBox.setChecked( |
32 self.databaseEnabledCheckBox.setChecked( |
32 Preferences.getHelp("OfflineStorageDatabaseEnabled")) |
33 Preferences.getHelp("OfflineStorageDatabaseEnabled")) |
33 self.databaseQuotaSpinBox.setValue( |
34 self.databaseQuotaSpinBox.setValue( |
34 Preferences.getHelp("OfflineStorageDatabaseQuota")) |
35 Preferences.getHelp("OfflineStorageDatabaseQuota")) |
|
36 |
|
37 if hasattr(QWebSettings, "OfflineWebApplicationCacheEnabled"): |
|
38 self.applicationCacheEnabledCheckBox.setChecked( |
|
39 Preferences.getHelp("OfflineWebApplicationCacheEnabled")) |
|
40 self.applicationCacheQuotaSpinBox.setValue( |
|
41 Preferences.getHelp("OfflineWebApplicationCacheQuota")) |
|
42 else: |
|
43 self.applicationCacheGroup.setEnabled(False) |
|
44 |
|
45 if hasattr(QWebSettings, "LocalStorageEnabled"): |
|
46 self.localStorageEnabledCheckBox.setChecked( |
|
47 Preferences.getHelp("LocalStorageEnabled")) |
|
48 else: |
|
49 self.localStorageGroup.setEnabled(False) |
35 |
50 |
36 def storeData(self): |
51 def storeData(self): |
37 """ |
52 """ |
38 Public slot to store the configuration data. |
53 Public slot to store the configuration data. |
39 """ |
54 """ |
40 Preferences.setHelp("OfflineStorageDatabaseEnabled", |
55 Preferences.setHelp("OfflineStorageDatabaseEnabled", |
41 self.databaseEnabledCheckBox.isChecked()) |
56 self.databaseEnabledCheckBox.isChecked()) |
42 Preferences.setHelp("OfflineStorageDatabaseQuota", |
57 Preferences.setHelp("OfflineStorageDatabaseQuota", |
43 self.databaseQuotaSpinBox.value()) |
58 self.databaseQuotaSpinBox.value()) |
|
59 |
|
60 if self.applicationCacheGroup.isEnabled(): |
|
61 Preferences.setHelp("OfflineWebApplicationCacheEnabled", |
|
62 self.applicationCacheEnabledCheckBox.isChecked()) |
|
63 Preferences.setHelp("OfflineWebApplicationCacheQuota", |
|
64 self.applicationCacheQuotaSpinBox.value()) |
|
65 |
|
66 if self.localStorageGroup.isEnabled(): |
|
67 Preferences.setHelp("LocalStorageEnabled", |
|
68 self.localStorageEnabledCheckBox.isChecked()) |
44 |
69 |
45 @pyqtSlot() |
70 @pyqtSlot() |
46 def on_showDatabasesButton_clicked(self): |
71 def on_showDatabasesButton_clicked(self): |
47 """ |
72 """ |
48 Private slot to show a dialog with all databases. |
73 Private slot to show a dialog with all databases. |