+void DomainSettingsDialog::populateLabel(const int label) const
+{
+ // Create the label strings.
+ QString enabledString;
+ QString enabledBoldString;
+ QString disabledString;
+ QString disabledBoldString;
+
+ // Create the system default bool.
+ bool systemDefaultEnabled;
+
+ // Create the widget pointers.
+ QWidget *widgetPointer;
+ QComboBox *comboBoxPointer;
+ QLabel *labelPointer;
+
+ // Populate the local variables.
+ switch (label)
+ {
+ case (JAVASCRIPT):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings JavaScript label.", "JavaScript enabled");
+ enabledBoldString = i18nc("Domain settings JavaScript label. The <b> tags should be retained.", "<b>JavaScript enabled</b>");
+ disabledString = i18nc("Domain settings JavaScript label.", "JavaScript disabled");
+ disabledBoldString = i18nc("Domain settings JavaScript label. The <b> tags should be retained.", "<b>JavaScript disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::javaScriptEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = javaScriptWidgetPointer;
+ comboBoxPointer = javaScriptComboBoxPointer;
+ labelPointer = javaScriptLabelPointer;
+
+ break;
+ }
+
+ case (LOCAL_STORAGE):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings local storage label.", "Local storage enabled");
+ enabledBoldString = i18nc("Domain settings local storage label. The <b> tags should be retained.", "<b>Local storage enabled</b>");
+ disabledString = i18nc("Domain settings local storage label.", "Local storage disabled");
+ disabledBoldString = i18nc("Domain settings local storage label. The <b> tags should be retained.", "<b>Local storage disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::localStorageEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = localStorageWidgetPointer;
+ comboBoxPointer = localStorageComboBoxPointer;
+ labelPointer = localStorageLabelPointer;
+
+ break;
+ }
+
+ case (DOM_STORAGE):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings DOM storage label.", "DOM storage enabled");
+ enabledBoldString = i18nc("Domain settings DOM storage label. The <b> tags should be retained.", "<b>DOM storage enabled</b>");
+ disabledString = i18nc("Domain settings DOM storage label.", "DOM storage disabled");
+ disabledBoldString = i18nc("Domain settings DOM storage label. The <b> tags should be retained.", "<b>DOM storage disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::domStorageEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = domStorageWidgetPointer;
+ comboBoxPointer = domStorageComboBoxPointer;
+ labelPointer = domStorageLabelPointer;
+
+ break;
+ }
+
+ case (ULTRAPRIVACY):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings UltraPrivacy enabled label.", "UltraPrivacy enabled");
+ enabledBoldString = i18nc("Domain settings UltraPrivacy enabled bold label. The <b> tags should be retained.", "<b>UltraPrivacy enabled</b>");
+ disabledString = i18nc("Domain settings UltraPrivacy disabled label.", "UltraPrivacy disabled");
+ disabledBoldString = i18nc("Domain settings UltraPrivacy disabled bold label. The <b> tags should be retained.", "<b>UltraPrivacy disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::ultraPrivacyEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = ultraPrivacyWidgetPointer;
+ comboBoxPointer = ultraPrivacyComboBoxPointer;
+ labelPointer = ultraPrivacyLabelPointer;
+
+ break;
+ }
+
+ case (ULTRALIST):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings UltraList enabled label.", "UltraList enabled");
+ enabledBoldString = i18nc("Domain settings UltraList enabled bold label. The <b> tags should be retained.", "<b>UltraList enabled</b>");
+ disabledString = i18nc("Domain settings UltraList disabled label.", "UltraList disabled");
+ disabledBoldString = i18nc("Domain settings UltraList disabled bold label. The <b> tags should be retained.", "<b>UltraList disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::ultraListEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = ultraListWidgetPointer;
+ comboBoxPointer = ultraListComboBoxPointer;
+ labelPointer = ultraListLabelPointer;
+
+ break;
+ }
+
+ case (EASYPRIVACY):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings EasyPrivacy enabled label.", "EasyPrivacy enabled");
+ enabledBoldString = i18nc("Domain settings EasyPrivacy enabled bold label. The <b> tags should be retained.", "<b>EasyPrivacy enabled</b>");
+ disabledString = i18nc("Domain settings EasyPrivacy disabled label.", "EasyPrivacy disabled");
+ disabledBoldString = i18nc("Domain settings EasyPrivacy disabled bold label. The <b> tags should be retained.", "<b>EasyPrivacy disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::easyPrivacyEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = easyPrivacyWidgetPointer;
+ comboBoxPointer = easyPrivacyComboBoxPointer;
+ labelPointer = easyPrivacyLabelPointer;
+
+ break;
+ }
+
+ case (EASYLIST):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings EasyList enabled label.", "EasyList enabled");
+ enabledBoldString = i18nc("Domain settings EasyList enabled bold label. The <b> tags should be retained.", "<b>EasyList enabled</b>");
+ disabledString = i18nc("Domain settings EasyList disabled label.", "EasyList disabled");
+ disabledBoldString = i18nc("Domain settings EasyList disabled bold label. The <b> tags should be retained.", "<b>EasyList disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::easyListEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = easyListWidgetPointer;
+ comboBoxPointer = easyListComboBoxPointer;
+ labelPointer = easyListLabelPointer;
+
+ break;
+ }
+
+ case (FANBOYS_ANNOYANCE_LIST):
+ {
+ // Populate the label strings.
+ enabledString = i18nc("Domain settings Fanboy’s Annoyance List enabled label.", "Fanboy’s Annoyance List enabled");
+ enabledBoldString = i18nc("Domain settings Fanboy’s Annoyance List enabled bold label. The <b> tags should be retained.", "<b>Fanboy’s Annoyance List enabled</b>");
+ disabledString = i18nc("Domain settings Fanboy’s Annoyance List disabled label.", "Fanboy’s Annoyance List disabled");
+ disabledBoldString = i18nc("Domain settings Fanboy’s Annoyance List disabled bold label. The <b> tags should be retained.", "<b>Fanboy’s Annoyance List disabled</b>");
+
+ // Populate the system default bool.
+ systemDefaultEnabled = Settings::fanboysAnnoyanceListEnabled();
+
+ // Populate the widget pointers.
+ widgetPointer = fanboysAnnoyanceListWidgetPointer;
+ comboBoxPointer = fanboysAnnoyanceListComboBoxPointer;
+ labelPointer = fanboysAnnoyanceListLabelPointer;
+
+ break;
+ }
+ }
+
+ // Populate the label and widget palette according to the currently selected combo box index.
+ switch (comboBoxPointer->currentIndex())
+ {
+ case (DomainsDatabase::SYSTEM_DEFAULT):
+ {
+ // Set the text according to the system default.
+ if (systemDefaultEnabled)
+ labelPointer->setText(enabledString);
+ else
+ labelPointer->setText(disabledString);
+
+ // Reset the palette.
+ widgetPointer->setPalette(defaultPalette);
+
+ break;
+ }
+
+ case (DomainsDatabase::ENABLED):
+ {
+ // Set the enabled bold text.
+ labelPointer->setText(enabledBoldString);
+
+ // Set the palette.
+ widgetPointer->setPalette(highlightedPalette);
+
+ break;
+ }
+
+ case (DomainsDatabase::DISABLED):
+ {
+ // Set the disabled bold text.
+ labelPointer->setText(disabledBoldString);
+
+ // Set the palette.
+ widgetPointer->setPalette(highlightedPalette);
+
+ break;
+ }
+ }
+}
+
+void DomainSettingsDialog::populateUserAgentLabel(const QString &userAgentName) const
+{
+ // Populate the label according to the type.
+ if (userAgentName == userAgentHelperPointer->SYSTEM_DEFAULT_TRANSLATED)
+ {
+ // Display the system default user agent name.
+ userAgentLabelPointer->setText(userAgentHelperPointer->getTranslatedUserAgentNameFromDatabaseName(Settings::userAgent()));
+
+ // Reset the palette.
+ userAgentWidgetPointer->setPalette(defaultPalette);
+ }
+ else
+ {
+ // Display the user agent name in bold.
+ userAgentLabelPointer->setText("<strong>" + userAgentName + "</strong>");
+
+ // Set the palette.
+ userAgentWidgetPointer->setPalette(highlightedPalette);
+ }
+}
+