<property name="iconSize">
<size>
- <width>24</width>
<height>24</height>
+ <width>24</width>
</size>
</property>
// Application headers.
#include "PrivacyWebEngineView.h"
#include "databases/CookiesDatabase.h"
+#include "windows/BrowserWindow.h"
// Construct the class.
PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr) {}
emit updateCookiesAction(cookieListPointer->size());
}
+QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType webWindowType) {
+ qDebug().noquote().nospace() << "Web window type: " << webWindowType;
+
+ // Get a handle for the browser window.
+ BrowserWindow *browserWindowPointer = qobject_cast<BrowserWindow*>(window());
+
+ // Create the requsted window type.
+ switch (webWindowType) {
+ case QWebEnginePage::WebBrowserTab: {
+ // Create the new tab and return the privacy WebEngine view pointer. It will then be populated with the link from the context menu.
+ return browserWindowPointer->tabWidgetPointer->addTab();
+ }
+
+ default: {
+ // Return an null pointer.
+ return nullptr;
+ }
+ }
+}
+
void PrivacyWebEngineView::removeCookieFromList(const QNetworkCookie &cookie) const
{
//qDebug() << "Remove cookie: " << cookie.toRawForm();
// The public slots.
void addCookieToList(const QNetworkCookie &cookie) const;
void removeCookieFromList(const QNetworkCookie &cookie) const;
+
+protected:
+ // The protected functions.
+ QWebEngineView* createWindow(QWebEnginePage::WebWindowType webWindowType) override;
};
#endif
tabWidgetPointer->currentWidget()->setFocus();
}
-void TabWidget::addTab()
+PrivacyWebEngineView* TabWidget::addTab()
{
// Create a privacy WebEngine view.
PrivacyWebEngineView *privacyWebEngineViewPointer = new PrivacyWebEngineView();
// Update the URL line edit when the URL changes.
connect(privacyWebEngineViewPointer, SIGNAL(urlChanged(const QUrl)), this, SLOT(updateUrl(const QUrl)));
-
// Update the progress bar.
connect(privacyWebEngineViewPointer, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(privacyWebEngineViewPointer, SIGNAL(loadProgress(const int)), this, SLOT(loadProgress(const int)));
// Move to the new tab.
tabWidgetPointer->setCurrentIndex(newTabIndex);
+
+ // Return the privacy WebEngine view pointer.
+ return privacyWebEngineViewPointer;
}
void TabWidget::applyApplicationSettings()
public Q_SLOTS:
// The public slots.
- void addTab();
+ PrivacyWebEngineView* addTab();
void addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer = nullptr) const;
void applyApplicationSettings();
void applyDomainSettingsAndReload();
// The public functions.
QSize sizeHint() const override;
+ // The public variables.
+ TabWidget *tabWidgetPointer;
+
private Q_SLOTS:
// The private slots.
void addOrEditDomainSettings() const;
QAction *searchEngineBingActionPointer;
QAction *searchEngineYahooActionPointer;
QAction *searchEngineCustomActionPointer;
- TabWidget *tabWidgetPointer;
QLabel *userAgentLabelPointer;
QAction *userAgentMenuActionPointer;
QAction *userAgentPrivacyBrowserActionPointer;