aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp2
-rw-r--r--src/mainwindow/menubar.cpp5
-rw-r--r--src/mainwindow/widgets/searchform.cpp4
-rw-r--r--src/util.cpp2
-rw-r--r--src/webengine/webpage.cpp4
-rw-r--r--src/webengine/webpage.h4
-rw-r--r--src/webengine/webprofilemanager.cpp1
-rw-r--r--src/webengine/webviewcontextmenu.cpp97
8 files changed, 13 insertions, 106 deletions
diff --git a/src/main.cpp b/src/main.cpp
index dad1f73..aa08236 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -106,6 +106,7 @@ int main(int argc, char **argv)
Configuration conf;
if(conf.value<bool>("usebreakpad").value()) {
+ /* FIXME
CrashHandler::Context ctx(
conf.value<std::string>("path.crashdump").value(),
conf.value<std::string>("path.crashhandler").value());
@@ -115,6 +116,7 @@ int main(int argc, char **argv)
} else {
spdlog::warn("Failed to install breakpad crash handler: {}", ctx.dumppath);
}
+ */
}
// load plugins
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp
index 5fc039a..e557d50 100644
--- a/src/mainwindow/menubar.cpp
+++ b/src/mainwindow/menubar.cpp
@@ -329,10 +329,7 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent)
auto *printer = new QPrinter(QPrinterInfo::defaultPrinter());
QPrintDialog dlg(printer, parent);
if(dlg.exec() == QDialog::Accepted) {
- parent->currentView()->page()->print(printer, [printer](bool success) {
- Q_UNUSED(success);
- delete printer;
- });
+ parent->currentView()->print(printer);
}
}
});
diff --git a/src/mainwindow/widgets/searchform.cpp b/src/mainwindow/widgets/searchform.cpp
index e10933b..af54f5c 100644
--- a/src/mainwindow/widgets/searchform.cpp
+++ b/src/mainwindow/widgets/searchform.cpp
@@ -10,6 +10,7 @@
#include "ui_searchform.h"
#include <QHideEvent>
#include <QShowEvent>
+#include <QWebEngineFindTextResult>
#include <QWebEngineView>
SearchForm::SearchForm(QWidget *parent)
@@ -26,7 +27,8 @@ SearchForm::SearchForm(QWidget *parent)
QWebEnginePage::FindFlags searchFlags;
searchFlags.setFlag(QWebEnginePage::FindCaseSensitively, ui->caseSensitivity_checkBox->isChecked());
searchFlags.setFlag(QWebEnginePage::FindBackward, ui->reverseSearch_checkBox->isChecked());
- m_view->findText(ui->lineEdit->text(), searchFlags, [this](bool found) {
+ m_view->findText(ui->lineEdit->text(), searchFlags, [this](const QWebEngineFindTextResult &result) {
+ const bool found = result.numberOfMatches() > 0;
ui->result_label->setVisible(!found);
});
}
diff --git a/src/util.cpp b/src/util.cpp
index fe74175..3061c96 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -62,7 +62,7 @@ QIcon Util::icon(QStyle::StandardPixmap id) {
return QIcon::fromTheme("go-home", qApp->style()->standardIcon(id));
default:
- spdlog::warn("FIXME: unhandled StandardPixmap {}", id);
+ spdlog::warn("FIXME: unhandled StandardPixmap");
return qApp->style()->standardIcon(id);
}
}
diff --git a/src/webengine/webpage.cpp b/src/webengine/webpage.cpp
index b2b19b5..f8a8f7f 100644
--- a/src/webengine/webpage.cpp
+++ b/src/webengine/webpage.cpp
@@ -62,6 +62,7 @@ WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
connect(this, &QWebEnginePage::featurePermissionRequested, this, &WebPage::featurePermissionDialog);
connect(this, &QWebEnginePage::renderProcessTerminated, this, &WebPage::renderProcessCrashed);
+ connect(this, &QWebEnginePage::certificateError, this, &WebPage::certificateError);
}
bool WebPage::certificateError(const QWebEngineCertificateError &certificateError)
@@ -77,9 +78,8 @@ bool WebPage::certificateError(const QWebEngineCertificateError &certificateErro
messageBox.setText(tr("An SSL error has occurred on <strong>%1</strong>").arg(certificateError.url().toString()));
messageBox.setInformativeText(tr("<p>%1</p>"
"<p>This error %2 be overridden.</p>")
- .arg(certificateError.errorDescription(),
+ .arg(certificateError.description(),
certificateError.isOverridable() ? tr("can") : tr("cannot")));
- messageBox.setDetailedText(tr("Error code: %1").arg(certificateError.error()));
if(certificateError.isOverridable()) {
messageBox.setStandardButtons(QMessageBox::Ignore | QMessageBox::Abort);
diff --git a/src/webengine/webpage.h b/src/webengine/webpage.h
index 91ae4f3..bd7d54c 100644
--- a/src/webengine/webpage.h
+++ b/src/webengine/webpage.h
@@ -19,12 +19,10 @@ public:
WebPage(QWebEngineProfile *profile, QObject *parent = nullptr);
~WebPage() override = default;
-protected:
- bool certificateError(const QWebEngineCertificateError &certificateError) override;
-
protected slots:
void featurePermissionDialog(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
void renderProcessCrashed(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode);
+ bool certificateError(const QWebEngineCertificateError &certificateError);
};
#endif // SMOLBOTE_WEBPAGE_H
diff --git a/src/webengine/webprofilemanager.cpp b/src/webengine/webprofilemanager.cpp
index 5cc83f8..9ae2960 100644
--- a/src/webengine/webprofilemanager.cpp
+++ b/src/webengine/webprofilemanager.cpp
@@ -8,6 +8,7 @@
#include "webprofilemanager.h"
#include "webprofile.h"
+#include <QActionGroup>
static WebProfileManager<false> *s_instance = nullptr;
diff --git a/src/webengine/webviewcontextmenu.cpp b/src/webengine/webviewcontextmenu.cpp
index ea5e8c6..0de3b9f 100644
--- a/src/webengine/webviewcontextmenu.cpp
+++ b/src/webengine/webviewcontextmenu.cpp
@@ -17,7 +17,7 @@
#include <QStyle>
#include <QToolButton>
#include <QVBoxLayout>
-#include <QWebEngineContextMenuData>
+#include <QWebEngineContextMenuRequest>
#include <QWebEngineHistory>
#include <QWidgetAction>
@@ -94,100 +94,7 @@ WebViewContextMenu::WebViewContextMenu(WebView *view)
this->addAction(navButtons);
this->addSeparator();
- const auto ctxdata = view->page()->contextMenuData();
-
- if(ctxdata.mediaType() == QWebEngineContextMenuData::MediaTypeNone) {
- auto *backMenu = this->addMenu(tr("Back"));
- if(!view->history()->canGoBack()) {
- backMenu->setEnabled(false);
- } else {
- connect(backMenu, &QMenu::aboutToShow, view, [view, backMenu]() {
- backMenu->clear();
- const auto backItems = view->history()->backItems(10);
- for(const QWebEngineHistoryItem &item : backItems) {
- backMenu->addAction(historyAction(view, item));
- }
- });
- }
-
- auto *forwardMenu = this->addMenu(tr("Forward"));
- if(!view->history()->canGoForward()) {
- forwardMenu->setEnabled(false);
- } else {
- connect(forwardMenu, &QMenu::aboutToShow, view, [view, forwardMenu]() {
- forwardMenu->clear();
- const auto forwardItems = view->history()->forwardItems(10);
- for(const QWebEngineHistoryItem &item : forwardItems) {
- forwardMenu->addAction(historyAction(view, item));
- }
- });
- }
-
- connect(this->addAction(tr("Reload")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::Reload);
- });
- connect(this->addAction(tr("Reload and bypass Cache")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::ReloadAndBypassCache);
- });
-
- this->addSeparator();
-
- connect(this->addAction(tr("Select All")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::SelectAll);
- });
- connect(this->addAction(tr("Clear Selection")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::Unselect);
- });
- connect(this->addAction(tr("Copy to clipboard")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::Copy);
- });
-
- } else if(ctxdata.mediaType() == QWebEngineContextMenuData::MediaTypeImage) {
- connect(this->addAction(tr("Copy image to clipboard")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::CopyImageToClipboard);
- });
- connect(this->addAction(tr("Copy image URL to clipboard")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::CopyImageUrlToClipboard);
- });
- if(!ctxdata.mediaUrl().isEmpty()) {
- if(view->url() != ctxdata.mediaUrl()) {
- connect(this->addAction(tr("Open image")), &QAction::triggered, view, [view, ctxdata]() {
- view->load(ctxdata.mediaUrl());
- });
- connect(this->addAction(tr("Open image in new tab")), &QAction::triggered, view, [view, ctxdata]() {
- view->createWindow(QWebEnginePage::WebBrowserTab)->load(ctxdata.mediaUrl());
- });
- }
- connect(this->addAction(tr("Save image")), &QAction::triggered, view, [view, ctxdata]() {
- view->page()->download(ctxdata.mediaUrl());
- });
- }
-
- } else {
- addMenu(view->page()->createStandardContextMenu());
- }
-
- if(!ctxdata.linkUrl().isEmpty()) {
- this->addSeparator();
- connect(this->addAction(tr("Open link in new tab")), &QAction::triggered, view, [view, ctxdata]() {
- view->createWindow(QWebEnginePage::WebBrowserTab)->load(ctxdata.linkUrl());
- });
-
- auto *newTabMenu = this->addMenu(tr("Open link in new tab with profile"));
- profileMenu(newTabMenu, [view, ctxdata](WebProfile *profile) {
- auto *v = view->createWindow(QWebEnginePage::WebBrowserTab);
- v->setProfile(profile);
- v->load(ctxdata.linkUrl());
- });
-
- connect(this->addAction(tr("Open link in new window")), &QAction::triggered, view, [view, ctxdata]() {
- view->createWindow(QWebEnginePage::WebBrowserWindow)->load(ctxdata.linkUrl());
- });
-
- connect(this->addAction(tr("Copy link address")), &QAction::triggered, view, [view]() {
- view->page()->triggerAction(QWebEnginePage::CopyLinkToClipboard);
- });
- }
+ addMenu(view->createStandardContextMenu());
// zoom widget
{