2 * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
4 * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
6 * Privacy Browser PC is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * Privacy Browser PC is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
20 // Application headers.
21 #include "BrowserWindow.h"
23 #include "ui_SettingsPrivacy.h"
24 #include "ui_SettingsGeneral.h"
25 #include "dialogs/DomainSettingsDialog.h"
26 #include "helpers/SearchEngineHelper.h"
27 #include "helpers/UserAgentHelper.h"
29 // KDE Frameworks headers.
30 #include <KActionCollection>
33 // Qt toolkit headers.
34 #include <QInputDialog>
37 BrowserWindow::BrowserWindow() : KXmlGuiWindow()
39 // Instantiate the main view pointer.
40 browserViewPointer = new BrowserView(this);
42 // Set the main view as the central widget.
43 setCentralWidget(browserViewPointer);
45 // Get a handle for the action collection.
46 KActionCollection *actionCollectionPointer = this->actionCollection();
48 // Add the standard actions.
49 KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer);
50 KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer);
51 KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollectionPointer);
53 // Add the custom actions.
54 userAgentPrivacyBrowserActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_privacy_browser"));
55 userAgentFirefoxLinuxActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_firefox_linux"));
56 userAgentChromiumLinuxActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_chromium_linux"));
57 userAgentFirefoxWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_firefox_windows"));
58 userAgentChromeWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_chrome_windows"));
59 userAgentEdgeWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_edge_windows"));
60 userAgentSafariMacosActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_safari_macos"));
61 userAgentCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_custom"));
62 zoomFactorActionPointer = actionCollectionPointer->addAction(QStringLiteral("zoom_factor"));
63 searchEngineMojeekActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_mojeek"));
64 searchEngineMonoclesActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_monocles"));
65 searchEngineMetagerActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_metager"));
66 searchEngineGoogleActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_google"));
67 searchEngineBingActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_bing"));
68 searchEngineYahooActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_yahoo"));
69 searchEngineCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_custom"));
70 backActionPointer = actionCollectionPointer->addAction(QStringLiteral("back"));
71 forwardActionPointer = actionCollectionPointer->addAction(QStringLiteral("forward"));
72 refreshActionPointer = actionCollectionPointer->addAction(QStringLiteral("refresh"));
73 homeActionPointer = actionCollectionPointer->addAction(QStringLiteral("home"));
74 javaScriptActionPointer = actionCollectionPointer->addAction(QStringLiteral("javascript"));
75 domainSettingsActionPointer = actionCollectionPointer->addAction(QStringLiteral("domain_settings"));
77 // Create the action groups
78 QActionGroup *userAgentActionGroupPointer = new QActionGroup(this);
79 QActionGroup *searchEngineActionGroupPointer = new QActionGroup(this);
81 // Add the actions to the groups.
82 userAgentActionGroupPointer->addAction(userAgentPrivacyBrowserActionPointer);
83 userAgentActionGroupPointer->addAction(userAgentFirefoxLinuxActionPointer);
84 userAgentActionGroupPointer->addAction(userAgentChromiumLinuxActionPointer);
85 userAgentActionGroupPointer->addAction(userAgentFirefoxWindowsActionPointer);
86 userAgentActionGroupPointer->addAction(userAgentChromeWindowsActionPointer);
87 userAgentActionGroupPointer->addAction(userAgentEdgeWindowsActionPointer);
88 userAgentActionGroupPointer->addAction(userAgentSafariMacosActionPointer);
89 userAgentActionGroupPointer->addAction(userAgentCustomActionPointer);
90 searchEngineActionGroupPointer->addAction(searchEngineMojeekActionPointer);
91 searchEngineActionGroupPointer->addAction(searchEngineMonoclesActionPointer);
92 searchEngineActionGroupPointer->addAction(searchEngineMetagerActionPointer);
93 searchEngineActionGroupPointer->addAction(searchEngineGoogleActionPointer);
94 searchEngineActionGroupPointer->addAction(searchEngineBingActionPointer);
95 searchEngineActionGroupPointer->addAction(searchEngineYahooActionPointer);
96 searchEngineActionGroupPointer->addAction(searchEngineCustomActionPointer);
98 // Set some actions to be checkable.
99 userAgentPrivacyBrowserActionPointer->setCheckable(true);
100 userAgentFirefoxLinuxActionPointer->setCheckable(true);
101 userAgentChromiumLinuxActionPointer->setCheckable(true);
102 userAgentFirefoxWindowsActionPointer->setCheckable(true);
103 userAgentChromeWindowsActionPointer->setCheckable(true);
104 userAgentEdgeWindowsActionPointer->setCheckable(true);
105 userAgentSafariMacosActionPointer->setCheckable(true);
106 userAgentCustomActionPointer->setCheckable(true);
107 searchEngineMojeekActionPointer->setCheckable(true);
108 searchEngineMonoclesActionPointer->setCheckable(true);
109 searchEngineMetagerActionPointer->setCheckable(true);
110 searchEngineGoogleActionPointer->setCheckable(true);
111 searchEngineBingActionPointer->setCheckable(true);
112 searchEngineYahooActionPointer->setCheckable(true);
113 searchEngineCustomActionPointer->setCheckable(true);
115 // Set the non-mutable action text.
116 userAgentPrivacyBrowserActionPointer->setText(UserAgentHelper::PRIVACY_BROWSER_TRANSLATED);
117 userAgentFirefoxLinuxActionPointer->setText(UserAgentHelper::FIREFOX_LINUX_TRANSLATED);
118 userAgentChromiumLinuxActionPointer->setText(UserAgentHelper::CHROMIUM_LINUX_TRANSLATED);
119 userAgentFirefoxWindowsActionPointer->setText(UserAgentHelper::FIREFOX_WINDOWS_TRANSLATED);
120 userAgentChromeWindowsActionPointer->setText(UserAgentHelper::CHROME_WINDOWS_TRANSLATED);
121 userAgentEdgeWindowsActionPointer->setText(UserAgentHelper::EDGE_WINDOWS_TRANSLATED);
122 userAgentSafariMacosActionPointer->setText(UserAgentHelper::SAFARI_MACOS_TRANSLATED);
123 searchEngineMojeekActionPointer->setText(i18nc("Search engine", "Mojeek"));
124 searchEngineMonoclesActionPointer->setText(i18nc("Search engine", "Monocles"));
125 searchEngineMetagerActionPointer->setText(i18nc("Search engine", "MetaGer"));
126 searchEngineGoogleActionPointer->setText(i18nc("Search engine", "Google"));
127 searchEngineBingActionPointer->setText(i18nc("Search engine", "Bing"));
128 searchEngineYahooActionPointer->setText(i18nc("Search engine", "Yahoo"));
129 backActionPointer->setText(i18nc("Back button", "Back"));
130 forwardActionPointer->setText(i18nc("Forward button", "Forward"));
131 refreshActionPointer->setText(i18nc("Refresh button", "Refresh"));
132 homeActionPointer->setText(i18nc("Home button", "Home"));
133 javaScriptActionPointer->setText(i18nc("JavaScript button", "JavaScript"));
134 domainSettingsActionPointer->setText(i18nc("Domain Settings button", "Domain Settings"));
136 // Set the action icons.
137 backActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("arrow-left")));
138 forwardActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("arrow-right")));
139 refreshActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
140 homeActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("home")));
141 domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("network-server-symbolic")));
143 // Update the on-the-fly menus.
144 connect(browserViewPointer, SIGNAL(userAgentUpdated(QString)), this, SLOT(updateOnTheFlyUserAgent(QString)));
145 connect(browserViewPointer, SIGNAL(zoomFactorUpdated(double)), this, SLOT(updateOnTheFlyZoomFactor(double)));
146 connect(browserViewPointer, SIGNAL(searchEngineUpdated(QString)), this, SLOT(updateOnTheFlySearchEngine(QString)));
148 // Apply the on-the-fly settings when selected.
149 connect(userAgentActionGroupPointer, SIGNAL(triggered(QAction*)), browserViewPointer, SLOT(applyOnTheFlyUserAgent(QAction*)));
150 connect(searchEngineActionGroupPointer, SIGNAL(triggered(QAction*)), browserViewPointer, SLOT(applyOnTheFlySearchEngine(QAction*)));
153 connect(zoomFactorActionPointer, SIGNAL(triggered()), this, SLOT(getZoomFactorFromUser()));
155 // Connect the URL toolbar actions.
156 connect(backActionPointer, SIGNAL(triggered()), this, SLOT(back()));
157 connect(forwardActionPointer, SIGNAL(triggered()), this, SLOT(forward()));
158 connect(refreshActionPointer, SIGNAL(triggered()), this, SLOT(refresh()));
159 connect(homeActionPointer, SIGNAL(triggered()), this, SLOT(home()));
160 connect(javaScriptActionPointer, SIGNAL(triggered()), this, SLOT(toggleJavaScript()));
161 connect(domainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(openDomainSettings()));
163 // Update the URL toolbar actions.
164 connect(browserViewPointer, SIGNAL(updateBackAction(bool)), backActionPointer, SLOT(setEnabled(bool)));
165 connect(browserViewPointer, SIGNAL(updateForwardAction(bool)), forwardActionPointer, SLOT(setEnabled(bool)));
166 connect(browserViewPointer, SIGNAL(updateJavaScriptAction(bool)), this, SLOT(updateJavaScriptAction(bool)));
168 // Setup the GUI based on the browser_ui.rc file.
169 setupGUI(StandardWindowOption::Default, ("browser_ui.rc"));
171 // Get a handle for the URL toolbar.
172 KToolBar *urlToolBarPointer = toolBar(QStringLiteral("url_toolbar"));
174 // Create a URL line edit.
175 urlLineEditPointer = new KLineEdit();
177 // Populate the URL toolbar.
178 urlToolBarPointer->addWidget(urlLineEditPointer);
179 urlToolBarPointer->addAction(javaScriptActionPointer);
180 urlToolBarPointer->addAction(domainSettingsActionPointer);
182 // Load a new URL from the URL line edit.
183 connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrlFromLineEdit(const QString)));
185 // Update the URL line edit on page loads.
186 connect(browserViewPointer, SIGNAL(updateUrlLineEdit(QString)), this, SLOT(updateUrlLineEdit(QString)));
188 // Get a handle for the status bar.
189 QStatusBar *statusBarPointer = statusBar();
191 // Update the status bar with the URL when a link is hovered.
192 connect(browserViewPointer, SIGNAL(linkHovered(QString)), statusBarPointer, SLOT(showMessage(QString)));
194 // Get the URL line edit palettes.
195 noDomainSettingsPalette = urlLineEditPointer->palette();
196 domainSettingsPalette = urlLineEditPointer->palette();
198 // Modify the domain settings palette.
199 domainSettingsPalette.setColor(QPalette::Base, QColor("#C8E6C9"));
201 // Update the applied palette.
202 connect(browserViewPointer, SIGNAL(updateDomainSettingsIndicator(bool)), this, SLOT(updateDomainSettingsIndicator(bool)));
204 // Load the initial website.
205 browserViewPointer->loadInitialWebsite();
208 void BrowserWindow::back() const
210 // Remove the focus from the URL line edit.
211 urlLineEditPointer->clearFocus();
214 browserViewPointer->back();
217 void BrowserWindow::fileNew() const
219 // Display a new instance of Privacy Browser.
220 (new BrowserWindow)->show();
223 void BrowserWindow::forward() const
225 // Remove the focus from the URL line edit.
226 urlLineEditPointer->clearFocus();
229 browserViewPointer->forward();
232 void BrowserWindow::getZoomFactorFromUser()
234 // Create an OK flag.
237 // Display a dialog to get the new zoom factor from the user. Format the double to display two decimals and have a 0.25 step.
238 double newZoomFactor = QInputDialog::getDouble(this, i18nc("The on-the-fly zoom factor dialog title", "On-The-Fly Zoom Factor"),
239 i18nc("The instruction text of the on-the-fly zoom factor dialog", "Enter a zoom factor between 0.25 and 5.00"),
240 currentZoomFactor, .025, 5.00, 2, &okClicked, Qt::WindowFlags(), 0.25);
242 // Update the zoom factor if the user clicked OK.
245 // Update the current zoom factor.
246 currentZoomFactor = newZoomFactor;
248 // Set the new zoom factor.
249 browserViewPointer->applyOnTheFlyZoomFactor(newZoomFactor);
251 // Update the on-the-fly action text.
252 updateOnTheFlyZoomFactor(newZoomFactor);
256 void BrowserWindow::home() const
258 // Remove the focus from the URL line edit.
259 urlLineEditPointer->clearFocus();
262 browserViewPointer->home();
265 void BrowserWindow::loadUrlFromLineEdit(const QString &url) const
267 // Remove the focus from the URL line edit.
268 urlLineEditPointer->clearFocus();
271 browserViewPointer->loadUrlFromLineEdit(url);
274 void BrowserWindow::openDomainSettings() const
276 // Remove the focus from the URL line edit.
277 urlLineEditPointer->clearFocus();
279 // Instantiate the domain settings window.
280 DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog();
282 // Set the dialog window title.
283 domainSettingsDialogPointer->setWindowTitle(i18nc("The domain settings dialog title", "Domain Settings"));
286 domainSettingsDialogPointer->setWindowModality(Qt::WindowModality::WindowModal);;
289 domainSettingsDialogPointer->show();
291 // Reload the tabs when domain settings are updated.
292 connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), browserViewPointer, SLOT(applyDomainSettingsAndReload()));
295 void BrowserWindow::refresh() const
297 // Remove the focus from the URL line edit.
298 urlLineEditPointer->clearFocus();
300 // Refresh the web page.
301 browserViewPointer->refresh();
304 void BrowserWindow::toggleJavaScript() const
306 // Remove the focus from the URL line edit.
307 urlLineEditPointer->clearFocus();
309 // Toggle JavaScript.
310 browserViewPointer->toggleJavaScript();
313 void BrowserWindow::settingsConfigure()
315 // Check to make sure the dialog box isn't already displayed.
316 if (KConfigDialog::exists(QStringLiteral("settings")))
318 // Show the existing config dialog if it is hidden.
319 configDialogPointer->show();
321 // Raise the existing config dialog if it is below other windows.
322 configDialogPointer->raise();
324 // Restore the existing config dialog if it has been minimized.
325 if (configDialogPointer->isMinimized()) {
326 configDialogPointer->showNormal();
329 // Activate the existing config dialog, which brings its virtual desktop into focus.
330 configDialogPointer->activateWindow();
334 // Create the settings widgets.
335 QWidget *privacySettingsWidgetPointer = new QWidget;
336 QWidget *generalSettingsWidgetPointer = new QWidget;
338 // Instantiate the settings UI.
339 Ui::PrivacySettings privacySettingsUi;
340 Ui::GeneralSettings generalSettingsUi;
342 // Setup the UI to display the settings widgets.
343 privacySettingsUi.setupUi(privacySettingsWidgetPointer);
344 generalSettingsUi.setupUi(generalSettingsWidgetPointer);
346 // Get handles for the widgets.
347 QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
348 userAgentLabelPointer = privacySettingsUi.userAgentLabel;
349 QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
350 searchEngineLabelPointer = generalSettingsUi.searchEngineLabel;
352 // Populate the combo box labels.
353 updateUserAgentLabel(userAgentComboBoxPointer->currentText());
354 updateSearchEngineLabel(searchEngineComboBoxPointer->currentText());
356 // Update the labels when the combo boxes change.
357 connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateUserAgentLabel(const QString)));
358 connect(searchEngineComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateSearchEngineLabel(const QString)));
360 // Instantiate a settings config dialog from the settings.kcfg file.
361 configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
363 // Add the settings widgets as config dialog pages.
364 configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("@title:tab", "Privacy"), QStringLiteral("privacy-browser"));
365 configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("@title:tab", "General"), QStringLiteral("breeze-settings"));
367 // Delete the config dialog when it is closed.
368 configDialogPointer->setAttribute(Qt::WA_DeleteOnClose);
371 configDialogPointer->show();
373 // TODO. KConfigDialog does not respect expanding size policies. <https://redmine.stoutner.com/issues/823>
374 //configDialogPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
375 //privacySettingsWidgetPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
376 //generalSettingsWidgetPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
377 //configDialogPointer->adjustSize();
379 // Expand the config dialog.
380 configDialogPointer->resize(1000, 500);
382 // Apply the settings when they are updated.
383 connect(configDialogPointer, SIGNAL(settingsChanged(QString)), browserViewPointer, SLOT(applyApplicationSettings()));
384 connect(configDialogPointer, SIGNAL(settingsChanged(QString)), browserViewPointer, SLOT(applyDomainSettingsAndReload()));
388 void BrowserWindow::updateDomainSettingsIndicator(const bool &status) const
390 // Set the domain palette according to the status.
391 if (status) urlLineEditPointer->setPalette(domainSettingsPalette);
392 else urlLineEditPointer->setPalette(noDomainSettingsPalette);
395 void BrowserWindow::updateJavaScriptAction(const bool &isEnabled) const
397 // Set the icon according to the status.
398 if (isEnabled) javaScriptActionPointer->setIcon(QIcon(":/icons/javascript-warning"));
399 else javaScriptActionPointer->setIcon(QIcon(":/icons/privacy-mode"));
402 void BrowserWindow::updateOnTheFlySearchEngine(const QString &searchEngine) const
404 // Initialize the custom search engine flag.
405 bool customSearchEngine = false;
407 if (searchEngine == "Mojeek") // Mojeek.
409 searchEngineMojeekActionPointer->setChecked(true);
411 else if (searchEngine == "Monocles") // Monocles.
413 searchEngineMonoclesActionPointer->setChecked(true);
415 else if (searchEngine == "MetaGer") // MetaGer.
417 searchEngineMetagerActionPointer->setChecked(true);
419 else if (searchEngine == "Google") // Google.
421 searchEngineGoogleActionPointer->setChecked(true);
423 else if (searchEngine == "Bing") // Bing.
425 searchEngineBingActionPointer->setChecked(true);
427 else if (searchEngine == "Yahoo") // Yahoo.
429 searchEngineYahooActionPointer->setChecked(true);
431 else // Custom search engine.
433 // Check the user agent.
434 searchEngineCustomActionPointer->setChecked(true);
436 // Set the custom search engine flag.
437 customSearchEngine = true;
440 // Format the custom search engine.
441 if (customSearchEngine)
443 // Enable the custom search engine.
444 searchEngineCustomActionPointer->setEnabled(true);
446 // Set the custom search engine text.
447 searchEngineCustomActionPointer->setText(searchEngine);
451 // Disable the custom search engine.
452 searchEngineCustomActionPointer->setEnabled(false);
454 // Reset the custom search engine text.
455 searchEngineCustomActionPointer->setText(i18nc("@action", "Custom"));
459 void BrowserWindow::updateOnTheFlyUserAgent(const QString &userAgent) const
461 // Initialize the custom user agent flag.
462 bool customUserAgent = false;
464 // Check the indicated on-the-fly user agent.
465 if (userAgent == UserAgentHelper::PRIVACY_BROWSER_USER_AGENT) userAgentPrivacyBrowserActionPointer->setChecked(true); // Privacy Browser.
466 else if (userAgent == UserAgentHelper::FIREFOX_LINUX_USER_AGENT) userAgentFirefoxLinuxActionPointer->setChecked(true); // Firefox Linux.
467 else if (userAgent == UserAgentHelper::CHROMIUM_LINUX_USER_AGENT) userAgentChromiumLinuxActionPointer->setChecked(true); // Chromium Linux.
468 else if (userAgent == UserAgentHelper::FIREFOX_WINDOWS_USER_AGENT) userAgentFirefoxWindowsActionPointer->setChecked(true); // Firefox Windows.
469 else if (userAgent == UserAgentHelper::CHROME_WINDOWS_USER_AGENT) userAgentChromeWindowsActionPointer->setChecked(true); // Chrome Windows.
470 else if (userAgent == UserAgentHelper::EDGE_WINDOWS_USER_AGENT) userAgentEdgeWindowsActionPointer->setChecked(true); // Edge Windows.
471 else if (userAgent == UserAgentHelper::SAFARI_MACOS_USER_AGENT) userAgentSafariMacosActionPointer->setChecked(true); // Safara macOS.
472 else // Custom user agent.
474 // Check the user agent.
475 userAgentCustomActionPointer->setChecked(true);
477 // Set the custom user agent flag.
478 customUserAgent = true;
482 // Format the custom user agent.
485 // Enable the custom user agent.
486 userAgentCustomActionPointer->setEnabled(true);
488 // Set the custom user agent text.
489 userAgentCustomActionPointer->setText(userAgent);
493 // Disable the custom user agent.
494 userAgentCustomActionPointer->setEnabled(false);
496 // Reset the custom user agent text.
497 userAgentCustomActionPointer->setText(i18nc("@action", "Custom"));
501 void BrowserWindow::updateOnTheFlyZoomFactor(const double &zoomFactor)
503 // Set the current zoom factor.
504 currentZoomFactor = Settings::zoomFactor();
506 // Update the zoom factor action text, formatting the double with 2 decimal places.
507 zoomFactorActionPointer->setText(ki18nc("@action", "Zoom Factor - %1").subs(zoomFactor, 0, '0', 2).toString());
510 void BrowserWindow::updateSearchEngineLabel(const QString &searchEngineString) const
512 // Update the search engine label.
513 searchEngineLabelPointer->setText(SearchEngineHelper::getSearchUrl(searchEngineString));
516 void BrowserWindow::updateUrlLineEdit(const QString &newUrl) const
518 // Update the URL line edit if it does not have focus.
519 if (!urlLineEditPointer->hasFocus())
521 // Update the URL line edit.
522 urlLineEditPointer->setText(newUrl);
526 void BrowserWindow::updateUserAgentLabel(const QString &userAgentDatabaseName) const
528 // Update the user agent label.
529 userAgentLabelPointer->setText(UserAgentHelper::getUserAgentFromDatabaseName(userAgentDatabaseName));