+void BrowserWindow::showSettingsDialog()
+{
+ // Create the settings widgets.
+ QWidget *privacySettingsWidgetPointer = new QWidget;
+ QWidget *generalSettingsWidgetPointer = new QWidget;
+
+ // Instantiate the settings UI.
+ Ui::PrivacySettings privacySettingsUi;
+ Ui::GeneralSettings generalSettingsUi;
+
+ // Setup the UI to display the settings widgets.
+ privacySettingsUi.setupUi(privacySettingsWidgetPointer);
+ generalSettingsUi.setupUi(generalSettingsWidgetPointer);
+
+ // Get handles for the widgets.
+ QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
+ userAgentLabelPointer = privacySettingsUi.userAgentLabel;
+ QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
+ searchEngineLabelPointer = generalSettingsUi.searchEngineLabel;
+ downloadLocationComboBoxPointer = generalSettingsUi.kcfg_downloadLocation;
+ QPushButton *browseButtonPointer = generalSettingsUi.browseButton;
+
+ // Populate the combo box labels.
+ updateUserAgentLabel(userAgentComboBoxPointer->currentText());
+ updateSearchEngineLabel(searchEngineComboBoxPointer->currentText());
+
+ // Update the labels when the combo boxes change.
+ connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateUserAgentLabel(const QString)));
+ connect(searchEngineComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateSearchEngineLabel(const QString)));
+
+ // Connect the download location directory browse button.
+ connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(showDownloadLocationBrowseDialog()));
+
+ // Instantiate a settings config dialog from the settings.kcfg file.
+ configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
+
+ // Add the settings widgets as config dialog pages.
+ configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("@title:tab", "Privacy"), QStringLiteral("privacy-browser"));
+ configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("@title:tab", "General"), QStringLiteral("breeze-settings"));
+
+ // Prevent interaction with the parent window while the dialog is open.
+ configDialogPointer->setWindowModality(Qt::WindowModal);
+
+ // Make it so.
+ configDialogPointer->show();
+
+ // TODO. KConfigDialog does not respect expanding size policies. <https://redmine.stoutner.com/issues/823>
+ //configDialogPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ //privacySettingsWidgetPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ //generalSettingsWidgetPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ //configDialogPointer->adjustSize();
+
+ // Expand the config dialog.
+ configDialogPointer->resize(1000, 500);
+
+ // Apply the settings when they are updated.
+ connect(configDialogPointer, SIGNAL(settingsChanged(QString)), tabWidgetPointer, SLOT(applyApplicationSettings()));
+ connect(configDialogPointer, SIGNAL(settingsChanged(QString)), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
+}
+