X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fviews%2FBrowserView.cpp;h=c6a984c880023acc641d7fa18cbc3ca419c27b5d;hp=aa9ffffa18132bb0d6d18d5802758a1a0310183b;hb=fe9f5cdee9e6e16eac1858f7f661516c24f71fa5;hpb=16118809a11aa423f453a03c47f5263e9dd8b662 diff --git a/src/views/BrowserView.cpp b/src/views/BrowserView.cpp index aa9ffff..c6a984c 100644 --- a/src/views/BrowserView.cpp +++ b/src/views/BrowserView.cpp @@ -60,7 +60,7 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent) // Update the webengine view from the URL line edit. connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrlFromTextBox(const QString))); - // Update the URL line edit form the webengine view. + // Update the URL line edit from the webengine view. connect(webEngineViewPointer, SIGNAL(loadStarted()), this, SLOT(updateInterface())); connect(webEngineViewPointer, SIGNAL(loadProgress(const int)), this, SLOT(updateInterface())); connect(webEngineViewPointer, SIGNAL(loadFinished(const bool)), this, SLOT(updateInterface())); @@ -78,7 +78,7 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent) domainSettingsPalette = urlLineEditPointer->palette(); // Modify the domain settings palette. - domainSettingsPalette.setColor(QPalette::Base, Qt::green); + domainSettingsPalette.setColor(QPalette::Base, QColor("#C8E6C9")); // Instantiate the mouse event pointer. MouseEventFilter *mouseEventFilterPointer = new MouseEventFilter(webEngineViewPointer); @@ -139,8 +139,6 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload // Check if the hostname has domain settings. if (domainQuery.isValid()) // The hostname has domain settings. { - - // Get the domain record. QSqlRecord domainRecord = domainQuery.record(); @@ -172,8 +170,8 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload } } - // Apply the user agent. - webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgent(Settings::userAgent())); + // Set the user agent. + webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getResultingDomainSettingsUserAgent(domainRecord.field(DomainsDatabaseHelper::USER_AGENT).value().toString())); // Set the zoom factor. webEngineViewPointer->setZoomFactor(Settings::zoomFactor()); @@ -186,8 +184,8 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload // Set the JavaScript status. webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScript()); - // Apply the user agent. - webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgent(Settings::userAgent())); + // Set the user agent. + webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent())); // Set the zoom factor. webEngineViewPointer->setZoomFactor(Settings::zoomFactor()); @@ -207,7 +205,7 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload } // Emit the on-the-fly menu update signals. - emit userAgentUpdated(Settings::userAgent()); + emit userAgentUpdated(webEngineProfilePointer->httpUserAgent()); emit zoomFactorUpdated(Settings::zoomFactor()); // Reload the website if requested. @@ -238,7 +236,7 @@ void BrowserView::applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const userAgentName.remove('&'); // Apply the user agent. - webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgent(userAgentName)); + webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromTranslatedName(userAgentName)); // Reload the website. webEngineViewPointer->reload(); @@ -310,14 +308,14 @@ void BrowserView::openDomainSettings() const // Set the dialog window title. domainSettingsDialogPointer->setWindowTitle(i18nc("The domain settings dialog title", "Domain Settings")); - // Resize the dialog window. - domainSettingsDialogPointer->resize(1500, 1000); - // Set the modality. domainSettingsDialogPointer->setWindowModality(Qt::WindowModality::WindowModal);; // Show the dialog. domainSettingsDialogPointer->show(); + + // Reload the tabs when domain settings are updated. + connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), this, SLOT(applyDomainSettingsAndReload())); } void BrowserView::pageLinkHovered(const QString &linkUrl) const