searchEngineUrl = SearchEngineHelper::getSearchUrl(Settings::searchEngine());
// Emit the update search engine actions signal.
- emit updateSearchEngineActions(Settings::searchEngine());
+ emit updateSearchEngineActions(Settings::searchEngine(), true);
}
// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
emit updateJavaScriptAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
emit updateLocalStorageAction(currentPrivacyWebEnginePointer->localStorageEnabled);
emit updateDomStorageAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
- emit updateUserAgentActions(webEngineProfilePointer->httpUserAgent());
+ emit updateUserAgentActions(webEngineProfilePointer->httpUserAgent(), true);
emit updateZoomFactorAction(webEngineViewPointer->zoomFactor());
// Reload the website if requested.
if (reloadWebsite)
- {
webEngineViewPointer->reload();
- }
}
void BrowserView::applyOnTheFlySearchEngine(QAction *searchEngineActionPointer)
searchEngineUrl = SearchEngineHelper::getSearchUrl(searchEngineName);
// Update the search engine actionas.
- emit updateSearchEngineActions(searchEngineName);
+ emit updateSearchEngineActions(searchEngineName, false);
}
void BrowserView::applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const
webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromTranslatedName(userAgentName));
// Update the user agent actions.
- emit updateUserAgentActions(webEngineProfilePointer->httpUserAgent());
+ emit updateUserAgentActions(webEngineProfilePointer->httpUserAgent(), false);
// Reload the website.
webEngineViewPointer->reload();
domStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-web-browser-dom-tree")));
// Update the on-the-fly menus.
- connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString)), this, SLOT(updateUserAgentActions(QString)));
+ connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString, bool)), this, SLOT(updateUserAgentActions(QString, bool)));
connect(browserViewPointer, SIGNAL(updateZoomFactorAction(double)), this, SLOT(updateZoomFactorAction(double)));
- connect(browserViewPointer, SIGNAL(updateSearchEngineActions(QString)), this, SLOT(updateSearchEngineActions(QString)));
+ connect(browserViewPointer, SIGNAL(updateSearchEngineActions(QString, bool)), this, SLOT(updateSearchEngineActions(QString, bool)));
// Apply the on-the-fly settings when selected.
connect(userAgentActionGroupPointer, SIGNAL(triggered(QAction*)), browserViewPointer, SLOT(applyOnTheFlyUserAgent(QAction*)));
domStorageActionPointer->setEnabled(localStorageEnabled & javaScriptEnabled);
}
-void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
+void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus)
{
// Initialize the custom search engine flag.
bool customSearchEngine = false;
// Update the search engine menu action text.
searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Custom"));
+ // Set the custom search engine text.
+ searchEngineCustomActionPointer->setText(searchEngine);
+
// Set the custom search engine flag.
customSearchEngine = true;
}
+ // Update the custom search engine enabled boolean.
+ if (updateCustomSearchEngineStatus)
+ customSearchEngineEnabled = customSearchEngine;
+
// Format the custom search engine.
- if (customSearchEngine)
+ if (customSearchEngineEnabled)
{
// Enable the custom search engine.
searchEngineCustomActionPointer->setEnabled(true);
-
- // Set the custom search engine text.
- searchEngineCustomActionPointer->setText(searchEngine);
}
else
{
}
}
-void BrowserWindow::updateUserAgentActions(const QString &userAgent) const
+void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus)
{
// Initialize the custom user agent flag.
bool customUserAgent = false;
// Update the user agent menu action text.
userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Custom"));
+ // Set the custom user agent text.
+ userAgentCustomActionPointer->setText(userAgent);
+
// Set the custom user agent flag.
customUserAgent = true;
}
+ // Update the custom user agent enabled boolean.
+ if (updateCustomUserAgentStatus)
+ customUserAgentEnabled = customUserAgent;
+
// Format the custom user agent.
- if (customUserAgent)
+ if (customUserAgentEnabled)
{
// Enable the custom user agent.
userAgentCustomActionPointer->setEnabled(true);
-
- // Set the custom user agent text.
- userAgentCustomActionPointer->setText(userAgent);
}
else
{
void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain);
void updateJavaScriptAction(const bool &isEnabled);
void updateLocalStorageAction(const bool &isEnabled);
- void updateSearchEngineActions(const QString &searchEngine) const;
- void updateUserAgentActions(const QString &userAgent) const;
+ void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
+ void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
void updateZoomFactorAction(const double &zoomFactor);
void updateSearchEngineLabel(const QString &searchEngineString) const;
void updateUrlLineEdit(const QUrl &newUrl);
QString currentDomainSettingsDomain;
QUrl currentUrl;
double currentZoomFactor;
+ bool customSearchEngineEnabled;
+ bool customUserAgentEnabled;
QAction *domStorageActionPointer;
QPalette domainSettingsPalette;
QAction *javaScriptActionPointer;