[education/rkward] rkward/windows: If workaround for mimetype detection failure is needed, make sure not to prompt for external application.
Thomas Friedrichsmeier
null at kde.org
Thu Apr 28 19:48:26 BST 2022
Git commit ef48c2f7bc86eaeca94d70df38baa50a643186b6 by Thomas Friedrichsmeier.
Committed on 28/04/2022 at 18:47.
Pushed by tfry into branch 'master'.
If workaround for mimetype detection failure is needed, make sure not to prompt for external application.
M +8 -3 rkward/windows/rkhtmlwindow.cpp
https://invent.kde.org/education/rkward/commit/ef48c2f7bc86eaeca94d70df38baa50a643186b6
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 37b00da4..b4119c4f 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -109,8 +109,9 @@ public:
QUrl url () {
return mainFrame ()->url ();
}
- void setHtml (const QString &html) {
- mainFrame ()->setHtml (html);
+ void setHtmlWrapper(const QString &html, const QUrl &baseurl) {
+ direct_load = true;
+ mainFrame()->setHtml(html, baseurl);
}
QPointF scrollPosition () const {
return mainFrame ()->scrollPosition ();
@@ -127,6 +128,10 @@ public:
});
}
#else
+ void setHtmlWrapper(const QString &html, const QUrl &baseurl) {
+ direct_load = true;
+ setHtml(html, baseurl);
+ }
bool supportsContentType (const QString &name) {
if (name.startsWith("text")) return true;
#ifdef __GNUC__
@@ -655,7 +660,7 @@ bool RKHTMLWindow::openURL (const QUrl &url) {
RK_DEBUG (APP, DL_WARNING, "Applying workaround for https://bugs.kde.org/show_bug.cgi?id=405386");
QFile f (url.toLocalFile ());
f.open (QIODevice::ReadOnly);
- page->setHtml (f.readAll());
+ page->setHtmlWrapper(f.readAll(), url.adjusted(QUrl::RemoveFilename));
f.close ();
} else {
page->load (url);
More information about the rkward-tracker
mailing list