/*
- * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
#define BROWSERWINDOW_H
// Application headers.
-#include "views/BrowserView.h"
+#include "widgets/TabWidget.h"
// KDE Frameworks headers.
#include <KConfigDialog>
+#include <KToggleFullScreenAction>
+#include <KToolBar>
#include <KXmlGuiWindow>
// Qt toolkit headers.
+#include <QComboBox>
#include <QLabel>
#include <QProgressBar>
public:
// The default constructor.
- BrowserWindow();
+ BrowserWindow(bool firstWindow=true, QString *initialUrlStringPointer = nullptr);
// The public functions.
QSize sizeHint() const override;
+ // The public variables.
+ TabWidget *tabWidgetPointer;
+
private Q_SLOTS:
// The private slots.
+ void addOrEditDomainSettings() const;
void back() const;
- void fileNew() const;
+ void clearUrlLineEditFocus() const;
+ void decrementZoom();
+ void editBookmarks() const;
+ void escape() const;
+ void findNext() const;
+ void findPrevious() const;
void forward() const;
+ void fullScreenRequested(const bool toggleOn);
void getZoomFactorFromUser();
+ void hideFindTextActions() const;
void home() const;
+ void incrementZoom();
void loadUrlFromLineEdit(const QString &url) const;
- void openDomainSettings() const;
+ void newWindow() const;
+ void populateBookmarks();
void refresh() const;
- void settingsConfigure();
+ void reloadAndBypassCache() const;
+ void showAddBookmarkDialog() const;
+ void showAddFolderDialog() const;
+ void showBookmarkContextMenu(const QPoint &point);
+ void showCookiesDialog();
+ void showDownloadLocationBrowseDialog() const;
+ void showDomainSettingsDialog() const;
+ void showFindTextActions() const;
void showProgressBar(const int &progress) const;
+ void showSettingsDialog();
+ void toggleDomStorage() const;
+ void toggleFindCaseSensitive() const;
void toggleJavaScript() const;
void toggleLocalStorage() const;
- void updateDomainSettingsIndicator(const bool &status) const;
- void updateJavaScriptAction(const bool &isEnabled) const;
- void updateLocalStorageAction(const bool &isEnabled) const;
- void updateSearchEngineActions(const QString &searchEngine) const;
- void updateUserAgentActions(const QString &userAgent) const;
- void updateZoomFactorAction(const double &zoomFactor);
+ void toggleFullScreen();
+ void toggleViewBookmarksToolBar();
+ void toggleViewSource() const;
+ void toggleViewSourceInNewTab() const;
+ void updateCookiesAction(const int numberOfCookies) const;
+ void updateDefaultZoomFactor(const double newDefaultZoomFactor);
+ void updateDomStorageAction(const bool &isEnabled) const;
+ void updateDomainSettingsIndicator(const bool status);
+ void updateFindText(const QString &text, const bool findCaseSensitive) const;
+ void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
+ void updateJavaScriptAction(const bool &isEnabled);
+ void updateLocalStorageAction(const bool &isEnabled);
+ void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
+ void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
+ void updateZoomActions(const double &zoomFactor);
void updateSearchEngineLabel(const QString &searchEngineString) const;
- void updateUrlLineEdit(const QString &newUrl) const;
+ void updateUrlLineEdit(const QUrl &newUrl);
void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
+ void updateViewBookmarksToolBarCheckbox(const bool visible);
+ void updateWindowTitle(const QString &title);
+ void zoomDefault();
private:
// The private variables.
- BrowserView *browserViewPointer;
+ QList<QPair<QMenu *, QAction *> *> bookmarksMenuActionList;
+ QMenu *bookmarksMenuPointer;
+ QList<QPair<QMenu *, QMenu *> *> bookmarksMenuSubmenuList;
+ QList<QAction*> bookmarksToolBarActionList;
+ QList<QPair<QMenu *, const double> *> bookmarksToolBarMenuList;
+ KToolBar *bookmarksToolBarPointer;
+ QList<QPair<QMenu *, QAction *> *> bookmarksToolBarSubfolderActionList;
+ bool bookmarksToolBarIsVisible = false;
+ bool bookmarksToolBarUninitialized = true;
KConfigDialog *configDialogPointer;
- QAction *domainSettingsActionPointer;
- QPalette domainSettingsPalette;
+ QAction *cookiesActionPointer;
+ QUrl currentUrl;
+ QPushButton *currentZoomButtonPointer;
double currentZoomFactor;
+ bool customSearchEngineEnabled;
+ bool customUserAgentEnabled;
+ double defaultZoomFactor;
+ QAction *domStorageActionPointer;
+ QComboBox *downloadLocationComboBoxPointer;
+ QAction *findCaseSensitiveActionPointer;
+ QAction *findNextActionPointer;
+ QAction *findPreviousActionPointer;
+ QAction *findTextLabelActionPointer;
+ QLabel *findTextLabelPointer;
+ QAction *findTextLineEditActionPointer;
+ KLineEdit *findTextLineEditPointer;
+ KToggleFullScreenAction *fullScreenActionPointer;
+ QAction *hideFindTextActionPointer;
QAction *javaScriptActionPointer;
+ bool javaScriptEnabled;
QAction *localStorageActionPointer;
- QPalette noDomainSettingsPalette;
+ bool localStorageEnabled;
+ KToolBar *navigationToolBarPointer;
+ QPalette negativeBackgroundPalette;
+ QPalette normalBackgroundPalette;
+ QPalette positiveBackgroundPalette;
QProgressBar *progressBarPointer;
QLabel *searchEngineLabelPointer;
+ QAction *searchEngineMenuActionPointer;
QAction *searchEngineMojeekActionPointer;
QAction *searchEngineMonoclesActionPointer;
QAction *searchEngineMetagerActionPointer;
QAction *searchEngineYahooActionPointer;
QAction *searchEngineCustomActionPointer;
QLabel *userAgentLabelPointer;
+ QAction *userAgentMenuActionPointer;
QAction *userAgentPrivacyBrowserActionPointer;
+ QAction *userAgentWebEngineDefaultActionPointer;
QAction *userAgentFirefoxLinuxActionPointer;
QAction *userAgentChromiumLinuxActionPointer;
QAction *userAgentFirefoxWindowsActionPointer;
QAction *userAgentSafariMacosActionPointer;
QAction *userAgentCustomActionPointer;
KLineEdit *urlLineEditPointer;
+ KToolBar *urlToolBarPointer;
+ QAction *viewBookmarksToolBarActionPointer;
+ QAction *viewSourceActionPointer;
+ QAction *viewSourceInNewTabActionPointer;
+ QAction *zoomDefaultActionPointer;
QAction *zoomFactorActionPointer;
+ QAction *zoomInActionPointer;
+ QPushButton *zoomMinusButtonPointer;
+ QAction *zoomOutActionPointer;
+ QPushButton *zoomPlusButtonPointer;
+
+ // The private functions.
+ void populateBookmarksMenuSubfolders(const double folderId, QMenu *menuPointer);
+ void populateBookmarksToolBar();
+ void populateBookmarksToolBarSubfolders(const double folderId, QMenu *menuPointer);
};
#endif