// Select the first entry in the list view.
domainsListViewPointer->setCurrentIndex(domainsTableModelPointer->index(0, domainsTableModelPointer->fieldIndex(DomainsDatabase::DOMAIN_NAME)));
- // Populate the domain settings.
- domainSelected(domainsSelectionModelPointer->currentIndex());
-
break;
}
// Move to the new domain.
domainsListViewPointer->setCurrentIndex(newDomainIndex[0]);
- // Populate the domain settings.
- domainSelected(domainsSelectionModelPointer->currentIndex());
-
break;
}
}
+ // Populate the domain settings.
+ domainSelected(domainsSelectionModelPointer->currentIndex());
+
// Handle clicks on the domains.
connect(domainsListViewPointer, SIGNAL(activated(QModelIndex)), this, SLOT(domainSelected(QModelIndex)));
connect(applyButtonPointer, SIGNAL(clicked()), this, SLOT(apply()));
connect(dialogButtonBoxPointer, SIGNAL(rejected()), this, SLOT(cancel()));
+ // Update the DOM storage status.
+ updateDomStorageStatus();
+
// Update the UI.
updateUi();
}
// Populate the JavaScript label.
populateJavaScriptLabel();
+ // Update the DOM storage status.
+ updateDomStorageStatus();
+
// Update the UI.
updateUi();
}
// Populate the local storage label.
populateLocalStorageLabel();
+ // Update the DOM storage status.
+ updateDomStorageStatus();
+
// Update the UI.
updateUi();
}
}
}
+void DomainSettingsDialog::updateDomStorageStatus() const
+{
+ // Instantiate tracking variables.
+ bool javaScriptEnabled;
+ bool localStorageEnabled;
+
+ // Populate the JavaScript tracker.
+ switch (javaScriptComboBoxPointer->currentIndex())
+ {
+ case (DomainsDatabase::SYSTEM_DEFAULT):
+ {
+ // Update the tracker according to the system default.
+ if (Settings::javaScriptEnabled())
+ javaScriptEnabled = true;
+ else
+ javaScriptEnabled = false;
+
+ break;
+ }
+
+ case (DomainsDatabase::ENABLED):
+ {
+ // Update the tracker.
+ javaScriptEnabled = true;
+
+ break;
+ }
+
+ case (DomainsDatabase::DISABLED):
+ {
+ // Update the tracker.
+ javaScriptEnabled = false;
+
+ break;
+ }
+ }
+
+ // Populate the local storage tracker.
+ switch (localStorageComboBoxPointer->currentIndex())
+ {
+ case (DomainsDatabase::SYSTEM_DEFAULT):
+ {
+ // Update the tracker according to the system default.
+ if (Settings::localStorageEnabled())
+ localStorageEnabled = true;
+ else
+ localStorageEnabled = false;
+
+ break;
+ }
+
+ case (DomainsDatabase::ENABLED):
+ {
+ // Update the tracker.
+ localStorageEnabled = true;
+
+ break;
+ }
+
+ case (DomainsDatabase::DISABLED):
+ {
+ // Update the tracker.
+ localStorageEnabled = false;
+
+ break;
+ }
+ }
+
+ // Only enable DOM storage if both JavaScript and local storage are enabled.
+ domStorageComboBoxPointer->setEnabled(javaScriptEnabled && localStorageEnabled);
+}
+
void DomainSettingsDialog::updateUi() const
{
// Update the delete button status.
spellCheckSettingsUi.setupUi(spellCheckSettingsWidgetPointer);
// Get handles for the widgets.
+ QCheckBox *javaScriptCheckBoxPointer = privacySettingsUi.kcfg_javaScriptEnabled;
+ QCheckBox *localStorageCheckBoxPointer = privacySettingsUi.kcfg_localStorageEnabled;
+ QCheckBox *domStorageCheckBoxPointer = privacySettingsUi.kcfg_domStorageEnabled;
QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
userAgentLabelPointer = privacySettingsUi.userAgentLabel;
QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
QPushButton *browseButtonPointer = generalSettingsUi.browseButton;
QListWidget *spellCheckListWidgetPointer = spellCheckSettingsUi.spellCheckListWidget;
+ // Create a save spell check languages lambda.
+ auto updateCheckBoxes = [javaScriptCheckBoxPointer, localStorageCheckBoxPointer, domStorageCheckBoxPointer] ()
+ {
+ // Only enable the DOM storage check box if both JavaScript and local storage are checked.
+ domStorageCheckBoxPointer->setEnabled(javaScriptCheckBoxPointer->isChecked() && localStorageCheckBoxPointer->isChecked());
+ };
+
+ // Update the status of the DOM storage check box when either JavaScript or local storage are changed.
+ connect(javaScriptCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes);
+ connect(localStorageCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes);
+
// Populate the combo box labels.
updateUserAgentLabel(userAgentComboBoxPointer->currentText());
updateSearchEngineLabel(searchEngineComboBoxPointer->currentText());