]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/BrowserWindow.cpp
Add search engine options.
[PrivacyBrowserPC.git] / src / BrowserWindow.cpp
index e2f17bd0d47f4cb5cf9f06c143cd3b260447c76a..29fe4644feb31db29f80f92ea8bdd798e82d7862 100644 (file)
@@ -22,7 +22,8 @@
 #include "Settings.h"
 #include "ui_SettingsPrivacy.h"
 #include "ui_SettingsGeneral.h"
 #include "Settings.h"
 #include "ui_SettingsPrivacy.h"
 #include "ui_SettingsGeneral.h"
-#include "UserAgentHelper.h"
+#include "helpers/SearchEngineHelper.h"
+#include "helpers/UserAgentHelper.h"
 
 // KDE Frameworks headers.
 #include <KActionCollection>
 
 // KDE Frameworks headers.
 #include <KActionCollection>
@@ -77,15 +78,19 @@ void BrowserWindow::settingsConfigure()
         privacySettingsUi.setupUi(privacySettingsWidgetPointer);
         generalSettingsUi.setupUi(generalSettingsWidgetPointer);
 
         privacySettingsUi.setupUi(privacySettingsWidgetPointer);
         generalSettingsUi.setupUi(generalSettingsWidgetPointer);
 
-        // Get handles for the user agent widgets.
+        // Get handles for the widgets.
         QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
         userAgentLabelPointer = privacySettingsUi.userAgentLabel;
         QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
         userAgentLabelPointer = privacySettingsUi.userAgentLabel;
+        QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
+        searchEngineLabelPointer = generalSettingsUi.searchEngineLabel;
 
 
-        // Display the initial user agent.
+        // Populate the combo box labels.
         updateUserAgentLabel(userAgentComboBoxPointer->currentText());
         updateUserAgentLabel(userAgentComboBoxPointer->currentText());
+        updateSearchEngineLabel(searchEngineComboBoxPointer->currentText());
 
 
-        // Update the user agent when the combo box changes.
-        connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(QString)), this, SLOT(updateUserAgentLabel(QString)));
+        // Update the labels when the combo boxs change.
+        connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateUserAgentLabel(const QString)));
+        connect(searchEngineComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateSearchEngineLabel(const QString)));
 
         // Instantiate a settings config dialog from the settings.kcfg file.
         KConfigDialog *configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
 
         // Instantiate a settings config dialog from the settings.kcfg file.
         KConfigDialog *configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
@@ -109,6 +114,12 @@ void BrowserWindow::settingsConfigure()
     }
 }
 
     }
 }
 
+void BrowserWindow::updateSearchEngineLabel(const QString &searchEngineString) const
+{
+    // Update the search engine label.
+    searchEngineLabelPointer->setText(SearchEngineHelper::getSearchUrl(searchEngineString));
+}
+
 void BrowserWindow::updateStatusBar(const QString &statusBarMessage) const
 {
     // Display the status bar message.
 void BrowserWindow::updateStatusBar(const QString &statusBarMessage) const
 {
     // Display the status bar message.