/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#include <QPushButton>
// Construct the class.
-AddBookmarkDialog::AddBookmarkDialog(const QString &bookmarkName, const QString &bookmarkUrl, const QIcon &favoriteIcon, const double parentFolderId) : QDialog(nullptr)
+AddBookmarkDialog::AddBookmarkDialog(QWidget *parentWidgetPointer, const QString &bookmarkName, const QString &bookmarkUrl, const QIcon &favoriteIcon, const double parentFolderId) :
+ QDialog(parentWidgetPointer)
{
// Set the window title.
setWindowTitle(i18nc("The add bookmark dialog window title.", "Add Bookmark"));
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit AddBookmarkDialog(const QString &bookmarkName, const QString &bookmarkUrl, const QIcon &favoriteIcon, const double parentFolderId);
+ explicit AddBookmarkDialog(QWidget *parentWidgetPointer, const QString &bookmarkName, const QString &bookmarkUrl, const QIcon &favoriteIcon, const double parentFolderId);
signals:
// The signals.
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#include <QFileDialog>
// Construct the class.
-AddFolderDialog::AddFolderDialog(const QIcon ¤tWebsiteFavoriteIcon, const double parentFolderId) : QDialog(nullptr)
+AddFolderDialog::AddFolderDialog(QWidget *parentWidgetPointer, const QIcon ¤tWebsiteFavoriteIcon, const double parentFolderId) : QDialog(parentWidgetPointer)
{
// Set the window title.
setWindowTitle(i18nc("The add folder dialog window title.", "Add Folder"));
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit AddFolderDialog(const QIcon ¤tWebsiteFavoriteIcon, const double parentFolderId);
+ explicit AddFolderDialog(QWidget *parentWidgetPointer, const QIcon ¤tWebsiteFavoriteIcon, const double parentFolderId);
signals:
// The signals.
/*
- * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
const int AddOrEditCookieDialog::EditCookie = 1;
// Construct the class.
-AddOrEditCookieDialog::AddOrEditCookieDialog(const int &dialogType, const QNetworkCookie *cookiePointer, const bool &isDurable) : QDialog(nullptr)
+AddOrEditCookieDialog::AddOrEditCookieDialog(QWidget *parentWidgetPointer, const int dialogType, const QNetworkCookie *cookiePointer, const bool isDurable) : QDialog(parentWidgetPointer)
{
// Set the dialog window title according to the dialog type.
if (dialogType == AddCookie)
/*
- * Copyright 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022, 2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit AddOrEditCookieDialog(const int &dialogType, const QNetworkCookie *cookiePointer = nullptr, const bool &isDurable = false);
+ explicit AddOrEditCookieDialog(QWidget *parentWidgetPointer, const int dialogType, const QNetworkCookie *cookiePointer = nullptr, const bool isDurable = false);
// The public static constants.
static const int AddCookie;
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#include <QStandardItemModel>
// Construct the class.
-BookmarksDialog::BookmarksDialog(QString currentWebsiteTitle, QString currentWebsiteUrl, QIcon currentWebsiteFavorieIcon) :
- QDialog(nullptr), websiteFavoriteIcon(currentWebsiteFavorieIcon), websiteTitle(currentWebsiteTitle), websiteUrl(currentWebsiteUrl)
+BookmarksDialog::BookmarksDialog(QWidget *parentWidgetPointer, QIcon currentWebsiteFavorieIcon, QString currentWebsiteTitle, QString currentWebsiteUrl) :
+ QDialog(parentWidgetPointer), websiteFavoriteIcon(currentWebsiteFavorieIcon), websiteTitle(currentWebsiteTitle), websiteUrl(currentWebsiteUrl)
{
// Set the dialog window title.
setWindowTitle(i18nc("The bookmarks dialog window title", "Bookmarks"));
}
}
-void BookmarksDialog::showAddBookmarkDialog() const
+void BookmarksDialog::showAddBookmarkDialog()
{
// Return the most recently selected index.
QModelIndex currentIndex = treeSelectionModelPointer->currentIndex();
}
// Instantiate an add bookmark dialog.
- AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(websiteTitle, websiteUrl, websiteFavoriteIcon, parentFolderId);
+ AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(this, websiteTitle, websiteUrl, websiteFavoriteIcon, parentFolderId);
// Update the displayed bookmarks when a new one is added.
connect(addBookmarkDialogPointer, SIGNAL(bookmarkAdded()), this, SLOT(refreshBookmarks()));
addBookmarkDialogPointer->show();
}
-void BookmarksDialog::showAddFolderDialog() const
+void BookmarksDialog::showAddFolderDialog()
{
// Get the most recently selected index.
QModelIndex currentIndex = treeSelectionModelPointer->currentIndex();
}
// Instantiate an add folder dialog.
- AddFolderDialog *addFolderDialogPointer = new AddFolderDialog(websiteFavoriteIcon, parentFolderId);
+ AddFolderDialog *addFolderDialogPointer = new AddFolderDialog(this, websiteFavoriteIcon, parentFolderId);
// Update the displayed bookmarks when a folder is added.
connect(addFolderDialogPointer, SIGNAL(folderAdded()), this, SLOT(refreshBookmarks()));
if (currentIndex.siblingAtColumn(IS_FOLDER_COLUMN).data().toInt() == 1) // The selected item is a folder.
{
// Instantiate an edit folder dialog.
- QDialog *editFolderDialogPointer = new EditFolderDialog(currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
+ QDialog *editFolderDialogPointer = new EditFolderDialog(this, currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
// Show the dialog.
editFolderDialogPointer->show();
else // The selected item is a bookmark.
{
// Instantiate an edit bookmark dialog.
- QDialog *editBookmarkDialogPointer = new EditBookmarkDialog(currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
+ QDialog *editBookmarkDialogPointer = new EditBookmarkDialog(this, currentIndex.siblingAtColumn(DATABASE_ID_COLUMN).data().toInt(), websiteFavoriteIcon);
// Show the dialog.
editBookmarkDialogPointer->show();
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit BookmarksDialog(QString currentWebsiteTitle, QString currentWebsiteUrl, QIcon currentWebsiteFavoriteIcon);
+ BookmarksDialog(QWidget *parentWidgetPointer, QIcon currentWebsiteFavorieIcon, QString currentWebsiteTitle, QString currentWebsiteUrl);
// The public constants.
static const int NAME_COLUMN = 0;
// The private slots.
void deleteItems() const;
void refreshBookmarks() const;
- void showAddBookmarkDialog() const;
- void showAddFolderDialog() const;
+ void showAddBookmarkDialog();
+ void showAddFolderDialog();
void showEditDialog();
void updateBookmarkFromTree(QStandardItem *modifiedStandardItem);
void updateSelection() const;
-# Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
+# Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
#
# This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
#
EditBookmarkDialog.cpp
EditFolderDialog.cpp
SaveDialog.cpp
+ SettingsDialog.cpp
)
/*
- * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
emit deleteCookie(cookie);
}
-void CookiesDialog::showAddCookieDialog() const
+void CookiesDialog::showAddCookieDialog()
{
// Instantiate an add cookie dialog.
- QDialog *addCookieDialogPointer = new AddOrEditCookieDialog(AddOrEditCookieDialog::AddCookie);
+ QDialog *addCookieDialogPointer = new AddOrEditCookieDialog(this, AddOrEditCookieDialog::AddCookie);
// Show the dialog.
addCookieDialogPointer->show();
}
}
-void CookiesDialog::showDurableCookiesDialog() const
+void CookiesDialog::showDurableCookiesDialog()
{
// Instantiate a durable cookies dialog.
- QDialog *durableCookiesDialogPointer = new DurableCookiesDialog();
+ QDialog *durableCookiesDialogPointer = new DurableCookiesDialog(this);
// Show the dialog.
durableCookiesDialogPointer->show();
connect(durableCookiesDialogPointer, SIGNAL(updateParentUi()), this, SLOT(updateUi()));
}
-void CookiesDialog::showEditCookieDialog() const
+void CookiesDialog::showEditCookieDialog()
{
// Get the current model index.
QModelIndex currentIndex = treeSelectionModelPointer->currentIndex();
}
// Instantiate an edit cookie dialog.
- QDialog *editCookieDialogPointer = new AddOrEditCookieDialog(AddOrEditCookieDialog::EditCookie, &cookieToEdit, currentIndex.siblingAtColumn(1).data().toString() == i18n("yes"));
+ QDialog *editCookieDialogPointer = new AddOrEditCookieDialog(this, AddOrEditCookieDialog::EditCookie, &cookieToEdit, currentIndex.siblingAtColumn(1).data().toString() == i18n("yes"));
// Show the dialog.
editCookieDialogPointer->show();
/*
- * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
void addCookieFromDialog(const QNetworkCookie &cookie, const bool &isDurable) const;
void deleteCookieFromDatabase(const QNetworkCookie &cookie) const;
void deleteCookieFromDialog(const QNetworkCookie &cookie) const;
- void showAddCookieDialog() const;
+ void showAddCookieDialog();
void showDeleteAllMessageBox() const;
void showDeleteCookieMessageBox() const;
- void showDurableCookiesDialog() const;
- void showEditCookieDialog() const;
+ void showDurableCookiesDialog();
+ void showEditCookieDialog();
void updateUi() const;
private:
const int DomainSettingsDialog::EDIT_DOMAIN = 1;
// Construct the class.
-DomainSettingsDialog::DomainSettingsDialog(const int &startType, const QString &domainName) : QDialog(nullptr)
+DomainSettingsDialog::DomainSettingsDialog(QWidget *parentWidgetPointer, const int &startType, const QString &domainName) : QDialog(parentWidgetPointer)
{
// Set the window title.
setWindowTitle(i18nc("The domain settings dialog window title", "Domain Settings"));
public:
// The primary constructor.
- explicit DomainSettingsDialog(const int &startType = SHOW_ALL_DOMAINS, const QString &domainName = QStringLiteral(""));
+ explicit DomainSettingsDialog(QWidget *parentWidgetPointer, const int &startType = SHOW_ALL_DOMAINS, const QString &domainName = QStringLiteral(""));
// The public static int constants.
static const int SHOW_ALL_DOMAINS;
/*
- * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
// KDE Frameworks headers.
#include <KLocalizedString>
-DurableCookiesDialog::DurableCookiesDialog() : QDialog(nullptr)
+DurableCookiesDialog::DurableCookiesDialog(QWidget *parentWidgetPointer) : QDialog(parentWidgetPointer)
{
// Set the dialog window title.
setWindowTitle(i18nc("The durable cookies dialog window title", "Durable Cookies"));
/*
- * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022, 2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The default constructor.
- explicit DurableCookiesDialog();
+ explicit DurableCookiesDialog(QWidget *parentWidgetPointer);
signals:
// The signals.
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#include <QFileDialog>
// Construct the class.
-EditBookmarkDialog::EditBookmarkDialog(const int databaseId, QIcon ¤tWebsiteFavoriteIcon) : QDialog(nullptr), bookmarkDatabaseId(databaseId)
+EditBookmarkDialog::EditBookmarkDialog(QWidget *parentWidgetPointer, const int databaseId, QIcon ¤tWebsiteFavoriteIcon) : QDialog(parentWidgetPointer), bookmarkDatabaseId(databaseId)
{
// Set the window title.
setWindowTitle(i18nc("The edit bookmark dialog window title.", "Edit Bookmark"));
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit EditBookmarkDialog(const int databaseId, QIcon ¤tWebsiteFavoriteIcon);
+ explicit EditBookmarkDialog(QWidget *parentWidgetPointer, const int databaseId, QIcon ¤tWebsiteFavoriteIcon);
signals:
// The signals.
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#include <QFileDialog>
// Construct the class.
-EditFolderDialog::EditFolderDialog(const int databaseId, QIcon ¤tWebsiteFavoriteIcon) : QDialog(nullptr), folderDatabaseId(databaseId)
+EditFolderDialog::EditFolderDialog(QWidget *parentWidgetPointer, const int databaseId, QIcon ¤tWebsiteFavoriteIcon) : QDialog(parentWidgetPointer), folderDatabaseId(databaseId)
{
// Set the window title.
setWindowTitle(i18nc("The edit folder dialog window title.", "Edit Folder"));
/*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit EditFolderDialog(const int databaseId, QIcon ¤tWebsiteFavoriteIcon);
+ explicit EditFolderDialog(QWidget *parentWidgetPointer, const int databaseId, QIcon ¤tWebsiteFavoriteIcon);
signals:
// The signals.
/*
- * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#include <QShortcut>
#include <QStandardPaths>
-SaveDialog::SaveDialog(QUrl &url, QString &mimeTypeString, int totalBytes, QString fileName, bool nativeDownloader): downloadUrl(url), suggestedFileName(fileName)
+SaveDialog::SaveDialog(QWidget *parentWidgetPointer, QUrl &url, QString &mimeTypeString, int totalBytes, QString fileName, bool nativeDownloader) :
+ QDialog(parentWidgetPointer), downloadUrl(url), suggestedFileName(fileName)
{
// Set the dialog window title.
setWindowTitle(i18nc("The save dialog window title", "Save"));
// Close the dialog.
reject();
}
-
/*
- * Copyright 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022, 2024 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
public:
// The primary constructor.
- explicit SaveDialog(QUrl &url, QString &mimeTypeString, int totalBytes, QString fileName = QString(), bool nativeDownloader = false);
+ explicit SaveDialog(QWidget *parentWidgetPointer, QUrl &url, QString &mimeTypeString, int totalBytes, QString fileName = QString(), bool nativeDownloader = false);
signals:
// The signals.
--- /dev/null
+/*
+ * Copyright 2024 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
+ *
+ * Privacy Browser PC is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser PC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// Application headers.
+#include "Settings.h"
+#include "SettingsDialog.h"
+#include "helpers/SearchEngineHelper.h"
+#include "helpers/UserAgentHelper.h"
+#include "ui_SettingsGeneral.h"
+#include "ui_SettingsPrivacy.h"
+#include "ui_SettingsSpellCheck.h"
+
+// Qt toolkit headers.
+#include <QDir>
+#include <QFileDialog>
+
+SettingsDialog::SettingsDialog(QWidget *parentWidgetPointer, KCoreConfigSkeleton *coreConfigSkeletonPointer) :
+ KConfigDialog(parentWidgetPointer, QLatin1String("settings"), coreConfigSkeletonPointer)
+{
+ // Instantiate the settings UI.
+ Ui::PrivacySettings privacySettingsUi;
+ Ui::GeneralSettings generalSettingsUi;
+ Ui::SpellCheckSettings spellCheckSettingsUi;
+
+ // Create the settings widgets.
+ QWidget *privacySettingsWidgetPointer = new QWidget;
+ QWidget *generalSettingsWidgetPointer = new QWidget;
+ QWidget *spellCheckSettingsWidgetPointer = new QWidget;
+
+ // Setup the UI to display the settings widgets.
+ privacySettingsUi.setupUi(privacySettingsWidgetPointer);
+ generalSettingsUi.setupUi(generalSettingsWidgetPointer);
+ spellCheckSettingsUi.setupUi(spellCheckSettingsWidgetPointer);
+
+ // Get handles for the widgets.
+ QCheckBox *javaScriptCheckBoxPointer = privacySettingsUi.kcfg_javaScriptEnabled;
+ QCheckBox *localStorageCheckBoxPointer = privacySettingsUi.kcfg_localStorageEnabled;
+ QCheckBox *domStorageCheckBoxPointer = privacySettingsUi.kcfg_domStorageEnabled;
+ QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
+ userAgentLabelPointer = privacySettingsUi.userAgentLabel;
+ QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
+ searchEngineLabelPointer = generalSettingsUi.searchEngineLabel;
+ downloadDirectoryComboBoxPointer = generalSettingsUi.kcfg_downloadDirectory;
+ QPushButton *browseButtonPointer = generalSettingsUi.browseButton;
+ QListWidget *spellCheckListWidgetPointer = spellCheckSettingsUi.spellCheckListWidget;
+
+ // Create a save spell check languages lambda.
+ auto updateCheckBoxes = [javaScriptCheckBoxPointer, localStorageCheckBoxPointer, domStorageCheckBoxPointer] ()
+ {
+ // Only enable the DOM storage check box if both JavaScript and local storage are checked.
+ domStorageCheckBoxPointer->setEnabled(javaScriptCheckBoxPointer->isChecked() && localStorageCheckBoxPointer->isChecked());
+ };
+
+ // Update the status of the DOM storage check box when either JavaScript or local storage are changed.
+ connect(javaScriptCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes);
+ connect(localStorageCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes);
+
+ // 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 directory directory browse button.
+ connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(showDownloadDirectoryBrowseDialog()));
+
+ // Create a dictionaries QDir from the `QTWEBENGINE_DICTIONARIES_PATH` environment variable.
+ QDir dictionariesDir = QDir(qEnvironmentVariable("QTWEBENGINE_DICTIONARIES_PATH"));
+
+ // Get a dictionaries string list.
+ QStringList dictionariesStringList = dictionariesDir.entryList(QStringList(QLatin1String("*.bdic")), QDir::Files | QDir::NoSymLinks);
+
+ // Remove the `.bdic` file extensions from the dictionaries list.
+ dictionariesStringList.replaceInStrings(QLatin1String(".bdic"), QLatin1String(""));
+
+ // Get a list of the enabled spell check languages.
+ QStringList enabledSpellCheckLanguagesList = Settings::spellCheckLanguages();
+
+ // Add each dictionary to the spell check list widget.
+ foreach(QString dictionaryString, dictionariesStringList)
+ {
+ // Create a new list widget item pointer.
+ QListWidgetItem *listWidgetItemPointer = new QListWidgetItem();
+
+ // Create a dictionary check box widget with the name of the dictionary string.
+ QCheckBox *dictionaryCheckBoxWidget = new QCheckBox(dictionaryString);
+
+ // Check the language if it is currently enabled.
+ if (enabledSpellCheckLanguagesList.contains(dictionaryString))
+ dictionaryCheckBoxWidget->setCheckState(Qt::Checked);
+ else
+ dictionaryCheckBoxWidget->setCheckState(Qt::Unchecked);
+
+ // Add the list widget item to the spell check list widget.
+ spellCheckListWidgetPointer->addItem(listWidgetItemPointer);
+
+ // Set the list widget item check box widget.
+ spellCheckListWidgetPointer->setItemWidget(listWidgetItemPointer, dictionaryCheckBoxWidget);
+ }
+
+ // Create a settings icon string.
+ QString settingsIconString;
+
+ // Get a settings icon that matches the theme.
+ if (QIcon::hasThemeIcon("breeze-settings"))
+ {
+ // KDE uses breeze-settings.
+ settingsIconString = QLatin1String("breeze-settings");
+ }
+ else
+ {
+ // Gnome uses preferences-desktop.
+ settingsIconString = QLatin1String("preferences-desktop");
+ }
+
+ // Add the settings widgets as config dialog pages.
+ addPage(privacySettingsWidgetPointer, i18nc("Settings tab title", "Privacy"), QLatin1String("privacybrowser"));
+ addPage(generalSettingsWidgetPointer, i18nc("Settings tab title", "General"), settingsIconString);
+ addPage(spellCheckSettingsWidgetPointer, i18nc("Settings tab title", "Spell Check"), QLatin1String("tools-check-spelling"));
+
+ // Get handles for the buttons.
+ QPushButton *applyButtonPointer = button(QDialogButtonBox::Apply);
+ QPushButton *okButtonPointer = button(QDialogButtonBox::Ok);
+
+ // Prevent interaction with the parent window while the dialog is open.
+ setWindowModality(Qt::WindowModal);
+
+ // Create a save spell check languages lambda.
+ auto saveSpellCheckLanguages = [spellCheckListWidgetPointer, coreConfigSkeletonPointer, this] ()
+ {
+ // Create a list of enabled languages.
+ QStringList newSpellCheckLanguages = QStringList();
+
+ // Get a count of all the languages.
+ int allLanguagesCount = spellCheckListWidgetPointer->count();
+
+ // Get a list of all the checked languages.
+ for (int i = 0; i < allLanguagesCount; ++i) {
+ // Get the language item.
+ QListWidgetItem *languageItemPointer = spellCheckListWidgetPointer->item(i);
+
+ // Get the language check box.
+ QCheckBox *languageCheckBoxPointer = qobject_cast<QCheckBox*>(spellCheckListWidgetPointer->itemWidget(languageItemPointer));
+
+ // Add the item to the enabled languages if it is checked.
+ if (languageCheckBoxPointer->checkState() == Qt::Checked)
+ {
+ // Get the text.
+ QString languageString = languageCheckBoxPointer->text();
+
+ // Remove all instances of `&`, which may have been added automatically when creating the check box text.
+ languageString.remove(QChar('&'));
+
+ // Add the language string to the list.
+ newSpellCheckLanguages.append(languageString);
+ }
+ }
+
+ // Update the spell check languages.
+ if (Settings::spellCheckLanguages() != newSpellCheckLanguages)
+ {
+ // Update the spell check languages.
+ Settings::setSpellCheckLanguages(newSpellCheckLanguages);
+
+ // Write the settings to disk.
+ coreConfigSkeletonPointer->save();
+
+ // Emit the spell check languages updated signal.
+ emit spellCheckLanguagesUpdated();
+ }
+ };
+
+ // Process clicks on the buttons.
+ connect(applyButtonPointer, &QPushButton::clicked, this, saveSpellCheckLanguages);
+ connect(okButtonPointer, &QPushButton::clicked, this, saveSpellCheckLanguages);
+}
+
+void SettingsDialog::showDownloadDirectoryBrowseDialog()
+{
+ // Get the current download directory.
+ QString currentDownloadDirectory = downloadDirectoryComboBoxPointer->currentText();
+
+ // Resolve the system download directory if specified.
+ if (currentDownloadDirectory == QStringLiteral("System Download Directory"))
+ currentDownloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+
+ // Get the new download directory.
+ QString newDownloadDirectory = QFileDialog::getExistingDirectory(this, i18nc("Select download directory dialog caption", "Select Download Directory"), currentDownloadDirectory);
+
+ // Populate the download directory combo box according to the new download location.
+ if (newDownloadDirectory == QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)) // The default download location was selected.
+ {
+ // Populate the download location with the default text.
+ downloadDirectoryComboBoxPointer->setCurrentText("System Download Directory");
+ }
+ else if (newDownloadDirectory != QStringLiteral("")) // A different directory was selected.
+ {
+ // Populate the download location.
+ downloadDirectoryComboBoxPointer->setCurrentText(newDownloadDirectory);
+ }
+}
+
+void SettingsDialog::updateSearchEngineLabel(const QString &searchEngineString) const
+{
+ // Update the search engine label.
+ searchEngineLabelPointer->setText(SearchEngineHelper::getSearchUrl(searchEngineString));
+}
+
+void SettingsDialog::updateUserAgentLabel(const QString &userAgentDatabaseName) const
+{
+ // Update the user agent label.
+ userAgentLabelPointer->setText(UserAgentHelper::getUserAgentFromDatabaseName(userAgentDatabaseName));
+}
--- /dev/null
+/*
+ * Copyright 2024 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
+ *
+ * Privacy Browser PC is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser PC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+// KDE Framework headers.
+#include <KConfigDialog>
+
+// Qt toolkit headers.
+#include <QComboBox>
+#include <QLabel>
+
+class SettingsDialog : public KConfigDialog
+{
+ // Include the Q_OBJECT macro.
+ Q_OBJECT
+
+public:
+ // The primary constructor.
+ explicit SettingsDialog(QWidget *parentWidgetPointer, KCoreConfigSkeleton *coreConfigSkeletonPointer);
+
+signals:
+ void spellCheckLanguagesUpdated() const;
+
+private Q_SLOTS:
+ void showDownloadDirectoryBrowseDialog();
+ void updateSearchEngineLabel(const QString &searchEngineString) const;
+ void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
+
+private:
+ // The private variables.
+ QComboBox *downloadDirectoryComboBoxPointer;
+ QLabel *searchEngineLabelPointer;
+ QLabel *userAgentLabelPointer;
+};
+#endif
if (!isRunningKde || currentPrivacyWebEngineViewPointer->localStorageEnabled) // KDE is not running or local storage (cookies) is enabled. Use WebEngine's downloader.
{
// Instantiate the save dialog.
- SaveDialog *saveDialogPointer = new SaveDialog(downloadUrl, mimeTypeString, totalBytes);
+ SaveDialog *saveDialogPointer = new SaveDialog(this, downloadUrl, mimeTypeString, totalBytes);
// Display the save dialog.
int saveDialogResult = saveDialogPointer->exec();
// This must use the show command to launch a separate dialog which cancels WebEngine's automatic background download of the file to a temporary location.
{
// Instantiate the save dialog. `true` instructs it to use the native downloader
- SaveDialog *saveDialogPointer = new SaveDialog(downloadUrl, mimeTypeString, totalBytes, suggestedFileName, true);
+ SaveDialog *saveDialogPointer = new SaveDialog(this, downloadUrl, mimeTypeString, totalBytes, suggestedFileName, true);
// Connect the save button.
connect(saveDialogPointer, SIGNAL(useNativeKdeDownloader(QUrl &, QString &)), this, SLOT(useNativeKdeDownloader(QUrl &, QString &)));
// The public functions.
void applyOnTheFlyZoomFactor(const double zoomFactorDouble) const;
- void applySpellCheckLanguages() const;
PrivacyWebEngineView* loadBlankInitialWebsite();
void loadInitialWebsite();
void findPrevious(const QString &text) const;
void applyDomainSettingsAndReload();
void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
+ void applySpellCheckLanguages() const;
void back() const;
void deleteAllCookies() const;
void deleteCookieFromStore(const QNetworkCookie &cookie) const;
// Application headers.
#include "BrowserWindow.h"
#include "Settings.h"
-#include "ui_SettingsGeneral.h"
-#include "ui_SettingsPrivacy.h"
-#include "ui_SettingsSpellCheck.h"
#include "databases/BookmarksDatabase.h"
#include "databases/DomainsDatabase.h"
#include "dialogs/AddBookmarkDialog.h"
#include "dialogs/DomainSettingsDialog.h"
#include "dialogs/EditBookmarkDialog.h"
#include "dialogs/EditFolderDialog.h"
+#include "dialogs/SettingsDialog.h"
#include "helpers/SearchEngineHelper.h"
#include "helpers/UserAgentHelper.h"
#include "structs/BookmarkStruct.h"
// KDE Frameworks headers.
#include <KActionCollection>
#include <KColorScheme>
+#include <KLocalizedString>
#include <KXMLGUIFactory>
// Qt toolkit headers.
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDBusMessage>
-#include <QFileDialog>
+#include <QGuiApplication>
#include <QInputDialog>
+#include <QLayout>
#include <QNetworkCookie>
#include <QMenuBar>
#include <QMessageBox>
QAction *addBookmarkActionPointer = menuPointer->addAction(QIcon::fromTheme(QLatin1String("bookmark-new")), i18nc("The add bookmark action", "Add Bookmark"), [=]
{
// Instantiate an add bookmark dialog.
- AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(tabWidgetPointer->getCurrentTabTitle(), tabWidgetPointer->getCurrentTabUrl(),
+ AddBookmarkDialog *addBookmarkDialogPointer = new AddBookmarkDialog(this, tabWidgetPointer->getCurrentTabTitle(), tabWidgetPointer->getCurrentTabUrl(),
tabWidgetPointer->getCurrentTabFavoritIcon(), folderId);
// Update the displayed bookmarks when a new one is added.
QAction *addFolderActionPointer = menuPointer->addAction(QIcon::fromTheme(QLatin1String("folder-add")), i18nc("The add folder action", "Add Folder"), [=]
{
// Instantiate an add folder dialog.
- AddFolderDialog *addFolderDialogPointer = new AddFolderDialog(tabWidgetPointer->getCurrentTabFavoritIcon(), folderId);
+ AddFolderDialog *addFolderDialogPointer = new AddFolderDialog(this, tabWidgetPointer->getCurrentTabFavoritIcon(), folderId);
// Update the displayed bookmarks when a folder is added.
connect(addFolderDialogPointer, SIGNAL(folderAdded()), this, SLOT(populateBookmarksInAllWindows()));
QIcon currentTabFavoriteIcon = tabWidgetPointer->getCurrentTabFavoritIcon();
// Instantiate an edit folder dialog.
- QDialog *editFolderDialogPointer = new EditFolderDialog(folderDatabaseId, currentTabFavoriteIcon);
+ QDialog *editFolderDialogPointer = new EditFolderDialog(this, folderDatabaseId, currentTabFavoriteIcon);
// Show the dialog.
editFolderDialogPointer->show();
finalBookmarkFolderMenuActionList.prepend(new QPair<QMenu *, QAction *>(menuPointer, deleteFolderActionPointer));
}
-void BrowserWindow::addOrEditDomainSettings() const
+void BrowserWindow::addOrEditDomainSettings()
{
// Remove the focus from the URL line edit.
urlLineEditPointer->clearFocus();
}
// Create the domain settings dialog pointer.
- DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog(DomainSettingsDialog::EDIT_DOMAIN, currentDomainSettingsName);
+ DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog(this, DomainSettingsDialog::EDIT_DOMAIN, currentDomainSettingsName);
// Reload the tabs when domain settings are updated.
connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
updateZoomActions(currentZoomFactorDouble);
}
-void BrowserWindow::editBookmarks() const
+void BrowserWindow::editBookmarks()
{
// Instantiate an edit bookmarks dialog.
- BookmarksDialog *bookmarksDialogPointer = new BookmarksDialog(tabWidgetPointer->getCurrentTabTitle(), tabWidgetPointer->getCurrentTabUrl(), tabWidgetPointer->getCurrentTabFavoritIcon());
+ BookmarksDialog *bookmarksDialogPointer = new BookmarksDialog(this, tabWidgetPointer->getCurrentTabFavoritIcon(), tabWidgetPointer->getCurrentTabTitle(), tabWidgetPointer->getCurrentTabUrl());
// Update the displayed bookmarks when edited.
connect(bookmarksDialogPointer, SIGNAL(bookmarkUpdated()), this, SLOT(populateBookmarksInAllWindows()));
QIcon currentTabFavoriteIcon = tabWidgetPointer->getCurrentTabFavoritIcon();
// Instantiate an edit bookmark dialog.
- QDialog *editBookmarkDialogPointer = new EditBookmarkDialog(databaseId, currentTabFavoriteIcon);
+ QDialog *editBookmarkDialogPointer = new EditBookmarkDialog(this, databaseId, currentTabFavoriteIcon);
// Show the dialog.
editBookmarkDialogPointer->show();
connect(cookiesDialogPointer, SIGNAL(deleteCookie(QNetworkCookie)), tabWidgetPointer, SLOT(deleteCookieFromStore(QNetworkCookie)));
}
-void BrowserWindow::showDownloadDirectoryBrowseDialog() const
-{
- // Get the current download directory.
- QString currentDownloadDirectory = downloadDirectoryComboBoxPointer->currentText();
-
- // Resolve the system download directory if specified.
- if (currentDownloadDirectory == QStringLiteral("System Download Directory"))
- currentDownloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
-
- // Get the new download directory.
- QString newDownloadDirectory = QFileDialog::getExistingDirectory(configDialogPointer, i18nc("Select download directory dialog caption", "Select Download Directory"),
- currentDownloadDirectory);
-
- // Populate the download directory combo box according to the new download location.
- if (newDownloadDirectory == QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)) // The default download location was selected.
- {
- // Populate the download location with the default text.
- downloadDirectoryComboBoxPointer->setCurrentText("System Download Directory");
- }
- else if (newDownloadDirectory != QStringLiteral("")) // A different directory was selected.
- {
- // Populate the download location.
- downloadDirectoryComboBoxPointer->setCurrentText(newDownloadDirectory);
- }
-}
-
-void BrowserWindow::showDomainSettingsDialog() const
+void BrowserWindow::showDomainSettingsDialog()
{
// Remove the focus from the URL line edit.
urlLineEditPointer->clearFocus();
// Instantiate the domain settings dialog.
- DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog();
+ DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog(this);
// Reload the tabs when domain settings are updated.
connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
void BrowserWindow::showSettingsDialog()
{
- // Create the settings widgets.
- QWidget *privacySettingsWidgetPointer = new QWidget;
- QWidget *generalSettingsWidgetPointer = new QWidget;
- QWidget *spellCheckSettingsWidgetPointer = new QWidget;
-
- // Instantiate the settings UI.
- Ui::PrivacySettings privacySettingsUi;
- Ui::GeneralSettings generalSettingsUi;
- Ui::SpellCheckSettings spellCheckSettingsUi;
-
- // Setup the UI to display the settings widgets.
- privacySettingsUi.setupUi(privacySettingsWidgetPointer);
- generalSettingsUi.setupUi(generalSettingsWidgetPointer);
- spellCheckSettingsUi.setupUi(spellCheckSettingsWidgetPointer);
-
- // Get handles for the widgets.
- QCheckBox *javaScriptCheckBoxPointer = privacySettingsUi.kcfg_javaScriptEnabled;
- QCheckBox *localStorageCheckBoxPointer = privacySettingsUi.kcfg_localStorageEnabled;
- QCheckBox *domStorageCheckBoxPointer = privacySettingsUi.kcfg_domStorageEnabled;
- QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
- userAgentLabelPointer = privacySettingsUi.userAgentLabel;
- QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
- searchEngineLabelPointer = generalSettingsUi.searchEngineLabel;
- downloadDirectoryComboBoxPointer = generalSettingsUi.kcfg_downloadDirectory;
- QPushButton *browseButtonPointer = generalSettingsUi.browseButton;
- QListWidget *spellCheckListWidgetPointer = spellCheckSettingsUi.spellCheckListWidget;
-
- // Create a save spell check languages lambda.
- auto updateCheckBoxes = [javaScriptCheckBoxPointer, localStorageCheckBoxPointer, domStorageCheckBoxPointer] ()
- {
- // Only enable the DOM storage check box if both JavaScript and local storage are checked.
- domStorageCheckBoxPointer->setEnabled(javaScriptCheckBoxPointer->isChecked() && localStorageCheckBoxPointer->isChecked());
- };
-
- // Update the status of the DOM storage check box when either JavaScript or local storage are changed.
- connect(javaScriptCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes);
- connect(localStorageCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes);
-
- // 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 directory directory browse button.
- connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(showDownloadDirectoryBrowseDialog()));
-
- // Create a dictionaries QDir from the `QTWEBENGINE_DICTIONARIES_PATH` environment variable.
- QDir dictionariesDir = QDir(qEnvironmentVariable("QTWEBENGINE_DICTIONARIES_PATH"));
-
- // Get a dictionaries string list.
- QStringList dictionariesStringList = dictionariesDir.entryList(QStringList(QLatin1String("*.bdic")), QDir::Files | QDir::NoSymLinks);
-
- // Remove the `.bdic` file extensions from the dictionaries list.
- dictionariesStringList.replaceInStrings(QLatin1String(".bdic"), QLatin1String(""));
-
- // Get a list of the enabled spell check languages.
- QStringList enabledSpellCheckLanguagesList = Settings::spellCheckLanguages();
-
- // Add each dictionary to the spell check list widget.
- foreach(QString dictionaryString, dictionariesStringList)
- {
- // Create a new list widget item pointer.
- QListWidgetItem *listWidgetItemPointer = new QListWidgetItem();
-
- // Create a dictionary check box widget with the name of the dictionary string.
- QCheckBox *dictionaryCheckBoxWidget = new QCheckBox(dictionaryString);
-
- // Check the language if it is currently enabled.
- if (enabledSpellCheckLanguagesList.contains(dictionaryString))
- dictionaryCheckBoxWidget->setCheckState(Qt::Checked);
- else
- dictionaryCheckBoxWidget->setCheckState(Qt::Unchecked);
-
- // Add the list widget item to the spell check list widget.
- spellCheckListWidgetPointer->addItem(listWidgetItemPointer);
-
- // Set the list widget item check box widget.
- spellCheckListWidgetPointer->setItemWidget(listWidgetItemPointer, dictionaryCheckBoxWidget);
- }
-
// Get a handle for the KConfig skeleton.
KConfigSkeleton *kConfigSkeletonPointer = Settings::self();
- // Instantiate a settings config dialog from the settings.kcfg file.
- configDialogPointer = new KConfigDialog(this, QLatin1String("settings"), kConfigSkeletonPointer);
+ // Instantiate a settings dialog.
+ SettingsDialog *settingsDialogPointer = new SettingsDialog(this, kConfigSkeletonPointer);
- // Create a settings icon string.
- QString settingsIconString;
-
- // Get a settings icon that matches the theme.
- if (QIcon::hasThemeIcon("breeze-settings"))
- {
- // KDE uses breeze-settings.
- settingsIconString = QLatin1String("breeze-settings");
- }
- else
- {
- // Gnome uses preferences-desktop.
- settingsIconString = QLatin1String("preferences-desktop");
- }
-
- // Add the settings widgets as config dialog pages.
- configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("Settings tab title", "Privacy"), QLatin1String("privacybrowser"));
- configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("Settings tab title", "General"), settingsIconString);
- configDialogPointer->addPage(spellCheckSettingsWidgetPointer, i18nc("Settings tab title", "Spell Check"), QLatin1String("tools-check-spelling"));
-
- // Get handles for the buttons.
- QPushButton *applyButtonPointer = configDialogPointer->button(QDialogButtonBox::Apply);
- QPushButton *okButtonPointer = configDialogPointer->button(QDialogButtonBox::Ok);
-
- // Prevent interaction with the parent window while the dialog is open.
- configDialogPointer->setWindowModality(Qt::WindowModal);
-
- // Make it so.
- configDialogPointer->show();
+ // Show the dialog
+ settingsDialogPointer->show();
// TODO. KConfigDialog does not respect expanding size policies. <https://redmine.stoutner.com/issues/823>
- //configDialogPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ //settingsDialogPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//privacySettingsWidgetPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//generalSettingsWidgetPointer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- //configDialogPointer->adjustSize();
+ //settingsDialogPointer->adjustSize();
// Expand the config dialog.
- configDialogPointer->resize(1000, 500);
-
- // Create a save spell check languages lambda.
- auto saveSpellCheckLanguages = [spellCheckListWidgetPointer, kConfigSkeletonPointer, this] ()
- {
- // Create a list of enabled languages.
- QStringList newSpellCheckLanguages = QStringList();
-
- // Get a count of all the languages.
- int allLanguagesCount = spellCheckListWidgetPointer->count();
-
- // Get a list of all the checked languages.
- for (int i = 0; i < allLanguagesCount; ++i) {
- // Get the language item.
- QListWidgetItem *languageItemPointer = spellCheckListWidgetPointer->item(i);
-
- // Get the language check box.
- QCheckBox *languageCheckBoxPointer = qobject_cast<QCheckBox*>(spellCheckListWidgetPointer->itemWidget(languageItemPointer));
-
- // Add the item to the enabled languages if it is checked.
- if (languageCheckBoxPointer->checkState() == Qt::Checked)
- {
- // Get the text.
- QString languageString = languageCheckBoxPointer->text();
-
- // Remove all instances of `&`, which may have been added automatically when creating the check box text.
- languageString.remove(QChar('&'));
-
- // Add the language string to the list.
- newSpellCheckLanguages.append(languageString);
- }
- }
-
- // Update the spell check languages.
- if (Settings::spellCheckLanguages() != newSpellCheckLanguages)
- {
- // Update the spell check languages.
- Settings::setSpellCheckLanguages(newSpellCheckLanguages);
-
- // Write the settings to disk.
- kConfigSkeletonPointer->save();
- }
-
- // Apply the spell check languages.
- tabWidgetPointer->applySpellCheckLanguages();
- };
-
- // Process
- connect(applyButtonPointer, &QPushButton::clicked, this, saveSpellCheckLanguages);
- connect(okButtonPointer, &QPushButton::clicked, this, saveSpellCheckLanguages);
+ settingsDialogPointer->resize(1000, 500);
// Apply the settings handled by KConfig.
- connect(configDialogPointer, SIGNAL(settingsChanged(QString)), tabWidgetPointer, SLOT(applyApplicationSettings()));
- connect(configDialogPointer, SIGNAL(settingsChanged(QString)), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
+ connect(settingsDialogPointer, SIGNAL(spellCheckLanguagesUpdated()), tabWidgetPointer, SLOT(applySpellCheckLanguages()));
+ connect(settingsDialogPointer, SIGNAL(settingsChanged(QString)), tabWidgetPointer, SLOT(applyApplicationSettings()));
+ connect(settingsDialogPointer, SIGNAL(settingsChanged(QString)), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
}
QSize BrowserWindow::sizeHint() const
}
}
-void BrowserWindow::updateSearchEngineLabel(const QString &searchEngineString) const
-{
- // Update the search engine label.
- searchEngineLabelPointer->setText(SearchEngineHelper::getSearchUrl(searchEngineString));
-}
-
void BrowserWindow::updateUrlLineEdit(const QUrl &newUrl)
{
// Get the new URL string in encoded form, which displays punycode.
}
}
-void BrowserWindow::updateUserAgentLabel(const QString &userAgentDatabaseName) const
-{
- // Update the user agent label.
- userAgentLabelPointer->setText(UserAgentHelper::getUserAgentFromDatabaseName(userAgentDatabaseName));
-}
-
void BrowserWindow::updateViewBookmarksToolBarCheckbox(const bool visible)
{
// Update the view bookmarks toolbar checkbox.
private Q_SLOTS:
// The private slots.
- void addOrEditDomainSettings() const;
+ void addOrEditDomainSettings();
void back() const;
void clearUrlLineEditFocus() const;
void decrementZoom();
- void editBookmarks() const;
+ void editBookmarks();
void escape() const;
void findNext() const;
void findPrevious() const;
void reloadAndBypassCache() const;
void showBookmarkContextMenu(const QPoint &point);
void showCookiesDialog();
- void showDownloadDirectoryBrowseDialog() const;
- void showDomainSettingsDialog() const;
+ void showDomainSettingsDialog();
void showFindTextActions() const;
void showProgressBar(const int &progress) const;
void showSettingsDialog();
void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
void updateZoomActions(const double zoomFactorDouble);
- void updateSearchEngineLabel(const QString &searchEngineString) const;
void updateUrlLineEdit(const QUrl &newUrl);
- void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
void updateViewBookmarksToolBarCheckbox(const bool visible);
void updateWindowTitle(const QString &title);
void zoomDefault();
QList<QPair<QMenu *, QAction *> *> bookmarksToolBarSubfolderActionList;
bool bookmarksToolBarIsVisible = false;
bool bookmarksToolBarUninitialized = true;
- KConfigDialog *configDialogPointer;
QAction *cookiesActionPointer;
QUrl currentUrl;
QPushButton *currentZoomButtonPointer;
double defaultZoomFactorDouble;
QAction *developerToolsActionPointer;
QAction *domStorageActionPointer;
- QComboBox *downloadDirectoryComboBoxPointer;
QList<QPair<QMenu *, QAction *> *> finalBookmarkFolderMenuActionList;
QAction *findCaseSensitiveActionPointer;
QAction *findNextActionPointer;
QPalette positiveBackgroundPalette;
QProgressBar *progressBarPointer;
QAction *refreshActionPointer;
- QLabel *searchEngineLabelPointer;
QAction *searchEngineMenuActionPointer;
QAction *searchEngineMojeekActionPointer;
QAction *searchEngineMonoclesActionPointer;
QAction *searchEngineYahooActionPointer;
QAction *searchEngineCustomActionPointer;
QAction *stopActionPointer;
- QLabel *userAgentLabelPointer;
QAction *userAgentMenuActionPointer;
QAction *userAgentPrivacyBrowserActionPointer;
QAction *userAgentWebEngineDefaultActionPointer;