#include <QInputDialog>
#include <QMessageBox>
#include <QPushButton>
+#include <QTimer>
// Define the public static int constants.
const int DomainSettingsDialog::SHOW_ALL_DOMAINS = 0;
// Add the new domain.
addDomain(domainName);
+ // Emit the domain settings updated signal after 100 milliseconds. This is necessary because the browser window takes time to process the connect command to receive the signal.
+ QTimer::singleShot(100, [this] () { emit domainSettingsUpdated();});
+
break;
}
// Set the values for the new domain.
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabase::DOMAIN_NAME), domainName);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabase::JAVASCRIPT), DomainsDatabase::SYSTEM_DEFAULT);
+ newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabase::LOCAL_STORAGE), DomainsDatabase::SYSTEM_DEFAULT);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabase::DOM_STORAGE), DomainsDatabase::SYSTEM_DEFAULT);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabase::USER_AGENT), UserAgentHelper::SYSTEM_DEFAULT_DATABASE);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabase::ZOOM_FACTOR), DomainsDatabase::SYSTEM_DEFAULT);
// Update the UI.
updateUi();
+
+ // Emit the domain settings updated signal.
+ emit domainSettingsUpdated();
}
void DomainSettingsDialog::apply() const
// Update the domains table model.
domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabase::LOCAL_STORAGE)), newIndex);
- // Poplate the local storage label.
+ // Populate the local storage label.
populateLocalStorageLabel();
// Update the UI.
domainsTableModelPointer->submitAll();
// Emit the domain settings updated signal.
- domainSettingsUpdated();
+ emit domainSettingsUpdated();
// Close the dialog.
accept();
// Update the Ui.
updateUi();
+
+ // Emit the domain settings updated signal.
+ emit domainSettingsUpdated();
}
}
void TabWidget::applyDomainSettingsAndReload()
{
- // Apply the domain settings. `true` reloads the website.
- currentPrivacyWebEngineViewPointer->applyDomainSettings(currentPrivacyWebEngineViewPointer->url().host(), true);
+ // Get the number of tabs.
+ int numberOfTabs = qTabWidgetPointer->count();
+
+ // Apply the domain settings to each WebEngine.
+ for (int i = 0; i < numberOfTabs; ++i) {
+ // Get the WebEngine view pointer.
+ PrivacyWebEngineView *privacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(qTabWidgetPointer->widget(i));
+
+ // Apply the spatial navigation settings to each page.
+ privacyWebEngineViewPointer->applyDomainSettings(privacyWebEngineViewPointer->url().host(), true);
+ }
}
void TabWidget::applyOnTheFlySearchEngine(QAction *searchEngineActionPointer)
domainSettingsDialogPointer = new DomainSettingsDialog(DomainSettingsDialog::EDIT_DOMAIN, currentDomainSettingsName);
}
- // Set the dialog window title.
- domainSettingsDialogPointer->setWindowTitle(i18nc("The domain settings dialog title", "Domain Settings"));
-
- // Set the modality.
- domainSettingsDialogPointer->setWindowModality(Qt::WindowModality::WindowModal);;
+ // Reload the tabs when domain settings are updated.
+ connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
// Show the dialog.
domainSettingsDialogPointer->show();
-
- // Reload the tabs when domain settings are updated.
- connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
}
void BrowserWindow::back() const
// Instantiate the domain settings dialog.
DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog();
- // Show the dialog.
- domainSettingsDialogPointer->show();
-
// Reload the tabs when domain settings are updated.
connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
+
+ // Show the dialog.
+ domainSettingsDialogPointer->show();
}
void BrowserWindow::showFindTextActions() const